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_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_INTERPRETER_ASSEMBLER_H_ |
6 #define V8_COMPILER_INTERPRETER_ASSEMBLER_H_ | 6 #define V8_COMPILER_INTERPRETER_ASSEMBLER_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/builtins.h" | 12 #include "src/builtins.h" |
13 #include "src/frames.h" | 13 #include "src/frames.h" |
14 #include "src/interpreter/bytecodes.h" | 14 #include "src/interpreter/bytecodes.h" |
15 #include "src/runtime/runtime.h" | 15 #include "src/runtime/runtime.h" |
| 16 #include "src/zone-containers.h" |
16 | 17 |
17 namespace v8 { | 18 namespace v8 { |
18 namespace internal { | 19 namespace internal { |
19 | 20 |
20 class CallInterfaceDescriptor; | 21 class CallInterfaceDescriptor; |
21 class Isolate; | 22 class Isolate; |
22 class Zone; | 23 class Zone; |
23 | 24 |
24 namespace compiler { | 25 namespace compiler { |
25 | 26 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 62 |
62 // Returns the location in memory of the register |reg_index| in the | 63 // Returns the location in memory of the register |reg_index| in the |
63 // interpreter register file. | 64 // interpreter register file. |
64 Node* RegisterLocation(Node* reg_index); | 65 Node* RegisterLocation(Node* reg_index); |
65 | 66 |
66 // Constants. | 67 // Constants. |
67 Node* Int32Constant(int value); | 68 Node* Int32Constant(int value); |
68 Node* IntPtrConstant(intptr_t value); | 69 Node* IntPtrConstant(intptr_t value); |
69 Node* NumberConstant(double value); | 70 Node* NumberConstant(double value); |
70 Node* HeapConstant(Handle<HeapObject> object); | 71 Node* HeapConstant(Handle<HeapObject> object); |
| 72 Node* BooleanConstant(bool value); |
71 | 73 |
72 // Tag and untag Smi values. | 74 // Tag and untag Smi values. |
73 Node* SmiTag(Node* value); | 75 Node* SmiTag(Node* value); |
74 Node* SmiUntag(Node* value); | 76 Node* SmiUntag(Node* value); |
75 | 77 |
76 // Basic arithmetic operations. | 78 // Basic arithmetic operations. |
77 Node* IntPtrAdd(Node* a, Node* b); | 79 Node* IntPtrAdd(Node* a, Node* b); |
78 Node* IntPtrSub(Node* a, Node* b); | 80 Node* IntPtrSub(Node* a, Node* b); |
79 Node* WordShl(Node* value, int shift); | 81 Node* WordShl(Node* value, int shift); |
80 | 82 |
(...skipping 19 matching lines...) Expand all Loading... |
100 // Call an IC code stub. | 102 // Call an IC code stub. |
101 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, | 103 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, |
102 Node* arg2, Node* arg3, Node* arg4); | 104 Node* arg2, Node* arg3, Node* arg4); |
103 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, | 105 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, |
104 Node* arg2, Node* arg3, Node* arg4, Node* arg5); | 106 Node* arg2, Node* arg3, Node* arg4, Node* arg5); |
105 | 107 |
106 // Call runtime function. | 108 // Call runtime function. |
107 Node* CallRuntime(Runtime::FunctionId function_id, Node* arg1); | 109 Node* CallRuntime(Runtime::FunctionId function_id, Node* arg1); |
108 Node* CallRuntime(Runtime::FunctionId function_id, Node* arg1, Node* arg2); | 110 Node* CallRuntime(Runtime::FunctionId function_id, Node* arg1, Node* arg2); |
109 | 111 |
| 112 // Jump relative to the current bytecode by |jump_offset|. |
| 113 void Jump(Node* jump_offset); |
| 114 |
| 115 // Jump relative to the current bytecode by |jump_offset| if the |
| 116 // word values |lhs| and |rhs| are equal. |
| 117 void JumpIfWordEqual(Node* lhs, Node* rhs, Node* jump_offset); |
| 118 |
110 // Returns from the function. | 119 // Returns from the function. |
111 void Return(); | 120 void Return(); |
112 | 121 |
113 // Dispatch to the bytecode. | 122 // Dispatch to the bytecode. |
114 void Dispatch(); | 123 void Dispatch(); |
115 | 124 |
116 protected: | 125 protected: |
117 // Close the graph. | 126 // Close the graph. |
118 void End(); | 127 void End(); |
119 | 128 |
(...skipping 20 matching lines...) Expand all Loading... |
140 Node* BytecodeOperand(int operand_index); | 149 Node* BytecodeOperand(int operand_index); |
141 Node* BytecodeOperandSignExtended(int operand_index); | 150 Node* BytecodeOperandSignExtended(int operand_index); |
142 | 151 |
143 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node** args); | 152 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node** args); |
144 Node* CallJSBuiltin(int context_index, Node* receiver, Node** js_args, | 153 Node* CallJSBuiltin(int context_index, Node* receiver, Node** js_args, |
145 int js_arg_count); | 154 int js_arg_count); |
146 | 155 |
147 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not | 156 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not |
148 // update BytecodeOffset() itself. | 157 // update BytecodeOffset() itself. |
149 Node* Advance(int delta); | 158 Node* Advance(int delta); |
| 159 Node* Advance(Node* delta); |
150 | 160 |
151 // Sets the end node of the graph. | 161 // Starts next instruction dispatch at |new_bytecode_offset|. |
152 void SetEndInput(Node* input); | 162 void DispatchTo(Node* new_bytecode_offset); |
| 163 |
| 164 // Adds an end node of the graph. |
| 165 void AddEndInput(Node* input); |
153 | 166 |
154 // Private helpers which delegate to RawMachineAssembler. | 167 // Private helpers which delegate to RawMachineAssembler. |
155 Isolate* isolate(); | 168 Isolate* isolate(); |
156 Schedule* schedule(); | 169 Schedule* schedule(); |
157 Zone* zone(); | 170 Zone* zone(); |
158 | 171 |
159 interpreter::Bytecode bytecode_; | 172 interpreter::Bytecode bytecode_; |
160 base::SmartPointer<RawMachineAssembler> raw_assembler_; | 173 base::SmartPointer<RawMachineAssembler> raw_assembler_; |
161 Node* end_node_; | 174 ZoneVector<Node*> end_nodes_; |
162 Node* accumulator_; | 175 Node* accumulator_; |
163 bool code_generated_; | 176 bool code_generated_; |
164 | 177 |
165 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); | 178 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); |
166 }; | 179 }; |
167 | 180 |
168 } // namespace interpreter | 181 } // namespace interpreter |
169 } // namespace internal | 182 } // namespace internal |
170 } // namespace v8 | 183 } // namespace v8 |
171 | 184 |
172 #endif // V8_COMPILER_INTERPRETER_ASSEMBLER_H_ | 185 #endif // V8_COMPILER_INTERPRETER_ASSEMBLER_H_ |
OLD | NEW |