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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef V8_COMPILER_INTERPRETER_CODEGEN_H_
6 #define V8_COMPILER_INTERPRETER_CODEGEN_H_
7
8 // Clients of this interface shouldn't depend on lots of compiler internals.
9 // Do not include anything from src/compiler here!
10 #include "src/allocation.h"
11 #include "src/base/smart-pointers.h"
12 #include "src/frames.h"
13 #include "src/interpreter/bytecodes.h"
14
15 namespace v8 {
16 namespace internal {
17
18 class Isolate;
19 class Zone;
20
21 namespace compiler {
22
23 class CallDescriptor;
24 class CommonOperatorBuilder;
25 class Graph;
26 class MachineOperatorBuilder;
27 class Node;
28 class Operator;
29 class RawMachineAssembler;
30 class Schedule;
31
32 class InterpreterAssembler {
33 public:
34 InterpreterAssembler(Isolate* isolate, Zone* zone,
35 interpreter::Bytecode bytecode);
36 virtual ~InterpreterAssembler();
37
38 Handle<Code> GenerateCode();
39
40 // Constants.
41 Node* Int32Constant(int value);
42 Node* NumberConstant(double value);
43
44 // Returns the bytecode argument |index| for the current bytecode.
45 Node* BytecodeArg(int index);
46
47 // Loads from and stores to the interpreter register file.
48 Node* LoadRegister(int index);
49 Node* LoadRegister(Node* index);
50 Node* StoreRegister(Node* value, int index);
51 Node* StoreRegister(Node* value, Node* index);
52
53 // Dispatch to the bytecode.
54 void Dispatch();
55
56 protected:
57 static const int kFirstRegisterOffsetFromFp =
58 -kPointerSize - StandardFrameConstants::kFixedFrameSizeFromFp;
59
60 // TODO(rmcilroy): Increase this when required.
61 static const int kMaxRegisterIndex = 255;
62
63 // Close the graph.
64 void End();
65
66 // Protected helpers (for testing) which delegate to RawMachineAssembler.
67 CallDescriptor* call_descriptor() const;
68 Graph* graph();
69
70 private:
71 // Returns the pointer to the current bytecode.
72 Node* BytecodePointer();
73 // Returns the pointer to first entry in the interpreter dispatch table.
74 Node* DispatchTablePointer();
75 // Returns the frame pointer for the current function.
76 Node* FramePointer();
77
78 // Returns the offset of register |index|.
79 Node* RegisterFrameOffset(int index);
80 Node* RegisterFrameOffset(Node* index);
81
82 // Returns BytecodePointer() advanced by delta bytecodes. Note: this does not
83 // update BytecodePointer() itself.
84 Node* Advance(int delta);
85
86 // Sets the end node of the graph.
87 void SetEndInput(Node* input);
88
89 // Private helpers which delegate to RawMachineAssembler.
90 Isolate* isolate();
91 Schedule* schedule();
92 MachineOperatorBuilder* machine();
93 CommonOperatorBuilder* common();
94
95 interpreter::Bytecode bytecode_;
96 base::SmartPointer<RawMachineAssembler> raw_assembler_;
97 Node* end_node_;
98 bool code_generated_;
99
100 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler);
101 };
102
103 } // namespace interpreter
104 } // namespace internal
105 } // namespace v8
106
107 #endif // V8_COMPILER_INTERPRETER_CODEGEN_H_
OLDNEW
« 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