OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/interpreter/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
6 | 6 |
7 #include "src/ast/prettyprinter.h" | 7 #include "src/ast/prettyprinter.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 // CallJSRuntimeWide <context_index> <receiver> <arg_count> | 1159 // CallJSRuntimeWide <context_index> <receiver> <arg_count> |
1160 // | 1160 // |
1161 // Call the JS runtime function that has the |context_index| with the receiver | 1161 // Call the JS runtime function that has the |context_index| with the receiver |
1162 // in register |receiver| and |arg_count| arguments in subsequent registers. | 1162 // in register |receiver| and |arg_count| arguments in subsequent registers. |
1163 void Interpreter::DoCallJSRuntimeWide(InterpreterAssembler* assembler) { | 1163 void Interpreter::DoCallJSRuntimeWide(InterpreterAssembler* assembler) { |
1164 DoCallJSRuntimeCommon(assembler); | 1164 DoCallJSRuntimeCommon(assembler); |
1165 } | 1165 } |
1166 | 1166 |
1167 void Interpreter::DoCallConstruct(InterpreterAssembler* assembler) { | 1167 void Interpreter::DoCallConstruct(InterpreterAssembler* assembler) { |
1168 Callable ic = CodeFactory::InterpreterPushArgsAndConstruct(isolate_); | 1168 Callable ic = CodeFactory::InterpreterPushArgsAndConstruct(isolate_); |
| 1169 Node* new_target = __ GetAccumulator(); |
1169 Node* constructor_reg = __ BytecodeOperandReg(0); | 1170 Node* constructor_reg = __ BytecodeOperandReg(0); |
1170 Node* constructor = __ LoadRegister(constructor_reg); | 1171 Node* constructor = __ LoadRegister(constructor_reg); |
1171 Node* first_arg_reg = __ BytecodeOperandReg(1); | 1172 Node* first_arg_reg = __ BytecodeOperandReg(1); |
1172 Node* first_arg = __ RegisterLocation(first_arg_reg); | 1173 Node* first_arg = __ RegisterLocation(first_arg_reg); |
1173 Node* args_count = __ BytecodeOperandCount(2); | 1174 Node* args_count = __ BytecodeOperandCount(2); |
1174 Node* context = __ GetContext(); | 1175 Node* context = __ GetContext(); |
1175 Node* result = __ CallConstruct(constructor, context, constructor, first_arg, | 1176 Node* result = |
1176 args_count); | 1177 __ CallConstruct(constructor, context, new_target, first_arg, args_count); |
1177 __ SetAccumulator(result); | 1178 __ SetAccumulator(result); |
1178 __ Dispatch(); | 1179 __ Dispatch(); |
1179 } | 1180 } |
1180 | 1181 |
1181 | 1182 |
1182 // New <constructor> <first_arg> <arg_count> | 1183 // New <constructor> <first_arg> <arg_count> |
1183 // | 1184 // |
1184 // Call operator new with |constructor| and the first argument in | 1185 // Call operator new with |constructor| and the first argument in |
1185 // register |first_arg| and |arg_count| arguments in subsequent | 1186 // register |first_arg| and |arg_count| arguments in subsequent |
| 1187 // registers. The new.target is in the accumulator. |
1186 // | 1188 // |
1187 void Interpreter::DoNew(InterpreterAssembler* assembler) { | 1189 void Interpreter::DoNew(InterpreterAssembler* assembler) { |
1188 DoCallConstruct(assembler); | 1190 DoCallConstruct(assembler); |
1189 } | 1191 } |
1190 | 1192 |
1191 | 1193 |
1192 // NewWide <constructor> <first_arg> <arg_count> | 1194 // NewWide <constructor> <first_arg> <arg_count> |
1193 // | 1195 // |
1194 // Call operator new with |constructor| and the first argument in | 1196 // Call operator new with |constructor| and the first argument in |
1195 // register |first_arg| and |arg_count| arguments in subsequent | 1197 // register |first_arg| and |arg_count| arguments in subsequent |
| 1198 // registers. The new.target is in the accumulator. |
1196 // | 1199 // |
1197 void Interpreter::DoNewWide(InterpreterAssembler* assembler) { | 1200 void Interpreter::DoNewWide(InterpreterAssembler* assembler) { |
1198 DoCallConstruct(assembler); | 1201 DoCallConstruct(assembler); |
1199 } | 1202 } |
1200 | 1203 |
1201 | 1204 |
1202 // TestEqual <src> | 1205 // TestEqual <src> |
1203 // | 1206 // |
1204 // Test if the value in the <src> register equals the accumulator. | 1207 // Test if the value in the <src> register equals the accumulator. |
1205 void Interpreter::DoTestEqual(InterpreterAssembler* assembler) { | 1208 void Interpreter::DoTestEqual(InterpreterAssembler* assembler) { |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 Node* index = __ LoadRegister(index_reg); | 1880 Node* index = __ LoadRegister(index_reg); |
1878 Node* context = __ GetContext(); | 1881 Node* context = __ GetContext(); |
1879 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); | 1882 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); |
1880 __ SetAccumulator(result); | 1883 __ SetAccumulator(result); |
1881 __ Dispatch(); | 1884 __ Dispatch(); |
1882 } | 1885 } |
1883 | 1886 |
1884 } // namespace interpreter | 1887 } // namespace interpreter |
1885 } // namespace internal | 1888 } // namespace internal |
1886 } // namespace v8 | 1889 } // namespace v8 |
OLD | NEW |