diff options
author | Dmitry Stogov <dmitry@zend.com> | 2016-04-27 00:24:20 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2016-04-27 00:24:20 +0300 |
commit | e88c71d3560d06a3d5a330b8572dd2aa83ecc5b6 (patch) | |
tree | bcc5e422a488981040c5a97391d0750d4db0c10d /Zend/zend_objects.c | |
parent | 4da3eb8f1306f29b0bc51c1a7c19f92ffe39d895 (diff) | |
download | php-git-e88c71d3560d06a3d5a330b8572dd2aa83ecc5b6.tar.gz |
Optimize property guards for the most usual case with only one acive guard.
Diffstat (limited to 'Zend/zend_objects.c')
-rw-r--r-- | Zend/zend_objects.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index 793d1ac4c3..0f052335db 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -46,7 +46,6 @@ ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce) } if (UNEXPECTED(ce->ce_flags & ZEND_ACC_USE_GUARDS)) { GC_FLAGS(object) |= IS_OBJ_USE_GUARDS; - Z_PTR_P(p) = NULL; ZVAL_UNDEF(p); } } @@ -71,11 +70,17 @@ ZEND_API void zend_object_std_dtor(zend_object *object) } while (p != end); } if (UNEXPECTED(GC_FLAGS(object) & IS_OBJ_HAS_GUARDS)) { - HashTable *guards = Z_PTR_P(p); + if (EXPECTED(Z_TYPE_P(p) == IS_STRING)) { + zend_string_release(Z_STR_P(p)); + } else { + HashTable *guards; - ZEND_ASSERT(guards != NULL); - zend_hash_destroy(guards); - FREE_HASHTABLE(guards); + ZEND_ASSERT(Z_TYPE_P(p) == IS_ARRAY); + guards = Z_ARRVAL_P(p); + ZEND_ASSERT(guards != NULL); + zend_hash_destroy(guards); + FREE_HASHTABLE(guards); + } } } |