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/representation-change.h" | 5 #include "src/compiler/representation-change.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 op = simplified()->ChangeInt32ToTagged(); | 220 op = simplified()->ChangeInt32ToTagged(); |
221 } else if (output_type->Is(Type::Unsigned32())) { | 221 } else if (output_type->Is(Type::Unsigned32())) { |
222 op = simplified()->ChangeUint32ToTagged(); | 222 op = simplified()->ChangeUint32ToTagged(); |
223 } else { | 223 } else { |
224 return TypeError(node, output_rep, output_type, | 224 return TypeError(node, output_rep, output_type, |
225 MachineRepresentation::kTagged); | 225 MachineRepresentation::kTagged); |
226 } | 226 } |
227 } else if (output_rep == | 227 } else if (output_rep == |
228 MachineRepresentation::kFloat32) { // float32 -> float64 -> tagged | 228 MachineRepresentation::kFloat32) { // float32 -> float64 -> tagged |
229 node = InsertChangeFloat32ToFloat64(node); | 229 node = InsertChangeFloat32ToFloat64(node); |
230 // TODO(bmeurer): Pass -0 hint to ChangeFloat64ToTagged. | 230 op = simplified()->ChangeFloat64ToTagged( |
231 op = simplified()->ChangeFloat64ToTagged(); | 231 output_type->Maybe(Type::MinusZero()) |
| 232 ? CheckForMinusZeroMode::kCheckForMinusZero |
| 233 : CheckForMinusZeroMode::kDontCheckForMinusZero); |
232 } else if (output_rep == MachineRepresentation::kFloat64) { | 234 } else if (output_rep == MachineRepresentation::kFloat64) { |
233 if (output_type->Is(Type::Signed31())) { // float64 -> int32 -> tagged | 235 if (output_type->Is(Type::Signed31())) { // float64 -> int32 -> tagged |
234 node = InsertChangeFloat64ToInt32(node); | 236 node = InsertChangeFloat64ToInt32(node); |
235 op = simplified()->ChangeInt31ToTaggedSigned(); | 237 op = simplified()->ChangeInt31ToTaggedSigned(); |
236 } else if (output_type->Is( | 238 } else if (output_type->Is( |
237 Type::Signed32())) { // float64 -> int32 -> tagged | 239 Type::Signed32())) { // float64 -> int32 -> tagged |
238 node = InsertChangeFloat64ToInt32(node); | 240 node = InsertChangeFloat64ToInt32(node); |
239 op = simplified()->ChangeInt32ToTagged(); | 241 op = simplified()->ChangeInt32ToTagged(); |
240 } else if (output_type->Is( | 242 } else if (output_type->Is( |
241 Type::Unsigned32())) { // float64 -> uint32 -> tagged | 243 Type::Unsigned32())) { // float64 -> uint32 -> tagged |
242 node = InsertChangeFloat64ToUint32(node); | 244 node = InsertChangeFloat64ToUint32(node); |
243 op = simplified()->ChangeUint32ToTagged(); | 245 op = simplified()->ChangeUint32ToTagged(); |
244 } else { | 246 } else { |
245 // TODO(bmeurer): Pass -0 hint to ChangeFloat64ToTagged. | 247 op = simplified()->ChangeFloat64ToTagged( |
246 op = simplified()->ChangeFloat64ToTagged(); | 248 output_type->Maybe(Type::MinusZero()) |
| 249 ? CheckForMinusZeroMode::kCheckForMinusZero |
| 250 : CheckForMinusZeroMode::kDontCheckForMinusZero); |
247 } | 251 } |
248 } else { | 252 } else { |
249 return TypeError(node, output_rep, output_type, | 253 return TypeError(node, output_rep, output_type, |
250 MachineRepresentation::kTagged); | 254 MachineRepresentation::kTagged); |
251 } | 255 } |
252 return jsgraph()->graph()->NewNode(op, node); | 256 return jsgraph()->graph()->NewNode(op, node); |
253 } | 257 } |
254 | 258 |
255 | 259 |
256 Node* RepresentationChanger::GetFloat32RepresentationFor( | 260 Node* RepresentationChanger::GetFloat32RepresentationFor( |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 } | 819 } |
816 | 820 |
817 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { | 821 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { |
818 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), | 822 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), |
819 node); | 823 node); |
820 } | 824 } |
821 | 825 |
822 } // namespace compiler | 826 } // namespace compiler |
823 } // namespace internal | 827 } // namespace internal |
824 } // namespace v8 | 828 } // namespace v8 |
OLD | NEW |