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/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/graph-builder.h" | 9 #include "src/compiler/graph-builder.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 Node* Int64GreaterThanOrEqual(Node* a, Node* b) { | 295 Node* Int64GreaterThanOrEqual(Node* a, Node* b) { |
296 return Int64LessThanOrEqual(b, a); | 296 return Int64LessThanOrEqual(b, a); |
297 } | 297 } |
298 Node* Uint64Div(Node* a, Node* b) { | 298 Node* Uint64Div(Node* a, Node* b) { |
299 return NewNode(machine()->Uint64Div(), a, b); | 299 return NewNode(machine()->Uint64Div(), a, b); |
300 } | 300 } |
301 Node* Uint64Mod(Node* a, Node* b) { | 301 Node* Uint64Mod(Node* a, Node* b) { |
302 return NewNode(machine()->Uint64Mod(), a, b); | 302 return NewNode(machine()->Uint64Mod(), a, b); |
303 } | 303 } |
304 | 304 |
305 // TODO(turbofan): What is this used for? | |
306 Node* ConvertIntPtrToInt32(Node* a) { | |
307 return kPointerSize == 8 ? NewNode(machine()->TruncateInt64ToInt32(), a) | |
308 : a; | |
309 } | |
310 Node* ConvertInt32ToIntPtr(Node* a) { | |
311 return kPointerSize == 8 ? NewNode(machine()->ChangeInt32ToInt64(), a) : a; | |
312 } | |
313 | |
314 #define INTPTR_BINOP(prefix, name) \ | 305 #define INTPTR_BINOP(prefix, name) \ |
315 Node* IntPtr##name(Node* a, Node* b) { \ | 306 Node* IntPtr##name(Node* a, Node* b) { \ |
316 return kPointerSize == 8 ? prefix##64##name(a, b) \ | 307 return kPointerSize == 8 ? prefix##64##name(a, b) \ |
317 : prefix##32##name(a, b); \ | 308 : prefix##32##name(a, b); \ |
318 } | 309 } |
319 | 310 |
320 INTPTR_BINOP(Int, Add); | 311 INTPTR_BINOP(Int, Add); |
321 INTPTR_BINOP(Int, Sub); | 312 INTPTR_BINOP(Int, Sub); |
322 INTPTR_BINOP(Int, LessThan); | 313 INTPTR_BINOP(Int, LessThan); |
323 INTPTR_BINOP(Int, LessThanOrEqual); | 314 INTPTR_BINOP(Int, LessThanOrEqual); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 Node* Float64InsertHighWord32(Node* a, Node* b) { | 438 Node* Float64InsertHighWord32(Node* a, Node* b) { |
448 return NewNode(machine()->Float64InsertHighWord32(), a, b); | 439 return NewNode(machine()->Float64InsertHighWord32(), a, b); |
449 } | 440 } |
450 | 441 |
451 // Stack operations. | 442 // Stack operations. |
452 Node* LoadStackPointer() { return NewNode(machine()->LoadStackPointer()); } | 443 Node* LoadStackPointer() { return NewNode(machine()->LoadStackPointer()); } |
453 | 444 |
454 // Parameters. | 445 // Parameters. |
455 Node* Parameter(size_t index); | 446 Node* Parameter(size_t index); |
456 | 447 |
| 448 // Pointer utilities. |
| 449 Node* LoadFromPointer(void* address, MachineType rep, int32_t offset = 0) { |
| 450 return Load(rep, PointerConstant(address), Int32Constant(offset)); |
| 451 } |
| 452 void StoreToPointer(void* address, MachineType rep, Node* node) { |
| 453 Store(rep, PointerConstant(address), node); |
| 454 } |
| 455 Node* StringConstant(const char* string) { |
| 456 return HeapConstant(isolate()->factory()->InternalizeUtf8String(string)); |
| 457 } |
| 458 |
457 // Control flow. | 459 // Control flow. |
458 Label* Exit(); | 460 Label* Exit(); |
459 void Goto(Label* label); | 461 void Goto(Label* label); |
460 void Branch(Node* condition, Label* true_val, Label* false_val); | 462 void Branch(Node* condition, Label* true_val, Label* false_val); |
461 void Switch(Node* index, Label* default_label, int32_t* case_values, | 463 void Switch(Node* index, Label* default_label, int32_t* case_values, |
462 Label** case_labels, size_t case_count); | 464 Label** case_labels, size_t case_count); |
463 // Call through CallFunctionStub with lazy deopt and frame-state. | 465 // Call through CallFunctionStub with lazy deopt and frame-state. |
464 Node* CallFunctionStub0(Node* function, Node* receiver, Node* context, | 466 Node* CallFunctionStub0(Node* function, Node* receiver, Node* context, |
465 Node* frame_state, CallFunctionFlags flags); | 467 Node* frame_state, CallFunctionFlags flags); |
466 // Call to a JS function with zero parameters. | 468 // Call to a JS function with zero parameters. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 BasicBlock* current_block_; | 515 BasicBlock* current_block_; |
514 | 516 |
515 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); | 517 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); |
516 }; | 518 }; |
517 | 519 |
518 } // namespace compiler | 520 } // namespace compiler |
519 } // namespace internal | 521 } // namespace internal |
520 } // namespace v8 | 522 } // namespace v8 |
521 | 523 |
522 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 524 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |