| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Finalizes the schedule and exports it to be used for code generation. Note | 65 // Finalizes the schedule and exports it to be used for code generation. Note |
| 66 // that this RawMachineAssembler becomes invalid after export. | 66 // that this RawMachineAssembler becomes invalid after export. |
| 67 Schedule* Export(); | 67 Schedule* Export(); |
| 68 | 68 |
| 69 // =========================================================================== | 69 // =========================================================================== |
| 70 // The following utility methods create new nodes with specific operators and | 70 // The following utility methods create new nodes with specific operators and |
| 71 // place them into the current basic block. They don't perform control flow, | 71 // place them into the current basic block. They don't perform control flow, |
| 72 // hence will not switch the current basic block. | 72 // hence will not switch the current basic block. |
| 73 | 73 |
| 74 Node* UndefinedConstant() { | 74 Node* UndefinedConstant() { |
| 75 Unique<HeapObject> unique = Unique<HeapObject>::CreateImmovable( | 75 Handle<HeapObject> undefined = isolate()->factory()->undefined_value(); |
| 76 isolate()->factory()->undefined_value()); | 76 return NewNode(common()->HeapConstant(undefined)); |
| 77 return NewNode(common()->HeapConstant(unique)); | |
| 78 } | 77 } |
| 79 | 78 |
| 80 // Constants. | 79 // Constants. |
| 81 Node* PointerConstant(void* value) { | 80 Node* PointerConstant(void* value) { |
| 82 return IntPtrConstant(reinterpret_cast<intptr_t>(value)); | 81 return IntPtrConstant(reinterpret_cast<intptr_t>(value)); |
| 83 } | 82 } |
| 84 Node* IntPtrConstant(intptr_t value) { | 83 Node* IntPtrConstant(intptr_t value) { |
| 85 // TODO(dcarney): mark generated code as unserializable if value != 0. | 84 // TODO(dcarney): mark generated code as unserializable if value != 0. |
| 86 return kPointerSize == 8 ? Int64Constant(value) | 85 return kPointerSize == 8 ? Int64Constant(value) |
| 87 : Int32Constant(static_cast<int>(value)); | 86 : Int32Constant(static_cast<int>(value)); |
| 88 } | 87 } |
| 89 Node* Int32Constant(int32_t value) { | 88 Node* Int32Constant(int32_t value) { |
| 90 return NewNode(common()->Int32Constant(value)); | 89 return NewNode(common()->Int32Constant(value)); |
| 91 } | 90 } |
| 92 Node* Int64Constant(int64_t value) { | 91 Node* Int64Constant(int64_t value) { |
| 93 return NewNode(common()->Int64Constant(value)); | 92 return NewNode(common()->Int64Constant(value)); |
| 94 } | 93 } |
| 95 Node* NumberConstant(double value) { | 94 Node* NumberConstant(double value) { |
| 96 return NewNode(common()->NumberConstant(value)); | 95 return NewNode(common()->NumberConstant(value)); |
| 97 } | 96 } |
| 98 Node* Float32Constant(float value) { | 97 Node* Float32Constant(float value) { |
| 99 return NewNode(common()->Float32Constant(value)); | 98 return NewNode(common()->Float32Constant(value)); |
| 100 } | 99 } |
| 101 Node* Float64Constant(double value) { | 100 Node* Float64Constant(double value) { |
| 102 return NewNode(common()->Float64Constant(value)); | 101 return NewNode(common()->Float64Constant(value)); |
| 103 } | 102 } |
| 104 Node* HeapConstant(Handle<HeapObject> object) { | 103 Node* HeapConstant(Handle<HeapObject> object) { |
| 105 Unique<HeapObject> val = Unique<HeapObject>::CreateUninitialized(object); | |
| 106 return NewNode(common()->HeapConstant(val)); | |
| 107 } | |
| 108 Node* HeapConstant(Unique<HeapObject> object) { | |
| 109 return NewNode(common()->HeapConstant(object)); | 104 return NewNode(common()->HeapConstant(object)); |
| 110 } | 105 } |
| 111 Node* ExternalConstant(ExternalReference address) { | 106 Node* ExternalConstant(ExternalReference address) { |
| 112 return NewNode(common()->ExternalConstant(address)); | 107 return NewNode(common()->ExternalConstant(address)); |
| 113 } | 108 } |
| 114 | 109 |
| 115 Node* Projection(int index, Node* a) { | 110 Node* Projection(int index, Node* a) { |
| 116 return NewNode(common()->Projection(index), a); | 111 return NewNode(common()->Projection(index), a); |
| 117 } | 112 } |
| 118 | 113 |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 BasicBlock* current_block_; | 587 BasicBlock* current_block_; |
| 593 | 588 |
| 594 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); | 589 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); |
| 595 }; | 590 }; |
| 596 | 591 |
| 597 } // namespace compiler | 592 } // namespace compiler |
| 598 } // namespace internal | 593 } // namespace internal |
| 599 } // namespace v8 | 594 } // namespace v8 |
| 600 | 595 |
| 601 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 596 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
| OLD | NEW |