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

Unified Diff: src/compiler/simplified-lowering.cc

Issue 2802113003: [turbofan] Introduce a SpeculativeToNumber operator. (Closed)
Patch Set: Paint it green! 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/operation-typer.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index 4af401df5c42a1239a387436b1d8fc96ec8866ee..09d42b362de5d9bc7825d2e668a8c4bd9527378b 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -454,6 +454,16 @@ class RepresentationSelector {
SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_CASE)
#undef DECLARE_CASE
+#define DECLARE_CASE(Name) \
+ case IrOpcode::k##Name: { \
+ new_type = \
+ Type::Intersect(op_typer_.Name(FeedbackTypeOf(node->InputAt(0))), \
+ info->restriction_type(), graph_zone()); \
+ break; \
+ }
+ SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(DECLARE_CASE)
+#undef DECLARE_CASE
+
case IrOpcode::kPlainPrimitiveToNumber:
new_type = op_typer_.ToNumber(FeedbackTypeOf(node->InputAt(0)));
break;
@@ -845,11 +855,12 @@ class RepresentationSelector {
}
// Helper for unops of the I -> O variety.
- void VisitUnop(Node* node, UseInfo input_use, MachineRepresentation output) {
+ void VisitUnop(Node* node, UseInfo input_use, MachineRepresentation output,
+ Type* restriction_type = Type::Any()) {
DCHECK_EQ(1, node->op()->ValueInputCount());
ProcessInput(node, 0, input_use);
ProcessRemainingInputs(node, 1);
- SetOutput(node, output);
+ SetOutput(node, output, restriction_type);
}
// Helper for leaf nodes.
@@ -2586,6 +2597,23 @@ class RepresentationSelector {
}
return;
}
+ case IrOpcode::kSpeculativeToNumber: {
+ NumberOperationHint const hint = NumberOperationHintOf(node->op());
+ switch (hint) {
+ case NumberOperationHint::kSigned32:
+ case NumberOperationHint::kSignedSmall:
+ VisitUnop(node, CheckedUseInfoAsWord32FromHint(hint),
+ MachineRepresentation::kWord32, Type::Signed32());
+ break;
+ case NumberOperationHint::kNumber:
+ case NumberOperationHint::kNumberOrOddball:
+ VisitUnop(node, CheckedUseInfoAsFloat64FromHint(hint),
+ MachineRepresentation::kFloat64);
+ break;
+ }
+ if (lower()) DeferReplacement(node, node->InputAt(0));
+ return;
+ }
case IrOpcode::kObjectIsDetectableCallable: {
VisitObjectIs(node, Type::DetectableCallable(), lowering);
return;
« no previous file with comments | « src/compiler/operation-typer.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698