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

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

Issue 2065953002: [turbofan] Introduce dedicated NumberConvertHoleNaN simplified operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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/opcodes.h ('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 86742ce10a2913844b6a5a14df374294b2350350..ecff28b66f79bf6d70bcd51b8c9bc701488d7092 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -1449,6 +1449,41 @@ class RepresentationSelector {
}
return;
}
+ case IrOpcode::kNumberConvertHoleNaN: {
+ if (truncation.TruncatesToFloat64()) {
+ // NumberConvertHoleNaN(x) => x
+ VisitUnop(node, UseInfo::TruncatingFloat64(),
+ MachineRepresentation::kFloat64);
+ if (lower()) DeferReplacement(node, node->InputAt(0));
+ } else {
+ VisitUnop(node, UseInfo::TruncatingFloat64(),
+ MachineRepresentation::kTagged);
+ if (lower()) {
+ // NumberConvertHoleNaN(x) =>
+ // Select(Word32Equal(Float64ExtractHighWord32(x),
+ // #HoleNanUpper32),
+ // #Undefined,
+ // ChangeFloat64ToTagged(x))
+ Node* value = node->InputAt(0);
+ node->ReplaceInput(
+ 0,
+ jsgraph_->graph()->NewNode(
+ jsgraph_->machine()->Word32Equal(),
+ jsgraph_->graph()->NewNode(
+ jsgraph_->machine()->Float64ExtractHighWord32(), value),
+ jsgraph_->Int32Constant(kHoleNanUpper32)));
+ node->AppendInput(jsgraph_->zone(), jsgraph_->UndefinedConstant());
+ node->AppendInput(
+ jsgraph_->zone(),
+ jsgraph_->graph()->NewNode(
+ jsgraph_->simplified()->ChangeFloat64ToTagged(), value));
+ NodeProperties::ChangeOp(
+ node, jsgraph_->common()->Select(MachineRepresentation::kTagged,
+ BranchHint::kFalse));
+ }
+ }
+ return;
+ }
case IrOpcode::kReferenceEqual: {
VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit);
if (lower()) {
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698