Saving the latter checking in most cases

This commit is contained in:
Xinchen Hui 2015-05-04 19:21:54 +08:00
parent fff921d7a3
commit 7af9ba23a7
2 changed files with 6 additions and 8 deletions

View file

@ -5191,7 +5191,6 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
{ {
USE_OPLINE USE_OPLINE
zend_function *op_array; zend_function *op_array;
int closure_is_static, closure_is_being_defined_inside_static_context;
SAVE_OPLINE(); SAVE_OPLINE();
@ -5200,9 +5199,9 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); zend_error_noreturn(E_ERROR, "Base lambda function for closure not found");
} }
closure_is_static = op_array->common.fn_flags & ZEND_ACC_STATIC; if (UNEXPECTED((op_array->common.fn_flags & ZEND_ACC_STATIC) ||
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC; (EX(prev_execute_data) &&
if (closure_is_static || closure_is_being_defined_inside_static_context) { EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC))) {
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(called_scope), NULL TSRMLS_CC); zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(called_scope), NULL TSRMLS_CC);
} else { } else {
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC); zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC);

View file

@ -6494,7 +6494,6 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
{ {
USE_OPLINE USE_OPLINE
zend_function *op_array; zend_function *op_array;
int closure_is_static, closure_is_being_defined_inside_static_context;
SAVE_OPLINE(); SAVE_OPLINE();
@ -6503,9 +6502,9 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); zend_error_noreturn(E_ERROR, "Base lambda function for closure not found");
} }
closure_is_static = op_array->common.fn_flags & ZEND_ACC_STATIC; if (UNEXPECTED((op_array->common.fn_flags & ZEND_ACC_STATIC) ||
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC; (EX(prev_execute_data) &&
if (closure_is_static || closure_is_being_defined_inside_static_context) { EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC))) {
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(called_scope), NULL TSRMLS_CC); zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(called_scope), NULL TSRMLS_CC);
} else { } else {
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC); zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC);