summaryrefslogtreecommitdiff
path: root/Zend/zend_vm_execute.h
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2021-03-01 22:37:37 +0300
committerDmitry Stogov <dmitry@zend.com>2021-03-01 22:37:37 +0300
commit9da66e6ad0f57d7ba71417731ec2586703f4d790 (patch)
tree53b6bbc0615fc2b10ec1099f65fdd3b853a307e5 /Zend/zend_vm_execute.h
parentf9f8c1c79cac1b03279190e0c5513a51881615f9 (diff)
downloadphp-git-9da66e6ad0f57d7ba71417731ec2586703f4d790.tar.gz
Optimized object conversion to array without rebulding properties HashTable
Diffstat (limited to 'Zend/zend_vm_execute.h')
-rw-r--r--Zend/zend_vm_execute.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 26903f9403..385941e595 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -4643,6 +4643,11 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CONST_H
} else {
ZVAL_EMPTY_ARRAY(result);
}
+ } else if (Z_OBJ_P(expr)->properties == NULL
+ && Z_OBJ_HT_P(expr)->get_properties_for == NULL
+ && Z_OBJ_HT_P(expr)->get_properties == zend_std_get_properties) {
+ /* Optimized version without rebulding properties HashTable */
+ ZVAL_ARR(result, zend_std_build_object_properties_array(Z_OBJ_P(expr)));
} else {
HashTable *obj_ht = zend_get_properties_for(expr, ZEND_PROP_PURPOSE_ARRAY_CAST);
if (obj_ht) {
@@ -18859,6 +18864,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPC
} else {
ZVAL_EMPTY_ARRAY(result);
}
+ } else if (Z_OBJ_P(expr)->properties == NULL
+ && Z_OBJ_HT_P(expr)->get_properties_for == NULL
+ && Z_OBJ_HT_P(expr)->get_properties == zend_std_get_properties) {
+ /* Optimized version without rebulding properties HashTable */
+ ZVAL_ARR(result, zend_std_build_object_properties_array(Z_OBJ_P(expr)));
} else {
HashTable *obj_ht = zend_get_properties_for(expr, ZEND_PROP_PURPOSE_ARRAY_CAST);
if (obj_ht) {
@@ -21469,6 +21479,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_VAR_HANDLER(ZEND_OPC
} else {
ZVAL_EMPTY_ARRAY(result);
}
+ } else if (Z_OBJ_P(expr)->properties == NULL
+ && Z_OBJ_HT_P(expr)->get_properties_for == NULL
+ && Z_OBJ_HT_P(expr)->get_properties == zend_std_get_properties) {
+ /* Optimized version without rebulding properties HashTable */
+ ZVAL_ARR(result, zend_std_build_object_properties_array(Z_OBJ_P(expr)));
} else {
HashTable *obj_ht = zend_get_properties_for(expr, ZEND_PROP_PURPOSE_ARRAY_CAST);
if (obj_ht) {
@@ -38144,6 +38159,11 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CV_HANDLER(ZEND_OPCO
} else {
ZVAL_EMPTY_ARRAY(result);
}
+ } else if (Z_OBJ_P(expr)->properties == NULL
+ && Z_OBJ_HT_P(expr)->get_properties_for == NULL
+ && Z_OBJ_HT_P(expr)->get_properties == zend_std_get_properties) {
+ /* Optimized version without rebulding properties HashTable */
+ ZVAL_ARR(result, zend_std_build_object_properties_array(Z_OBJ_P(expr)));
} else {
HashTable *obj_ht = zend_get_properties_for(expr, ZEND_PROP_PURPOSE_ARRAY_CAST);
if (obj_ht) {