Lines Matching refs:thr

26 DUK_INTERNAL void duk_hthread_callstack_grow(duk_hthread *thr) {  in duk_hthread_callstack_grow()  argument
31 DUK_ASSERT(thr != NULL); in duk_hthread_callstack_grow()
32 DUK_ASSERT_DISABLE(thr->callstack_top >= 0); /* avoid warning (unsigned) */ in duk_hthread_callstack_grow()
33 DUK_ASSERT(thr->callstack_size >= thr->callstack_top); in duk_hthread_callstack_grow()
35 if (thr->callstack_top < thr->callstack_size) { in duk_hthread_callstack_grow()
39 old_size = thr->callstack_size; in duk_hthread_callstack_grow()
43 if (new_size >= thr->callstack_max) { in duk_hthread_callstack_grow()
44 DUK_ERROR_RANGE(thr, DUK_STR_CALLSTACK_LIMIT); in duk_hthread_callstack_grow()
55 …ew_ptr = (duk_activation *) DUK_REALLOC_INDIRECT(thr->heap, duk_hthread_get_callstack_ptr, (void *… in duk_hthread_callstack_grow()
58 DUK_ERROR_ALLOC_DEFMSG(thr); in duk_hthread_callstack_grow()
60 thr->callstack = new_ptr; in duk_hthread_callstack_grow()
61 thr->callstack_size = new_size; in duk_hthread_callstack_grow()
66 DUK_INTERNAL void duk_hthread_callstack_shrink_check(duk_hthread *thr) { in duk_hthread_callstack_shrink_check() argument
70 DUK_ASSERT(thr != NULL); in duk_hthread_callstack_shrink_check()
71 DUK_ASSERT_DISABLE(thr->callstack_top >= 0); /* avoid warning (unsigned) */ in duk_hthread_callstack_shrink_check()
72 DUK_ASSERT(thr->callstack_size >= thr->callstack_top); in duk_hthread_callstack_shrink_check()
74 if (thr->callstack_size - thr->callstack_top < DUK_CALLSTACK_SHRINK_THRESHOLD) { in duk_hthread_callstack_shrink_check()
78 new_size = thr->callstack_top + DUK_CALLSTACK_SHRINK_SPARE; in duk_hthread_callstack_shrink_check()
79 DUK_ASSERT(new_size >= thr->callstack_top); in duk_hthread_callstack_shrink_check()
81 DUK_DD(DUK_DDPRINT("shrinking callstack %ld -> %ld", (long) thr->callstack_size, (long) new_size)); in duk_hthread_callstack_shrink_check()
89 …p = (duk_activation *) DUK_REALLOC_INDIRECT(thr->heap, duk_hthread_get_callstack_ptr, (void *) thr in duk_hthread_callstack_shrink_check()
91 thr->callstack = p; in duk_hthread_callstack_shrink_check()
92 thr->callstack_size = new_size; in duk_hthread_callstack_shrink_check()
104 DUK_INTERNAL void duk_hthread_callstack_unwind(duk_hthread *thr, duk_size_t new_top) { in duk_hthread_callstack_unwind() argument
108 (void *) thr, in duk_hthread_callstack_unwind()
109 (thr != NULL ? (long) thr->callstack_top : (long) -1), in duk_hthread_callstack_unwind()
112 DUK_ASSERT(thr); in duk_hthread_callstack_unwind()
113 DUK_ASSERT(thr->heap); in duk_hthread_callstack_unwind()
115 DUK_ASSERT((duk_size_t) new_top <= thr->callstack_top); /* cannot grow */ in duk_hthread_callstack_unwind()
129 idx = thr->callstack_top; in duk_hthread_callstack_unwind()
142 DUK_ASSERT((duk_size_t) idx < thr->callstack_size); /* true, despite side effect resizes */ in duk_hthread_callstack_unwind()
144 act = thr->callstack + idx; in duk_hthread_callstack_unwind()
158 …tv_caller = duk_hobject_find_existing_entry_tval_ptr(thr->heap, func, DUK_HTHREAD_STRING_CALLER(th… in duk_hthread_callstack_unwind()
177 DUK_TVAL_DECREF(thr, &tv_tmp); /* side effects */ in duk_hthread_callstack_unwind()
182 DUK_HOBJECT_DECREF(thr, h_tmp); /* side effects */ in duk_hthread_callstack_unwind()
185 act = thr->callstack + idx; /* avoid side effects */ in duk_hthread_callstack_unwind()
196 heap = thr->heap; in duk_hthread_callstack_unwind()
197 if (heap->dbg_step_thread == thr && in duk_hthread_callstack_unwind()
228 duk_js_close_environment_record(thr, act->var_env, func, act->idx_bottom); in duk_hthread_callstack_unwind()
229 act = thr->callstack + idx; /* avoid side effect issues */ in duk_hthread_callstack_unwind()
242 duk_js_close_environment_record(thr, act->lex_env, DUK_ACT_GET_FUNC(act), act->idx_bottom); in duk_hthread_callstack_unwind()
243 act = thr->callstack + idx; /* avoid side effect issues */ in duk_hthread_callstack_unwind()
249 …((duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->lex_env, DUK_HTHREAD_STRING_INT_CALLEE( in duk_hthread_callstack_unwind()
250 …(duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->lex_env, DUK_HTHREAD_STRING_INT_VARMAP(t… in duk_hthread_callstack_unwind()
251 …(duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->lex_env, DUK_HTHREAD_STRING_INT_THREAD(t… in duk_hthread_callstack_unwind()
252 …(duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->lex_env, DUK_HTHREAD_STRING_INT_REGBASE( in duk_hthread_callstack_unwind()
255 …((duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->var_env, DUK_HTHREAD_STRING_INT_CALLEE( in duk_hthread_callstack_unwind()
256 …(duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->var_env, DUK_HTHREAD_STRING_INT_VARMAP(t… in duk_hthread_callstack_unwind()
257 …(duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->var_env, DUK_HTHREAD_STRING_INT_THREAD(t… in duk_hthread_callstack_unwind()
258 …(duk_hobject_find_existing_entry_tval_ptr(thr->heap, act->var_env, DUK_HTHREAD_STRING_INT_REGBASE( in duk_hthread_callstack_unwind()
267 DUK_ASSERT(thr->callstack_preventcount >= 1); in duk_hthread_callstack_unwind()
268 thr->callstack_preventcount--; in duk_hthread_callstack_unwind()
285 DUK_HOBJECT_DECREF_ALLOWNULL(thr, tmp); in duk_hthread_callstack_unwind()
286 act = thr->callstack + idx; /* avoid side effect issues */ in duk_hthread_callstack_unwind()
294 DUK_HOBJECT_DECREF_ALLOWNULL(thr, tmp); in duk_hthread_callstack_unwind()
295 act = thr->callstack + idx; /* avoid side effect issues */ in duk_hthread_callstack_unwind()
306 DUK_HOBJECT_DECREF_ALLOWNULL(thr, tmp); in duk_hthread_callstack_unwind()
307 act = thr->callstack + idx; /* avoid side effect issues */ in duk_hthread_callstack_unwind()
312 thr->callstack_top = new_top; in duk_hthread_callstack_unwind()
319 if (thr->callstack_top > 0) { in duk_hthread_callstack_unwind()
320 duk_activation *act = thr->callstack + thr->callstack_top - 1; in duk_hthread_callstack_unwind()
331 DUK_INTERNAL void duk_hthread_catchstack_grow(duk_hthread *thr) { in duk_hthread_catchstack_grow() argument
336 DUK_ASSERT(thr != NULL); in duk_hthread_catchstack_grow()
337 DUK_ASSERT_DISABLE(thr->catchstack_top); /* avoid warning (unsigned) */ in duk_hthread_catchstack_grow()
338 DUK_ASSERT(thr->catchstack_size >= thr->catchstack_top); in duk_hthread_catchstack_grow()
340 if (thr->catchstack_top < thr->catchstack_size) { in duk_hthread_catchstack_grow()
344 old_size = thr->catchstack_size; in duk_hthread_catchstack_grow()
348 if (new_size >= thr->catchstack_max) { in duk_hthread_catchstack_grow()
349 DUK_ERROR_RANGE(thr, DUK_STR_CATCHSTACK_LIMIT); in duk_hthread_catchstack_grow()
360 …new_ptr = (duk_catcher *) DUK_REALLOC_INDIRECT(thr->heap, duk_hthread_get_catchstack_ptr, (void *)… in duk_hthread_catchstack_grow()
363 DUK_ERROR_ALLOC_DEFMSG(thr); in duk_hthread_catchstack_grow()
365 thr->catchstack = new_ptr; in duk_hthread_catchstack_grow()
366 thr->catchstack_size = new_size; in duk_hthread_catchstack_grow()
371 DUK_INTERNAL void duk_hthread_catchstack_shrink_check(duk_hthread *thr) { in duk_hthread_catchstack_shrink_check() argument
375 DUK_ASSERT(thr != NULL); in duk_hthread_catchstack_shrink_check()
376 DUK_ASSERT_DISABLE(thr->catchstack_top >= 0); /* avoid warning (unsigned) */ in duk_hthread_catchstack_shrink_check()
377 DUK_ASSERT(thr->catchstack_size >= thr->catchstack_top); in duk_hthread_catchstack_shrink_check()
379 if (thr->catchstack_size - thr->catchstack_top < DUK_CATCHSTACK_SHRINK_THRESHOLD) { in duk_hthread_catchstack_shrink_check()
383 new_size = thr->catchstack_top + DUK_CATCHSTACK_SHRINK_SPARE; in duk_hthread_catchstack_shrink_check()
384 DUK_ASSERT(new_size >= thr->catchstack_top); in duk_hthread_catchstack_shrink_check()
386 …DUK_DD(DUK_DDPRINT("shrinking catchstack %ld -> %ld", (long) thr->catchstack_size, (long) new_size… in duk_hthread_catchstack_shrink_check()
394 …p = (duk_catcher *) DUK_REALLOC_INDIRECT(thr->heap, duk_hthread_get_catchstack_ptr, (void *) thr, … in duk_hthread_catchstack_shrink_check()
396 thr->catchstack = p; in duk_hthread_catchstack_shrink_check()
397 thr->catchstack_size = new_size; in duk_hthread_catchstack_shrink_check()
409 DUK_INTERNAL void duk_hthread_catchstack_unwind(duk_hthread *thr, duk_size_t new_top) { in duk_hthread_catchstack_unwind() argument
413 (void *) thr, in duk_hthread_catchstack_unwind()
414 (thr != NULL ? (long) thr->catchstack_top : (long) -1), in duk_hthread_catchstack_unwind()
417 DUK_ASSERT(thr); in duk_hthread_catchstack_unwind()
418 DUK_ASSERT(thr->heap); in duk_hthread_catchstack_unwind()
420 DUK_ASSERT((duk_size_t) new_top <= thr->catchstack_top); /* cannot grow */ in duk_hthread_catchstack_unwind()
429 idx = thr->catchstack_top; in duk_hthread_catchstack_unwind()
437 DUK_ASSERT((duk_size_t) idx < thr->catchstack_size); in duk_hthread_catchstack_unwind()
439 p = thr->catchstack + idx; in duk_hthread_catchstack_unwind()
443 (long) idx, (long) p->callstack_index, (long) thr->callstack_top)); in duk_hthread_catchstack_unwind()
454 act = thr->callstack + p->callstack_index; in duk_hthread_catchstack_unwind()
455 DUK_ASSERT(act >= thr->callstack); in duk_hthread_catchstack_unwind()
456 DUK_ASSERT(act < thr->callstack + thr->callstack_top); in duk_hthread_catchstack_unwind()
464 …act->lex_env = DUK_HOBJECT_GET_PROTOTYPE(thr->heap, env); /* prototype is lex_env before catcher … in duk_hthread_catchstack_unwind()
465 DUK_HOBJECT_DECREF(thr, env); in duk_hthread_catchstack_unwind()
473 thr->catchstack_top = new_top; in duk_hthread_catchstack_unwind()