Lines Matching refs:frame
180 static inline unsigned local_off(call_frame_t *frame, int ref) in local_off() argument
183 ? frame->arguments_off - ref-1 in local_off()
184 : frame->variables_off + ref; in local_off()
187 static inline BSTR local_name(call_frame_t *frame, int ref) in local_name() argument
189 return ref < 0 ? frame->function->params[-ref-1] : frame->function->variables[ref].name; in local_name()
229 call_frame_t *frame = ctx->call_ctx; in stack_topn_exprval() local
232 if(!frame->base_scope->frame && off >= frame->arguments_off) { in stack_topn_exprval()
239 assert(off < frame->variables_off + frame->function->var_cnt); in stack_topn_exprval()
240 name = off >= frame->variables_off in stack_topn_exprval()
241 ? frame->function->variables[off - frame->variables_off].name in stack_topn_exprval()
242 : frame->function->params[off - frame->arguments_off]; in stack_topn_exprval()
250 *stack_top_ref(ctx, n+1) = jsval_obj(jsdisp_addref(frame->base_scope->jsobj)); in stack_topn_exprval()
253 r->u.idref.disp = frame->base_scope->obj; in stack_topn_exprval()
388 static inline jsval_t steal_ret(call_frame_t *frame) in steal_ret() argument
390 jsval_t r = frame->ret; in steal_ret()
391 frame->ret = jsval_undefined(); in steal_ret()
414 new_scope->frame = NULL; in scope_push()
573 static HRESULT detach_variable_object(script_ctx_t *ctx, call_frame_t *frame, BOOL from_release) in detach_variable_object() argument
578 if(!frame->base_scope || !frame->base_scope->frame) in detach_variable_object()
581 TRACE("detaching %p\n", frame); in detach_variable_object()
583 assert(frame == frame->base_scope->frame); in detach_variable_object()
584 assert(frame->variable_obj == frame->base_scope->jsobj); in detach_variable_object()
586 if(!from_release && !frame->arguments_obj) { in detach_variable_object()
587 hres = setup_arguments_object(ctx, frame); in detach_variable_object()
592 frame->base_scope->frame = NULL; in detach_variable_object()
594 for(i = 0; i < frame->function->locals_cnt; i++) { in detach_variable_object()
595 hres = jsdisp_propput_name(frame->variable_obj, frame->function->locals[i].name, in detach_variable_object()
596 ctx->stack[local_off(frame, frame->function->locals[i].ref)]); in detach_variable_object()
646 if(scope->frame) { in identifier_eval()
647 function_code_t *func = scope->frame->function; in identifier_eval()
653 ret->u.off = local_off(scope->frame, ref->ref); in identifier_eval()
659 hres = detach_variable_object(ctx, scope->frame, FALSE); in identifier_eval()
720 call_frame_t *frame = ctx->call_ctx; in get_op_bstr() local
721 return frame->bytecode->instrs[frame->ip].u.arg[i].bstr; in get_op_bstr()
726 call_frame_t *frame = ctx->call_ctx; in get_op_uint() local
727 return frame->bytecode->instrs[frame->ip].u.arg[i].uint; in get_op_uint()
732 call_frame_t *frame = ctx->call_ctx; in get_op_int() local
733 return frame->bytecode->instrs[frame->ip].u.arg[i].lng; in get_op_int()
738 call_frame_t *frame = ctx->call_ctx; in get_op_str() local
739 return frame->bytecode->instrs[frame->ip].u.arg[i].str; in get_op_str()
744 call_frame_t *frame = ctx->call_ctx; in get_op_double() local
745 return frame->bytecode->instrs[frame->ip].u.dbl; in get_op_double()
910 call_frame_t *frame = ctx->call_ctx; in interp_push_except() local
920 except->scope = frame->scope; in interp_push_except()
923 except->next = frame->except_frame; in interp_push_except()
924 frame->except_frame = except; in interp_push_except()
932 call_frame_t *frame = ctx->call_ctx; in interp_pop_except() local
938 except = frame->except_frame; in interp_pop_except()
942 frame->except_frame = except->next; in interp_pop_except()
954 frame->ip = finally_off; in interp_pop_except()
956 frame->ip = ret_off; in interp_pop_except()
965 call_frame_t *frame = ctx->call_ctx; in interp_end_finally() local
982 frame->ip = get_number(v); in interp_end_finally()
1010 call_frame_t *frame = ctx->call_ctx; in interp_func() local
1016 hres = create_source_function(ctx, frame->bytecode, frame->function->funcs+func_idx, in interp_func()
1017 frame->scope, &dispex); in interp_func()
1224 call_frame_t *frame = ctx->call_ctx; in interp_this() local
1228 IDispatch_AddRef(frame->this_obj); in interp_this()
1229 return stack_push(ctx, jsval_disp(frame->this_obj)); in interp_this()
1284 call_frame_t *frame = ctx->call_ctx; in interp_local_ref() local
1289 if(!frame->base_scope || !frame->base_scope->frame) in interp_local_ref()
1290 return interp_identifier_ref(ctx, local_name(frame, arg), flags); in interp_local_ref()
1293 ref.u.off = local_off(frame, arg); in interp_local_ref()
1300 call_frame_t *frame = ctx->call_ctx; in interp_local() local
1304 TRACE("%d: %s\n", arg, debugstr_w(local_name(frame, arg))); in interp_local()
1306 if(!frame->base_scope || !frame->base_scope->frame) in interp_local()
1307 return identifier_value(ctx, local_name(frame, arg)); in interp_local()
1309 hres = jsval_copy(ctx->stack[local_off(frame, arg)], ©); in interp_local()
2606 call_frame_t *frame = ctx->call_ctx; in interp_ret() local
2611 jsval_release(steal_ret(frame)); in interp_ret()
2613 if((frame->flags & EXEC_CONSTRUCTOR) && !is_object_instance(frame->ret)) { in interp_ret()
2614 jsval_release(frame->ret); in interp_ret()
2615 IDispatch_AddRef(frame->this_obj); in interp_ret()
2616 frame->ret = jsval_disp(frame->this_obj); in interp_ret()
2625 call_frame_t *frame = ctx->call_ctx; in interp_setret() local
2629 jsval_release(frame->ret); in interp_setret()
2630 frame->ret = stack_pop(ctx); in interp_setret()
2662 call_frame_t *frame = ctx->call_ctx; in pop_call_frame() local
2664 frame->stack_base -= frame->pop_locals + frame->pop_variables; in pop_call_frame()
2666 assert(frame->scope == frame->base_scope); in pop_call_frame()
2669 if(frame->scope && frame->scope->ref > 1) { in pop_call_frame()
2670 HRESULT hres = detach_variable_object(ctx, frame, TRUE); in pop_call_frame()
2675 if(frame->arguments_obj) in pop_call_frame()
2676 detach_arguments_object(frame->arguments_obj); in pop_call_frame()
2677 if(frame->scope) in pop_call_frame()
2678 scope_release(frame->scope); in pop_call_frame()
2680 if(frame->pop_variables) in pop_call_frame()
2681 stack_popn(ctx, frame->pop_variables); in pop_call_frame()
2682 stack_popn(ctx, frame->pop_locals); in pop_call_frame()
2684 ctx->call_ctx = frame->prev_frame; in pop_call_frame()
2686 if(frame->function_instance) in pop_call_frame()
2687 jsdisp_release(frame->function_instance); in pop_call_frame()
2688 if(frame->variable_obj) in pop_call_frame()
2689 jsdisp_release(frame->variable_obj); in pop_call_frame()
2690 if(frame->this_obj) in pop_call_frame()
2691 IDispatch_Release(frame->this_obj); in pop_call_frame()
2692 jsval_release(frame->ret); in pop_call_frame()
2693 release_bytecode(frame->bytecode); in pop_call_frame()
2694 heap_free(frame); in pop_call_frame()
2700 call_frame_t *frame; in print_backtrace() local
2702 for(frame = ctx->call_ctx; frame; frame = frame->prev_frame) { in print_backtrace()
2706 …if(frame->this_obj && frame->this_obj != to_disp(ctx->global) && frame->this_obj != ctx->host_glob… in print_backtrace()
2707 WARN("%p->", frame->this_obj); in print_backtrace()
2708 WARN("%s(", frame->function->name ? debugstr_w(frame->function->name) : "[unnamed]"); in print_backtrace()
2709 if(frame->base_scope && frame->base_scope->frame) { in print_backtrace()
2710 for(i=0; i < frame->argc; i++) { in print_backtrace()
2711 if(i < frame->function->param_cnt) in print_backtrace()
2712 WARN("%s%s=%s", i ? ", " : "", debugstr_w(frame->function->params[i]), in print_backtrace()
2713 debugstr_jsval(ctx->stack[local_off(frame, -i-1)])); in print_backtrace()
2715 WARN("%s%s", i ? ", " : "", debugstr_jsval(ctx->stack[local_off(frame, -i-1)])); in print_backtrace()
2722 if(!(frame->flags & EXEC_RETURN_TO_INTERP)) { in print_backtrace()
2732 call_frame_t *frame; in unwind_exception() local
2759 for(frame = ctx->call_ctx; !frame->except_frame; frame = ctx->call_ctx) { in unwind_exception()
2762 while(frame->scope != frame->base_scope) in unwind_exception()
2763 scope_pop(&frame->scope); in unwind_exception()
2765 stack_popn(ctx, ctx->stack_top-frame->stack_base); in unwind_exception()
2767 flags = frame->flags; in unwind_exception()
2773 except_frame = frame->except_frame; in unwind_exception()
2779 while(except_frame->scope != frame->scope) in unwind_exception()
2780 scope_pop(&frame->scope); in unwind_exception()
2782 frame->ip = catch_off ? catch_off : except_frame->finally_off; in unwind_exception()
2783 if(catch_off) assert(frame->bytecode->instrs[frame->ip].op == OP_enter_catch); in unwind_exception()
2793 frame->except_frame = except_frame->next; in unwind_exception()
2808 call_frame_t *frame; in enter_bytecode() local
2815 frame = ctx->call_ctx; in enter_bytecode()
2816 op = frame->bytecode->instrs[frame->ip].op; in enter_bytecode()
2822 }else if(frame->ip == -1) { in enter_bytecode()
2823 const DWORD return_to_interp = frame->flags & EXEC_RETURN_TO_INTERP; in enter_bytecode()
2825 assert(ctx->stack_top == frame->stack_base); in enter_bytecode()
2826 assert(frame->scope == frame->base_scope); in enter_bytecode()
2830 ctx->acc = steal_ret(frame); in enter_bytecode()
2832 *r = steal_ret(frame); in enter_bytecode()
2838 frame->ip += op_move[op]; in enter_bytecode()
2881 static HRESULT setup_scope(script_ctx_t *ctx, call_frame_t *frame, scope_chain_t *scope_chain, jsdi… in setup_scope() argument
2891 frame->arguments_off = argv - ctx->stack; in setup_scope()
2894 frame->arguments_off = ctx->stack_top; in setup_scope()
2907 for(; i < frame->function->param_cnt; i++) { in setup_scope()
2915 frame->pop_locals = ctx->stack_top - orig_stack; in setup_scope()
2917 frame->variables_off = ctx->stack_top; in setup_scope()
2919 for(i = 0; i < frame->function->var_cnt; i++) { in setup_scope()
2927 frame->pop_variables = i; in setup_scope()
2935 for(i = 0; i < frame->function->func_cnt; i++) { in setup_scope()
2936 if(frame->function->funcs[i].name && !frame->function->funcs[i].event_target) { in setup_scope()
2940 … hres = create_source_function(ctx, frame->bytecode, frame->function->funcs+i, scope, &func_obj); in setup_scope()
2947 off = local_off(frame, frame->function->funcs[i].local_ref); in setup_scope()
2953 scope->frame = frame; in setup_scope()
2954 frame->base_scope = frame->scope = scope; in setup_scope()
2961 call_frame_t *frame; in exec_source() local
3021 frame = heap_alloc_zero(sizeof(*frame)); in exec_source()
3022 if(!frame) in exec_source()
3025 frame->function = function; in exec_source()
3026 frame->ret = jsval_undefined(); in exec_source()
3027 frame->argc = argc; in exec_source()
3028 frame->bytecode = bytecode_addref(bytecode); in exec_source()
3031 hres = setup_scope(ctx, frame, scope, variable_obj, argc, argv); in exec_source()
3033 release_bytecode(frame->bytecode); in exec_source()
3034 heap_free(frame); in exec_source()
3038 frame->base_scope = frame->scope = scope_addref(scope); in exec_source()
3041 frame->ip = function->instr_off; in exec_source()
3042 frame->stack_base = ctx->stack_top; in exec_source()
3044 frame->this_obj = this_obj; in exec_source()
3046 frame->this_obj = ctx->host_global; in exec_source()
3048 frame->this_obj = to_disp(ctx->global); in exec_source()
3049 IDispatch_AddRef(frame->this_obj); in exec_source()
3052 frame->function_instance = jsdisp_addref(function_instance); in exec_source()
3054 frame->flags = flags; in exec_source()
3055 frame->variable_obj = jsdisp_addref(variable_obj); in exec_source()
3057 frame->prev_frame = ctx->call_ctx; in exec_source()
3058 ctx->call_ctx = frame; in exec_source()