Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: src/interpreter/interpreter.cc

Issue 1278413002: [interpreter] Fix nosnap build for interpreter table generation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove create_heap_objects Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "src/zone.h" 11 #include "src/zone.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 namespace interpreter { 15 namespace interpreter {
16 16
17 using compiler::Node; 17 using compiler::Node;
18 #define __ assembler-> 18 #define __ assembler->
19 19
20 20
21 Interpreter::Interpreter(Isolate* isolate) : isolate_(isolate) {} 21 Interpreter::Interpreter(Isolate* isolate)
22 : isolate_(isolate) {}
22 23
23 24
24 void Interpreter::Initialize(bool create_heap_objects) { 25 // static
26 Handle<FixedArray> Interpreter::CreateUninitializedInterpreterTable(
27 Isolate* isolate) {
28 Handle<FixedArray> handler_table = isolate->factory()->NewFixedArray(
29 static_cast<int>(Bytecode::kLast) + 1, TENURED);
30 // We rely on the interpreter handler table being immovable, so check that
31 // it was allocated on the first page (which is always immovable).
32 DCHECK(isolate->heap()->old_space()->FirstPage()->Contains(
33 handler_table->address()));
34 for (int i = 0; i < static_cast<int>(Bytecode::kLast); i++) {
35 handler_table->set(i, isolate->builtins()->builtin(Builtins::kIllegal));
36 }
37 return handler_table;
38 }
39
40
41 void Interpreter::Initialize() {
25 DCHECK(FLAG_ignition); 42 DCHECK(FLAG_ignition);
26 if (create_heap_objects) { 43 Handle<FixedArray> handler_table = isolate_->factory()->interpreter_table();
44 if (!IsInterpreterTableInitialized(handler_table)) {
27 Zone zone; 45 Zone zone;
28 HandleScope scope(isolate_); 46 HandleScope scope(isolate_);
29 Handle<FixedArray> handler_table = isolate_->factory()->NewFixedArray(
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()));
35 isolate_->heap()->public_set_interpreter_table(*handler_table);
36 47
37 #define GENERATE_CODE(Name, ...) \ 48 #define GENERATE_CODE(Name, ...) \
38 { \ 49 { \
39 compiler::InterpreterAssembler assembler(isolate_, &zone, \ 50 compiler::InterpreterAssembler assembler(isolate_, &zone, \
40 Bytecode::k##Name); \ 51 Bytecode::k##Name); \
41 Do##Name(&assembler); \ 52 Do##Name(&assembler); \
42 Handle<Code> code = assembler.GenerateCode(); \ 53 Handle<Code> code = assembler.GenerateCode(); \
43 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ 54 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \
44 } 55 }
45 BYTECODE_LIST(GENERATE_CODE) 56 BYTECODE_LIST(GENERATE_CODE)
46 #undef GENERATE_CODE 57 #undef GENERATE_CODE
47 } 58 }
48 } 59 }
49 60
50 61
62 bool Interpreter::IsInterpreterTableInitialized(
63 Handle<FixedArray> handler_table) {
64 DCHECK(handler_table->length() == static_cast<int>(Bytecode::kLast) + 1);
65 return handler_table->get(0) ==
66 isolate_->builtins()->builtin(Builtins::kIllegal);
67 }
68
69
51 // LdaZero 70 // LdaZero
52 // 71 //
53 // Load literal '0' into the accumulator. 72 // Load literal '0' into the accumulator.
54 void Interpreter::DoLdaZero(compiler::InterpreterAssembler* assembler) { 73 void Interpreter::DoLdaZero(compiler::InterpreterAssembler* assembler) {
55 // TODO(rmcilroy) Implement. 74 // TODO(rmcilroy) Implement.
56 __ Dispatch(); 75 __ Dispatch();
57 } 76 }
58 77
59 78
60 // LdaSmi8 <imm8> 79 // LdaSmi8 <imm8>
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // 188 //
170 // Return the value in register 0. 189 // Return the value in register 0.
171 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { 190 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
172 __ Return(); 191 __ Return();
173 } 192 }
174 193
175 194
176 } // namespace interpreter 195 } // namespace interpreter
177 } // namespace internal 196 } // namespace internal
178 } // namespace v8 197 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698