summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-04-21 13:19:52 +0400
committerDmitry Stogov <dmitry@zend.com>2014-04-21 13:19:52 +0400
commite9f4d822b0c794cceaf71b68b37977bb3b6212a3 (patch)
tree48c6fcf7e2be12639dbf0ac2212643ce9b883fa6
parent54d9ad53f4797733b41bf2c65bd2c2cb5a1938b6 (diff)
downloadphp-git-e9f4d822b0c794cceaf71b68b37977bb3b6212a3.tar.gz
Avoid useles copy ctor
-rw-r--r--Zend/zend_vm_def.h11
-rw-r--r--Zend/zend_vm_execute.h44
2 files changed, 30 insertions, 25 deletions
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index e3b58bcea8..81f000dc6e 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -2863,13 +2863,14 @@ ZEND_VM_HANDLER(108, ZEND_THROW, CONST|TMP|VAR|CV, ANY)
}
zend_exception_save(TSRMLS_C);
- /* Not sure if a complete copy is what we want here */
- ZVAL_COPY_VALUE(&exception, value);
- if (!IS_OP1_TMP_FREE()) {
- zval_opt_copy_ctor(&exception);
+ if (OP1_TYPE == IS_CONST) {
+ ZVAL_DUP(&exception, value);
+ value = &exception;
+ } else if (OP1_TYPE != IS_TMP_VAR) {
+ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- zend_throw_exception_object(&exception TSRMLS_CC);
+ zend_throw_exception_object(value TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
FREE_OP1_IF_VAR();
HANDLE_EXCEPTION();
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 482ea3109d..29a9821bf5 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -2638,13 +2638,14 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
}
zend_exception_save(TSRMLS_C);
- /* Not sure if a complete copy is what we want here */
- ZVAL_COPY_VALUE(&exception, value);
- if (!0) {
- zval_opt_copy_ctor(&exception);
+ if (IS_CONST == IS_CONST) {
+ ZVAL_DUP(&exception, value);
+ value = &exception;
+ } else if (IS_CONST != IS_TMP_VAR) {
+ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- zend_throw_exception_object(&exception TSRMLS_CC);
+ zend_throw_exception_object(value TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
HANDLE_EXCEPTION();
@@ -7585,13 +7586,14 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
zend_exception_save(TSRMLS_C);
- /* Not sure if a complete copy is what we want here */
- ZVAL_COPY_VALUE(&exception, value);
- if (!1) {
- zval_opt_copy_ctor(&exception);
+ if (IS_TMP_VAR == IS_CONST) {
+ ZVAL_DUP(&exception, value);
+ value = &exception;
+ } else if (IS_TMP_VAR != IS_TMP_VAR) {
+ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- zend_throw_exception_object(&exception TSRMLS_CC);
+ zend_throw_exception_object(value TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
HANDLE_EXCEPTION();
@@ -12454,13 +12456,14 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
zend_exception_save(TSRMLS_C);
- /* Not sure if a complete copy is what we want here */
- ZVAL_COPY_VALUE(&exception, value);
- if (!0) {
- zval_opt_copy_ctor(&exception);
+ if (IS_VAR == IS_CONST) {
+ ZVAL_DUP(&exception, value);
+ value = &exception;
+ } else if (IS_VAR != IS_TMP_VAR) {
+ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- zend_throw_exception_object(&exception TSRMLS_CC);
+ zend_throw_exception_object(value TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
zval_ptr_dtor_nogc(free_op1.var);
HANDLE_EXCEPTION();
@@ -28986,13 +28989,14 @@ static int ZEND_FASTCALL ZEND_THROW_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
zend_exception_save(TSRMLS_C);
- /* Not sure if a complete copy is what we want here */
- ZVAL_COPY_VALUE(&exception, value);
- if (!0) {
- zval_opt_copy_ctor(&exception);
+ if (IS_CV == IS_CONST) {
+ ZVAL_DUP(&exception, value);
+ value = &exception;
+ } else if (IS_CV != IS_TMP_VAR) {
+ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
}
- zend_throw_exception_object(&exception TSRMLS_CC);
+ zend_throw_exception_object(value TSRMLS_CC);
zend_exception_restore(TSRMLS_C);
HANDLE_EXCEPTION();