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

Unified Diff: src/compiler/representation-change.cc

Issue 2312003005: [turbofan] Handle word32 truncation in word32->tagged representation change. (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/representation-change.h ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/representation-change.cc
diff --git a/src/compiler/representation-change.cc b/src/compiler/representation-change.cc
index e2a3097f7702b70b9b9ed28d874376098c437f09..6da77053e5bdd8247a8d546da4cd0ddb98f15007 100644
--- a/src/compiler/representation-change.cc
+++ b/src/compiler/representation-change.cc
@@ -149,7 +149,8 @@ Node* RepresentationChanger::GetRepresentationFor(
return GetTaggedPointerRepresentationFor(node, output_rep, output_type);
case MachineRepresentation::kTagged:
DCHECK(use_info.type_check() == TypeCheckKind::kNone);
- return GetTaggedRepresentationFor(node, output_rep, output_type);
+ return GetTaggedRepresentationFor(node, output_rep, output_type,
+ use_info.truncation());
case MachineRepresentation::kFloat32:
DCHECK(use_info.type_check() == TypeCheckKind::kNone);
return GetFloat32RepresentationFor(node, output_rep, output_type,
@@ -262,7 +263,8 @@ Node* RepresentationChanger::GetTaggedPointerRepresentationFor(
}
Node* RepresentationChanger::GetTaggedRepresentationFor(
- Node* node, MachineRepresentation output_rep, Type* output_type) {
+ Node* node, MachineRepresentation output_rep, Type* output_type,
+ Truncation truncation) {
// Eagerly fold representation changes for constants.
switch (node->opcode()) {
case IrOpcode::kNumberConstant:
@@ -312,7 +314,10 @@ Node* RepresentationChanger::GetTaggedRepresentationFor(
op = simplified()->ChangeInt31ToTaggedSigned();
} else if (output_type->Is(Type::Signed32())) {
op = simplified()->ChangeInt32ToTagged();
- } else if (output_type->Is(Type::Unsigned32())) {
+ } else if (output_type->Is(Type::Unsigned32()) ||
+ truncation.IsUsedAsWord32()) {
+ // Either the output is uint32 or the uses only care about the
+ // low 32 bits (so we can pick uint32 safely).
op = simplified()->ChangeUint32ToTagged();
} else {
return TypeError(node, output_rep, output_type,
« no previous file with comments | « src/compiler/representation-change.h ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698