com php-src: Optimized is_a: Zend/zend_builtin_functi ons.c
| From: | Xinchen Hui | Date: | Mon, 19 Jan 2015 14:10:01 +0000 |
| Subject: | com php-src: Optimized is_a: Zend/zend_builtin_functi ons.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84180@lists.php.net to get a copy of this message | ||
Commit: 442efdaaea3c1a06b01aa5f52c2ec05c3d64a0d1
Author: Xinchen Hui <laruence@php.net> Mon, 19 Jan 2015 09:10:01 -0500
Parents: d917484ab7678930bc6867caabed04ecec0baafc
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=442efdaaea3c1a06b01aa5f52c2ec05c3d64a0d1
Log:
Optimized is_a
Changed paths:
M Zend/zend_builtin_functions.c
Diff:
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index f13a2da..161bfb2 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -1014,14 +1014,18 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
/*
RETURN_FALSE;
}
- ce = zend_lookup_class_ex(class_name, NULL, 0);
- if (!ce) {
- retval = 0;
+ if (!only_subclass && EXPECTED(zend_string_equals(instance_ce->name, class_name))) {
+ retval = 1;
} else {
- if (only_subclass && instance_ce == ce) {
+ ce = zend_lookup_class_ex(class_name, NULL, 0);
+ if (!ce) {
retval = 0;
- } else {
- retval = instanceof_function(instance_ce, ce);
+ } else {
+ if (only_subclass && instance_ce == ce) {
+ retval = 0;
+ } else {
+ retval = instanceof_function(instance_ce, ce);
+ }
}
}