jscript: Use bytecode for execution main code block in exec_source.
This commit is contained in:
parent
f6023c428a
commit
2f3e27f09a
@ -931,7 +931,7 @@ HRESULT compile_subscript(parser_ctx_t *parser, expression_t *expr, BOOL do_ret,
|
|||||||
return push_instr(parser->compiler, OP_ret) == -1 ? E_OUTOFMEMORY : S_OK;
|
return push_instr(parser->compiler, OP_ret) == -1 ? E_OUTOFMEMORY : S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT compile_subscript_stat(parser_ctx_t *parser, statement_t *stat, unsigned *ret_off)
|
HRESULT compile_subscript_stat(parser_ctx_t *parser, statement_t *stat, BOOL compile_block, unsigned *ret_off)
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
@ -942,6 +942,9 @@ HRESULT compile_subscript_stat(parser_ctx_t *parser, statement_t *stat, unsigned
|
|||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
*ret_off = parser->compiler->code_off;
|
*ret_off = parser->compiler->code_off;
|
||||||
|
if(compile_block && stat->next)
|
||||||
|
hres = compile_block_statement(parser->compiler, stat);
|
||||||
|
else
|
||||||
hres = compile_statement(parser->compiler, stat);
|
hres = compile_statement(parser->compiler, stat);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
@ -513,8 +513,7 @@ HRESULT exec_source(exec_ctx_t *ctx, parser_ctx_t *parser, source_elements_t *so
|
|||||||
function_declaration_t *func;
|
function_declaration_t *func;
|
||||||
parser_ctx_t *prev_parser;
|
parser_ctx_t *prev_parser;
|
||||||
var_list_t *var;
|
var_list_t *var;
|
||||||
VARIANT val, tmp;
|
VARIANT val;
|
||||||
statement_t *stat;
|
|
||||||
exec_ctx_t *prev_ctx;
|
exec_ctx_t *prev_ctx;
|
||||||
return_type_t rt;
|
return_type_t rt;
|
||||||
HRESULT hres = S_OK;
|
HRESULT hres = S_OK;
|
||||||
@ -560,15 +559,11 @@ HRESULT exec_source(exec_ctx_t *ctx, parser_ctx_t *parser, source_elements_t *so
|
|||||||
memset(&rt, 0, sizeof(rt));
|
memset(&rt, 0, sizeof(rt));
|
||||||
rt.type = RT_NORMAL;
|
rt.type = RT_NORMAL;
|
||||||
|
|
||||||
for(stat = source->statement; stat; stat = stat->next) {
|
if(source->statement) {
|
||||||
hres = stat_eval(script, stat, &rt, &tmp);
|
if(source->statement->instr_off == -1)
|
||||||
if(FAILED(hres))
|
hres = compile_subscript_stat(ctx->parser, source->statement, TRUE, &source->statement->instr_off);
|
||||||
break;
|
if(SUCCEEDED(hres))
|
||||||
|
hres = compiled_statement_eval(script, source->statement, &rt, &val);
|
||||||
VariantClear(&val);
|
|
||||||
val = tmp;
|
|
||||||
if(rt.type != RT_NORMAL)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
script->exec_ctx = prev_ctx;
|
script->exec_ctx = prev_ctx;
|
||||||
@ -3005,7 +3000,7 @@ HRESULT compiled_statement_eval(script_ctx_t *ctx, statement_t *stat, return_typ
|
|||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
if(stat->instr_off == -1) {
|
if(stat->instr_off == -1) {
|
||||||
hres = compile_subscript_stat(exec_ctx->parser, stat, &stat->instr_off);
|
hres = compile_subscript_stat(exec_ctx->parser, stat, FALSE, &stat->instr_off);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
@ -590,4 +590,4 @@ typedef struct {
|
|||||||
} property_value_expression_t;
|
} property_value_expression_t;
|
||||||
|
|
||||||
HRESULT compile_subscript(parser_ctx_t*,expression_t*,BOOL,unsigned*) DECLSPEC_HIDDEN;
|
HRESULT compile_subscript(parser_ctx_t*,expression_t*,BOOL,unsigned*) DECLSPEC_HIDDEN;
|
||||||
HRESULT compile_subscript_stat(parser_ctx_t*,statement_t*,unsigned*) DECLSPEC_HIDDEN;
|
HRESULT compile_subscript_stat(parser_ctx_t*,statement_t*,BOOL,unsigned*) DECLSPEC_HIDDEN;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user