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

Unified Diff: src/interpreter/interpreter.cc

Issue 1239793002: [interpreter] Add basic framework for bytecode handler code generation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review comments. Created 5 years, 5 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.h » ('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
new file mode 100644
index 0000000000000000000000000000000000000000..8c206c91a4305371c7a14da9b237657543bdab88
--- /dev/null
+++ b/src/interpreter/interpreter.cc
@@ -0,0 +1,63 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/interpreter/interpreter.h"
+
+#include "src/compiler.h"
+#include "src/compiler/interpreter-assembler.h"
+#include "src/factory.h"
+#include "src/interpreter/bytecodes.h"
+#include "src/zone.h"
+
+namespace v8 {
+namespace internal {
+namespace interpreter {
+
+using compiler::Node;
+#define __ assembler->
+
+
+Interpreter::Interpreter() {}
+
+
+void Interpreter::Initialize(Isolate* isolate, bool create_heap_objects) {
+ if (create_heap_objects) {
+ Zone zone;
+ HandleScope scope(isolate);
+ Handle<FixedArray> handler_table = isolate->factory()->NewFixedArray(
+ static_cast<int>(Bytecode::kLast) + 1, TENURED);
picksi 2015/07/16 09:08:10 It's probably macro magic, but Bytecode::kLast is
rmcilroy 2015/07/16 15:11:09 This is macro magic ;). It is assigned -1 but then
+ isolate->heap()->public_set_interpreter_table(*handler_table);
+
+#define GENERATE_CODE(Name, _) \
+ { \
+ compiler::InterpreterAssembler assembler(isolate, &zone, \
+ Bytecode::k##Name); \
+ Do##Name(&assembler); \
+ handler_table->set(static_cast<int>(Bytecode::k##Name), \
+ *assembler.GenerateCode()); \
+ }
+ BYTECODE_LIST(GENERATE_CODE)
+#undef GENERATE_CODE
+ }
+}
+
+
+// Load literal '0' into the register index specified by the bytecode's
+// argument.
+void Interpreter::DoLoadLiteral0(compiler::InterpreterAssembler* assembler) {
+ Node* register_index = __ BytecodeArg(0);
+ __ StoreRegister(__ NumberConstant(0), register_index);
+ __ Dispatch();
+}
+
+
+// Return the value in register 0.
+void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
+ __ Return(__ LoadRegister(0));
+}
+
+
+} // namespace interpreter
+} // namespace internal
+} // namespace v8
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698