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

Unified Diff: src/compiler/effect-control-linearizer.cc

Issue 2738483002: [turbofan] Introduce TruncateTaggedPointerToBit operator. (Closed)
Patch Set: Created 3 years, 9 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/effect-control-linearizer.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/effect-control-linearizer.cc
diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc
index 768ac93242a1a8449939215e425cdeef5bc27b0f..4d94d833319e5245cbe93ba399338974e5d47a7e 100644
--- a/src/compiler/effect-control-linearizer.cc
+++ b/src/compiler/effect-control-linearizer.cc
@@ -639,6 +639,9 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kTruncateTaggedToBit:
result = LowerTruncateTaggedToBit(node);
break;
+ case IrOpcode::kTruncateTaggedPointerToBit:
+ result = LowerTruncateTaggedPointerToBit(node);
+ break;
case IrOpcode::kTruncateTaggedToFloat64:
result = LowerTruncateTaggedToFloat64(node);
break;
@@ -983,6 +986,53 @@ Node* EffectControlLinearizer::LowerTruncateTaggedToBit(Node* node) {
return done.PhiAt(0);
}
+Node* EffectControlLinearizer::LowerTruncateTaggedPointerToBit(Node* node) {
+ Node* value = node->InputAt(0);
+
+ auto if_heapnumber = __ MakeDeferredLabel<1>();
+ auto done = __ MakeLabel<5>(MachineRepresentation::kBit);
+
+ Node* zero = __ Int32Constant(0);
+ Node* fzero = __ Float64Constant(0.0);
+
+ // Check if {value} is false.
+ __ GotoIf(__ WordEqual(value, __ FalseConstant()), &done, zero);
+
+ // Check if {value} is the empty string.
+ __ GotoIf(__ WordEqual(value, __ EmptyStringConstant()), &done, zero);
+
+ // Load the map of {value}.
+ Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
+
+ // Check if the {value} is undetectable and immediately return false.
+ Node* value_map_bitfield =
+ __ LoadField(AccessBuilder::ForMapBitField(), value_map);
+ __ GotoUnless(
+ __ Word32Equal(__ Word32And(value_map_bitfield,
+ __ Int32Constant(1 << Map::kIsUndetectable)),
+ zero),
+ &done, zero);
+
+ // Check if {value} is a HeapNumber.
+ __ GotoIf(__ WordEqual(value_map, __ HeapNumberMapConstant()),
+ &if_heapnumber);
+
+ // All other values that reach here are true.
+ __ Goto(&done, __ Int32Constant(1));
+
+ __ Bind(&if_heapnumber);
+ {
+ // For HeapNumber {value}, just check that its value is not 0.0, -0.0 or
+ // NaN.
+ Node* value_value =
+ __ LoadField(AccessBuilder::ForHeapNumberValue(), value);
+ __ Goto(&done, __ Float64LessThan(fzero, __ Float64Abs(value_value)));
+ }
+
+ __ Bind(&done);
+ return done.PhiAt(0);
+}
+
Node* EffectControlLinearizer::LowerChangeTaggedToInt32(Node* node) {
Node* value = node->InputAt(0);
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698