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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // Either the output is uint32 or the uses only care about the | 319 // Either the output is uint32 or the uses only care about the |
320 // low 32 bits (so we can pick uint32 safely). | 320 // low 32 bits (so we can pick uint32 safely). |
321 op = simplified()->ChangeUint32ToTagged(); | 321 op = simplified()->ChangeUint32ToTagged(); |
322 } else { | 322 } else { |
323 return TypeError(node, output_rep, output_type, | 323 return TypeError(node, output_rep, output_type, |
324 MachineRepresentation::kTagged); | 324 MachineRepresentation::kTagged); |
325 } | 325 } |
326 } else if (output_rep == | 326 } else if (output_rep == |
327 MachineRepresentation::kFloat32) { // float32 -> float64 -> tagged | 327 MachineRepresentation::kFloat32) { // float32 -> float64 -> tagged |
328 node = InsertChangeFloat32ToFloat64(node); | 328 node = InsertChangeFloat32ToFloat64(node); |
329 op = simplified()->ChangeFloat64ToTagged(); | 329 op = simplified()->ChangeFloat64ToTagged( |
| 330 output_type->Maybe(Type::MinusZero()) |
| 331 ? CheckForMinusZeroMode::kCheckForMinusZero |
| 332 : CheckForMinusZeroMode::kDontCheckForMinusZero); |
330 } else if (output_rep == MachineRepresentation::kFloat64) { | 333 } else if (output_rep == MachineRepresentation::kFloat64) { |
331 if (output_type->Is(Type::Signed31())) { // float64 -> int32 -> tagged | 334 if (output_type->Is(Type::Signed31())) { // float64 -> int32 -> tagged |
332 node = InsertChangeFloat64ToInt32(node); | 335 node = InsertChangeFloat64ToInt32(node); |
333 op = simplified()->ChangeInt31ToTaggedSigned(); | 336 op = simplified()->ChangeInt31ToTaggedSigned(); |
334 } else if (output_type->Is( | 337 } else if (output_type->Is( |
335 Type::Signed32())) { // float64 -> int32 -> tagged | 338 Type::Signed32())) { // float64 -> int32 -> tagged |
336 node = InsertChangeFloat64ToInt32(node); | 339 node = InsertChangeFloat64ToInt32(node); |
337 op = simplified()->ChangeInt32ToTagged(); | 340 op = simplified()->ChangeInt32ToTagged(); |
338 } else if (output_type->Is( | 341 } else if (output_type->Is( |
339 Type::Unsigned32())) { // float64 -> uint32 -> tagged | 342 Type::Unsigned32())) { // float64 -> uint32 -> tagged |
340 node = InsertChangeFloat64ToUint32(node); | 343 node = InsertChangeFloat64ToUint32(node); |
341 op = simplified()->ChangeUint32ToTagged(); | 344 op = simplified()->ChangeUint32ToTagged(); |
342 } else { | 345 } else { |
343 op = simplified()->ChangeFloat64ToTagged(); | 346 op = simplified()->ChangeFloat64ToTagged( |
| 347 output_type->Maybe(Type::MinusZero()) |
| 348 ? CheckForMinusZeroMode::kCheckForMinusZero |
| 349 : CheckForMinusZeroMode::kDontCheckForMinusZero); |
344 } | 350 } |
345 } else { | 351 } else { |
346 return TypeError(node, output_rep, output_type, | 352 return TypeError(node, output_rep, output_type, |
347 MachineRepresentation::kTagged); | 353 MachineRepresentation::kTagged); |
348 } | 354 } |
349 return jsgraph()->graph()->NewNode(op, node); | 355 return jsgraph()->graph()->NewNode(op, node); |
350 } | 356 } |
351 | 357 |
352 | 358 |
353 Node* RepresentationChanger::GetFloat32RepresentationFor( | 359 Node* RepresentationChanger::GetFloat32RepresentationFor( |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 } | 952 } |
947 | 953 |
948 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { | 954 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { |
949 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), | 955 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), |
950 node); | 956 node); |
951 } | 957 } |
952 | 958 |
953 } // namespace compiler | 959 } // namespace compiler |
954 } // namespace internal | 960 } // namespace internal |
955 } // namespace v8 | 961 } // namespace v8 |
OLD | NEW |