zend_isset_isempty_dim_prop_obj_handler() split into separate handlers. (Actually, it shared near nothing)

This commit is contained in:
Dmitry Stogov 2014-04-22 00:32:29 +04:00
parent 9610977d10
commit ff6dc3e1f2
2 changed files with 466 additions and 286 deletions

View File

@ -1824,6 +1824,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
HANDLE_EXCEPTION_LEAVE();
}
LOAD_OPLINE();
ZEND_VM_INC_OPCODE();
ZEND_VM_LEAVE();
} else if (frame_kind == VM_FRAME_NESTED_CODE) {
@ -1843,6 +1844,7 @@ ZEND_VM_HELPER(zend_leave_helper, ANY, ANY)
HANDLE_EXCEPTION_LEAVE();
}
LOAD_OPLINE();
ZEND_VM_INC_OPCODE();
ZEND_VM_LEAVE();
} else {
@ -4530,7 +4532,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|TMP|VAR|CV, int prop_dim)
ZEND_VM_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
USE_OPLINE
zend_free_op free_op1, free_op2;
@ -4543,7 +4545,7 @@ ZEND_VM_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, VAR|UNUSED|CV, CONST|
container = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_IS);
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (Z_TYPE_P(container) == IS_ARRAY && !prop_dim) {
if (Z_TYPE_P(container) == IS_ARRAY) {
HashTable *ht = Z_ARRVAL_P(container);
zval *value = NULL;
zend_string *str;
@ -4588,25 +4590,16 @@ ZEND_VM_C_LABEL(str_index_prop):
result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
}
} else if (Z_TYPE_P(container) == IS_OBJECT) {
if (prop_dim) {
if (Z_OBJ_HT_P(container)->has_property) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
}
if (Z_OBJ_HT_P(container)->has_dimension) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
if (Z_OBJ_HT_P(container)->has_dimension) {
result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check element of non-array");
result = 0;
}
zend_error(E_NOTICE, "Trying to check element of non-array");
result = 0;
}
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
} else if (Z_TYPE_P(container) == IS_STRING && !prop_dim) { /* string offsets */
} else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
zval tmp;
result = 0;
@ -4641,14 +4634,37 @@ ZEND_VM_C_LABEL(str_index_prop):
ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HANDLER(115, ZEND_ISSET_ISEMPTY_DIM_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, prop_dim, 0);
}
ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
ZEND_VM_DISPATCH_TO_HELPER_EX(zend_isset_isempty_dim_prop_obj_handler, prop_dim, 1);
USE_OPLINE
zend_free_op free_op1, free_op2;
zval *container;
int result;
zval *offset;
SAVE_OPLINE();
container = GET_OP1_OBJ_ZVAL_PTR_DEREF(BP_VAR_IS);
offset = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (Z_TYPE_P(container) == IS_OBJECT) {
if (Z_OBJ_HT_P(container)->has_property) {
result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((OP2_TYPE == IS_CONST) ? Z_CACHE_SLOT_P(offset) : -1) TSRMLS_CC);
} else {
zend_error(E_NOTICE, "Trying to check property of non-object");
result = 0;
}
if ((opline->extended_value & ZEND_ISSET) == 0) {
result = !result;
}
} else {
result = ((opline->extended_value & ZEND_ISSET) == 0);
}
FREE_OP2();
ZVAL_BOOL(EX_VAR(opline->result.var), result);
FREE_OP1_IF_VAR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY)

File diff suppressed because it is too large Load Diff