Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/compiler/representation-change.cc

Issue 2815283002: [turbofan] Let ChangeFloat64ToTagged canonicalize to Smi if possible. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/effect-control-linearizer.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 // Either the output is uint32 or the uses only care about the 429 // Either the output is uint32 or the uses only care about the
430 // low 32 bits (so we can pick uint32 safely). 430 // low 32 bits (so we can pick uint32 safely).
431 op = simplified()->ChangeUint32ToTagged(); 431 op = simplified()->ChangeUint32ToTagged();
432 } else { 432 } else {
433 return TypeError(node, output_rep, output_type, 433 return TypeError(node, output_rep, output_type,
434 MachineRepresentation::kTagged); 434 MachineRepresentation::kTagged);
435 } 435 }
436 } else if (output_rep == 436 } else if (output_rep ==
437 MachineRepresentation::kFloat32) { // float32 -> float64 -> tagged 437 MachineRepresentation::kFloat32) { // float32 -> float64 -> tagged
438 node = InsertChangeFloat32ToFloat64(node); 438 node = InsertChangeFloat32ToFloat64(node);
439 op = simplified()->ChangeFloat64ToTagged(); 439 op = simplified()->ChangeFloat64ToTagged(
440 output_type->Maybe(Type::MinusZero())
441 ? CheckForMinusZeroMode::kCheckForMinusZero
442 : CheckForMinusZeroMode::kDontCheckForMinusZero);
440 } else if (output_rep == MachineRepresentation::kFloat64) { 443 } else if (output_rep == MachineRepresentation::kFloat64) {
441 if (output_type->Is(Type::Signed31())) { // float64 -> int32 -> tagged 444 if (output_type->Is(Type::Signed31())) { // float64 -> int32 -> tagged
442 node = InsertChangeFloat64ToInt32(node); 445 node = InsertChangeFloat64ToInt32(node);
443 op = simplified()->ChangeInt31ToTaggedSigned(); 446 op = simplified()->ChangeInt31ToTaggedSigned();
444 } else if (output_type->Is( 447 } else if (output_type->Is(
445 Type::Signed32())) { // float64 -> int32 -> tagged 448 Type::Signed32())) { // float64 -> int32 -> tagged
446 node = InsertChangeFloat64ToInt32(node); 449 node = InsertChangeFloat64ToInt32(node);
447 op = simplified()->ChangeInt32ToTagged(); 450 op = simplified()->ChangeInt32ToTagged();
448 } else if (output_type->Is( 451 } else if (output_type->Is(
449 Type::Unsigned32())) { // float64 -> uint32 -> tagged 452 Type::Unsigned32())) { // float64 -> uint32 -> tagged
450 node = InsertChangeFloat64ToUint32(node); 453 node = InsertChangeFloat64ToUint32(node);
451 op = simplified()->ChangeUint32ToTagged(); 454 op = simplified()->ChangeUint32ToTagged();
452 } else { 455 } else {
453 op = simplified()->ChangeFloat64ToTagged(); 456 op = simplified()->ChangeFloat64ToTagged(
457 output_type->Maybe(Type::MinusZero())
458 ? CheckForMinusZeroMode::kCheckForMinusZero
459 : CheckForMinusZeroMode::kDontCheckForMinusZero);
454 } 460 }
455 } else { 461 } else {
456 return TypeError(node, output_rep, output_type, 462 return TypeError(node, output_rep, output_type,
457 MachineRepresentation::kTagged); 463 MachineRepresentation::kTagged);
458 } 464 }
459 return jsgraph()->graph()->NewNode(op, node); 465 return jsgraph()->graph()->NewNode(op, node);
460 } 466 }
461 467
462 468
463 Node* RepresentationChanger::GetFloat32RepresentationFor( 469 Node* RepresentationChanger::GetFloat32RepresentationFor(
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 node); 1097 node);
1092 } 1098 }
1093 1099
1094 Node* RepresentationChanger::InsertChangeUint32ToFloat64(Node* node) { 1100 Node* RepresentationChanger::InsertChangeUint32ToFloat64(Node* node) {
1095 return jsgraph()->graph()->NewNode(machine()->ChangeUint32ToFloat64(), node); 1101 return jsgraph()->graph()->NewNode(machine()->ChangeUint32ToFloat64(), node);
1096 } 1102 }
1097 1103
1098 } // namespace compiler 1104 } // namespace compiler
1099 } // namespace internal 1105 } // namespace internal
1100 } // namespace v8 1106 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/effect-control-linearizer.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698