diff --git a/jerry-core/parser/js/opcodes-dumper.cpp b/jerry-core/parser/js/opcodes-dumper.cpp index b6cef8dda..2308247e0 100644 --- a/jerry-core/parser/js/opcodes-dumper.cpp +++ b/jerry-core/parser/js/opcodes-dumper.cpp @@ -325,8 +325,6 @@ dumper_try_replace_identifier_name_with_reg (scopes_tree tree, /**< a function s #define VM_OP_3(opcode_name, opcode_name_uppercase, arg1, arg1_type, arg2, arg2_type, arg3, arg3_type) \ if (opcode == VM_OP_ ## opcode_name_uppercase) \ { \ - JERRY_STATIC_ASSERT (((arg1_type) & VM_OP_ARG_TYPE_TYPE_OF_NEXT) == 0); \ - \ /* * See also: * The loop below @@ -334,6 +332,8 @@ dumper_try_replace_identifier_name_with_reg (scopes_tree tree, /**< a function s \ JERRY_ASSERT ((opcode == VM_OP_ASSIGNMENT && (arg2_type) == VM_OP_ARG_TYPE_TYPE_OF_NEXT) \ || (opcode != VM_OP_ASSIGNMENT && ((arg2_type) & VM_OP_ARG_TYPE_TYPE_OF_NEXT) == 0)); \ + JERRY_ASSERT ((opcode == VM_OP_META && ((arg1_type) & VM_OP_ARG_TYPE_TYPE_OF_NEXT) != 0) \ + || (opcode != VM_OP_META && ((arg1_type) & VM_OP_ARG_TYPE_TYPE_OF_NEXT) == 0)); \ JERRY_STATIC_ASSERT (((arg3_type) & VM_OP_ARG_TYPE_TYPE_OF_NEXT) == 0); \ args_num = 3; \ } @@ -343,7 +343,8 @@ dumper_try_replace_identifier_name_with_reg (scopes_tree tree, /**< a function s for (int arg_index = 0; arg_index < args_num; arg_index++) { /* - * This is the only opcode with statically unspecified argument type (checked by assertions above) + * 'assignment' and 'meta' are the only opcodes with statically unspecified argument type + * (checked by assertions above) */ if (opcode == VM_OP_ASSIGNMENT && arg_index == 1 @@ -352,6 +353,15 @@ dumper_try_replace_identifier_name_with_reg (scopes_tree tree, /**< a function s break; } + if (opcode == VM_OP_META + && (om.op.data.meta.type == OPCODE_META_TYPE_VARG_PROP_DATA + || om.op.data.meta.type == OPCODE_META_TYPE_VARG_PROP_GETTER + || om.op.data.meta.type == OPCODE_META_TYPE_VARG_PROP_SETTER) + && arg_index == 1) + { + continue; + } + if (om.lit_id[arg_index].packed_value == lit_cp.packed_value) { om.lit_id[arg_index] = NOT_A_LITERAL; diff --git a/jerry-core/vm/vm-opcodes.inc.h b/jerry-core/vm/vm-opcodes.inc.h index e1fe4f9da..149eb4e3d 100644 --- a/jerry-core/vm/vm-opcodes.inc.h +++ b/jerry-core/vm/vm-opcodes.inc.h @@ -298,7 +298,8 @@ VM_OP_3 (reg_var_decl, REG_VAR_DECL, arg_regs_num, VM_OP_ARG_TYPE_INTEGER_CONST) VM_OP_3 (meta, META, - type, VM_OP_ARG_TYPE_INTEGER_CONST, + type, VM_OP_ARG_TYPE_INTEGER_CONST | + VM_OP_ARG_TYPE_TYPE_OF_NEXT, data_1, VM_OP_ARG_TYPE_INTEGER_CONST | VM_OP_ARG_TYPE_STRING | VM_OP_ARG_TYPE_VARIABLE, diff --git a/tests/jerry/regression-test-issue-703.js b/tests/jerry/regression-test-issue-703.js new file mode 100644 index 000000000..db474383d --- /dev/null +++ b/tests/jerry/regression-test-issue-703.js @@ -0,0 +1,26 @@ +// Copyright 2015 Samsung Electronics Co., Ltd. +// Copyright 2015 University of Szeged. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +function f(a, b) { + return { + a: a, + b: b + }; +} + +var o = f('1', '2'); + +assert(o.a == '1'); +assert(o.b == '2');