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

Side by Side Diff: src/compiler/interpreter-assembler.h

Issue 1343363002: [Interpreter] Basic flow control. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Clarify comment and diff reduction. Created 5 years, 3 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
OLDNEW
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
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 18 matching lines...) Expand all
99 101
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, Node* arg2); 109 Node* CallRuntime(Runtime::FunctionId function_id, Node* arg1, Node* arg2);
108 110
111 // Jump relative to the current bytecode by |jump_offset|.
112 void Jump(Node* jump_offset);
rmcilroy 2015/09/18 10:42:23 please add tests for these in interpreter-assemble
oth 2015/09/23 10:46:55 Added a test for Jump and a partial test JumpIfWor
113
114 // Jump relative to the current bytecode by |jump_offset| if the
115 // values |lhs| and |rhs| are equal.
116 void JumpIfEqual(Node* lhs, Node* rhs, Node* jump_offset);
117
118 // Jump relative to the current bytecode by |jump_offset| if the
119 // values |lhs| and |rhs| are not equal.
120 void JumpIfNotEqual(Node* lhs, Node* rhs, Node* jump_offset);
121
109 // Returns from the function. 122 // Returns from the function.
110 void Return(); 123 void Return();
111 124
112 // Dispatch to the bytecode. 125 // Dispatch to the bytecode.
113 void Dispatch(); 126 void Dispatch();
114 127
115 protected: 128 protected:
116 // Close the graph. 129 // Close the graph.
117 void End(); 130 void End();
118 131
(...skipping 20 matching lines...) Expand all
139 Node* BytecodeOperand(int operand_index); 152 Node* BytecodeOperand(int operand_index);
140 Node* BytecodeOperandSignExtended(int operand_index); 153 Node* BytecodeOperandSignExtended(int operand_index);
141 154
142 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node** args); 155 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node** args);
143 Node* CallJSBuiltin(int context_index, Node* receiver, Node** js_args, 156 Node* CallJSBuiltin(int context_index, Node* receiver, Node** js_args,
144 int js_arg_count); 157 int js_arg_count);
145 158
146 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not 159 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not
147 // update BytecodeOffset() itself. 160 // update BytecodeOffset() itself.
148 Node* Advance(int delta); 161 Node* Advance(int delta);
162 Node* Advance(Node* delta);
149 163
150 // Sets the end node of the graph. 164 // Starts next instruction dispatch at |new_bytecode_offset|.
151 void SetEndInput(Node* input); 165 void DispatchTo(Node* new_bytecode_offset);
166
167 // Adds an end node of the graph.
168 void AddEndInput(Node* input);
152 169
153 // Private helpers which delegate to RawMachineAssembler. 170 // Private helpers which delegate to RawMachineAssembler.
154 Isolate* isolate(); 171 Isolate* isolate();
155 Schedule* schedule(); 172 Schedule* schedule();
156 Zone* zone(); 173 Zone* zone();
157 174
158 interpreter::Bytecode bytecode_; 175 interpreter::Bytecode bytecode_;
159 base::SmartPointer<RawMachineAssembler> raw_assembler_; 176 base::SmartPointer<RawMachineAssembler> raw_assembler_;
160 Node* end_node_; 177 ZoneVector<Node*> end_nodes_;
161 Node* accumulator_; 178 Node* accumulator_;
162 bool code_generated_; 179 bool code_generated_;
163 180
164 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); 181 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler);
165 }; 182 };
166 183
167 } // namespace interpreter 184 } // namespace interpreter
168 } // namespace internal 185 } // namespace internal
169 } // namespace v8 186 } // namespace v8
170 187
171 #endif // V8_COMPILER_INTERPRETER_ASSEMBLER_H_ 188 #endif // V8_COMPILER_INTERPRETER_ASSEMBLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698