Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 23 | 23 |
| 24 void Interpreter::Initialize(bool create_heap_objects) { | 24 void Interpreter::Initialize(bool create_heap_objects) { |
| 25 DCHECK(FLAG_ignition); | 25 DCHECK(FLAG_ignition); |
| 26 if (create_heap_objects) { | 26 if (create_heap_objects) { |
| 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 isolate_->heap()->public_set_interpreter_table(*handler_table); | 31 isolate_->heap()->public_set_interpreter_table(*handler_table); |
| 32 | 32 |
| 33 #define GENERATE_CODE(Name, _) \ | 33 #define GENERATE_CODE(Name) \ |
| 34 { \ | 34 { \ |
| 35 compiler::InterpreterAssembler assembler(isolate_, &zone, \ | 35 compiler::InterpreterAssembler assembler(isolate_, &zone, \ |
| 36 Bytecode::k##Name); \ | 36 Bytecode::k##Name); \ |
| 37 Do##Name(&assembler); \ | 37 Do##Name(&assembler); \ |
| 38 Handle<Code> code = assembler.GenerateCode(); \ | 38 Handle<Code> code = assembler.GenerateCode(); \ |
| 39 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ | 39 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ |
| 40 } | 40 } |
| 41 BYTECODE_LIST(GENERATE_CODE) | 41 BYTECODE_LIST(GENERATE_CODE) |
| 42 #undef GENERATE_CODE | 42 #undef GENERATE_CODE |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 | 46 |
| 47 // Load literal '0' into the register index specified by the bytecode's | 47 // Load literal '0' into the register index specified by the bytecode's |
| 48 // argument. | 48 // argument. |
| 49 void Interpreter::DoLoadLiteral0(compiler::InterpreterAssembler* assembler) { | 49 void Interpreter::DoLoadSmi0(compiler::InterpreterAssembler* assembler) { |
| 50 Node* register_index = __ BytecodeArg(0); | 50 Node* register_index = __ BytecodeArg(0); |
| 51 __ StoreRegister(__ NumberConstant(0), register_index); | 51 __ StoreRegister(__ NumberConstant(0), register_index); |
| 52 __ Dispatch(); | 52 __ Dispatch(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 // LoadSmi8 dst, imm8 | |
| 57 void Interpreter::DoLoadSmi8(compiler::InterpreterAssembler* assembler) { | |
| 58 UNIMPLEMENTED(); | |
|
rmcilroy
2015/07/24 18:34:48
This will fail when we build the interpreter-table
| |
| 59 } | |
| 60 | |
| 61 | |
| 62 // LoadSmi dst, imm32 | |
| 63 void Interpreter::DoLoadSmi(compiler::InterpreterAssembler* assembler) { | |
| 64 UNIMPLEMENTED(); | |
| 65 } | |
| 66 | |
| 67 | |
| 68 // Move dst, src | |
| 69 void Interpreter::DoMove(compiler::InterpreterAssembler* assembler) { | |
| 70 UNIMPLEMENTED(); | |
| 71 } | |
| 72 | |
| 73 | |
| 74 // Instruction Add dst, src1, src2 | |
| 75 // Effect dst = src1 + src2 | |
| 76 void Interpreter::DoAdd(compiler::InterpreterAssembler* assembler) { | |
| 77 UNIMPLEMENTED(); | |
| 78 } | |
| 79 | |
| 80 | |
| 81 // Instruction Sub dst, src1, src2 | |
| 82 // Effect dst = src1 - src2 | |
| 83 void Interpreter::DoSub(compiler::InterpreterAssembler* assembler) { | |
| 84 UNIMPLEMENTED(); | |
| 85 } | |
| 86 | |
| 87 | |
| 88 // Instruction Mul dst, src1, src2 | |
| 89 // Effect dst = src1 * src2 | |
| 90 void Interpreter::DoMul(compiler::InterpreterAssembler* assembler) { | |
| 91 UNIMPLEMENTED(); | |
| 92 } | |
| 93 | |
| 94 | |
| 95 // Instruction Div dst, src1, src2 | |
| 96 // Effect dst = src1 / src2 | |
| 97 void Interpreter::DoDiv(compiler::InterpreterAssembler* assembler) { | |
| 98 UNIMPLEMENTED(); | |
| 99 } | |
| 100 | |
| 101 | |
| 102 // Instruction Mod dst, src1, src2 | |
| 103 // Effect dst = src1 % src2 | |
| 104 void Interpreter::DoMod(compiler::InterpreterAssembler* assembler) { | |
| 105 UNIMPLEMENTED(); | |
| 106 } | |
| 107 | |
| 108 | |
| 56 // Return the value in register 0. | 109 // Return the value in register 0. |
| 57 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 110 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
| 58 // TODO(rmcilroy) Jump to exit trampoline. | 111 // TODO(rmcilroy) Jump to exit trampoline. |
| 59 } | 112 } |
| 60 | 113 |
| 61 | 114 |
| 62 } // namespace interpreter | 115 } // namespace interpreter |
| 63 } // namespace internal | 116 } // namespace internal |
| 64 } // namespace v8 | 117 } // namespace v8 |
| OLD | NEW |