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

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

Issue 1909343002: [turbofan] Move more type checks to the representation selector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 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 404eb1c16cb7c38ccec1e9f5cefea7d4b94ad01c..9a054504b64fc649c05331971338d978033df9c9 100644
--- a/src/compiler/representation-change.cc
+++ b/src/compiler/representation-change.cc
@@ -322,7 +322,13 @@ Node* RepresentationChanger::GetFloat64RepresentationFor(
op = machine()->ChangeUint32ToFloat64();
}
} else if (output_rep == MachineRepresentation::kTagged) {
- if (output_type->Is(Type::NumberOrUndefined())) {
+ if (output_type->Is(Type::Undefined())) {
+ return jsgraph()->Float64Constant(
+ std::numeric_limits<double>::quiet_NaN());
Jarin 2016/04/22 10:35:30 Nice! Thanks.
+ } else if (output_type->Is(Type::TaggedSigned())) {
+ node = InsertChangeTaggedSignedToInt32(node);
+ op = machine()->ChangeInt32ToFloat64();
+ } else if (output_type->Is(Type::NumberOrUndefined())) {
op = simplified()->ChangeTaggedToFloat64();
}
} else if (output_rep == MachineRepresentation::kFloat32) {
@@ -377,7 +383,9 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
op = machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript);
}
} else if (output_rep == MachineRepresentation::kTagged) {
- if (output_type->Is(Type::Unsigned32())) {
+ if (output_type->Is(Type::TaggedSigned())) {
+ op = simplified()->ChangeTaggedSignedToInt32();
+ } else if (output_type->Is(Type::Unsigned32())) {
op = simplified()->ChangeTaggedToUint32();
} else if (output_type->Is(Type::Signed32())) {
op = simplified()->ChangeTaggedToInt32();
@@ -553,6 +561,11 @@ Node* RepresentationChanger::InsertChangeFloat64ToInt32(Node* node) {
return jsgraph()->graph()->NewNode(machine()->ChangeFloat64ToInt32(), node);
}
+Node* RepresentationChanger::InsertChangeTaggedSignedToInt32(Node* node) {
+ return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedSignedToInt32(),
+ node);
+}
+
Node* RepresentationChanger::InsertChangeTaggedToFloat64(Node* node) {
return jsgraph()->graph()->NewNode(simplified()->ChangeTaggedToFloat64(),
node);
« 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