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 10 matching lines...) Expand all Loading... |
21 Interpreter::Interpreter(Isolate* isolate) : isolate_(isolate) {} | 21 Interpreter::Interpreter(Isolate* isolate) : isolate_(isolate) {} |
22 | 22 |
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 // We rely on the interpreter handler table being immovable, so check that |
| 32 // it was allocated on the first page (which is always immovable). |
| 33 DCHECK(isolate_->heap()->old_space()->FirstPage()->Contains( |
| 34 handler_table->address())); |
31 isolate_->heap()->public_set_interpreter_table(*handler_table); | 35 isolate_->heap()->public_set_interpreter_table(*handler_table); |
32 | 36 |
33 #define GENERATE_CODE(Name, _) \ | 37 #define GENERATE_CODE(Name, _) \ |
34 { \ | 38 { \ |
35 compiler::InterpreterAssembler assembler(isolate_, &zone, \ | 39 compiler::InterpreterAssembler assembler(isolate_, &zone, \ |
36 Bytecode::k##Name); \ | 40 Bytecode::k##Name); \ |
37 Do##Name(&assembler); \ | 41 Do##Name(&assembler); \ |
38 Handle<Code> code = assembler.GenerateCode(); \ | 42 Handle<Code> code = assembler.GenerateCode(); \ |
39 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ | 43 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ |
40 } | 44 } |
(...skipping 14 matching lines...) Expand all Loading... |
55 | 59 |
56 // Return the value in register 0. | 60 // Return the value in register 0. |
57 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 61 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
58 // TODO(rmcilroy) Jump to exit trampoline. | 62 // TODO(rmcilroy) Jump to exit trampoline. |
59 } | 63 } |
60 | 64 |
61 | 65 |
62 } // namespace interpreter | 66 } // namespace interpreter |
63 } // namespace internal | 67 } // namespace internal |
64 } // namespace v8 | 68 } // namespace v8 |
OLD | NEW |