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_CODE_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_CODE_ASSEMBLER_H_ |
6 #define V8_COMPILER_CODE_ASSEMBLER_H_ | 6 #define V8_COMPILER_CODE_ASSEMBLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 // Clients of this interface shouldn't depend on lots of compiler internals. | 10 // Clients of this interface shouldn't depend on lots of compiler internals. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 V(Float64LessThan) \ | 45 V(Float64LessThan) \ |
46 V(Float64LessThanOrEqual) \ | 46 V(Float64LessThanOrEqual) \ |
47 V(Float64GreaterThan) \ | 47 V(Float64GreaterThan) \ |
48 V(Float64GreaterThanOrEqual) \ | 48 V(Float64GreaterThanOrEqual) \ |
49 V(Int32GreaterThan) \ | 49 V(Int32GreaterThan) \ |
50 V(Int32GreaterThanOrEqual) \ | 50 V(Int32GreaterThanOrEqual) \ |
51 V(Int32LessThan) \ | 51 V(Int32LessThan) \ |
52 V(Int32LessThanOrEqual) \ | 52 V(Int32LessThanOrEqual) \ |
53 V(IntPtrLessThan) \ | 53 V(IntPtrLessThan) \ |
54 V(IntPtrLessThanOrEqual) \ | 54 V(IntPtrLessThanOrEqual) \ |
55 V(IntPtrEqual) \ | |
55 V(Uint32LessThan) \ | 56 V(Uint32LessThan) \ |
56 V(UintPtrGreaterThanOrEqual) \ | 57 V(UintPtrGreaterThanOrEqual) \ |
57 V(WordEqual) \ | 58 V(WordEqual) \ |
58 V(WordNotEqual) \ | 59 V(WordNotEqual) \ |
59 V(Word32Equal) \ | 60 V(Word32Equal) \ |
60 V(Word32NotEqual) \ | 61 V(Word32NotEqual) \ |
61 V(Word64Equal) \ | 62 V(Word64Equal) \ |
62 V(Word64NotEqual) | 63 V(Word64NotEqual) |
63 | 64 |
64 #define CODE_ASSEMBLER_BINARY_OP_LIST(V) \ | 65 #define CODE_ASSEMBLER_BINARY_OP_LIST(V) \ |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 | 185 |
185 // Constants. | 186 // Constants. |
186 Node* Int32Constant(int value); | 187 Node* Int32Constant(int value); |
187 Node* IntPtrConstant(intptr_t value); | 188 Node* IntPtrConstant(intptr_t value); |
188 Node* NumberConstant(double value); | 189 Node* NumberConstant(double value); |
189 Node* SmiConstant(Smi* value); | 190 Node* SmiConstant(Smi* value); |
190 Node* HeapConstant(Handle<HeapObject> object); | 191 Node* HeapConstant(Handle<HeapObject> object); |
191 Node* BooleanConstant(bool value); | 192 Node* BooleanConstant(bool value); |
192 Node* ExternalConstant(ExternalReference address); | 193 Node* ExternalConstant(ExternalReference address); |
193 Node* Float64Constant(double value); | 194 Node* Float64Constant(double value); |
194 Node* BooleanMapConstant(); | 195 Node* BooleanMapConstant(); |
Benedikt Meurer
2016/04/18 17:56:24
Maybe these three helpers should move to CodeStubA
| |
195 Node* EmptyStringConstant(); | 196 Node* EmptyStringConstant(); |
196 Node* HeapNumberMapConstant(); | 197 Node* HeapNumberMapConstant(); |
197 Node* NaNConstant(); | 198 Node* NaNConstant(); |
198 Node* NoContextConstant(); | 199 Node* NoContextConstant(); |
199 Node* NullConstant(); | 200 Node* NullConstant(); |
200 Node* UndefinedConstant(); | 201 Node* UndefinedConstant(); |
201 | 202 |
202 Node* Parameter(int value); | 203 Node* Parameter(int value); |
203 void Return(Node* value); | 204 void Return(Node* value); |
204 | 205 |
(...skipping 10 matching lines...) Expand all Loading... | |
215 Node* LoadFramePointer(); | 216 Node* LoadFramePointer(); |
216 Node* LoadParentFramePointer(); | 217 Node* LoadParentFramePointer(); |
217 | 218 |
218 // Access to the stack pointer | 219 // Access to the stack pointer |
219 Node* LoadStackPointer(); | 220 Node* LoadStackPointer(); |
220 | 221 |
221 // Load raw memory location. | 222 // Load raw memory location. |
222 Node* Load(MachineType rep, Node* base); | 223 Node* Load(MachineType rep, Node* base); |
223 Node* Load(MachineType rep, Node* base, Node* index); | 224 Node* Load(MachineType rep, Node* base, Node* index); |
224 | 225 |
226 // Load a value from the root array. | |
227 Node* LoadRoot(Heap::RootListIndex root_index); | |
228 | |
225 // Store value to raw memory location. | 229 // Store value to raw memory location. |
226 Node* Store(MachineRepresentation rep, Node* base, Node* value); | 230 Node* Store(MachineRepresentation rep, Node* base, Node* value); |
227 Node* Store(MachineRepresentation rep, Node* base, Node* index, Node* value); | 231 Node* Store(MachineRepresentation rep, Node* base, Node* index, Node* value); |
228 Node* StoreNoWriteBarrier(MachineRepresentation rep, Node* base, Node* value); | 232 Node* StoreNoWriteBarrier(MachineRepresentation rep, Node* base, Node* value); |
229 Node* StoreNoWriteBarrier(MachineRepresentation rep, Node* base, Node* index, | 233 Node* StoreNoWriteBarrier(MachineRepresentation rep, Node* base, Node* index, |
230 Node* value); | 234 Node* value); |
231 | 235 |
232 // Basic arithmetic operations. | 236 // Basic arithmetic operations. |
233 #define DECLARE_CODE_ASSEMBLER_BINARY_OP(name) Node* name(Node* a, Node* b); | 237 #define DECLARE_CODE_ASSEMBLER_BINARY_OP(name) Node* name(Node* a, Node* b); |
234 CODE_ASSEMBLER_BINARY_OP_LIST(DECLARE_CODE_ASSEMBLER_BINARY_OP) | 238 CODE_ASSEMBLER_BINARY_OP_LIST(DECLARE_CODE_ASSEMBLER_BINARY_OP) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 | 296 |
293 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1, | 297 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1, |
294 Node* arg2, size_t result_size = 1); | 298 Node* arg2, size_t result_size = 1); |
295 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target, | 299 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target, |
296 Node* context, Node* arg1, Node* arg2, | 300 Node* context, Node* arg1, Node* arg2, |
297 size_t result_size = 1); | 301 size_t result_size = 1); |
298 | 302 |
299 Node* TailCallBytecodeDispatch(const CallInterfaceDescriptor& descriptor, | 303 Node* TailCallBytecodeDispatch(const CallInterfaceDescriptor& descriptor, |
300 Node* code_target_address, Node** args); | 304 Node* code_target_address, Node** args); |
301 | 305 |
302 // =========================================================================== | |
303 // Macros | |
304 // =========================================================================== | |
305 | |
306 // Tag a Word as a Smi value. | |
307 Node* SmiTag(Node* value); | |
308 // Untag a Smi value as a Word. | |
309 Node* SmiUntag(Node* value); | |
310 | |
311 // Load a value from the root array. | |
312 Node* LoadRoot(Heap::RootListIndex root_index); | |
313 | |
314 // Allocate an object of the given size. | |
315 Node* Allocate(int size, AllocationFlags flags = kNone); | |
316 Node* InnerAllocate(Node* previous, int offset); | |
317 | |
318 // Branching helpers. | 306 // Branching helpers. |
319 void BranchIf(Node* condition, Label* if_true, Label* if_false); | 307 void BranchIf(Node* condition, Label* if_true, Label* if_false); |
320 | 308 |
321 #define BRANCH_HELPER(name) \ | 309 #define BRANCH_HELPER(name) \ |
322 void BranchIf##name(Node* a, Node* b, Label* if_true, Label* if_false) { \ | 310 void BranchIf##name(Node* a, Node* b, Label* if_true, Label* if_false) { \ |
323 BranchIf(name(a, b), if_true, if_false); \ | 311 BranchIf(name(a, b), if_true, if_false); \ |
324 } | 312 } |
325 CODE_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER) | 313 CODE_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER) |
326 #undef BRANCH_HELPER | 314 #undef BRANCH_HELPER |
327 | 315 |
(...skipping 14 matching lines...) Expand all Loading... | |
342 | 330 |
343 private: | 331 private: |
344 friend class CodeAssemblerTester; | 332 friend class CodeAssemblerTester; |
345 | 333 |
346 CodeAssembler(Isolate* isolate, Zone* zone, CallDescriptor* call_descriptor, | 334 CodeAssembler(Isolate* isolate, Zone* zone, CallDescriptor* call_descriptor, |
347 Code::Flags flags, const char* name); | 335 Code::Flags flags, const char* name); |
348 | 336 |
349 Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args); | 337 Node* CallN(CallDescriptor* descriptor, Node* code_target, Node** args); |
350 Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args); | 338 Node* TailCallN(CallDescriptor* descriptor, Node* code_target, Node** args); |
351 | 339 |
352 Node* AllocateRawAligned(Node* size_in_bytes, AllocationFlags flags, | |
353 Node* top_address, Node* limit_address); | |
354 Node* AllocateRawUnaligned(Node* size_in_bytes, AllocationFlags flags, | |
355 Node* top_adddress, Node* limit_address); | |
356 | |
357 base::SmartPointer<RawMachineAssembler> raw_assembler_; | 340 base::SmartPointer<RawMachineAssembler> raw_assembler_; |
358 Code::Flags flags_; | 341 Code::Flags flags_; |
359 const char* name_; | 342 const char* name_; |
360 bool code_generated_; | 343 bool code_generated_; |
361 ZoneVector<Variable::Impl*> variables_; | 344 ZoneVector<Variable::Impl*> variables_; |
362 | 345 |
363 DISALLOW_COPY_AND_ASSIGN(CodeAssembler); | 346 DISALLOW_COPY_AND_ASSIGN(CodeAssembler); |
364 }; | 347 }; |
365 | 348 |
366 DEFINE_OPERATORS_FOR_FLAGS(CodeAssembler::AllocationFlags); | 349 DEFINE_OPERATORS_FOR_FLAGS(CodeAssembler::AllocationFlags); |
(...skipping 30 matching lines...) Expand all Loading... | |
397 // Map of variables to the list of value nodes that have been added from each | 380 // Map of variables to the list of value nodes that have been added from each |
398 // merge path in their order of merging. | 381 // merge path in their order of merging. |
399 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; | 382 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; |
400 }; | 383 }; |
401 | 384 |
402 } // namespace compiler | 385 } // namespace compiler |
403 } // namespace internal | 386 } // namespace internal |
404 } // namespace v8 | 387 } // namespace v8 |
405 | 388 |
406 #endif // V8_COMPILER_CODE_ASSEMBLER_H_ | 389 #endif // V8_COMPILER_CODE_ASSEMBLER_H_ |
OLD | NEW |