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_STUB_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_CODE_STUB_ASSEMBLER_H_ |
6 #define V8_COMPILER_CODE_STUB_ASSEMBLER_H_ | 6 #define V8_COMPILER_CODE_STUB_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 17 matching lines...) Expand all Loading... |
28 namespace compiler { | 28 namespace compiler { |
29 | 29 |
30 class CallDescriptor; | 30 class CallDescriptor; |
31 class Graph; | 31 class Graph; |
32 class Node; | 32 class Node; |
33 class Operator; | 33 class Operator; |
34 class RawMachineAssembler; | 34 class RawMachineAssembler; |
35 class RawMachineLabel; | 35 class RawMachineLabel; |
36 class Schedule; | 36 class Schedule; |
37 | 37 |
38 #define CODE_STUB_ASSEMBLER_BINARY_OP_LIST(V) \ | 38 #define CODE_STUB_ASSEMBLER_COMPARE_BINARY_OP_LIST(V) \ |
39 V(Float32Equal) \ | 39 V(Float32Equal) \ |
40 V(Float32LessThan) \ | 40 V(Float32LessThan) \ |
41 V(Float32LessThanOrEqual) \ | 41 V(Float32LessThanOrEqual) \ |
42 V(Float32GreaterThan) \ | 42 V(Float32GreaterThan) \ |
43 V(Float32GreaterThanOrEqual) \ | 43 V(Float32GreaterThanOrEqual) \ |
44 V(Float64Equal) \ | 44 V(Float64Equal) \ |
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(IntPtrAdd) \ | 49 V(Int32GreaterThan) \ |
50 V(IntPtrSub) \ | 50 V(Int32GreaterThanOrEqual) \ |
51 V(Int32Add) \ | 51 V(Int32LessThan) \ |
52 V(Int32Sub) \ | 52 V(Int32LessThanOrEqual) \ |
53 V(Int32Mul) \ | 53 V(IntPtrLessThan) \ |
54 V(Int32GreaterThan) \ | 54 V(IntPtrLessThanOrEqual) \ |
55 V(Int32GreaterThanOrEqual) \ | 55 V(Uint32LessThan) \ |
56 V(Int32LessThan) \ | 56 V(UintPtrGreaterThanOrEqual) \ |
57 V(Int32LessThanOrEqual) \ | 57 V(WordEqual) \ |
58 V(Uint32LessThan) \ | 58 V(WordNotEqual) \ |
59 V(WordEqual) \ | 59 V(Word32Equal) \ |
60 V(WordNotEqual) \ | 60 V(Word32NotEqual) \ |
61 V(WordOr) \ | 61 V(Word64Equal) \ |
62 V(WordAnd) \ | 62 V(Word64NotEqual) |
63 V(WordXor) \ | 63 |
64 V(WordShl) \ | 64 #define CODE_STUB_ASSEMBLER_BINARY_OP_LIST(V) \ |
65 V(WordShr) \ | 65 CODE_STUB_ASSEMBLER_COMPARE_BINARY_OP_LIST(V) \ |
66 V(WordSar) \ | 66 V(IntPtrAdd) \ |
67 V(WordRor) \ | 67 V(IntPtrSub) \ |
68 V(Word32Equal) \ | 68 V(Int32Add) \ |
69 V(Word32NotEqual) \ | 69 V(Int32Sub) \ |
70 V(Word32Or) \ | 70 V(Int32Mul) \ |
71 V(Word32And) \ | 71 V(WordOr) \ |
72 V(Word32Xor) \ | 72 V(WordAnd) \ |
73 V(Word32Shl) \ | 73 V(WordXor) \ |
74 V(Word32Shr) \ | 74 V(WordShl) \ |
75 V(Word32Sar) \ | 75 V(WordShr) \ |
76 V(Word32Ror) \ | 76 V(WordSar) \ |
77 V(Word64Equal) \ | 77 V(WordRor) \ |
78 V(Word64NotEqual) \ | 78 V(Word32Or) \ |
79 V(Word64Or) \ | 79 V(Word32And) \ |
80 V(Word64And) \ | 80 V(Word32Xor) \ |
81 V(Word64Xor) \ | 81 V(Word32Shl) \ |
82 V(Word64Shr) \ | 82 V(Word32Shr) \ |
83 V(Word64Sar) \ | 83 V(Word32Sar) \ |
84 V(Word64Ror) \ | 84 V(Word32Ror) \ |
85 V(IntPtrLessThan) \ | 85 V(Word64Or) \ |
86 V(IntPtrLessThanOrEqual) \ | 86 V(Word64And) \ |
87 V(UintPtrGreaterThanOrEqual) | 87 V(Word64Xor) \ |
| 88 V(Word64Shr) \ |
| 89 V(Word64Sar) \ |
| 90 V(Word64Ror) |
88 | 91 |
89 #define CODE_STUB_ASSEMBLER_UNARY_OP_LIST(V) \ | 92 #define CODE_STUB_ASSEMBLER_UNARY_OP_LIST(V) \ |
90 V(ChangeFloat64ToUint32) \ | 93 V(ChangeFloat64ToUint32) \ |
91 V(ChangeInt32ToFloat64) \ | 94 V(ChangeInt32ToFloat64) \ |
92 V(ChangeInt32ToInt64) \ | 95 V(ChangeInt32ToInt64) \ |
93 V(ChangeUint32ToFloat64) \ | 96 V(ChangeUint32ToFloat64) \ |
94 V(ChangeUint32ToUint64) | 97 V(ChangeUint32ToUint64) |
95 | 98 |
96 class CodeStubAssembler { | 99 class CodeStubAssembler { |
97 public: | 100 public: |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 template <typename T> | 306 template <typename T> |
304 Node* BitFieldDecode(Node* word32) { | 307 Node* BitFieldDecode(Node* word32) { |
305 return BitFieldDecode(word32, T::kShift, T::kMask); | 308 return BitFieldDecode(word32, T::kShift, T::kMask); |
306 } | 309 } |
307 | 310 |
308 Node* BitFieldDecode(Node* word32, uint32_t shift, uint32_t mask); | 311 Node* BitFieldDecode(Node* word32, uint32_t shift, uint32_t mask); |
309 | 312 |
310 // Branching helpers. | 313 // Branching helpers. |
311 // TODO(danno): Can we be more cleverish wrt. edge-split? | 314 // TODO(danno): Can we be more cleverish wrt. edge-split? |
312 void BranchIf(Node* condition, Label* if_true, Label* if_false); | 315 void BranchIf(Node* condition, Label* if_true, Label* if_false); |
313 void BranchIfInt32LessThan(Node* a, Node* b, Label* if_true, Label* if_false); | 316 |
314 void BranchIfSmiLessThan(Node* a, Node* b, Label* if_true, Label* if_false); | 317 #define BRANCH_HELPER(name) \ |
| 318 void BranchIf##name(Node* a, Node* b, Label* if_true, Label* if_false) { \ |
| 319 BranchIf(name(a, b), if_true, if_false); \ |
| 320 } |
| 321 CODE_STUB_ASSEMBLER_COMPARE_BINARY_OP_LIST(BRANCH_HELPER) |
| 322 #undef BRANCH_HELPER |
| 323 |
| 324 void BranchIfSmiLessThan(Node* a, Node* b, Label* if_true, Label* if_false) { |
| 325 BranchIf(SmiLessThan(a, b), if_true, if_false); |
| 326 } |
| 327 |
315 void BranchIfSmiLessThanOrEqual(Node* a, Node* b, Label* if_true, | 328 void BranchIfSmiLessThanOrEqual(Node* a, Node* b, Label* if_true, |
316 Label* if_false); | 329 Label* if_false) { |
317 void BranchIfFloat64Equal(Node* a, Node* b, Label* if_true, Label* if_false); | 330 BranchIf(SmiLessThanOrEqual(a, b), if_true, if_false); |
318 void BranchIfFloat64LessThan(Node* a, Node* b, Label* if_true, | 331 } |
319 Label* if_false); | 332 |
320 void BranchIfFloat64LessThanOrEqual(Node* a, Node* b, Label* if_true, | |
321 Label* if_false); | |
322 void BranchIfFloat64GreaterThan(Node* a, Node* b, Label* if_true, | |
323 Label* if_false); | |
324 void BranchIfFloat64GreaterThanOrEqual(Node* a, Node* b, Label* if_true, | |
325 Label* if_false); | |
326 void BranchIfFloat64IsNaN(Node* value, Label* if_true, Label* if_false) { | 333 void BranchIfFloat64IsNaN(Node* value, Label* if_true, Label* if_false) { |
327 BranchIfFloat64Equal(value, value, if_false, if_true); | 334 BranchIfFloat64Equal(value, value, if_false, if_true); |
328 } | 335 } |
329 void BranchIfWord32Equal(Node* a, Node* b, Label* if_true, Label* if_false); | |
330 | 336 |
331 // Helpers which delegate to RawMachineAssembler. | 337 // Helpers which delegate to RawMachineAssembler. |
332 Factory* factory() const; | 338 Factory* factory() const; |
333 Isolate* isolate() const; | 339 Isolate* isolate() const; |
334 Zone* zone() const; | 340 Zone* zone() const; |
335 | 341 |
336 protected: | 342 protected: |
337 // Protected helpers which delegate to RawMachineAssembler. | 343 // Protected helpers which delegate to RawMachineAssembler. |
338 Graph* graph() const; | 344 Graph* graph() const; |
339 | 345 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 // Map of variables to the list of value nodes that have been added from each | 410 // Map of variables to the list of value nodes that have been added from each |
405 // merge path in their order of merging. | 411 // merge path in their order of merging. |
406 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; | 412 std::map<Variable::Impl*, std::vector<Node*>> variable_merges_; |
407 }; | 413 }; |
408 | 414 |
409 } // namespace compiler | 415 } // namespace compiler |
410 } // namespace internal | 416 } // namespace internal |
411 } // namespace v8 | 417 } // namespace v8 |
412 | 418 |
413 #endif // V8_COMPILER_CODE_STUB_ASSEMBLER_H_ | 419 #endif // V8_COMPILER_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |