diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2016-04-14 16:07:28 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2016-04-14 16:07:28 +0300 |
| commit | b73517c1a1a30fb64f0f8f291db3c3a5f312caba (patch) | |
| tree | 569494e15840812bd0e159bdbeae7ab195c4f186 /Zend/zend_compile.c | |
| parent | 9d76e012cf25c2f6173419fc281c6f756a035371 (diff) | |
| download | php-git-b73517c1a1a30fb64f0f8f291db3c3a5f312caba.tar.gz | |
Use DO_FCALL_BY_NAME instead of DO_FCALL, if possible
Diffstat (limited to 'Zend/zend_compile.c')
| -rw-r--r-- | Zend/zend_compile.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index da2c83c55e..c6234f1088 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3132,26 +3132,30 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc) /* {{{ */ } /* }}} */ -ZEND_API zend_uchar zend_get_call_op(zend_uchar init_op, zend_function *fbc) /* {{{ */ +ZEND_API zend_uchar zend_get_call_op(const zend_op *init_op, zend_function *fbc) /* {{{ */ { - if (fbc) { + if (fbc && init_op->opcode == ZEND_INIT_FCALL) { if (fbc->type == ZEND_INTERNAL_FUNCTION) { - if (!zend_execute_internal && - !fbc->common.scope && - !(fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED|ZEND_ACC_HAS_TYPE_HINTS|ZEND_ACC_RETURN_REFERENCE))) { - return ZEND_DO_ICALL; + if (!zend_execute_internal) { + if (!(fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED|ZEND_ACC_HAS_TYPE_HINTS|ZEND_ACC_RETURN_REFERENCE))) { + return ZEND_DO_ICALL; + } else { + return ZEND_DO_FCALL_BY_NAME; + } } } else { - if (zend_execute_ex == execute_ex && - !fbc->common.scope && - !(fbc->common.fn_flags & ZEND_ACC_GENERATOR)) { - return ZEND_DO_UCALL; + if (zend_execute_ex == execute_ex) { + if (!(fbc->common.fn_flags & ZEND_ACC_GENERATOR)) { + return ZEND_DO_UCALL; + } else { + return ZEND_DO_FCALL_BY_NAME; + } } } } else if (zend_execute_ex == execute_ex && !zend_execute_internal && - (init_op == ZEND_INIT_FCALL_BY_NAME || - init_op == ZEND_INIT_NS_FCALL_BY_NAME)) { + (init_op->opcode == ZEND_INIT_FCALL_BY_NAME || + init_op->opcode == ZEND_INIT_NS_FCALL_BY_NAME)) { return ZEND_DO_FCALL_BY_NAME; } return ZEND_DO_FCALL; @@ -3177,7 +3181,7 @@ void zend_compile_call_common(znode *result, zend_ast *args_ast, zend_function * } call_flags = (opline->opcode == ZEND_NEW ? ZEND_CALL_CTOR : 0); - opline = zend_emit_op(result, zend_get_call_op(opline->opcode, fbc), NULL, NULL); + opline = zend_emit_op(result, zend_get_call_op(opline, fbc), NULL, NULL); opline->op1.num = call_flags; zend_do_extended_fcall_end(); |
