--- parser3/src/main/compile.y 2009/04/29 03:26:50 1.234 +++ parser3/src/main/compile.y 2009/05/09 10:45:43 1.237 @@ -5,7 +5,7 @@ Copyright (c) 2001-2005 ArtLebedev Group (http://www.artlebedev.com) Author: Alexander Petrosyan (http://design.ru/paf) - $Id: compile.y,v 1.234 2009/04/29 03:26:50 misha Exp $ + $Id: compile.y,v 1.237 2009/05/09 10:45:43 misha Exp $ */ /** @@ -317,7 +317,9 @@ action: get | put | call; get: get_value { $$=$1; /* stack: resulting value */ +#ifdef OPTIMIZE_BYTECODE_GET_ELEMENT if(!replace_top_opcode(*$$, OP::OP_VALUE__GET_ELEMENT, OP::OP_VALUE__GET_ELEMENT__WRITE)) +#endif changetail_or_append(*$$, OP::OP_GET_ELEMENT, false, /*->*/OP::OP_GET_ELEMENT__WRITE, /*or */OP::OP_WRITE_VALUE @@ -342,13 +344,14 @@ name_without_curly_rdive_read: name_with diving_code->count()>=4?4/*OP::OP_VALUE+origin+string+OP::OP_GET_ELEMENTx*/:3/*OP::OP_+origin+string*/); } else { #ifdef OPTIMIZE_BYTECODE_GET_ELEMENT - if(diving_code->count()==4){ // optimisations for simple (but very popular) cases + size_t count=diving_code->count(); + if(count==4){ // optimisations for popular simple cases O(*yyval, (PC.in_call_value) // ^call ? OP::OP_VALUE__GET_ELEMENT_OR_OPERATOR // OP_VALUE+origin+string+OP_GET_ELEMENT -> OP_VALUE__GET_ELEMENT_OR_OPERATOR+origin+string : OP::OP_VALUE__GET_ELEMENT // OP_VALUE+origin+string+OP_GET_ELEMENT -> OP_VALUE__GET_ELEMENT+origin+string ); - P(*$$, *diving_code, 1/*offset==1: skip leading OP_VALUE*/, 2/*limit==2: skip trailing OP_GET_ELEMENT*/); + P(*$$, *diving_code, 1/*offset*/, 2/*limit*/); // copy origin+value } else { O(*yyval, OP::OP_WITH_READ); /* stack: starting context */ P(*$$, *diving_code);