From: Dmitry Stogov Date: Wed, 16 Jan 2019 09:49:28 +0000 (+0300) Subject: Micro-optimization X-Git-Tag: php-7.4.0alpha1~1209 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=44f4370880680c1f6e914c3577900f70a6453e88;p=php Micro-optimization --- diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 86a4718d50..be967847dc 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -379,6 +379,7 @@ static zend_always_inline uintptr_t zend_get_property_offset(zend_class_entry *c zend_property_info *property_info; uint32_t flags; zend_class_entry *scope; + uintptr_t offset; if (cache_slot && EXPECTED(ce == CACHED_PTR_EX(cache_slot))) { *info_ptr = CACHED_PTR_EX(cache_slot + 2); @@ -450,14 +451,18 @@ found: } return ZEND_DYNAMIC_PROPERTY_OFFSET; } - if (cache_slot) { - CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, (void*)(uintptr_t)property_info->offset); - CACHE_PTR_EX(cache_slot + 2, property_info->type ? property_info : NULL); - } - if (property_info->type) { + + offset = property_info->offset; + if (EXPECTED(!property_info->type)) { + property_info = NULL; + } else { *info_ptr = property_info; } - return property_info->offset; + if (cache_slot) { + CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, (void*)(uintptr_t)offset); + CACHE_PTR_EX(cache_slot + 2, property_info); + } + return offset; } /* }}} */