com php-src: micro-optimization: Zend/zend_API.c Zend/zen d_inheritance.c Zend/zend_object_handlers.c
| From: | Dmitry Stogov | Date: | Wed, 03 Jun 2015 10:43:05 +0000 |
| Subject: | com php-src: micro-optimization: Zend/zend_API.c Zend/zen d_inheritance.c Zend/zend_object_handlers.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87052@lists.php.net to get a copy of this message | ||
Commit: 6bcf121f5b990cbaee6324fb729b52e17a7bd7f2
Author: Dmitry Stogov <dmitry@zend.com> Wed, 3 Jun 2015 13:43:05 +0300
Parents: c09698753e7d1d95299dca54c8ca888c885fd45b
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6bcf121f5b990cbaee6324fb729b52e17a7bd7f2
Log:
micro-optimization
Changed paths:
M Zend/zend_API.c
M Zend/zend_inheritance.c
M Zend/zend_object_handlers.c
Diff:
diff --git a/Zend/zend_API.c b/Zend/zend_API..c
index 757becf..3a83f5f 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -3665,18 +3665,13 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string
*name, z
break;
}
}
- switch (access_type & ZEND_ACC_PPP_MASK) {
- case ZEND_ACC_PRIVATE: {
- property_info->name = zend_mangle_property_name(ce->name->val, ce->name->len,
name->val, name->len, ce->type & ZEND_INTERNAL_CLASS);
- }
- break;
- case ZEND_ACC_PROTECTED: {
- property_info->name = zend_mangle_property_name("*", 1, name->val,
name->len, ce->type & ZEND_INTERNAL_CLASS);
- }
- break;
- case ZEND_ACC_PUBLIC:
- property_info->name = zend_string_copy(name);
- break;
+ if (access_type & ZEND_ACC_PUBLIC) {
+ property_info->name = zend_string_copy(name);
+ } else if (access_type & ZEND_ACC_PRIVATE) {
+ property_info->name = zend_mangle_property_name(ce->name->val, ce->name->len,
name->val, name->len, ce->type & ZEND_INTERNAL_CLASS);
+ } else {
+ ZEND_ASSERT(access_type & ZEND_ACC_PROTECTED);
+ property_info->name = zend_mangle_property_name("*", 1, name->val, name->len,
ce->type & ZEND_INTERNAL_CLASS);
}
property_info->name = zend_new_interned_string(property_info->name);
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index f32c55a..608af74 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -1451,7 +1451,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce) /* {{{ */
* then check whether the property is already there
*/
flags = property_info->flags;
- if ((flags & ZEND_ACC_PPP_MASK) == ZEND_ACC_PUBLIC) {
+ if (flags & ZEND_ACC_PUBLIC) {
prop_name = zend_string_copy(property_info->name);
} else {
const char *pname;
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 0127a9c..259679a 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -265,15 +265,14 @@ static void zend_std_call_issetter(zval *object, zval *member, zval *retval)
/*
static zend_always_inline int zend_verify_property_access(zend_property_info *property_info,
zend_class_entry *ce) /* {{{ */
{
- switch (property_info->flags & ZEND_ACC_PPP_MASK) {
- case ZEND_ACC_PUBLIC:
- return 1;
- case ZEND_ACC_PROTECTED:
- return zend_check_protected(property_info->ce, EG(scope));
- case ZEND_ACC_PRIVATE:
- return (ce == EG(scope) || property_info->ce == EG(scope));
+ if (property_info->flags & ZEND_ACC_PUBLIC) {
+ return 1;
+ } else if (property_info->flags & ZEND_ACC_PRIVATE) {
+ return (ce == EG(scope) || property_info->ce == EG(scope));
+ } else {
+ ZEND_ASSERT(property_info->flags & ZEND_ACC_PROTECTED);
+ return zend_check_protected(property_info->ce, EG(scope));
}
- return 0;
}
/* }}} */