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_RAW_MACHINE_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 6 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
7 | 7 |
8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 Node* Uint32Mod(Node* a, Node* b) { | 271 Node* Uint32Mod(Node* a, Node* b) { |
272 return AddNode(machine()->Uint32Mod(), a, b); | 272 return AddNode(machine()->Uint32Mod(), a, b); |
273 } | 273 } |
274 Node* Uint32MulHigh(Node* a, Node* b) { | 274 Node* Uint32MulHigh(Node* a, Node* b) { |
275 return AddNode(machine()->Uint32MulHigh(), a, b); | 275 return AddNode(machine()->Uint32MulHigh(), a, b); |
276 } | 276 } |
277 Node* Int32GreaterThan(Node* a, Node* b) { return Int32LessThan(b, a); } | 277 Node* Int32GreaterThan(Node* a, Node* b) { return Int32LessThan(b, a); } |
278 Node* Int32GreaterThanOrEqual(Node* a, Node* b) { | 278 Node* Int32GreaterThanOrEqual(Node* a, Node* b) { |
279 return Int32LessThanOrEqual(b, a); | 279 return Int32LessThanOrEqual(b, a); |
280 } | 280 } |
| 281 Node* Uint32GreaterThan(Node* a, Node* b) { return Uint32LessThan(b, a); } |
| 282 Node* Uint32GreaterThanOrEqual(Node* a, Node* b) { |
| 283 return Uint32LessThanOrEqual(b, a); |
| 284 } |
281 Node* Int32Neg(Node* a) { return Int32Sub(Int32Constant(0), a); } | 285 Node* Int32Neg(Node* a) { return Int32Sub(Int32Constant(0), a); } |
282 | 286 |
283 Node* Int64Add(Node* a, Node* b) { | 287 Node* Int64Add(Node* a, Node* b) { |
284 return AddNode(machine()->Int64Add(), a, b); | 288 return AddNode(machine()->Int64Add(), a, b); |
285 } | 289 } |
286 Node* Int64AddWithOverflow(Node* a, Node* b) { | 290 Node* Int64AddWithOverflow(Node* a, Node* b) { |
287 return AddNode(machine()->Int64AddWithOverflow(), a, b); | 291 return AddNode(machine()->Int64AddWithOverflow(), a, b); |
288 } | 292 } |
289 Node* Int64Sub(Node* a, Node* b) { | 293 Node* Int64Sub(Node* a, Node* b) { |
290 return AddNode(machine()->Int64Sub(), a, b); | 294 return AddNode(machine()->Int64Sub(), a, b); |
(...skipping 20 matching lines...) Expand all Loading... |
311 Node* Uint64LessThan(Node* a, Node* b) { | 315 Node* Uint64LessThan(Node* a, Node* b) { |
312 return AddNode(machine()->Uint64LessThan(), a, b); | 316 return AddNode(machine()->Uint64LessThan(), a, b); |
313 } | 317 } |
314 Node* Uint64LessThanOrEqual(Node* a, Node* b) { | 318 Node* Uint64LessThanOrEqual(Node* a, Node* b) { |
315 return AddNode(machine()->Uint64LessThanOrEqual(), a, b); | 319 return AddNode(machine()->Uint64LessThanOrEqual(), a, b); |
316 } | 320 } |
317 Node* Int64GreaterThan(Node* a, Node* b) { return Int64LessThan(b, a); } | 321 Node* Int64GreaterThan(Node* a, Node* b) { return Int64LessThan(b, a); } |
318 Node* Int64GreaterThanOrEqual(Node* a, Node* b) { | 322 Node* Int64GreaterThanOrEqual(Node* a, Node* b) { |
319 return Int64LessThanOrEqual(b, a); | 323 return Int64LessThanOrEqual(b, a); |
320 } | 324 } |
| 325 Node* Uint64GreaterThan(Node* a, Node* b) { return Uint64LessThan(b, a); } |
| 326 Node* Uint64GreaterThanOrEqual(Node* a, Node* b) { |
| 327 return Uint64LessThanOrEqual(b, a); |
| 328 } |
321 Node* Uint64Div(Node* a, Node* b) { | 329 Node* Uint64Div(Node* a, Node* b) { |
322 return AddNode(machine()->Uint64Div(), a, b); | 330 return AddNode(machine()->Uint64Div(), a, b); |
323 } | 331 } |
324 Node* Uint64Mod(Node* a, Node* b) { | 332 Node* Uint64Mod(Node* a, Node* b) { |
325 return AddNode(machine()->Uint64Mod(), a, b); | 333 return AddNode(machine()->Uint64Mod(), a, b); |
326 } | 334 } |
327 | 335 |
328 #define INTPTR_BINOP(prefix, name) \ | 336 #define INTPTR_BINOP(prefix, name) \ |
329 Node* IntPtr##name(Node* a, Node* b) { \ | 337 Node* IntPtr##name(Node* a, Node* b) { \ |
330 return kPointerSize == 8 ? prefix##64##name(a, b) \ | 338 return kPointerSize == 8 ? prefix##64##name(a, b) \ |
331 : prefix##32##name(a, b); \ | 339 : prefix##32##name(a, b); \ |
332 } | 340 } |
333 | 341 |
334 INTPTR_BINOP(Int, Add); | 342 INTPTR_BINOP(Int, Add); |
335 INTPTR_BINOP(Int, Sub); | 343 INTPTR_BINOP(Int, Sub); |
336 INTPTR_BINOP(Int, LessThan); | 344 INTPTR_BINOP(Int, LessThan); |
337 INTPTR_BINOP(Int, LessThanOrEqual); | 345 INTPTR_BINOP(Int, LessThanOrEqual); |
338 INTPTR_BINOP(Word, Equal); | 346 INTPTR_BINOP(Word, Equal); |
339 INTPTR_BINOP(Word, NotEqual); | 347 INTPTR_BINOP(Word, NotEqual); |
340 INTPTR_BINOP(Int, GreaterThanOrEqual); | 348 INTPTR_BINOP(Int, GreaterThanOrEqual); |
341 INTPTR_BINOP(Int, GreaterThan); | 349 INTPTR_BINOP(Int, GreaterThan); |
342 | 350 |
343 #undef INTPTR_BINOP | 351 #undef INTPTR_BINOP |
344 | 352 |
| 353 #define UINTPTR_BINOP(prefix, name) \ |
| 354 Node* UintPtr##name(Node* a, Node* b) { \ |
| 355 return kPointerSize == 8 ? prefix##64##name(a, b) \ |
| 356 : prefix##32##name(a, b); \ |
| 357 } |
| 358 |
| 359 UINTPTR_BINOP(Uint, LessThan); |
| 360 UINTPTR_BINOP(Uint, LessThanOrEqual); |
| 361 UINTPTR_BINOP(Uint, GreaterThanOrEqual); |
| 362 UINTPTR_BINOP(Uint, GreaterThan); |
| 363 |
| 364 #undef UINTPTR_BINOP |
| 365 |
345 Node* Float32Add(Node* a, Node* b) { | 366 Node* Float32Add(Node* a, Node* b) { |
346 return AddNode(machine()->Float32Add(), a, b); | 367 return AddNode(machine()->Float32Add(), a, b); |
347 } | 368 } |
348 Node* Float32Sub(Node* a, Node* b) { | 369 Node* Float32Sub(Node* a, Node* b) { |
349 return AddNode(machine()->Float32Sub(), a, b); | 370 return AddNode(machine()->Float32Sub(), a, b); |
350 } | 371 } |
351 Node* Float32Mul(Node* a, Node* b) { | 372 Node* Float32Mul(Node* a, Node* b) { |
352 return AddNode(machine()->Float32Mul(), a, b); | 373 return AddNode(machine()->Float32Mul(), a, b); |
353 } | 374 } |
354 Node* Float32Div(Node* a, Node* b) { | 375 Node* Float32Div(Node* a, Node* b) { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 } | 581 } |
561 Node* StringConstant(const char* string) { | 582 Node* StringConstant(const char* string) { |
562 return HeapConstant(isolate()->factory()->InternalizeUtf8String(string)); | 583 return HeapConstant(isolate()->factory()->InternalizeUtf8String(string)); |
563 } | 584 } |
564 | 585 |
565 // Call a given call descriptor and the given arguments. | 586 // Call a given call descriptor and the given arguments. |
566 Node* CallN(CallDescriptor* desc, Node* function, Node** args); | 587 Node* CallN(CallDescriptor* desc, Node* function, Node** args); |
567 // Call a given call descriptor and the given arguments and frame-state. | 588 // Call a given call descriptor and the given arguments and frame-state. |
568 Node* CallNWithFrameState(CallDescriptor* desc, Node* function, Node** args, | 589 Node* CallNWithFrameState(CallDescriptor* desc, Node* function, Node** args, |
569 Node* frame_state); | 590 Node* frame_state); |
| 591 // Call to a runtime function with zero arguments. |
| 592 Node* CallRuntime0(Runtime::FunctionId function, Node* context); |
570 // Call to a runtime function with one arguments. | 593 // Call to a runtime function with one arguments. |
571 Node* CallRuntime1(Runtime::FunctionId function, Node* arg0, Node* context); | 594 Node* CallRuntime1(Runtime::FunctionId function, Node* arg0, Node* context); |
572 // Call to a runtime function with two arguments. | 595 // Call to a runtime function with two arguments. |
573 Node* CallRuntime2(Runtime::FunctionId function, Node* arg1, Node* arg2, | 596 Node* CallRuntime2(Runtime::FunctionId function, Node* arg1, Node* arg2, |
574 Node* context); | 597 Node* context); |
575 // Call to a runtime function with three arguments. | 598 // Call to a runtime function with three arguments. |
576 Node* CallRuntime3(Runtime::FunctionId function, Node* arg1, Node* arg2, | 599 Node* CallRuntime3(Runtime::FunctionId function, Node* arg1, Node* arg2, |
577 Node* arg3, Node* context); | 600 Node* arg3, Node* context); |
578 // Call to a runtime function with four arguments. | 601 // Call to a runtime function with four arguments. |
579 Node* CallRuntime4(Runtime::FunctionId function, Node* arg1, Node* arg2, | 602 Node* CallRuntime4(Runtime::FunctionId function, Node* arg1, Node* arg2, |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 bool bound_; | 716 bool bound_; |
694 friend class RawMachineAssembler; | 717 friend class RawMachineAssembler; |
695 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); | 718 DISALLOW_COPY_AND_ASSIGN(RawMachineLabel); |
696 }; | 719 }; |
697 | 720 |
698 } // namespace compiler | 721 } // namespace compiler |
699 } // namespace internal | 722 } // namespace internal |
700 } // namespace v8 | 723 } // namespace v8 |
701 | 724 |
702 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 725 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |