Browse Source

fix a set of multiline debug call sites

pull/7/head
Sami Vaarala 11 years ago
parent
commit
517557bb5a
  1. 224
      src/duk_debug_hobject.c
  2. 50
      src/duk_heap_stringcache.c
  3. 30
      src/duk_heap_stringtable.c
  4. 2
      src/duk_hstring_misc.c

224
src/duk_debug_hobject.c

@ -154,20 +154,20 @@ void duk_debug_dump_hobject(duk_hobject *obj) {
DUK_D(DUK_DPRINT(" %sspecial_stringobj", DUK_HOBJECT_HAS_SPECIAL_STRINGOBJ(obj) ? str_empty : str_excl));
DUK_D(DUK_DPRINT(" %sspecial_arguments", DUK_HOBJECT_HAS_SPECIAL_ARGUMENTS(obj) ? str_empty : str_excl));
DUK_DPRINT(" class: number %d -> %s",
(int) DUK_HOBJECT_GET_CLASS_NUMBER(obj),
duk__class_names[(DUK_HOBJECT_GET_CLASS_NUMBER(obj)) & ((1 << DUK_HOBJECT_FLAG_CLASS_BITS) - 1)]);
DUK_D(DUK_DPRINT(" class: number %d -> %s",
(int) DUK_HOBJECT_GET_CLASS_NUMBER(obj),
duk__class_names[(DUK_HOBJECT_GET_CLASS_NUMBER(obj)) & ((1 << DUK_HOBJECT_FLAG_CLASS_BITS) - 1)]));
DUK_DPRINT(" prototype: %p -> %!O",
(void *) obj->prototype,
(duk_heaphdr *) obj->prototype);
DUK_D(DUK_DPRINT(" prototype: %p -> %!O",
(void *) obj->prototype,
(duk_heaphdr *) obj->prototype));
DUK_DPRINT(" props: p=%p, e_size=%d, e_used=%d, a_size=%d, h_size=%d",
(void *) obj->p,
(int) obj->e_size,
(int) obj->e_used,
(int) obj->a_size,
(int) obj->h_size);
DUK_D(DUK_DPRINT(" props: p=%p, e_size=%d, e_used=%d, a_size=%d, h_size=%d",
(void *) obj->p,
(int) obj->e_size,
(int) obj->e_used,
(int) obj->a_size,
(int) obj->h_size));
/*
* Object (struct layout) specific dumping. Inline code here
@ -183,18 +183,18 @@ void duk_debug_dump_hobject(duk_hobject *obj) {
DUK_D(DUK_DPRINT(" nargs: %d", (int) h->nargs));
if (h->data && DUK_HBUFFER_HAS_DYNAMIC(h->data) && DUK_HBUFFER_GET_DATA_PTR(h->data)) {
DUK_DPRINT(" consts: %p (%d, %d bytes)",
(void *) DUK_HCOMPILEDFUNCTION_GET_CONSTS_BASE(h),
(int) DUK_HCOMPILEDFUNCTION_GET_CONSTS_COUNT(h),
(int) DUK_HCOMPILEDFUNCTION_GET_CONSTS_SIZE(h));
DUK_DPRINT(" funcs: %p (%d, %d bytes)",
(void *) DUK_HCOMPILEDFUNCTION_GET_FUNCS_BASE(h),
(int) DUK_HCOMPILEDFUNCTION_GET_FUNCS_COUNT(h),
(int) DUK_HCOMPILEDFUNCTION_GET_FUNCS_SIZE(h));
DUK_DPRINT(" bytecode: %p (%d, %d bytes)",
(void *) DUK_HCOMPILEDFUNCTION_GET_CODE_BASE(h),
(int) DUK_HCOMPILEDFUNCTION_GET_CODE_COUNT(h),
(int) DUK_HCOMPILEDFUNCTION_GET_CODE_SIZE(h));
DUK_D(DUK_DPRINT(" consts: %p (%d, %d bytes)",
(void *) DUK_HCOMPILEDFUNCTION_GET_CONSTS_BASE(h),
(int) DUK_HCOMPILEDFUNCTION_GET_CONSTS_COUNT(h),
(int) DUK_HCOMPILEDFUNCTION_GET_CONSTS_SIZE(h)));
DUK_D(DUK_DPRINT(" funcs: %p (%d, %d bytes)",
(void *) DUK_HCOMPILEDFUNCTION_GET_FUNCS_BASE(h),
(int) DUK_HCOMPILEDFUNCTION_GET_FUNCS_COUNT(h),
(int) DUK_HCOMPILEDFUNCTION_GET_FUNCS_SIZE(h)));
DUK_D(DUK_DPRINT(" bytecode: %p (%d, %d bytes)",
(void *) DUK_HCOMPILEDFUNCTION_GET_CODE_BASE(h),
(int) DUK_HCOMPILEDFUNCTION_GET_CODE_COUNT(h),
(int) DUK_HCOMPILEDFUNCTION_GET_CODE_SIZE(h)));
} else {
DUK_D(DUK_DPRINT(" consts: ???"));
DUK_D(DUK_DPRINT(" funcs: ???"));
@ -214,18 +214,18 @@ void duk_debug_dump_hobject(duk_hobject *obj) {
DUK_D(DUK_DPRINT(" strict: %d", (int) thr->strict));
DUK_D(DUK_DPRINT(" state: %d", (int) thr->state));
DUK_DPRINT(" valstack_max: %d, callstack_max:%d, catchstack_max: %d",
thr->valstack_max, thr->callstack_max, thr->catchstack_max);
DUK_D(DUK_DPRINT(" valstack_max: %d, callstack_max:%d, catchstack_max: %d",
thr->valstack_max, thr->callstack_max, thr->catchstack_max));
DUK_DPRINT(" callstack: ptr %p, size %d, top %d, preventcount %d, used size %d entries (%d bytes), alloc size %d entries (%d bytes)",
(void *) thr->callstack,
thr->callstack_size,
thr->callstack_top,
thr->callstack_preventcount,
thr->callstack_top,
thr->callstack_top * sizeof(duk_activation),
thr->callstack_size,
thr->callstack_size * sizeof(duk_activation));
DUK_D(DUK_DPRINT(" callstack: ptr %p, size %d, top %d, preventcount %d, used size %d entries (%d bytes), alloc size %d entries (%d bytes)",
(void *) thr->callstack,
thr->callstack_size,
thr->callstack_top,
thr->callstack_preventcount,
thr->callstack_top,
thr->callstack_top * sizeof(duk_activation),
thr->callstack_size,
thr->callstack_size * sizeof(duk_activation)));
DUK_DEBUG_SUMMARY_INIT();
DUK_DEBUG_SUMMARY_CHAR('[');
@ -252,18 +252,18 @@ void duk_debug_dump_hobject(duk_hobject *obj) {
DUK_DEBUG_SUMMARY_CHAR(']');
DUK_DEBUG_SUMMARY_FINISH();
DUK_DPRINT(" valstack: ptr %p, end %p (%d), bottom %p (%d), top %p (%d), used size %d entries (%d bytes), alloc size %d entries (%d bytes)",
(void *) thr->valstack,
(void *) thr->valstack_end,
(int) (thr->valstack_end - thr->valstack),
(void *) thr->valstack_bottom,
(int) (thr->valstack_bottom - thr->valstack),
(void *) thr->valstack_top,
(int) (thr->valstack_top - thr->valstack),
(int) (thr->valstack_top - thr->valstack),
(int) (thr->valstack_top - thr->valstack) * sizeof(duk_tval),
(int) (thr->valstack_end - thr->valstack),
(int) (thr->valstack_end - thr->valstack) * sizeof(duk_tval));
DUK_D(DUK_DPRINT(" valstack: ptr %p, end %p (%d), bottom %p (%d), top %p (%d), used size %d entries (%d bytes), alloc size %d entries (%d bytes)",
(void *) thr->valstack,
(void *) thr->valstack_end,
(int) (thr->valstack_end - thr->valstack),
(void *) thr->valstack_bottom,
(int) (thr->valstack_bottom - thr->valstack),
(void *) thr->valstack_top,
(int) (thr->valstack_top - thr->valstack),
(int) (thr->valstack_top - thr->valstack),
(int) (thr->valstack_top - thr->valstack) * sizeof(duk_tval),
(int) (thr->valstack_end - thr->valstack),
(int) (thr->valstack_end - thr->valstack) * sizeof(duk_tval)));
DUK_DEBUG_SUMMARY_INIT();
DUK_DEBUG_SUMMARY_CHAR('[');
@ -294,14 +294,14 @@ void duk_debug_dump_hobject(duk_hobject *obj) {
DUK_DEBUG_SUMMARY_CHAR(']');
DUK_DEBUG_SUMMARY_FINISH();
DUK_DPRINT(" catchstack: ptr %p, size %d, top %d, used size %d entries (%d bytes), alloc size %d entries (%d bytes)",
(void *) thr->catchstack,
thr->catchstack_size,
thr->catchstack_top,
thr->catchstack_top,
thr->catchstack_top * sizeof(duk_catcher),
thr->catchstack_size,
thr->catchstack_size * sizeof(duk_catcher));
DUK_D(DUK_DPRINT(" catchstack: ptr %p, size %d, top %d, used size %d entries (%d bytes), alloc size %d entries (%d bytes)",
(void *) thr->catchstack,
thr->catchstack_size,
thr->catchstack_top,
thr->catchstack_top,
thr->catchstack_top * sizeof(duk_catcher),
thr->catchstack_size,
thr->catchstack_size * sizeof(duk_catcher)));
DUK_DEBUG_SUMMARY_INIT();
DUK_DEBUG_SUMMARY_CHAR('[');
@ -322,8 +322,8 @@ void duk_debug_dump_hobject(duk_hobject *obj) {
DUK_DEBUG_SUMMARY_CHAR(']');
DUK_DEBUG_SUMMARY_FINISH();
DUK_DPRINT(" resumer: ptr %p",
(void *) thr->resumer);
DUK_D(DUK_DPRINT(" resumer: ptr %p",
(void *) thr->resumer));
#if 0 /* worth dumping? */
for (i = 0; i < DUK_NUM_BUILTINS; i++) {
@ -333,8 +333,8 @@ void duk_debug_dump_hobject(duk_hobject *obj) {
}
if (obj->p) {
DUK_DPRINT(" props alloc size: %d",
(int) DUK_HOBJECT_P_COMPUTE_SIZE(obj->e_size, obj->a_size, obj->h_size));
DUK_D(DUK_DPRINT(" props alloc size: %d",
(int) DUK_HOBJECT_P_COMPUTE_SIZE(obj->e_size, obj->a_size, obj->h_size)));
} else {
DUK_D(DUK_DPRINT(" props alloc size: n/a"));
}
@ -358,39 +358,39 @@ void duk_debug_dump_hobject(duk_hobject *obj) {
}
if (DUK_HOBJECT_E_SLOT_IS_ACCESSOR(obj, i)) {
DUK_DPRINT(" [%d]: [w=%d e=%d c=%d a=%d] %!O -> get:%p set:%p; get %!O; set %!O",
i,
DUK_HOBJECT_E_SLOT_IS_WRITABLE(obj, i),
DUK_HOBJECT_E_SLOT_IS_ENUMERABLE(obj, i),
DUK_HOBJECT_E_SLOT_IS_CONFIGURABLE(obj, i),
DUK_HOBJECT_E_SLOT_IS_ACCESSOR(obj, i),
k,
(void *) v->a.get,
(void *) v->a.set,
(duk_heaphdr *) v->a.get,
(duk_heaphdr *) v->a.set);
DUK_D(DUK_DPRINT(" [%d]: [w=%d e=%d c=%d a=%d] %!O -> get:%p set:%p; get %!O; set %!O",
i,
DUK_HOBJECT_E_SLOT_IS_WRITABLE(obj, i),
DUK_HOBJECT_E_SLOT_IS_ENUMERABLE(obj, i),
DUK_HOBJECT_E_SLOT_IS_CONFIGURABLE(obj, i),
DUK_HOBJECT_E_SLOT_IS_ACCESSOR(obj, i),
k,
(void *) v->a.get,
(void *) v->a.set,
(duk_heaphdr *) v->a.get,
(duk_heaphdr *) v->a.set));
} else {
DUK_DPRINT(" [%d]: [w=%d e=%d c=%d a=%d] %!O -> %!T",
i,
DUK_HOBJECT_E_SLOT_IS_WRITABLE(obj, i),
DUK_HOBJECT_E_SLOT_IS_ENUMERABLE(obj, i),
DUK_HOBJECT_E_SLOT_IS_CONFIGURABLE(obj, i),
DUK_HOBJECT_E_SLOT_IS_ACCESSOR(obj, i),
k,
&v->v);
DUK_D(DUK_DPRINT(" [%d]: [w=%d e=%d c=%d a=%d] %!O -> %!T",
i,
DUK_HOBJECT_E_SLOT_IS_WRITABLE(obj, i),
DUK_HOBJECT_E_SLOT_IS_ENUMERABLE(obj, i),
DUK_HOBJECT_E_SLOT_IS_CONFIGURABLE(obj, i),
DUK_HOBJECT_E_SLOT_IS_ACCESSOR(obj, i),
k,
&v->v));
}
}
DUK_D(DUK_DPRINT(" array entries:"));
for (i = 0; i < obj->a_size; i++) {
DUK_DPRINT(" [%d]: [w=%d e=%d c=%d a=%d] %d -> %!T",
i,
1, /* implicit attributes */
1,
1,
0,
i,
DUK_HOBJECT_A_GET_VALUE_PTR(obj, i));
DUK_D(DUK_DPRINT(" [%d]: [w=%d e=%d c=%d a=%d] %d -> %!T",
i,
1, /* implicit attributes */
1,
1,
0,
i,
DUK_HOBJECT_A_GET_VALUE_PTR(obj, i)));
}
DUK_D(DUK_DPRINT(" hash entries:"));
@ -401,9 +401,9 @@ void duk_debug_dump_hobject(duk_hobject *obj) {
} else if (t == DUK_HOBJECT_HASHIDX_DELETED) {
DUK_D(DUK_DPRINT(" [%d]: deleted", i));
} else {
DUK_DPRINT(" [%d]: %d",
i,
(int) t);
DUK_D(DUK_DPRINT(" [%d]: %d",
i,
(int) t));
}
}
}
@ -411,9 +411,9 @@ void duk_debug_dump_hobject(duk_hobject *obj) {
void duk_debug_dump_callstack(duk_hthread *thr) {
duk_uint_fast32_t i;
DUK_DPRINT("=== hthread %p callstack: %d entries ===",
(void *) thr,
(thr == NULL ? 0 : thr->callstack_top));
DUK_D(DUK_DPRINT("=== hthread %p callstack: %d entries ===",
(void *) thr,
(thr == NULL ? 0 : thr->callstack_top)));
if (!thr) {
return;
}
@ -427,16 +427,16 @@ void duk_debug_dump_callstack(duk_hthread *thr) {
this_binding = NULL;
}
DUK_DPRINT(" [%d] -> flags=0x%08x, func=%!O, var_env=%!iO, lex_env=%!iO, pc=%d, idx_bottom=%d, idx_retval=%d, this_binding=%!T",
i,
act->flags,
(duk_heaphdr *) act->func,
(duk_heaphdr *) act->var_env,
(duk_heaphdr *) act->lex_env,
act->pc,
act->idx_bottom,
act->idx_retval,
this_binding);
DUK_D(DUK_DPRINT(" [%d] -> flags=0x%08x, func=%!O, var_env=%!iO, lex_env=%!iO, pc=%d, idx_bottom=%d, idx_retval=%d, this_binding=%!T",
i,
act->flags,
(duk_heaphdr *) act->func,
(duk_heaphdr *) act->var_env,
(duk_heaphdr *) act->lex_env,
act->pc,
act->idx_bottom,
act->idx_retval,
this_binding));
}
}
@ -451,16 +451,16 @@ void duk_debug_dump_activation(duk_hthread *thr, duk_activation *act) {
this_binding = NULL;
}
DUK_DPRINT("duk_activation: %p -> flags=0x%08x, func=%!O, var_env=%!O, lex_env=%!O, pc=%d, idx_bottom=%d, idx_retval=%d, this_binding=%!T",
(void *) act,
act->flags,
(duk_heaphdr *) act->func,
(duk_heaphdr *) act->var_env,
(duk_heaphdr *) act->lex_env,
act->pc,
act->idx_bottom,
act->idx_retval,
this_binding);
DUK_D(DUK_DPRINT("duk_activation: %p -> flags=0x%08x, func=%!O, var_env=%!O, lex_env=%!O, pc=%d, idx_bottom=%d, idx_retval=%d, this_binding=%!T",
(void *) act,
act->flags,
(duk_heaphdr *) act->func,
(duk_heaphdr *) act->var_env,
(duk_heaphdr *) act->lex_env,
act->pc,
act->idx_bottom,
act->idx_retval,
this_binding));
}
}

50
src/duk_heap_stringcache.c

@ -22,8 +22,8 @@ void duk_heap_strcache_string_remove(duk_heap *heap, duk_hstring *h) {
for (i = 0; i < DUK_HEAP_STRCACHE_SIZE; i++) {
duk_strcache *c = &heap->strcache[i];
if (c->h == h) {
DUK_DDPRINT("deleting weak strcache reference to hstring %p from heap %p",
(void *) h, (void *) heap);
DUK_DD(DUK_DDPRINT("deleting weak strcache reference to hstring %p from heap %p",
(void *) h, (void *) heap));
c->h = NULL;
/* XXX: the string shouldn't appear twice, but we now loop to the
@ -116,9 +116,9 @@ duk_uint32_t duk_heap_strcache_offset_char2byte(duk_hthread *thr, duk_hstring *h
* necessary, inserting a new cache entry if none exists.
*/
DUK_DDDPRINT("non-ascii string %p, char_offset=%d, clen=%d, blen=%d",
(void *) h, char_offset, DUK_HSTRING_GET_CHARLEN(h),
DUK_HSTRING_GET_BYTELEN(h));
DUK_DDD(DUK_DDDPRINT("non-ascii string %p, char_offset=%d, clen=%d, blen=%d",
(void *) h, char_offset, DUK_HSTRING_GET_CHARLEN(h),
DUK_HSTRING_GET_BYTELEN(h)));
heap = thr->heap;
sce = NULL;
@ -163,11 +163,11 @@ duk_uint32_t duk_heap_strcache_offset_char2byte(duk_hthread *thr, duk_hstring *h
if (char_offset >= sce->cidx) {
dist_sce = char_offset - sce->cidx;
if ((dist_sce <= dist_start) && (dist_sce <= dist_end)) {
DUK_DDDPRINT("non-ascii string, use_cache=%d, sce=%p:%d:%d, "
"dist_start=%d, dist_end=%d, dist_sce=%d => "
"scan forwards from sce",
(int) use_cache, (sce ? sce->h : NULL), (sce ? (int) sce->cidx : (int) -1),
(sce ? (int) sce->bidx : (int) -1), (int) dist_start, (int) dist_end, (int) dist_sce);
DUK_DDD(DUK_DDDPRINT("non-ascii string, use_cache=%d, sce=%p:%d:%d, "
"dist_start=%d, dist_end=%d, dist_sce=%d => "
"scan forwards from sce",
(int) use_cache, (sce ? sce->h : NULL), (sce ? (int) sce->cidx : (int) -1),
(sce ? (int) sce->bidx : (int) -1), (int) dist_start, (int) dist_end, (int) dist_sce));
p_found = duk__scan_forwards(p_start + sce->bidx,
p_end,
@ -177,11 +177,11 @@ duk_uint32_t duk_heap_strcache_offset_char2byte(duk_hthread *thr, duk_hstring *h
} else {
dist_sce = sce->cidx - char_offset;
if ((dist_sce <= dist_start) && (dist_sce <= dist_end)) {
DUK_DDDPRINT("non-ascii string, use_cache=%d, sce=%p:%d:%d, "
"dist_start=%d, dist_end=%d, dist_sce=%d => "
"scan backwards from sce",
(int) use_cache, (sce ? sce->h : NULL), (sce ? (int) sce->cidx : (int) -1),
(sce ? (int) sce->bidx : (int) -1), (int) dist_start, (int) dist_end, (int) dist_sce);
DUK_DDD(DUK_DDDPRINT("non-ascii string, use_cache=%d, sce=%p:%d:%d, "
"dist_start=%d, dist_end=%d, dist_sce=%d => "
"scan backwards from sce",
(int) use_cache, (sce ? sce->h : NULL), (sce ? (int) sce->cidx : (int) -1),
(sce ? (int) sce->bidx : (int) -1), (int) dist_start, (int) dist_end, (int) dist_sce));
p_found = duk__scan_backwards(p_start + sce->bidx,
p_start,
@ -194,21 +194,21 @@ duk_uint32_t duk_heap_strcache_offset_char2byte(duk_hthread *thr, duk_hstring *h
/* no sce, or sce scan not best */
if (dist_start <= dist_end) {
DUK_DDDPRINT("non-ascii string, use_cache=%d, sce=%p:%d:%d, "
"dist_start=%d, dist_end=%d, dist_sce=%d => "
"scan forwards from string start",
(int) use_cache, (sce ? sce->h : NULL), (sce ? (int) sce->cidx : (int) -1),
(sce ? (int) sce->bidx : (int) -1), (int) dist_start, (int) dist_end, (int) dist_sce);
DUK_DDD(DUK_DDDPRINT("non-ascii string, use_cache=%d, sce=%p:%d:%d, "
"dist_start=%d, dist_end=%d, dist_sce=%d => "
"scan forwards from string start",
(int) use_cache, (sce ? sce->h : NULL), (sce ? (int) sce->cidx : (int) -1),
(sce ? (int) sce->bidx : (int) -1), (int) dist_start, (int) dist_end, (int) dist_sce));
p_found = duk__scan_forwards(p_start,
p_end,
dist_start);
} else {
DUK_DDDPRINT("non-ascii string, use_cache=%d, sce=%p:%d:%d, "
"dist_start=%d, dist_end=%d, dist_sce=%d => "
"scan backwards from string end",
(int) use_cache, (sce ? sce->h : NULL), (sce ? (int) sce->cidx : (int) -1),
(sce ? (int) sce->bidx : (int) -1), (int) dist_start, (int) dist_end, (int) dist_sce);
DUK_DDD(DUK_DDDPRINT("non-ascii string, use_cache=%d, sce=%p:%d:%d, "
"dist_start=%d, dist_end=%d, dist_sce=%d => "
"scan backwards from string end",
(int) use_cache, (sce ? sce->h : NULL), (sce ? (int) sce->cidx : (int) -1),
(sce ? (int) sce->bidx : (int) -1), (int) dist_start, (int) dist_end, (int) dist_sce));
p_found = duk__scan_backwards(p_end,
p_start,

30
src/duk_heap_stringtable.c

@ -52,11 +52,11 @@ static duk_hstring *duk__alloc_init_hstring(duk_heap *heap,
DUK_MEMCPY(data, str, blen);
data[blen] = (duk_uint8_t) 0;
DUK_DDDPRINT("interned string, hash=0x%08x, blen=%d, clen=%d, arridx=%d",
DUK_HSTRING_GET_HASH(res),
DUK_HSTRING_GET_BYTELEN(res),
DUK_HSTRING_GET_CHARLEN(res),
DUK_HSTRING_HAS_ARRIDX(res) ? 1 : 0);
DUK_DDD(DUK_DDDPRINT("interned string, hash=0x%08x, blen=%d, clen=%d, arridx=%d",
DUK_HSTRING_GET_HASH(res),
DUK_HSTRING_GET_BYTELEN(res),
DUK_HSTRING_GET_CHARLEN(res),
DUK_HSTRING_HAS_ARRIDX(res) ? 1 : 0));
return res;
@ -200,11 +200,11 @@ static int duk__resize_strtab_raw(duk_heap *heap, duk_uint32_t new_size) {
#endif
#ifdef DUK_USE_DDDPRINT
DUK_DDDPRINT("attempt to resize stringtable: %d entries, %d bytes, %d used, %d%% load -> %d entries, %d bytes, %d used, %d%% load",
(int) old_size, (int) (sizeof(duk_hstring *) * old_size), (int) old_used,
(int) (((double) old_used) / ((double) old_size) * 100.0),
(int) new_size, (int) (sizeof(duk_hstring *) * new_size), (int) duk__count_used(heap),
(int) (((double) duk__count_used(heap)) / ((double) new_size) * 100.0));
DUK_DDD(DUK_DDDPRINT("attempt to resize stringtable: %d entries, %d bytes, %d used, %d%% load -> %d entries, %d bytes, %d used, %d%% load",
(int) old_size, (int) (sizeof(duk_hstring *) * old_size), (int) old_used,
(int) (((double) old_used) / ((double) old_size) * 100.0),
(int) new_size, (int) (sizeof(duk_hstring *) * new_size), (int) duk__count_used(heap),
(int) (((double) duk__count_used(heap)) / ((double) new_size) * 100.0)));
#endif
DUK_ASSERT(new_size > (duk_uint32_t) duk__count_used(heap)); /* required for rehash to succeed, equality not that useful */
@ -259,11 +259,11 @@ static int duk__resize_strtab_raw(duk_heap *heap, duk_uint32_t new_size) {
}
#ifdef DUK_USE_DDPRINT
DUK_DDPRINT("resized stringtable: %d entries, %d bytes, %d used, %d%% load -> %d entries, %d bytes, %d used, %d%% load",
(int) old_size, (int) (sizeof(duk_hstring *) * old_size), (int) old_used,
(int) (((double) old_used) / ((double) old_size) * 100.0),
(int) new_size, (int) (sizeof(duk_hstring *) * new_size), (int) new_used,
(int) (((double) new_used) / ((double) new_size) * 100.0));
DUK_DD(DUK_DDPRINT("resized stringtable: %d entries, %d bytes, %d used, %d%% load -> %d entries, %d bytes, %d used, %d%% load",
(int) old_size, (int) (sizeof(duk_hstring *) * old_size), (int) old_used,
(int) (((double) old_used) / ((double) old_size) * 100.0),
(int) new_size, (int) (sizeof(duk_hstring *) * new_size), (int) new_used,
(int) (((double) new_used) / ((double) new_size) * 100.0)));
#endif
DUK_FREE(heap, heap->st);

2
src/duk_hstring_misc.c

@ -13,7 +13,7 @@ duk_ucodepoint_t duk_hstring_char_code_at_raw(duk_hthread *thr, duk_hstring *h,
DUK_ASSERT(thr != NULL);
DUK_ASSERT(h != NULL);
DUK_ASSERT(pos >= 0);
DUK_ASSERT(pos < DUK_HSTRING_GET_CHARLEN(h));
DUK_ASSERT(pos < (duk_int_t) DUK_HSTRING_GET_CHARLEN(h));
boff = duk_heap_strcache_offset_char2byte(thr, h, (duk_uint32_t) pos);
DUK_DDD(DUK_DDDPRINT("charCodeAt: pos=%d -> boff=%d, str=%!O", pos, boff, h));

Loading…
Cancel
Save