OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_MACHINE_NODE_FACTORY_H_ | 5 #ifndef V8_COMPILER_MACHINE_NODE_FACTORY_H_ |
6 #define V8_COMPILER_MACHINE_NODE_FACTORY_H_ | 6 #define V8_COMPILER_MACHINE_NODE_FACTORY_H_ |
7 | 7 |
8 #ifdef USE_SIMULATOR | 8 #ifdef USE_SIMULATOR |
9 #define MACHINE_ASSEMBLER_SUPPORTS_CALL_C 0 | 9 #define MACHINE_ASSEMBLER_SUPPORTS_CALL_C 0 |
10 #else | 10 #else |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 Node* Float64Constant(double value) { | 79 Node* Float64Constant(double value) { |
80 return NEW_NODE_0(COMMON()->Float64Constant(value)); | 80 return NEW_NODE_0(COMMON()->Float64Constant(value)); |
81 } | 81 } |
82 Node* HeapConstant(Handle<Object> object) { | 82 Node* HeapConstant(Handle<Object> object) { |
83 PrintableUnique<Object> val = | 83 PrintableUnique<Object> val = |
84 PrintableUnique<Object>::CreateUninitialized(ZONE(), object); | 84 PrintableUnique<Object>::CreateUninitialized(ZONE(), object); |
85 return NEW_NODE_0(COMMON()->HeapConstant(val)); | 85 return NEW_NODE_0(COMMON()->HeapConstant(val)); |
86 } | 86 } |
87 | 87 |
| 88 Node* Projection(int index, Node* a) { |
| 89 return NEW_NODE_1(COMMON()->Projection(index), a); |
| 90 } |
| 91 |
88 // Memory Operations. | 92 // Memory Operations. |
89 Node* Load(MachineRepresentation rep, Node* base) { | 93 Node* Load(MachineRepresentation rep, Node* base) { |
90 return Load(rep, base, Int32Constant(0)); | 94 return Load(rep, base, Int32Constant(0)); |
91 } | 95 } |
92 Node* Load(MachineRepresentation rep, Node* base, Node* index) { | 96 Node* Load(MachineRepresentation rep, Node* base, Node* index) { |
93 return NEW_NODE_2(MACHINE()->Load(rep), base, index); | 97 return NEW_NODE_2(MACHINE()->Load(rep), base, index); |
94 } | 98 } |
95 void Store(MachineRepresentation rep, Node* base, Node* value) { | 99 void Store(MachineRepresentation rep, Node* base, Node* value) { |
96 Store(rep, base, Int32Constant(0), value); | 100 Store(rep, base, Int32Constant(0), value); |
97 } | 101 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 195 } |
192 Node* Word64Not(Node* a) { return Word64Xor(a, Int64Constant(-1)); } | 196 Node* Word64Not(Node* a) { return Word64Xor(a, Int64Constant(-1)); } |
193 Node* Word64BinaryNot(Node* a) { return Word64Equal(a, Int64Constant(0)); } | 197 Node* Word64BinaryNot(Node* a) { return Word64Equal(a, Int64Constant(0)); } |
194 | 198 |
195 Node* Int32Add(Node* a, Node* b) { | 199 Node* Int32Add(Node* a, Node* b) { |
196 return NEW_NODE_2(MACHINE()->Int32Add(), a, b); | 200 return NEW_NODE_2(MACHINE()->Int32Add(), a, b); |
197 } | 201 } |
198 void Int32AddWithOverflow(Node* a, Node* b, Node** val_return, | 202 void Int32AddWithOverflow(Node* a, Node* b, Node** val_return, |
199 Node** ovf_return) { | 203 Node** ovf_return) { |
200 Node* add = NEW_NODE_2(MACHINE()->Int32AddWithOverflow(), a, b); | 204 Node* add = NEW_NODE_2(MACHINE()->Int32AddWithOverflow(), a, b); |
201 if (val_return) *val_return = NEW_NODE_1(COMMON()->Projection(0), add); | 205 if (val_return) *val_return = Projection(0, add); |
202 if (ovf_return) *ovf_return = NEW_NODE_1(COMMON()->Projection(1), add); | 206 if (ovf_return) *ovf_return = Projection(1, add); |
203 } | 207 } |
204 Node* Int32Sub(Node* a, Node* b) { | 208 Node* Int32Sub(Node* a, Node* b) { |
205 return NEW_NODE_2(MACHINE()->Int32Sub(), a, b); | 209 return NEW_NODE_2(MACHINE()->Int32Sub(), a, b); |
206 } | 210 } |
| 211 void Int32SubWithOverflow(Node* a, Node* b, Node** val_return, |
| 212 Node** ovf_return) { |
| 213 Node* add = NEW_NODE_2(MACHINE()->Int32SubWithOverflow(), a, b); |
| 214 if (val_return) *val_return = Projection(0, add); |
| 215 if (ovf_return) *ovf_return = Projection(1, add); |
| 216 } |
207 Node* Int32Mul(Node* a, Node* b) { | 217 Node* Int32Mul(Node* a, Node* b) { |
208 return NEW_NODE_2(MACHINE()->Int32Mul(), a, b); | 218 return NEW_NODE_2(MACHINE()->Int32Mul(), a, b); |
209 } | 219 } |
210 Node* Int32Div(Node* a, Node* b) { | 220 Node* Int32Div(Node* a, Node* b) { |
211 return NEW_NODE_2(MACHINE()->Int32Div(), a, b); | 221 return NEW_NODE_2(MACHINE()->Int32Div(), a, b); |
212 } | 222 } |
213 Node* Int32UDiv(Node* a, Node* b) { | 223 Node* Int32UDiv(Node* a, Node* b) { |
214 return NEW_NODE_2(MACHINE()->Int32UDiv(), a, b); | 224 return NEW_NODE_2(MACHINE()->Int32UDiv(), a, b); |
215 } | 225 } |
216 Node* Int32Mod(Node* a, Node* b) { | 226 Node* Int32Mod(Node* a, Node* b) { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 #undef NEW_NODE_3 | 381 #undef NEW_NODE_3 |
372 #undef MACHINE | 382 #undef MACHINE |
373 #undef COMMON | 383 #undef COMMON |
374 #undef ZONE | 384 #undef ZONE |
375 | 385 |
376 } // namespace compiler | 386 } // namespace compiler |
377 } // namespace internal | 387 } // namespace internal |
378 } // namespace v8 | 388 } // namespace v8 |
379 | 389 |
380 #endif // V8_COMPILER_MACHINE_NODE_FACTORY_H_ | 390 #endif // V8_COMPILER_MACHINE_NODE_FACTORY_H_ |
OLD | NEW |