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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // Finalizes the schedule and exports it to be used for code generation. Note | 66 // Finalizes the schedule and exports it to be used for code generation. Note |
67 // that this RawMachineAssembler becomes invalid after export. | 67 // that this RawMachineAssembler becomes invalid after export. |
68 Schedule* Export(); | 68 Schedule* Export(); |
69 | 69 |
70 // =========================================================================== | 70 // =========================================================================== |
71 // The following utility methods create new nodes with specific operators and | 71 // The following utility methods create new nodes with specific operators and |
72 // place them into the current basic block. They don't perform control flow, | 72 // place them into the current basic block. They don't perform control flow, |
73 // hence will not switch the current basic block. | 73 // hence will not switch the current basic block. |
74 | 74 |
75 Node* UndefinedConstant() { | 75 Node* UndefinedConstant() { |
76 Handle<HeapObject> undefined = isolate()->factory()->undefined_value(); | 76 return HeapConstant(isolate()->factory()->undefined_value()); |
77 return AddNode(common()->HeapConstant(undefined)); | |
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 AddNode(common()->Int32Constant(value)); | 89 return AddNode(common()->Int32Constant(value)); |
91 } | 90 } |
92 Node* Int64Constant(int64_t value) { | 91 Node* Int64Constant(int64_t value) { |
93 return AddNode(common()->Int64Constant(value)); | 92 return AddNode(common()->Int64Constant(value)); |
94 } | 93 } |
95 Node* NumberConstant(double value) { | 94 Node* NumberConstant(double value) { |
96 return AddNode(common()->NumberConstant(value)); | 95 return AddNode(common()->NumberConstant(value)); |
97 } | 96 } |
98 Node* Float32Constant(float value) { | 97 Node* Float32Constant(float value) { |
99 return AddNode(common()->Float32Constant(value)); | 98 return AddNode(common()->Float32Constant(value)); |
100 } | 99 } |
101 Node* Float64Constant(double value) { | 100 Node* Float64Constant(double value) { |
102 return AddNode(common()->Float64Constant(value)); | 101 return AddNode(common()->Float64Constant(value)); |
103 } | 102 } |
104 Node* HeapConstant(Handle<HeapObject> object) { | 103 Node* HeapConstant(Handle<HeapObject> object) { |
105 return AddNode(common()->HeapConstant(object)); | 104 return AddNode(common()->HeapConstant(object)); |
106 } | 105 } |
| 106 Node* BooleanConstant(bool value) { |
| 107 Handle<Object> object = isolate()->factory()->ToBoolean(value); |
| 108 return HeapConstant(Handle<HeapObject>::cast(object)); |
| 109 } |
107 Node* ExternalConstant(ExternalReference address) { | 110 Node* ExternalConstant(ExternalReference address) { |
108 return AddNode(common()->ExternalConstant(address)); | 111 return AddNode(common()->ExternalConstant(address)); |
109 } | 112 } |
110 | 113 |
111 Node* Projection(int index, Node* a) { | 114 Node* Projection(int index, Node* a) { |
112 return AddNode(common()->Projection(index), a); | 115 return AddNode(common()->Projection(index), a); |
113 } | 116 } |
114 | 117 |
115 // Memory Operations. | 118 // Memory Operations. |
116 Node* Load(MachineType rep, Node* base) { | 119 Node* Load(MachineType rep, Node* base) { |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 BasicBlock* current_block_; | 581 BasicBlock* current_block_; |
579 | 582 |
580 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); | 583 DISALLOW_COPY_AND_ASSIGN(RawMachineAssembler); |
581 }; | 584 }; |
582 | 585 |
583 } // namespace compiler | 586 } // namespace compiler |
584 } // namespace internal | 587 } // namespace internal |
585 } // namespace v8 | 588 } // namespace v8 |
586 | 589 |
587 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ | 590 #endif // V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ |
OLD | NEW |