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 <fstream> | 7 #include <fstream> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 Node* value = __ GetAccumulator(); | 1293 Node* value = __ GetAccumulator(); |
1294 Node* context = __ GetContext(); | 1294 Node* context = __ GetContext(); |
1295 Node* slot_index = __ BytecodeOperandIdx(0); | 1295 Node* slot_index = __ BytecodeOperandIdx(0); |
1296 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); | 1296 Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
1297 Node* result = Generator::Generate(assembler, value, context, | 1297 Node* result = Generator::Generate(assembler, value, context, |
1298 type_feedback_vector, slot_index); | 1298 type_feedback_vector, slot_index); |
1299 __ SetAccumulator(result); | 1299 __ SetAccumulator(result); |
1300 __ Dispatch(); | 1300 __ Dispatch(); |
1301 } | 1301 } |
1302 | 1302 |
| 1303 template <class Generator> |
| 1304 void Interpreter::DoConversionOp(InterpreterAssembler* assembler) { |
| 1305 Node* value = __ GetAccumulator(); |
| 1306 Node* context = __ GetContext(); |
| 1307 Node* result = Generator::Generate(assembler, value, context); |
| 1308 __ StoreRegister(result, __ BytecodeOperandReg(0)); |
| 1309 __ Dispatch(); |
| 1310 } |
| 1311 |
1303 // ToName | 1312 // ToName |
1304 // | 1313 // |
1305 // Cast the object referenced by the accumulator to a name. | 1314 // Cast the object referenced by the accumulator to a name. |
1306 void Interpreter::DoToName(InterpreterAssembler* assembler) { | 1315 void Interpreter::DoToName(InterpreterAssembler* assembler) { |
1307 Node* result = BuildUnaryOp(CodeFactory::ToName(isolate_), assembler); | 1316 DoConversionOp<ToNameStub>(assembler); |
1308 __ StoreRegister(result, __ BytecodeOperandReg(0)); | |
1309 __ Dispatch(); | |
1310 } | 1317 } |
1311 | 1318 |
1312 // ToNumber | 1319 // ToNumber |
1313 // | 1320 // |
1314 // Cast the object referenced by the accumulator to a number. | 1321 // Cast the object referenced by the accumulator to a number. |
1315 void Interpreter::DoToNumber(InterpreterAssembler* assembler) { | 1322 void Interpreter::DoToNumber(InterpreterAssembler* assembler) { |
1316 Node* result = BuildUnaryOp(CodeFactory::ToNumber(isolate_), assembler); | 1323 Node* result = BuildUnaryOp(CodeFactory::ToNumber(isolate_), assembler); |
1317 __ StoreRegister(result, __ BytecodeOperandReg(0)); | 1324 __ StoreRegister(result, __ BytecodeOperandReg(0)); |
1318 __ Dispatch(); | 1325 __ Dispatch(); |
1319 } | 1326 } |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2461 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2468 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2462 __ SmiTag(new_state)); | 2469 __ SmiTag(new_state)); |
2463 __ SetAccumulator(old_state); | 2470 __ SetAccumulator(old_state); |
2464 | 2471 |
2465 __ Dispatch(); | 2472 __ Dispatch(); |
2466 } | 2473 } |
2467 | 2474 |
2468 } // namespace interpreter | 2475 } // namespace interpreter |
2469 } // namespace internal | 2476 } // namespace internal |
2470 } // namespace v8 | 2477 } // namespace v8 |
OLD | NEW |