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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 // CallJSRuntimeWide <context_index> <receiver> <arg_count> | 1171 // CallJSRuntimeWide <context_index> <receiver> <arg_count> |
1172 // | 1172 // |
1173 // Call the JS runtime function that has the |context_index| with the receiver | 1173 // Call the JS runtime function that has the |context_index| with the receiver |
1174 // in register |receiver| and |arg_count| arguments in subsequent registers. | 1174 // in register |receiver| and |arg_count| arguments in subsequent registers. |
1175 void Interpreter::DoCallJSRuntimeWide(InterpreterAssembler* assembler) { | 1175 void Interpreter::DoCallJSRuntimeWide(InterpreterAssembler* assembler) { |
1176 DoCallJSRuntimeCommon(assembler); | 1176 DoCallJSRuntimeCommon(assembler); |
1177 } | 1177 } |
1178 | 1178 |
1179 void Interpreter::DoCallConstruct(InterpreterAssembler* assembler) { | 1179 void Interpreter::DoCallConstruct(InterpreterAssembler* assembler) { |
1180 Callable ic = CodeFactory::InterpreterPushArgsAndConstruct(isolate_); | 1180 Callable ic = CodeFactory::InterpreterPushArgsAndConstruct(isolate_); |
| 1181 Node* new_target = __ GetAccumulator(); |
1181 Node* constructor_reg = __ BytecodeOperandReg(0); | 1182 Node* constructor_reg = __ BytecodeOperandReg(0); |
1182 Node* constructor = __ LoadRegister(constructor_reg); | 1183 Node* constructor = __ LoadRegister(constructor_reg); |
1183 Node* first_arg_reg = __ BytecodeOperandReg(1); | 1184 Node* first_arg_reg = __ BytecodeOperandReg(1); |
1184 Node* first_arg = __ RegisterLocation(first_arg_reg); | 1185 Node* first_arg = __ RegisterLocation(first_arg_reg); |
1185 Node* args_count = __ BytecodeOperandCount(2); | 1186 Node* args_count = __ BytecodeOperandCount(2); |
1186 Node* context = __ GetContext(); | 1187 Node* context = __ GetContext(); |
1187 Node* result = __ CallConstruct(constructor, context, constructor, first_arg, | 1188 Node* result = |
1188 args_count); | 1189 __ CallConstruct(constructor, context, new_target, first_arg, args_count); |
1189 __ SetAccumulator(result); | 1190 __ SetAccumulator(result); |
1190 __ Dispatch(); | 1191 __ Dispatch(); |
1191 } | 1192 } |
1192 | 1193 |
1193 | 1194 |
1194 // New <constructor> <first_arg> <arg_count> | 1195 // New <constructor> <first_arg> <arg_count> |
1195 // | 1196 // |
1196 // Call operator new with |constructor| and the first argument in | 1197 // Call operator new with |constructor| and the first argument in |
1197 // register |first_arg| and |arg_count| arguments in subsequent | 1198 // register |first_arg| and |arg_count| arguments in subsequent |
| 1199 // registers. The new.target is in the accumulator. |
1198 // | 1200 // |
1199 void Interpreter::DoNew(InterpreterAssembler* assembler) { | 1201 void Interpreter::DoNew(InterpreterAssembler* assembler) { |
1200 DoCallConstruct(assembler); | 1202 DoCallConstruct(assembler); |
1201 } | 1203 } |
1202 | 1204 |
1203 | 1205 |
1204 // NewWide <constructor> <first_arg> <arg_count> | 1206 // NewWide <constructor> <first_arg> <arg_count> |
1205 // | 1207 // |
1206 // Call operator new with |constructor| and the first argument in | 1208 // Call operator new with |constructor| and the first argument in |
1207 // register |first_arg| and |arg_count| arguments in subsequent | 1209 // register |first_arg| and |arg_count| arguments in subsequent |
| 1210 // registers. The new.target is in the accumulator. |
1208 // | 1211 // |
1209 void Interpreter::DoNewWide(InterpreterAssembler* assembler) { | 1212 void Interpreter::DoNewWide(InterpreterAssembler* assembler) { |
1210 DoCallConstruct(assembler); | 1213 DoCallConstruct(assembler); |
1211 } | 1214 } |
1212 | 1215 |
1213 | 1216 |
1214 // TestEqual <src> | 1217 // TestEqual <src> |
1215 // | 1218 // |
1216 // Test if the value in the <src> register equals the accumulator. | 1219 // Test if the value in the <src> register equals the accumulator. |
1217 void Interpreter::DoTestEqual(InterpreterAssembler* assembler) { | 1220 void Interpreter::DoTestEqual(InterpreterAssembler* assembler) { |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 Node* index = __ LoadRegister(index_reg); | 1890 Node* index = __ LoadRegister(index_reg); |
1888 Node* context = __ GetContext(); | 1891 Node* context = __ GetContext(); |
1889 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); | 1892 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); |
1890 __ SetAccumulator(result); | 1893 __ SetAccumulator(result); |
1891 __ Dispatch(); | 1894 __ Dispatch(); |
1892 } | 1895 } |
1893 | 1896 |
1894 } // namespace interpreter | 1897 } // namespace interpreter |
1895 } // namespace internal | 1898 } // namespace internal |
1896 } // namespace v8 | 1899 } // namespace v8 |
OLD | NEW |