OLD | NEW |
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 #ifndef V8_COMPILER_INTERPRETER_CODEGEN_H_ | 5 #ifndef V8_COMPILER_INTERPRETER_CODEGEN_H_ |
6 #define V8_COMPILER_INTERPRETER_CODEGEN_H_ | 6 #define V8_COMPILER_INTERPRETER_CODEGEN_H_ |
7 | 7 |
8 // Clients of this interface shouldn't depend on lots of compiler internals. | 8 // Clients of this interface shouldn't depend on lots of compiler internals. |
9 // Do not include anything from src/compiler here! | 9 // Do not include anything from src/compiler here! |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
11 #include "src/base/smart-pointers.h" | 11 #include "src/base/smart-pointers.h" |
12 #include "src/frames.h" | 12 #include "src/frames.h" |
13 #include "src/interpreter/bytecodes.h" | 13 #include "src/interpreter/bytecodes.h" |
| 14 #include "src/unique.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 | 18 |
18 class Isolate; | 19 class Isolate; |
19 class Zone; | 20 class Zone; |
20 | 21 |
21 namespace compiler { | 22 namespace compiler { |
22 | 23 |
23 class CallDescriptor; | 24 class CallDescriptor; |
24 class CommonOperatorBuilder; | 25 class CommonOperatorBuilder; |
25 class Graph; | 26 class Graph; |
26 class MachineOperatorBuilder; | 27 class MachineOperatorBuilder; |
27 class Node; | 28 class Node; |
28 class Operator; | 29 class Operator; |
29 class RawMachineAssembler; | 30 class RawMachineAssembler; |
30 class Schedule; | 31 class Schedule; |
31 | 32 |
32 class InterpreterAssembler { | 33 class InterpreterAssembler { |
33 public: | 34 public: |
34 InterpreterAssembler(Isolate* isolate, Zone* zone, | 35 InterpreterAssembler(Isolate* isolate, Zone* zone, |
35 interpreter::Bytecode bytecode); | 36 interpreter::Bytecode bytecode); |
36 virtual ~InterpreterAssembler(); | 37 virtual ~InterpreterAssembler(); |
37 | 38 |
38 Handle<Code> GenerateCode(); | 39 Handle<Code> GenerateCode(); |
39 | 40 |
40 // Constants. | 41 // Constants. |
41 Node* Int32Constant(int value); | 42 Node* Int32Constant(int value); |
42 Node* NumberConstant(double value); | 43 Node* NumberConstant(double value); |
| 44 Node* HeapConstant(Unique<HeapObject> object); |
43 | 45 |
44 // Returns the bytecode argument |index| for the current bytecode. | 46 // Returns the bytecode argument |index| for the current bytecode. |
45 Node* BytecodeArg(int index); | 47 Node* BytecodeArg(int index); |
46 | 48 |
47 // Loads from and stores to the interpreter register file. | 49 // Loads from and stores to the interpreter register file. |
48 Node* LoadRegister(int index); | 50 Node* LoadRegister(int index); |
49 Node* LoadRegister(Node* index); | 51 Node* LoadRegister(Node* index); |
50 Node* StoreRegister(Node* value, int index); | 52 Node* StoreRegister(Node* value, int index); |
51 Node* StoreRegister(Node* value, Node* index); | 53 Node* StoreRegister(Node* value, Node* index); |
52 | 54 |
| 55 // Returns from the function. |
| 56 void Return(); |
| 57 |
53 // Dispatch to the bytecode. | 58 // Dispatch to the bytecode. |
54 void Dispatch(); | 59 void Dispatch(); |
55 | 60 |
56 protected: | 61 protected: |
57 static const int kFirstRegisterOffsetFromFp = | 62 static const int kFirstRegisterOffsetFromFp = |
58 -kPointerSize - StandardFrameConstants::kFixedFrameSizeFromFp; | 63 -kPointerSize - StandardFrameConstants::kFixedFrameSizeFromFp; |
59 | 64 |
60 // TODO(rmcilroy): Increase this when required. | 65 // TODO(rmcilroy): Increase this when required. |
61 static const int kMaxRegisterIndex = 255; | 66 static const int kMaxRegisterIndex = 255; |
62 | 67 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 bool code_generated_; | 105 bool code_generated_; |
101 | 106 |
102 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); | 107 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); |
103 }; | 108 }; |
104 | 109 |
105 } // namespace interpreter | 110 } // namespace interpreter |
106 } // namespace internal | 111 } // namespace internal |
107 } // namespace v8 | 112 } // namespace v8 |
108 | 113 |
109 #endif // V8_COMPILER_INTERPRETER_CODEGEN_H_ | 114 #endif // V8_COMPILER_INTERPRETER_CODEGEN_H_ |
OLD | NEW |