| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 // Either the output is uint32 or the uses only care about the | 359 // Either the output is uint32 or the uses only care about the |
| 360 // low 32 bits (so we can pick uint32 safely). | 360 // low 32 bits (so we can pick uint32 safely). |
| 361 op = simplified()->ChangeUint32ToTagged(); | 361 op = simplified()->ChangeUint32ToTagged(); |
| 362 } else { | 362 } else { |
| 363 return TypeError(node, output_rep, output_type, | 363 return TypeError(node, output_rep, output_type, |
| 364 MachineRepresentation::kTagged); | 364 MachineRepresentation::kTagged); |
| 365 } | 365 } |
| 366 } else if (output_rep == | 366 } else if (output_rep == |
| 367 MachineRepresentation::kFloat32) { // float32 -> float64 -> tagged | 367 MachineRepresentation::kFloat32) { // float32 -> float64 -> tagged |
| 368 node = InsertChangeFloat32ToFloat64(node); | 368 node = InsertChangeFloat32ToFloat64(node); |
| 369 op = simplified()->ChangeFloat64ToTagged( | 369 op = simplified()->ChangeFloat64ToTagged(); |
| 370 output_type->Maybe(Type::MinusZero()) | |
| 371 ? CheckForMinusZeroMode::kCheckForMinusZero | |
| 372 : CheckForMinusZeroMode::kDontCheckForMinusZero); | |
| 373 } else if (output_rep == MachineRepresentation::kFloat64) { | 370 } else if (output_rep == MachineRepresentation::kFloat64) { |
| 374 if (output_type->Is(Type::Signed31())) { // float64 -> int32 -> tagged | 371 if (output_type->Is(Type::Signed31())) { // float64 -> int32 -> tagged |
| 375 node = InsertChangeFloat64ToInt32(node); | 372 node = InsertChangeFloat64ToInt32(node); |
| 376 op = simplified()->ChangeInt31ToTaggedSigned(); | 373 op = simplified()->ChangeInt31ToTaggedSigned(); |
| 377 } else if (output_type->Is( | 374 } else if (output_type->Is( |
| 378 Type::Signed32())) { // float64 -> int32 -> tagged | 375 Type::Signed32())) { // float64 -> int32 -> tagged |
| 379 node = InsertChangeFloat64ToInt32(node); | 376 node = InsertChangeFloat64ToInt32(node); |
| 380 op = simplified()->ChangeInt32ToTagged(); | 377 op = simplified()->ChangeInt32ToTagged(); |
| 381 } else if (output_type->Is( | 378 } else if (output_type->Is( |
| 382 Type::Unsigned32())) { // float64 -> uint32 -> tagged | 379 Type::Unsigned32())) { // float64 -> uint32 -> tagged |
| 383 node = InsertChangeFloat64ToUint32(node); | 380 node = InsertChangeFloat64ToUint32(node); |
| 384 op = simplified()->ChangeUint32ToTagged(); | 381 op = simplified()->ChangeUint32ToTagged(); |
| 385 } else { | 382 } else { |
| 386 op = simplified()->ChangeFloat64ToTagged( | 383 op = simplified()->ChangeFloat64ToTagged(); |
| 387 output_type->Maybe(Type::MinusZero()) | |
| 388 ? CheckForMinusZeroMode::kCheckForMinusZero | |
| 389 : CheckForMinusZeroMode::kDontCheckForMinusZero); | |
| 390 } | 384 } |
| 391 } else { | 385 } else { |
| 392 return TypeError(node, output_rep, output_type, | 386 return TypeError(node, output_rep, output_type, |
| 393 MachineRepresentation::kTagged); | 387 MachineRepresentation::kTagged); |
| 394 } | 388 } |
| 395 return jsgraph()->graph()->NewNode(op, node); | 389 return jsgraph()->graph()->NewNode(op, node); |
| 396 } | 390 } |
| 397 | 391 |
| 398 | 392 |
| 399 Node* RepresentationChanger::GetFloat32RepresentationFor( | 393 Node* RepresentationChanger::GetFloat32RepresentationFor( |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 } | 989 } |
| 996 | 990 |
| 997 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { | 991 Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) { |
| 998 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), | 992 return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(), |
| 999 node); | 993 node); |
| 1000 } | 994 } |
| 1001 | 995 |
| 1002 } // namespace compiler | 996 } // namespace compiler |
| 1003 } // namespace internal | 997 } // namespace internal |
| 1004 } // namespace v8 | 998 } // namespace v8 |
| OLD | NEW |