--- parser3/src/main/compile.y 2009/05/19 13:33:14 1.239 +++ parser3/src/main/compile.y 2009/05/20 13:22:59 1.241 @@ -5,7 +5,7 @@ Copyright (c) 2001-2009 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.y,v 1.239 2009/05/19 13:33:14 misha Exp $ + $Id: compile.y,v 1.241 2009/05/20 13:22:59 misha Exp $ */ /** @@ -324,11 +324,7 @@ get: get_value { #endif { size_t count=code->count(); -#ifdef OPTIMIZE_BYTECODE_USE_TWO_OPERANDS_INSTRUCTIONS size_t len=6; -#else - size_t len=7; -#endif #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT if( @@ -379,23 +375,15 @@ name_without_curly_rdive_read: name_with #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_ELEMENT - else if( - count==8 - && append_2ops_opcode(*yyval, *diving_code, OP::OP_GET_OBJECT_ELEMENT, 5/*offset to next [OP_VALUE+]origin+value*/) - ){ + else if(maybe_make_get_object_element(*$$, *diving_code, count)){ // optimisation for $object.field + ^object.method[ - // OP_VALUE+origin+value+OP_GET_ELEMENT+OP_VALUE+origin+value+OP_GET_ELEMENT => OP_GET_OBJECT_ELEMENT+origin+value+[OP_VALUE]+origin+value+OP_GET_ELEMENT } #endif #ifdef OPTIMIZE_BYTECODE_GET_OBJECT_VAR_ELEMENT - else if( - count==10 - && append_2ops_opcode(*yyval, *diving_code, OP::OP_GET_OBJECT_VAR_ELEMENT, 6/*offset to next [OP_VALUE+]origin+value*/) - ){ + else if(maybe_make_get_object_var_element(*$$, *diving_code, count)){ // optimisation for $object.$var - // OP_VALUE+origin+value+OP_GET_ELEMENT+OP_WITH_READ+OP_VALUE+origin+value+OP_GET_ELEMENT+OP_GET_ELEMENT => OP_GET_OBJECT_VAR_ELEMENT+origin+value+[OP_VALUE]+origin+value+OP_GET_ELEMENT } #endif @@ -431,8 +419,16 @@ name_without_curly_rdive_code: name_adva /* put */ put: '$' name_expr_wdive construct { - $$=$2; /* stack: context,name */ - P(*$$, *$3); /* stack: context,name,constructor_value */ + $$=N(); +#ifdef OPTIMIZE_BYTECODE_CONSTRUCT + if(maybe_make_root_or_write_construct(*$$, *$2, *$3)){ + // $a(1) or $.b(2) or $c[d] or $.e[f] + } else +#endif + { + P(*$$, *$2); /* stack: context,name */ + P(*$$, *$3); /* stack: context,name,constructor_value */ + } }; name_expr_wdive: name_expr_wdive_root