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 #include "src/compiler/change-lowering.h" | 5 #include "src/compiler/change-lowering.h" |
6 #include "src/compiler/machine-operator.h" | 6 #include "src/compiler/machine-operator.h" |
7 | 7 |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 Reduction ChangeLowering::ChangeTaggedToUI32(Node* val, Node* control, | 161 Reduction ChangeLowering::ChangeTaggedToUI32(Node* val, Node* control, |
162 Signedness signedness) { | 162 Signedness signedness) { |
163 STATIC_ASSERT(kSmiTag == 0); | 163 STATIC_ASSERT(kSmiTag == 0); |
164 STATIC_ASSERT(kSmiTagMask == 1); | 164 STATIC_ASSERT(kSmiTagMask == 1); |
165 | 165 |
166 Node* tag = graph()->NewNode(machine()->WordAnd(), val, | 166 Node* tag = graph()->NewNode(machine()->WordAnd(), val, |
167 jsgraph()->Int32Constant(kSmiTagMask)); | 167 jsgraph()->Int32Constant(kSmiTagMask)); |
168 Node* branch = graph()->NewNode(common()->Branch(), tag, control); | 168 Node* branch = graph()->NewNode(common()->Branch(), tag, control); |
169 | 169 |
170 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 170 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
171 Operator* op = (signedness == kSigned) ? machine()->ChangeFloat64ToInt32() | 171 const Operator* op = (signedness == kSigned) |
172 : machine()->ChangeFloat64ToUint32(); | 172 ? machine()->ChangeFloat64ToInt32() |
| 173 : machine()->ChangeFloat64ToUint32(); |
173 Node* change = graph()->NewNode(op, LoadHeapNumberValue(val, if_true)); | 174 Node* change = graph()->NewNode(op, LoadHeapNumberValue(val, if_true)); |
174 | 175 |
175 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 176 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
176 Node* number = ChangeSmiToInt32(val); | 177 Node* number = ChangeSmiToInt32(val); |
177 | 178 |
178 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); | 179 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); |
179 Node* phi = graph()->NewNode( | 180 Node* phi = graph()->NewNode( |
180 common()->Phi((signedness == kSigned) ? kMachInt32 : kMachUint32, 2), | 181 common()->Phi((signedness == kSigned) ? kMachInt32 : kMachUint32, 2), |
181 change, number, merge); | 182 change, number, merge); |
182 | 183 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); } | 242 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); } |
242 | 243 |
243 | 244 |
244 CommonOperatorBuilder* ChangeLowering::common() const { | 245 CommonOperatorBuilder* ChangeLowering::common() const { |
245 return jsgraph()->common(); | 246 return jsgraph()->common(); |
246 } | 247 } |
247 | 248 |
248 } // namespace compiler | 249 } // namespace compiler |
249 } // namespace internal | 250 } // namespace internal |
250 } // namespace v8 | 251 } // namespace v8 |
OLD | NEW |