2 * Copyright 2011 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(jscript
);
29 struct _compiler_ctx_t
{
37 static HRESULT
compile_expression(compiler_ctx_t
*,expression_t
*);
39 static inline void *compiler_alloc(bytecode_t
*code
, size_t size
)
41 return jsheap_alloc(&code
->heap
, size
);
44 static WCHAR
*compiler_alloc_string(bytecode_t
*code
, const WCHAR
*str
)
49 size
= (strlenW(str
)+1)*sizeof(WCHAR
);
50 ret
= compiler_alloc(code
, size
);
52 memcpy(ret
, str
, size
);
56 static BSTR
compiler_alloc_bstr(compiler_ctx_t
*ctx
, const WCHAR
*str
)
58 if(!ctx
->code
->bstr_pool_size
) {
59 ctx
->code
->bstr_pool
= heap_alloc(8 * sizeof(BSTR
));
60 if(!ctx
->code
->bstr_pool
)
62 ctx
->code
->bstr_pool_size
= 8;
63 }else if(ctx
->code
->bstr_pool_size
== ctx
->code
->bstr_cnt
) {
66 new_pool
= heap_realloc(ctx
->code
->bstr_pool
, ctx
->code
->bstr_pool_size
*2*sizeof(BSTR
));
70 ctx
->code
->bstr_pool
= new_pool
;
71 ctx
->code
->bstr_pool_size
*= 2;
74 ctx
->code
->bstr_pool
[ctx
->code
->bstr_cnt
] = SysAllocString(str
);
75 if(!ctx
->code
->bstr_pool
[ctx
->code
->bstr_cnt
])
78 return ctx
->code
->bstr_pool
[ctx
->code
->bstr_cnt
++];
81 static unsigned push_instr(compiler_ctx_t
*ctx
, jsop_t op
)
83 assert(ctx
->code_size
>= ctx
->code_off
);
86 ctx
->code
->instrs
= heap_alloc(64 * sizeof(instr_t
));
87 if(!ctx
->code
->instrs
)
90 }else if(ctx
->code_size
== ctx
->code_off
) {
93 new_instrs
= heap_realloc(ctx
->code
->instrs
, ctx
->code_size
*2*sizeof(instr_t
));
97 ctx
->code
->instrs
= new_instrs
;
101 ctx
->code
->instrs
[ctx
->code_off
].op
= op
;
102 return ctx
->code_off
++;
105 static inline instr_t
*instr_ptr(compiler_ctx_t
*ctx
, unsigned off
)
107 assert(off
< ctx
->code_off
);
108 return ctx
->code
->instrs
+ off
;
111 static HRESULT
push_instr_int(compiler_ctx_t
*ctx
, jsop_t op
, LONG arg
)
115 instr
= push_instr(ctx
, op
);
117 return E_OUTOFMEMORY
;
119 instr_ptr(ctx
, instr
)->arg1
.lng
= arg
;
123 static HRESULT
push_instr_str(compiler_ctx_t
*ctx
, jsop_t op
, const WCHAR
*arg
)
128 str
= compiler_alloc_string(ctx
->code
, arg
);
130 return E_OUTOFMEMORY
;
132 instr
= push_instr(ctx
, op
);
134 return E_OUTOFMEMORY
;
136 instr_ptr(ctx
, instr
)->arg1
.str
= str
;
140 static HRESULT
push_instr_bstr(compiler_ctx_t
*ctx
, jsop_t op
, const WCHAR
*arg
)
145 str
= compiler_alloc_bstr(ctx
, arg
);
147 return E_OUTOFMEMORY
;
149 instr
= push_instr(ctx
, op
);
151 return E_OUTOFMEMORY
;
153 instr_ptr(ctx
, instr
)->arg1
.bstr
= str
;
157 static HRESULT
push_instr_bstr_uint(compiler_ctx_t
*ctx
, jsop_t op
, const WCHAR
*arg1
, unsigned arg2
)
162 str
= compiler_alloc_bstr(ctx
, arg1
);
164 return E_OUTOFMEMORY
;
166 instr
= push_instr(ctx
, op
);
168 return E_OUTOFMEMORY
;
170 instr_ptr(ctx
, instr
)->arg1
.bstr
= str
;
171 instr_ptr(ctx
, instr
)->arg2
.uint
= arg2
;
175 static HRESULT
push_instr_uint_str(compiler_ctx_t
*ctx
, jsop_t op
, unsigned arg1
, const WCHAR
*arg2
)
180 str
= compiler_alloc_string(ctx
->code
, arg2
);
182 return E_OUTOFMEMORY
;
184 instr
= push_instr(ctx
, op
);
186 return E_OUTOFMEMORY
;
188 instr_ptr(ctx
, instr
)->arg1
.uint
= arg1
;
189 instr_ptr(ctx
, instr
)->arg2
.str
= str
;
193 static HRESULT
push_instr_double(compiler_ctx_t
*ctx
, jsop_t op
, double arg
)
198 dbl
= compiler_alloc(ctx
->code
, sizeof(arg
));
200 return E_OUTOFMEMORY
;
203 instr
= push_instr(ctx
, op
);
205 return E_OUTOFMEMORY
;
207 instr_ptr(ctx
, instr
)->arg1
.dbl
= dbl
;
211 static HRESULT
push_instr_uint(compiler_ctx_t
*ctx
, jsop_t op
, unsigned arg
)
215 instr
= push_instr(ctx
, op
);
217 return E_OUTOFMEMORY
;
219 instr_ptr(ctx
, instr
)->arg1
.uint
= arg
;
223 static HRESULT
compile_binary_expression(compiler_ctx_t
*ctx
, binary_expression_t
*expr
, jsop_t op
)
227 hres
= compile_expression(ctx
, expr
->expression1
);
231 hres
= compile_expression(ctx
, expr
->expression2
);
235 return push_instr(ctx
, op
) == -1 ? E_OUTOFMEMORY
: S_OK
;
238 static HRESULT
compile_unary_expression(compiler_ctx_t
*ctx
, unary_expression_t
*expr
, jsop_t op
)
242 hres
= compile_expression(ctx
, expr
->expression
);
246 return push_instr(ctx
, op
) == -1 ? E_OUTOFMEMORY
: S_OK
;
249 /* ECMA-262 3rd Edition 11.2.1 */
250 static HRESULT
compile_member_expression(compiler_ctx_t
*ctx
, member_expression_t
*expr
)
254 hres
= compile_expression(ctx
, expr
->expression
);
258 return push_instr_bstr(ctx
, OP_member
, expr
->identifier
);
261 static inline BOOL
is_memberid_expr(expression_type_t type
)
263 return type
== EXPR_IDENT
|| type
== EXPR_MEMBER
|| type
== EXPR_ARRAY
;
266 static HRESULT
compile_memberid_expression(compiler_ctx_t
*ctx
, expression_t
*expr
, unsigned flags
)
272 identifier_expression_t
*ident_expr
= (identifier_expression_t
*)expr
;
274 hres
= push_instr_bstr_uint(ctx
, OP_identid
, ident_expr
->identifier
, flags
);
278 binary_expression_t
*array_expr
= (binary_expression_t
*)expr
;
280 hres
= compile_expression(ctx
, array_expr
->expression1
);
284 hres
= compile_expression(ctx
, array_expr
->expression2
);
288 hres
= push_instr_uint(ctx
, OP_memberid
, flags
);
292 member_expression_t
*member_expr
= (member_expression_t
*)expr
;
294 hres
= compile_expression(ctx
, member_expr
->expression
);
298 /* FIXME: Potential optimization */
299 hres
= push_instr_str(ctx
, OP_str
, member_expr
->identifier
);
303 hres
= push_instr_uint(ctx
, OP_memberid
, flags
);
313 static HRESULT
compile_increment_expression(compiler_ctx_t
*ctx
, unary_expression_t
*expr
, jsop_t op
, int n
)
317 if(!is_memberid_expr(expr
->expression
->type
)) {
318 hres
= compile_expression(ctx
, expr
->expression
);
322 return push_instr_uint(ctx
, OP_throw
, JS_E_ILLEGAL_ASSIGN
);
325 hres
= compile_memberid_expression(ctx
, expr
->expression
, fdexNameEnsure
);
329 return push_instr_int(ctx
, op
, n
);
332 /* ECMA-262 3rd Edition 11.14 */
333 static HRESULT
compile_comma_expression(compiler_ctx_t
*ctx
, binary_expression_t
*expr
)
337 hres
= compile_expression(ctx
, expr
->expression1
);
341 if(push_instr(ctx
, OP_pop
) == -1)
342 return E_OUTOFMEMORY
;
344 return compile_expression(ctx
, expr
->expression2
);
347 /* ECMA-262 3rd Edition 11.11 */
348 static HRESULT
compile_logical_expression(compiler_ctx_t
*ctx
, binary_expression_t
*expr
, jsop_t op
)
353 hres
= compile_expression(ctx
, expr
->expression1
);
357 instr
= push_instr(ctx
, op
);
359 return E_OUTOFMEMORY
;
361 hres
= compile_expression(ctx
, expr
->expression2
);
365 instr_ptr(ctx
, instr
)->arg1
.uint
= ctx
->code_off
;
369 /* ECMA-262 3rd Edition 11.12 */
370 static HRESULT
compile_conditional_expression(compiler_ctx_t
*ctx
, conditional_expression_t
*expr
)
372 unsigned jmp_false
, jmp_end
;
375 hres
= compile_expression(ctx
, expr
->expression
);
379 jmp_false
= push_instr(ctx
, OP_jmp_z
);
381 return E_OUTOFMEMORY
;
383 hres
= compile_expression(ctx
, expr
->true_expression
);
387 jmp_end
= push_instr(ctx
, OP_jmp
);
389 return E_OUTOFMEMORY
;
391 instr_ptr(ctx
, jmp_false
)->arg1
.uint
= ctx
->code_off
;
392 if(push_instr(ctx
, OP_pop
) == -1)
393 return E_OUTOFMEMORY
;
395 hres
= compile_expression(ctx
, expr
->false_expression
);
399 instr_ptr(ctx
, jmp_end
)->arg1
.uint
= ctx
->code_off
;
403 static HRESULT
compile_new_expression(compiler_ctx_t
*ctx
, call_expression_t
*expr
)
405 unsigned arg_cnt
= 0;
409 hres
= compile_expression(ctx
, expr
->expression
);
413 for(arg
= expr
->argument_list
; arg
; arg
= arg
->next
) {
414 hres
= compile_expression(ctx
, arg
->expr
);
420 return push_instr_int(ctx
, OP_new
, arg_cnt
);
423 static HRESULT
compile_interp_fallback(compiler_ctx_t
*ctx
, expression_t
*expr
)
427 instr
= push_instr(ctx
, OP_tree
);
429 return E_OUTOFMEMORY
;
431 instr_ptr(ctx
, instr
)->arg1
.expr
= expr
;
435 static HRESULT
compile_call_expression(compiler_ctx_t
*ctx
, call_expression_t
*expr
, BOOL
*no_ret
)
437 unsigned arg_cnt
= 0;
443 if(is_memberid_expr(expr
->expression
->type
)) {
445 hres
= compile_memberid_expression(ctx
, expr
->expression
, 0);
448 hres
= compile_expression(ctx
, expr
->expression
);
454 for(arg
= expr
->argument_list
; arg
; arg
= arg
->next
) {
455 hres
= compile_expression(ctx
, arg
->expr
);
461 instr
= push_instr(ctx
, op
);
463 return E_OUTOFMEMORY
;
465 instr_ptr(ctx
, instr
)->arg1
.uint
= arg_cnt
;
466 instr_ptr(ctx
, instr
)->arg2
.lng
= no_ret
== NULL
;
472 static HRESULT
compile_delete_expression(compiler_ctx_t
*ctx
, unary_expression_t
*expr
)
476 switch(expr
->expression
->type
) {
478 binary_expression_t
*array_expr
= (binary_expression_t
*)expr
->expression
;
480 hres
= compile_expression(ctx
, array_expr
->expression1
);
484 hres
= compile_expression(ctx
, array_expr
->expression2
);
488 if(push_instr(ctx
, OP_delete
) == -1)
489 return E_OUTOFMEMORY
;
493 member_expression_t
*member_expr
= (member_expression_t
*)expr
->expression
;
495 hres
= compile_expression(ctx
, member_expr
->expression
);
499 /* FIXME: Potential optimization */
500 hres
= push_instr_str(ctx
, OP_str
, member_expr
->identifier
);
504 if(push_instr(ctx
, OP_delete
) == -1)
505 return E_OUTOFMEMORY
;
509 return push_instr_bstr(ctx
, OP_delete_ident
, ((identifier_expression_t
*)expr
->expression
)->identifier
);
511 const WCHAR fixmeW
[] = {'F','I','X','M','E',0};
513 WARN("invalid delete, unimplemented exception message\n");
515 hres
= compile_expression(ctx
, expr
->expression
);
519 return push_instr_uint_str(ctx
, OP_throw_type
, JS_E_INVALID_DELETE
, fixmeW
);
526 static HRESULT
compile_assign_expression(compiler_ctx_t
*ctx
, binary_expression_t
*expr
, jsop_t op
)
530 if(!is_memberid_expr(expr
->expression1
->type
)) {
531 hres
= compile_expression(ctx
, expr
->expression1
);
535 hres
= compile_expression(ctx
, expr
->expression2
);
539 if(op
!= OP_LAST
&& push_instr(ctx
, op
) == -1)
540 return E_OUTOFMEMORY
;
542 return push_instr_uint(ctx
, OP_throw
, JS_E_ILLEGAL_ASSIGN
);
545 hres
= compile_memberid_expression(ctx
, expr
->expression1
, fdexNameEnsure
);
549 if(op
!= OP_LAST
&& push_instr(ctx
, OP_refval
) == -1)
550 return E_OUTOFMEMORY
;
552 hres
= compile_expression(ctx
, expr
->expression2
);
556 if(op
!= OP_LAST
&& push_instr(ctx
, op
) == -1)
557 return E_OUTOFMEMORY
;
559 if(push_instr(ctx
, OP_assign
) == -1)
560 return E_OUTOFMEMORY
;
565 static HRESULT
compile_typeof_expression(compiler_ctx_t
*ctx
, unary_expression_t
*expr
)
570 if(is_memberid_expr(expr
->expression
->type
)) {
571 if(expr
->expression
->type
== EXPR_IDENT
)
572 return push_instr_str(ctx
, OP_typeofident
, ((identifier_expression_t
*)expr
->expression
)->identifier
);
575 hres
= compile_memberid_expression(ctx
, expr
->expression
, 0);
578 hres
= compile_expression(ctx
, expr
->expression
);
583 return push_instr(ctx
, op
) == -1 ? E_OUTOFMEMORY
: S_OK
;
586 static HRESULT
compile_literal(compiler_ctx_t
*ctx
, literal_t
*literal
)
588 switch(literal
->type
) {
590 return push_instr_int(ctx
, OP_bool
, literal
->u
.bval
);
592 return push_instr_double(ctx
, OP_double
, literal
->u
.dval
);
594 return push_instr_int(ctx
, OP_int
, literal
->u
.lval
);
596 return push_instr(ctx
, OP_null
);
598 return push_instr_str(ctx
, OP_str
, literal
->u
.wstr
);
603 str
= compiler_alloc(ctx
->code
, (literal
->u
.regexp
.str_len
+1)*sizeof(WCHAR
));
605 return E_OUTOFMEMORY
;
606 memcpy(str
, literal
->u
.regexp
.str
, literal
->u
.regexp
.str_len
*sizeof(WCHAR
));
607 str
[literal
->u
.regexp
.str_len
] = 0;
609 instr
= push_instr(ctx
, OP_regexp
);
611 return E_OUTOFMEMORY
;
613 instr_ptr(ctx
, instr
)->arg1
.str
= str
;
614 instr_ptr(ctx
, instr
)->arg2
.lng
= literal
->u
.regexp
.flags
;
622 static HRESULT
compile_array_literal(compiler_ctx_t
*ctx
, array_literal_expression_t
*expr
)
624 unsigned i
, elem_cnt
= expr
->length
;
625 array_element_t
*iter
;
628 for(iter
= expr
->element_list
; iter
; iter
= iter
->next
) {
629 elem_cnt
+= iter
->elision
+1;
631 for(i
=0; i
< iter
->elision
; i
++) {
632 if(push_instr(ctx
, OP_undefined
) == -1)
633 return E_OUTOFMEMORY
;
636 hres
= compile_expression(ctx
, iter
->expr
);
641 for(i
=0; i
< expr
->length
; i
++) {
642 if(push_instr(ctx
, OP_undefined
) == -1)
643 return E_OUTOFMEMORY
;
646 return push_instr_uint(ctx
, OP_carray
, elem_cnt
);
649 static HRESULT
compile_function_expression(compiler_ctx_t
*ctx
, function_expression_t
*expr
)
653 /* FIXME: not exactly right */
655 return push_instr_bstr(ctx
, OP_ident
, expr
->identifier
);
657 instr
= push_instr(ctx
, OP_func
);
659 return E_OUTOFMEMORY
;
661 instr_ptr(ctx
, instr
)->arg1
.func
= expr
;
665 static HRESULT
compile_expression_noret(compiler_ctx_t
*ctx
, expression_t
*expr
, BOOL
*no_ret
)
669 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_add
);
671 return compile_logical_expression(ctx
, (binary_expression_t
*)expr
, OP_jmp_z
);
673 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_array
);
675 return compile_array_literal(ctx
, (array_literal_expression_t
*)expr
);
677 return compile_assign_expression(ctx
, (binary_expression_t
*)expr
, OP_LAST
);
679 return compile_assign_expression(ctx
, (binary_expression_t
*)expr
, OP_add
);
681 return compile_assign_expression(ctx
, (binary_expression_t
*)expr
, OP_and
);
683 return compile_assign_expression(ctx
, (binary_expression_t
*)expr
, OP_sub
);
685 return compile_assign_expression(ctx
, (binary_expression_t
*)expr
, OP_mul
);
687 return compile_assign_expression(ctx
, (binary_expression_t
*)expr
, OP_div
);
689 return compile_assign_expression(ctx
, (binary_expression_t
*)expr
, OP_mod
);
691 return compile_assign_expression(ctx
, (binary_expression_t
*)expr
, OP_or
);
692 case EXPR_ASSIGNLSHIFT
:
693 return compile_assign_expression(ctx
, (binary_expression_t
*)expr
, OP_lshift
);
694 case EXPR_ASSIGNRSHIFT
:
695 return compile_assign_expression(ctx
, (binary_expression_t
*)expr
, OP_rshift
);
696 case EXPR_ASSIGNRRSHIFT
:
697 return compile_assign_expression(ctx
, (binary_expression_t
*)expr
, OP_rshift2
);
699 return compile_assign_expression(ctx
, (binary_expression_t
*)expr
, OP_xor
);
701 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_and
);
703 return compile_unary_expression(ctx
, (unary_expression_t
*)expr
, OP_bneg
);
705 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_or
);
707 return compile_call_expression(ctx
, (call_expression_t
*)expr
, no_ret
);
709 return compile_comma_expression(ctx
, (binary_expression_t
*)expr
);
711 return compile_conditional_expression(ctx
, (conditional_expression_t
*)expr
);
713 return compile_delete_expression(ctx
, (unary_expression_t
*)expr
);
715 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_div
);
717 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_eq
);
719 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_eq2
);
721 return compile_function_expression(ctx
, (function_expression_t
*)expr
);
723 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_gt
);
725 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_gteq
);
727 return push_instr_bstr(ctx
, OP_ident
, ((identifier_expression_t
*)expr
)->identifier
);
729 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_in
);
730 case EXPR_INSTANCEOF
:
731 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_instanceof
);
733 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_lt
);
735 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_lteq
);
737 return compile_literal(ctx
, ((literal_expression_t
*)expr
)->literal
);
739 return compile_unary_expression(ctx
, (unary_expression_t
*)expr
, OP_neg
);
741 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_lshift
);
743 return compile_member_expression(ctx
, (member_expression_t
*)expr
);
745 return compile_unary_expression(ctx
, (unary_expression_t
*)expr
, OP_minus
);
747 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_mod
);
749 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_mul
);
751 return compile_new_expression(ctx
, (call_expression_t
*)expr
);
753 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_neq
);
755 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_neq2
);
757 return compile_logical_expression(ctx
, (binary_expression_t
*)expr
, OP_jmp_nz
);
759 return compile_unary_expression(ctx
, (unary_expression_t
*)expr
, OP_tonum
);
761 return compile_increment_expression(ctx
, (unary_expression_t
*)expr
, OP_postinc
, -1);
763 return compile_increment_expression(ctx
, (unary_expression_t
*)expr
, OP_postinc
, 1);
765 return compile_increment_expression(ctx
, (unary_expression_t
*)expr
, OP_preinc
, -1);
767 return compile_increment_expression(ctx
, (unary_expression_t
*)expr
, OP_preinc
, 1);
769 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_rshift
);
771 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_rshift2
);
773 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_sub
);
775 return push_instr(ctx
, OP_this
) == -1 ? E_OUTOFMEMORY
: S_OK
;
777 return compile_typeof_expression(ctx
, (unary_expression_t
*)expr
);
779 return compile_unary_expression(ctx
, (unary_expression_t
*)expr
, OP_void
);
781 return compile_binary_expression(ctx
, (binary_expression_t
*)expr
, OP_xor
);
783 assert(expr
->eval
!= compiled_expression_eval
);
784 return compile_interp_fallback(ctx
, expr
);
790 static HRESULT
compile_expression(compiler_ctx_t
*ctx
, expression_t
*expr
)
792 return compile_expression_noret(ctx
, expr
, NULL
);
795 void release_bytecode(bytecode_t
*code
)
799 for(i
=0; i
< code
->bstr_cnt
; i
++)
800 SysFreeString(code
->bstr_pool
[i
]);
802 jsheap_free(&code
->heap
);
803 heap_free(code
->bstr_pool
);
804 heap_free(code
->instrs
);
808 void release_compiler(compiler_ctx_t
*ctx
)
813 HRESULT
compile_subscript(parser_ctx_t
*parser
, expression_t
*expr
, BOOL do_ret
, unsigned *ret_off
)
819 parser
->code
= heap_alloc_zero(sizeof(bytecode_t
));
821 return E_OUTOFMEMORY
;
822 jsheap_init(&parser
->code
->heap
);
825 if(!parser
->compiler
) {
826 parser
->compiler
= heap_alloc_zero(sizeof(compiler_ctx_t
));
827 if(!parser
->compiler
)
828 return E_OUTOFMEMORY
;
830 parser
->compiler
->parser
= parser
;
831 parser
->compiler
->code
= parser
->code
;
834 *ret_off
= parser
->compiler
->code_off
;
835 hres
= compile_expression_noret(parser
->compiler
, expr
, do_ret
? NULL
: &no_ret
);
839 return push_instr(parser
->compiler
, OP_ret
) == -1 ? E_OUTOFMEMORY
: S_OK
;