From 9a203c580e1902393a63e44fbc3c5531e97b2515 Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Tue, 26 Aug 2014 12:17:21 +0400 Subject: [PATCH] Implementing 'this' opcode handler. --- src/libcoreint/opcodes.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/libcoreint/opcodes.c b/src/libcoreint/opcodes.c index d32f382da..27632bf30 100644 --- a/src/libcoreint/opcodes.c +++ b/src/libcoreint/opcodes.c @@ -127,7 +127,6 @@ free_string_literal_copy (string_literal_copy *str_lit_descr_p) /**< string lite op (prop_get_decl) \ op (prop_set_decl) \ op (obj_decl) \ - op (this) \ op (delete) \ op (typeof) \ op (with) \ @@ -1068,6 +1067,30 @@ opfunc_logical_and (opcode_t opdata, /**< operation data */ return ret_value; } /* opfunc_logical_and */ +/** + * 'This' opcode handler. + * + * See also: ECMA-262 v5, 11.1.1 + * + * @return completion value + * Returned value must be freed with ecma_free_completion_value + */ +ecma_completion_value_t +opfunc_this (opcode_t opdata, /**< operation data */ + int_data_t *int_data) /**< interpreter context */ +{ + const idx_t dst_var_idx = opdata.data.this.lhs; + + int_data->pos++; + + ecma_completion_value_t ret_value; + + ret_value = set_variable_value (int_data, + dst_var_idx, + int_data->this_binding); + + return ret_value; +} /* opfunc_this */ #define GETOP_DEF_1(a, name, field1) \ inline opcode_t getop_##name (idx_t arg1) \