OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/compiler/graph-assembler.h" | 5 #include "src/compiler/graph-assembler.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 namespace compiler { | 12 namespace compiler { |
13 | 13 |
14 GraphAssembler::GraphAssembler(JSGraph* jsgraph, Node* effect, Node* control, | 14 GraphAssembler::GraphAssembler(JSGraph* jsgraph, Node* effect, Node* control, |
15 Zone* zone) | 15 Zone* zone) |
16 : temp_zone_(zone), | 16 : temp_zone_(zone), |
17 jsgraph_(jsgraph), | 17 jsgraph_(jsgraph), |
18 current_effect_(effect), | 18 current_effect_(effect), |
19 current_control_(control) {} | 19 current_control_(control) {} |
20 | 20 |
21 Node* GraphAssembler::TrueConstant() { return jsgraph()->TrueConstant(); } | |
22 | |
23 Node* GraphAssembler::FalseConstant() { return jsgraph()->FalseConstant(); } | |
24 | |
25 Node* GraphAssembler::HeapNumberMapConstant() { | |
26 return jsgraph()->HeapNumberMapConstant(); | |
27 } | |
28 | |
29 Node* GraphAssembler::IntPtrConstant(intptr_t value) { | 21 Node* GraphAssembler::IntPtrConstant(intptr_t value) { |
30 return jsgraph()->IntPtrConstant(value); | 22 return jsgraph()->IntPtrConstant(value); |
31 } | 23 } |
32 | 24 |
33 Node* GraphAssembler::Int32Constant(int32_t value) { | 25 Node* GraphAssembler::Int32Constant(int32_t value) { |
34 return jsgraph()->Int32Constant(value); | 26 return jsgraph()->Int32Constant(value); |
35 } | 27 } |
36 | 28 |
| 29 Node* GraphAssembler::UniqueInt32Constant(int32_t value) { |
| 30 return graph()->NewNode(common()->Int32Constant(value)); |
| 31 } |
| 32 |
37 Node* GraphAssembler::SmiConstant(int32_t value) { | 33 Node* GraphAssembler::SmiConstant(int32_t value) { |
38 return jsgraph()->SmiConstant(value); | 34 return jsgraph()->SmiConstant(value); |
39 } | 35 } |
40 | 36 |
41 Node* GraphAssembler::Uint32Constant(int32_t value) { | 37 Node* GraphAssembler::Uint32Constant(int32_t value) { |
42 return jsgraph()->Uint32Constant(value); | 38 return jsgraph()->Uint32Constant(value); |
43 } | 39 } |
44 | 40 |
45 Node* GraphAssembler::Float64Constant(double value) { | 41 Node* GraphAssembler::Float64Constant(double value) { |
46 return jsgraph()->Float64Constant(value); | 42 return jsgraph()->Float64Constant(value); |
47 } | 43 } |
48 | 44 |
49 Node* GraphAssembler::HeapConstant(Handle<HeapObject> object) { | 45 Node* GraphAssembler::HeapConstant(Handle<HeapObject> object) { |
50 return jsgraph()->HeapConstant(object); | 46 return jsgraph()->HeapConstant(object); |
51 } | 47 } |
52 | 48 |
53 Node* GraphAssembler::NoContextConstant() { | |
54 return jsgraph()->NoContextConstant(); | |
55 } | |
56 | 49 |
57 Node* GraphAssembler::ExternalConstant(ExternalReference ref) { | 50 Node* GraphAssembler::ExternalConstant(ExternalReference ref) { |
58 return jsgraph()->ExternalConstant(ref); | 51 return jsgraph()->ExternalConstant(ref); |
59 } | 52 } |
60 | 53 |
61 Node* GraphAssembler::CEntryStubConstant(int result_size) { | 54 Node* GraphAssembler::CEntryStubConstant(int result_size) { |
62 return jsgraph()->CEntryStubConstant(result_size); | 55 return jsgraph()->CEntryStubConstant(result_size); |
63 } | 56 } |
64 | 57 |
65 Node* GraphAssembler::EmptyStringConstant() { | 58 #define SINGLETON_CONST_DEF(Name) \ |
66 return jsgraph()->EmptyStringConstant(); | 59 Node* GraphAssembler::Name() { return jsgraph()->Name(); } |
67 } | 60 JSGRAPH_SINGLETON_CONSTANT_LIST(SINGLETON_CONST_DEF) |
68 | 61 #undef SINGLETON_CONST_DEF |
69 Node* GraphAssembler::UndefinedConstant() { | |
70 return jsgraph()->UndefinedConstant(); | |
71 } | |
72 | |
73 Node* GraphAssembler::TheHoleConstant() { return jsgraph()->TheHoleConstant(); } | |
74 | |
75 Node* GraphAssembler::FixedArrayMapConstant() { | |
76 return jsgraph()->FixedArrayMapConstant(); | |
77 } | |
78 | 62 |
79 #define PURE_UNOP_DEF(Name) \ | 63 #define PURE_UNOP_DEF(Name) \ |
80 Node* GraphAssembler::Name(Node* input) { \ | 64 Node* GraphAssembler::Name(Node* input) { \ |
81 return graph()->NewNode(machine()->Name(), input); \ | 65 return graph()->NewNode(machine()->Name(), input); \ |
82 } | 66 } |
83 PURE_ASSEMBLER_MACH_UNOP_LIST(PURE_UNOP_DEF) | 67 PURE_ASSEMBLER_MACH_UNOP_LIST(PURE_UNOP_DEF) |
84 #undef PURE_UNOP_DEF | 68 #undef PURE_UNOP_DEF |
85 | 69 |
86 #define PURE_BINOP_DEF(Name) \ | 70 #define PURE_BINOP_DEF(Name) \ |
87 Node* GraphAssembler::Name(Node* left, Node* right) { \ | 71 Node* GraphAssembler::Name(Node* left, Node* right) { \ |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 value, current_effect_, current_control_); | 125 value, current_effect_, current_control_); |
142 } | 126 } |
143 | 127 |
144 Node* GraphAssembler::Store(StoreRepresentation rep, Node* object, Node* offset, | 128 Node* GraphAssembler::Store(StoreRepresentation rep, Node* object, Node* offset, |
145 Node* value) { | 129 Node* value) { |
146 return current_effect_ = | 130 return current_effect_ = |
147 graph()->NewNode(machine()->Store(rep), object, offset, value, | 131 graph()->NewNode(machine()->Store(rep), object, offset, value, |
148 current_effect_, current_control_); | 132 current_effect_, current_control_); |
149 } | 133 } |
150 | 134 |
| 135 Node* GraphAssembler::Load(MachineType rep, Node* object, Node* offset) { |
| 136 return current_effect_ = |
| 137 graph()->NewNode(machine()->Load(rep), object, offset, |
| 138 current_effect_, current_control_); |
| 139 } |
| 140 |
151 Node* GraphAssembler::Retain(Node* buffer) { | 141 Node* GraphAssembler::Retain(Node* buffer) { |
152 return current_effect_ = | 142 return current_effect_ = |
153 graph()->NewNode(common()->Retain(), buffer, current_effect_); | 143 graph()->NewNode(common()->Retain(), buffer, current_effect_); |
154 } | 144 } |
155 | 145 |
156 Node* GraphAssembler::UnsafePointerAdd(Node* base, Node* external) { | 146 Node* GraphAssembler::UnsafePointerAdd(Node* base, Node* external) { |
157 return current_effect_ = | 147 return current_effect_ = |
158 graph()->NewNode(machine()->UnsafePointerAdd(), base, external, | 148 graph()->NewNode(machine()->UnsafePointerAdd(), base, external, |
159 current_effect_, current_control_); | 149 current_effect_, current_control_); |
160 } | 150 } |
161 | 151 |
162 Node* GraphAssembler::ToNumber(Node* value) { | 152 Node* GraphAssembler::ToNumber(Node* value) { |
163 return current_effect_ = graph()->NewNode( | 153 return current_effect_ = |
164 ToNumberOperator(), jsgraph()->ToNumberBuiltinConstant(), value, | 154 graph()->NewNode(ToNumberOperator(), ToNumberBuiltinConstant(), |
165 jsgraph()->NoContextConstant(), current_effect_); | 155 value, NoContextConstant(), current_effect_); |
166 } | 156 } |
167 | 157 |
168 Node* GraphAssembler::DeoptimizeIf(DeoptimizeReason reason, Node* condition, | 158 Node* GraphAssembler::DeoptimizeIf(DeoptimizeReason reason, Node* condition, |
169 Node* frame_state) { | 159 Node* frame_state) { |
170 return current_control_ = current_effect_ = | 160 return current_control_ = current_effect_ = |
171 graph()->NewNode(common()->DeoptimizeIf(reason), condition, | 161 graph()->NewNode(common()->DeoptimizeIf(reason), condition, |
172 frame_state, current_effect_, current_control_); | 162 frame_state, current_effect_, current_control_); |
173 } | 163 } |
174 | 164 |
175 Node* GraphAssembler::DeoptimizeUnless(DeoptimizeReason reason, Node* condition, | 165 Node* GraphAssembler::DeoptimizeUnless(DeoptimizeReason reason, Node* condition, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 return representations_[phi_index]; | 278 return representations_[phi_index]; |
289 } | 279 } |
290 | 280 |
291 Node** GraphAssemblerLabel::GetControlsPtr() { return controls_; } | 281 Node** GraphAssemblerLabel::GetControlsPtr() { return controls_; } |
292 | 282 |
293 Node** GraphAssemblerLabel::GetEffectsPtr() { return effects_; } | 283 Node** GraphAssemblerLabel::GetEffectsPtr() { return effects_; } |
294 | 284 |
295 } // namespace compiler | 285 } // namespace compiler |
296 } // namespace internal | 286 } // namespace internal |
297 } // namespace v8 | 287 } // namespace v8 |
OLD | NEW |