diff options
author | Robert Fancsik <frobert@inf.u-szeged.hu> | 2018-12-06 14:31:30 +0100 |
---|---|---|
committer | Zoltan Herczeg <zherczeg.u-szeged@partner.samsung.com> | 2018-12-06 14:31:30 +0100 |
commit | 79b2df124e78307bdcb97d8b4209413ddd603165 (patch) | |
tree | dadc20e6743a19ae7a57091c3bb19d8458063731 | |
parent | 3f9dd0f1f9b1500082ca026aa7d69e3b59eb7c7b (diff) |
Separate VM_OC_PROP_GET to a single operation in vm_loop (#2607)
VM_OC_PROP_GET is the general vm instruction for getting an object's property.
This opcode can be mutated into several other opcodes depending on the context (pre- post increment, ident reference).
Since these mutated opcodes perform additional checks and VM_OC_PROP_GET is a highly frequent instruction and it is worth to introduce a special case for it.
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
-rw-r--r-- | jerry-core/vm/vm.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/jerry-core/vm/vm.c b/jerry-core/vm/vm.c index 7c2cc821..9697bc25 100644 --- a/jerry-core/vm/vm.c +++ b/jerry-core/vm/vm.c @@ -1636,6 +1636,18 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ } continue; } + case VM_OC_PROP_GET: + { + result = vm_op_get_value (left_value, right_value); + + if (ECMA_IS_VALUE_ERROR (result)) + { + goto error; + } + + *stack_top_p++ = result; + goto free_both_values; + } case VM_OC_PROP_REFERENCE: { /* Forms with reference requires preserving the base and offset. */ @@ -1660,7 +1672,6 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ } /* FALLTHRU */ } - case VM_OC_PROP_GET: case VM_OC_PROP_PRE_INCR: case VM_OC_PROP_PRE_DECR: case VM_OC_PROP_POST_INCR: @@ -1669,23 +1680,16 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ result = vm_op_get_value (left_value, right_value); - if (ECMA_IS_VALUE_ERROR (result)) - { - if (opcode >= CBC_PUSH_PROP_REFERENCE && opcode < CBC_PRE_INCR) - { - left_value = ECMA_VALUE_UNDEFINED; - right_value = ECMA_VALUE_UNDEFINED; - } - goto error; - } - if (opcode < CBC_PRE_INCR) { - if (opcode >= CBC_PUSH_PROP_REFERENCE) + left_value = ECMA_VALUE_UNDEFINED; + right_value = ECMA_VALUE_UNDEFINED; + + if (ECMA_IS_VALUE_ERROR (result)) { - left_value = ECMA_VALUE_UNDEFINED; - right_value = ECMA_VALUE_UNDEFINED; + goto error; } + break; } |