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

Unified Diff: src/compiler/interpreter-assembler.h

Issue 1239793002: [interpreter] Add basic framework for bytecode handler code generation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix GN for realz 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/compiler/ia32/linkage-ia32.cc ('k') | src/compiler/interpreter-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/interpreter-assembler.h
diff --git a/src/compiler/interpreter-assembler.h b/src/compiler/interpreter-assembler.h
new file mode 100644
index 0000000000000000000000000000000000000000..edbe86d07bfa290ce3bb7dada672587ffa1d1390
--- /dev/null
+++ b/src/compiler/interpreter-assembler.h
@@ -0,0 +1,107 @@
+// 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.
+
+#ifndef V8_COMPILER_INTERPRETER_CODEGEN_H_
+#define V8_COMPILER_INTERPRETER_CODEGEN_H_
+
+// Clients of this interface shouldn't depend on lots of compiler internals.
+// Do not include anything from src/compiler here!
+#include "src/allocation.h"
+#include "src/base/smart-pointers.h"
+#include "src/frames.h"
+#include "src/interpreter/bytecodes.h"
+
+namespace v8 {
+namespace internal {
+
+class Isolate;
+class Zone;
+
+namespace compiler {
+
+class CallDescriptor;
+class CommonOperatorBuilder;
+class Graph;
+class MachineOperatorBuilder;
+class Node;
+class Operator;
+class RawMachineAssembler;
+class Schedule;
+
+class InterpreterAssembler {
+ public:
+ InterpreterAssembler(Isolate* isolate, Zone* zone,
+ interpreter::Bytecode bytecode);
+ virtual ~InterpreterAssembler();
+
+ Handle<Code> GenerateCode();
+
+ // Constants.
+ Node* Int32Constant(int value);
+ Node* NumberConstant(double value);
+
+ // Returns the bytecode argument |index| for the current bytecode.
+ Node* BytecodeArg(int index);
+
+ // Loads from and stores to the interpreter register file.
+ Node* LoadRegister(int index);
+ Node* LoadRegister(Node* index);
+ Node* StoreRegister(Node* value, int index);
+ Node* StoreRegister(Node* value, Node* index);
+
+ // Dispatch to the bytecode.
+ void Dispatch();
+
+ protected:
+ static const int kFirstRegisterOffsetFromFp =
+ -kPointerSize - StandardFrameConstants::kFixedFrameSizeFromFp;
+
+ // TODO(rmcilroy): Increase this when required.
+ static const int kMaxRegisterIndex = 255;
+
+ // Close the graph.
+ void End();
+
+ // Protected helpers (for testing) which delegate to RawMachineAssembler.
+ CallDescriptor* call_descriptor() const;
+ Graph* graph();
+
+ private:
+ // Returns the pointer to the current bytecode.
+ Node* BytecodePointer();
+ // Returns the pointer to first entry in the interpreter dispatch table.
+ Node* DispatchTablePointer();
+ // Returns the frame pointer for the current function.
+ Node* FramePointer();
+
+ // Returns the offset of register |index|.
+ Node* RegisterFrameOffset(int index);
+ Node* RegisterFrameOffset(Node* index);
+
+ // Returns BytecodePointer() advanced by delta bytecodes. Note: this does not
+ // update BytecodePointer() itself.
+ Node* Advance(int delta);
+
+ // Sets the end node of the graph.
+ void SetEndInput(Node* input);
+
+ // Private helpers which delegate to RawMachineAssembler.
+ Isolate* isolate();
+ Schedule* schedule();
+ MachineOperatorBuilder* machine();
+ CommonOperatorBuilder* common();
+
+ interpreter::Bytecode bytecode_;
+ base::SmartPointer<RawMachineAssembler> raw_assembler_;
+ Node* end_node_;
+ bool code_generated_;
+
+ DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler);
+};
+
+} // namespace interpreter
+} // namespace internal
+} // namespace v8
+
+#endif // V8_COMPILER_INTERPRETER_CODEGEN_H_
« no previous file with comments | « src/compiler/ia32/linkage-ia32.cc ('k') | src/compiler/interpreter-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698