svn: /php/php-src/trunk/Zend/ zend_execute.c
| From: | Dmitry Stogov | Date: | Tue, 10 Aug 2010 14:43:17 +0000 |
| Subject: | svn: /php/php-src/trunk/Zend/ zend_execute.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-63258@lists.php.net to get a copy of this message | ||
dmitry Tue, 10 Aug 2010 14:43:17 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=302074
Log:
Optimization
Changed paths:
U php/php-src/trunk/Zend/zend_execute.c
Modified: php/php-src/trunk/Zend/zend_execute.c
===================================================================
--- php/php-src/trunk/Zend/zend_execute.c 2010-08-10 13:51:41 UTC (rev 302073)
+++ php/php-src/trunk/Zend/zend_execute.c 2010-08-10 14:43:17 UTC (rev 302074)
@@ -819,7 +819,6 @@
static inline zval* zend_assign_tmp_to_variable(zval **variable_ptr_ptr, zval *value TSRMLS_DC)
{
zval *variable_ptr = *variable_ptr_ptr;
- zval garbage;
if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
@@ -828,12 +827,12 @@
}
if (EXPECTED(!PZVAL_IS_REF(variable_ptr))) {
- if (Z_DELREF_P(variable_ptr)==0) {
- ZVAL_COPY_VALUE(&garbage, variable_ptr);
- INIT_PZVAL_COPY(variable_ptr, value);
- zendi_zval_dtor(garbage);
+ if (Z_REFCOUNT_P(variable_ptr)==1) {
+ zendi_zval_dtor(*variable_ptr);
+ ZVAL_COPY_VALUE(variable_ptr, value);
return variable_ptr;
} else { /* we need to split */
+ Z_DELREF_P(variable_ptr);
GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr);
ALLOC_ZVAL(variable_ptr);
INIT_PZVAL_COPY(variable_ptr, value);
@@ -841,11 +840,8 @@
return variable_ptr;
}
} else {
- if (EXPECTED(variable_ptr != value)) {
- ZVAL_COPY_VALUE(&garbage, variable_ptr);
- ZVAL_COPY_VALUE(variable_ptr, value);
- zendi_zval_dtor(garbage);
- }
+ zendi_zval_dtor(*variable_ptr);
+ ZVAL_COPY_VALUE(variable_ptr, value);
return variable_ptr;
}
}
@@ -863,17 +859,17 @@
}
if (EXPECTED(!PZVAL_IS_REF(variable_ptr))) {
- if (Z_DELREF_P(variable_ptr)==0) {
+ if (Z_REFCOUNT_P(variable_ptr)==1) {
if (variable_ptr==value) {
- Z_ADDREF_P(variable_ptr);
return variable_ptr;
} else if (PZVAL_IS_REF(value)) {
ZVAL_COPY_VALUE(&garbage, variable_ptr);
- INIT_PZVAL_COPY(variable_ptr, value);
+ ZVAL_COPY_VALUE(variable_ptr, value);
zval_copy_ctor(variable_ptr);
zendi_zval_dtor(garbage);
return variable_ptr;
} else {
+ Z_DELREF_P(variable_ptr);
Z_ADDREF_P(value);
*variable_ptr_ptr = value;
if (variable_ptr != &EG(uninitialized_zval)) {
@@ -884,6 +880,7 @@
return value;
}
} else { /* we need to split */
+ Z_DELREF_P(variable_ptr);
GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr);
if (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) {
ALLOC_ZVAL(variable_ptr);