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/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/interpreter-assembler.h" | 8 #include "src/compiler/interpreter-assembler.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 Zone zone; | 27 Zone zone; |
28 HandleScope scope(isolate_); | 28 HandleScope scope(isolate_); |
29 Handle<FixedArray> handler_table = isolate_->factory()->NewFixedArray( | 29 Handle<FixedArray> handler_table = isolate_->factory()->NewFixedArray( |
30 static_cast<int>(Bytecode::kLast) + 1, TENURED); | 30 static_cast<int>(Bytecode::kLast) + 1, TENURED); |
31 // We rely on the interpreter handler table being immovable, so check that | 31 // We rely on the interpreter handler table being immovable, so check that |
32 // it was allocated on the first page (which is always immovable). | 32 // it was allocated on the first page (which is always immovable). |
33 DCHECK(isolate_->heap()->old_space()->FirstPage()->Contains( | 33 DCHECK(isolate_->heap()->old_space()->FirstPage()->Contains( |
34 handler_table->address())); | 34 handler_table->address())); |
35 isolate_->heap()->public_set_interpreter_table(*handler_table); | 35 isolate_->heap()->public_set_interpreter_table(*handler_table); |
36 | 36 |
37 #define GENERATE_CODE(Name, _) \ | 37 #define GENERATE_CODE(Name, ...) \ |
38 { \ | 38 { \ |
39 compiler::InterpreterAssembler assembler(isolate_, &zone, \ | 39 compiler::InterpreterAssembler assembler(isolate_, &zone, \ |
40 Bytecode::k##Name); \ | 40 Bytecode::k##Name); \ |
41 Do##Name(&assembler); \ | 41 Do##Name(&assembler); \ |
42 Handle<Code> code = assembler.GenerateCode(); \ | 42 Handle<Code> code = assembler.GenerateCode(); \ |
43 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ | 43 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ |
44 } | 44 } |
45 BYTECODE_LIST(GENERATE_CODE) | 45 BYTECODE_LIST(GENERATE_CODE) |
46 #undef GENERATE_CODE | 46 #undef GENERATE_CODE |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 // Load literal '0' into the register index specified by the bytecode's | 51 // LoadLiteral0 <dst> |
52 // argument. | 52 // |
| 53 // Load literal '0' into the destination register. |
53 void Interpreter::DoLoadLiteral0(compiler::InterpreterAssembler* assembler) { | 54 void Interpreter::DoLoadLiteral0(compiler::InterpreterAssembler* assembler) { |
54 Node* register_index = __ BytecodeArg(0); | 55 Node* register_index = __ BytecodeOperand(0); |
55 __ StoreRegister(__ NumberConstant(0), register_index); | 56 __ StoreRegister(__ NumberConstant(0), register_index); |
56 __ Dispatch(); | 57 __ Dispatch(); |
57 } | 58 } |
58 | 59 |
59 | 60 |
| 61 // LoadSmi8 <dst>, <imm8> |
| 62 // |
| 63 // Load an 8-bit integer literal into destination register as a Smi. |
| 64 void Interpreter::DoLoadSmi8(compiler::InterpreterAssembler* assembler) { |
| 65 // TODO(rmcilroy) Convert an 8-bit integer to a Smi. |
| 66 } |
| 67 |
| 68 |
| 69 // Return |
| 70 // |
60 // Return the value in register 0. | 71 // Return the value in register 0. |
61 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 72 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
62 __ Return(); | 73 __ Return(); |
63 } | 74 } |
64 | 75 |
65 | 76 |
66 } // namespace interpreter | 77 } // namespace interpreter |
67 } // namespace internal | 78 } // namespace internal |
68 } // namespace v8 | 79 } // namespace v8 |
OLD | NEW |