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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 3d37874075575fcda79404b63d0a4f1c01713791..50abb0f1a290053782082ad52f0cce149d0876bb 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -18,36 +18,55 @@ using compiler::Node;
#define __ assembler->
-Interpreter::Interpreter(Isolate* isolate) : isolate_(isolate) {}
+Interpreter::Interpreter(Isolate* isolate)
+ : isolate_(isolate) {}
+
+
+// static
+Handle<FixedArray> Interpreter::CreateUninitializedInterpreterTable(
+ Isolate* isolate) {
+ Handle<FixedArray> handler_table = isolate->factory()->NewFixedArray(
+ static_cast<int>(Bytecode::kLast) + 1, TENURED);
+ // We rely on the interpreter handler table being immovable, so check that
+ // it was allocated on the first page (which is always immovable).
+ DCHECK(isolate->heap()->old_space()->FirstPage()->Contains(
+ handler_table->address()));
+ for (int i = 0; i < static_cast<int>(Bytecode::kLast); i++) {
+ handler_table->set(i, isolate->builtins()->builtin(Builtins::kIllegal));
+ }
+ return handler_table;
+}
-void Interpreter::Initialize(bool create_heap_objects) {
+void Interpreter::Initialize() {
DCHECK(FLAG_ignition);
- if (create_heap_objects) {
+ Handle<FixedArray> handler_table = isolate_->factory()->interpreter_table();
+ if (!IsInterpreterTableInitialized(handler_table)) {
Zone zone;
HandleScope scope(isolate_);
- Handle<FixedArray> handler_table = isolate_->factory()->NewFixedArray(
- static_cast<int>(Bytecode::kLast) + 1, TENURED);
- // We rely on the interpreter handler table being immovable, so check that
- // it was allocated on the first page (which is always immovable).
- DCHECK(isolate_->heap()->old_space()->FirstPage()->Contains(
- handler_table->address()));
- isolate_->heap()->public_set_interpreter_table(*handler_table);
-
-#define GENERATE_CODE(Name, ...) \
- { \
- compiler::InterpreterAssembler assembler(isolate_, &zone, \
- Bytecode::k##Name); \
- Do##Name(&assembler); \
- Handle<Code> code = assembler.GenerateCode(); \
- handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \
- }
+
+#define GENERATE_CODE(Name, ...) \
+ { \
+ compiler::InterpreterAssembler assembler(isolate_, &zone, \
+ Bytecode::k##Name); \
+ Do##Name(&assembler); \
+ Handle<Code> code = assembler.GenerateCode(); \
+ handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \
+ }
BYTECODE_LIST(GENERATE_CODE)
#undef GENERATE_CODE
}
}
+bool Interpreter::IsInterpreterTableInitialized(
+ Handle<FixedArray> handler_table) {
+ DCHECK(handler_table->length() == static_cast<int>(Bytecode::kLast) + 1);
+ return handler_table->get(0) ==
+ isolate_->builtins()->builtin(Builtins::kIllegal);
+}
+
+
// LdaZero
//
// Load literal '0' into the accumulator.
« 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