Permalink
Browse files

- Avoid zend_do_ticks() call for each statement in parsing

  • Loading branch information...
1 parent 8d52500 commit 80d432ca6281175dc01991b0c0ab6c98968a8790 @felipensp felipensp committed Jun 12, 2011
Showing with 9 additions and 10 deletions.
  1. +5 −7 Zend/zend_compile.c
  2. +1 −0 Zend/zend_compile.h
  3. +3 −3 Zend/zend_language_parser.y
View
12 Zend/zend_compile.c
@@ -6170,14 +6170,12 @@ void zend_do_extended_fcall_end(TSRMLS_D) /* {{{ */
void zend_do_ticks(TSRMLS_D) /* {{{ */
{
- if (Z_LVAL(CG(declarables).ticks)) {
- zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
+ zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- opline->opcode = ZEND_TICKS;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- opline->extended_value = Z_LVAL(CG(declarables).ticks);
- }
+ opline->opcode = ZEND_TICKS;
+ SET_UNUSED(opline->op1);
+ SET_UNUSED(opline->op2);
+ opline->extended_value = Z_LVAL(CG(declarables).ticks);
}
/* }}} */
View
1 Zend/zend_compile.h
@@ -39,6 +39,7 @@
#define INC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count++); }
#define DEC_BPC(op_array) if (op_array->fn_flags & ZEND_ACC_INTERACTIVE) { (CG(context).backpatch_count--); }
#define HANDLE_INTERACTIVE() if (CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) { execute_new_code(TSRMLS_C); }
+#define DO_TICKS() if (Z_LVAL(CG(declarables).ticks)) { zend_do_ticks(TSRMLS_C); }
#define RESET_DOC_COMMENT() \
{ \
View
6 Zend/zend_language_parser.y
@@ -213,7 +213,7 @@ inner_statement:
statement:
- unticked_statement { zend_do_ticks(TSRMLS_C); }
+ unticked_statement { DO_TICKS(); }
| T_STRING ':' { zend_do_label(&$1 TSRMLS_CC); }
;
@@ -293,11 +293,11 @@ unset_variable:
;
function_declaration_statement:
- unticked_function_declaration_statement { zend_do_ticks(TSRMLS_C); }
+ unticked_function_declaration_statement { DO_TICKS(); }
;
class_declaration_statement:
- unticked_class_declaration_statement { zend_do_ticks(TSRMLS_C); }
+ unticked_class_declaration_statement { DO_TICKS(); }
;

0 comments on commit 80d432c

Please sign in to comment.