summaryrefslogtreecommitdiff
path: root/Zend/zend_object_handlers.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-10-25 10:45:42 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-10-25 10:51:17 +0200
commitc858d17f06179aa25f6e8aa06965313fd519d8e9 (patch)
treede199c2dada0099a344ff595cf024958f98caa5b /Zend/zend_object_handlers.c
parentbd7b1afd6eb623a4905673dfc92bb0de62f23edd (diff)
downloadphp-git-c858d17f06179aa25f6e8aa06965313fd519d8e9.tar.gz
Optimize instanceof_function
Split out the simple equality check into an inline function -- this is one of the common cases. Replace instanceof_function_ex with zend_class_implements_interface. There are a few more places where it may be used.
Diffstat (limited to 'Zend/zend_object_handlers.c')
-rw-r--r--Zend/zend_object_handlers.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index 3df9160180..c5fd87eb97 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -898,7 +898,7 @@ ZEND_API zval *zend_std_read_dimension(zend_object *object, zval *offset, int ty
zend_class_entry *ce = object->ce;
zval tmp_offset;
- if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
+ if (EXPECTED(zend_class_implements_interface(ce, zend_ce_arrayaccess) != 0)) {
if (offset == NULL) {
/* [] construct */
ZVAL_NULL(&tmp_offset);
@@ -947,7 +947,7 @@ ZEND_API void zend_std_write_dimension(zend_object *object, zval *offset, zval *
zend_class_entry *ce = object->ce;
zval tmp_offset;
- if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
+ if (EXPECTED(zend_class_implements_interface(ce, zend_ce_arrayaccess) != 0)) {
if (!offset) {
ZVAL_NULL(&tmp_offset);
} else {
@@ -969,7 +969,7 @@ ZEND_API int zend_std_has_dimension(zend_object *object, zval *offset, int check
zval retval, tmp_offset;
int result;
- if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1) != 0)) {
+ if (EXPECTED(zend_class_implements_interface(ce, zend_ce_arrayaccess) != 0)) {
ZVAL_COPY_DEREF(&tmp_offset, offset);
GC_ADDREF(object);
zend_call_method_with_1_params(object, ce, NULL, "offsetexists", &retval, &tmp_offset);
@@ -1112,7 +1112,7 @@ ZEND_API void zend_std_unset_dimension(zend_object *object, zval *offset) /* {{{
zend_class_entry *ce = object->ce;
zval tmp_offset;
- if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1)) {
+ if (zend_class_implements_interface(ce, zend_ce_arrayaccess)) {
ZVAL_COPY_DEREF(&tmp_offset, offset);
GC_ADDREF(object);
zend_call_method_with_1_params(object, ce, NULL, "offsetunset", NULL, &tmp_offset);