Index: src/compiler/effect-control-linearizer.cc |
diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc |
index 98d6832afd51b83e387e80b7a22203a32b3c19b5..f68ebdf5f489ac85b8da41109fc2c0fa04c14ec1 100644 |
--- a/src/compiler/effect-control-linearizer.cc |
+++ b/src/compiler/effect-control-linearizer.cc |
@@ -455,6 +455,12 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node, |
case IrOpcode::kCheckIf: |
state = LowerCheckIf(node, frame_state, *effect, *control); |
break; |
+ case IrOpcode::kCheckHole: |
+ state = LowerCheckHole(node, frame_state, *effect, *control); |
+ break; |
+ case IrOpcode::kCheckHoleNaN: |
+ state = LowerCheckHoleNaN(node, frame_state, *effect, *control); |
+ break; |
case IrOpcode::kPlainPrimitiveToNumber: |
state = LowerPlainPrimitiveToNumber(node, *effect, *control); |
break; |
@@ -1296,6 +1302,51 @@ EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state, |
} |
EffectControlLinearizer::ValueEffectControl |
+EffectControlLinearizer::LowerCheckHole(Node* node, Node* frame_state, |
+ Node* effect, Node* control) { |
+ CheckHoleMode mode = CheckHoleModeOf(node->op()); |
+ Node* value = node->InputAt(0); |
+ Node* check = graph()->NewNode(machine()->WordEqual(), value, |
+ jsgraph()->TheHoleConstant()); |
+ switch (mode) { |
+ case CheckHoleMode::kAllowReturnHole: |
Jarin
2016/06/15 11:18:43
This is confusing - it does not return hole, it tu
Benedikt Meurer
2016/06/15 11:39:09
Done.
|
+ value = graph()->NewNode( |
+ common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse), |
+ check, jsgraph()->UndefinedConstant(), value); |
+ break; |
+ case CheckHoleMode::kNeverReturnHole: |
+ control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, |
Jarin
2016/06/15 11:18:43
kDeoptimizeIfHole?
Benedikt Meurer
2016/06/15 11:39:09
I kinda prefer the never-return-hole thing here.
|
+ frame_state, effect, control); |
+ break; |
+ } |
+ |
+ // Make sure the lowered node does not appear in any use lists. |
+ node->TrimInputCount(0); |
+ |
+ return ValueEffectControl(value, effect, control); |
+} |
+ |
+EffectControlLinearizer::ValueEffectControl |
+EffectControlLinearizer::LowerCheckHoleNaN(Node* node, Node* frame_state, |
+ Node* effect, Node* control) { |
+ // If we reach this point w/o eliminating the {node} that's marked |
+ // with allow-return-hole, we cannot do anything, so just deoptimize |
+ // in case of the hole NaN (similar to Crankshaft). |
+ Node* value = node->InputAt(0); |
+ Node* check = graph()->NewNode( |
+ machine()->Word32Equal(), |
+ graph()->NewNode(machine()->Float64ExtractHighWord32(), value), |
+ jsgraph()->Int32Constant(kHoleNanUpper32)); |
+ control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, |
+ frame_state, effect, control); |
+ |
+ // Make sure the lowered node does not appear in any use lists. |
+ node->TrimInputCount(0); |
+ |
+ return ValueEffectControl(value, effect, control); |
+} |
+ |
+EffectControlLinearizer::ValueEffectControl |
EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect, |
Node* control) { |
Node* result = effect = graph()->NewNode( |