Index: src/compiler/js-intrinsic-lowering.cc |
diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc |
index ca5cb932b4bd7606521b32ae63c7c8076779d74f..1ae45ea775c6b62db50fb5f673298ca5db285b01 100644 |
--- a/src/compiler/js-intrinsic-lowering.cc |
+++ b/src/compiler/js-intrinsic-lowering.cc |
@@ -39,6 +39,8 @@ |
return ReduceConstructDouble(node); |
case Runtime::kInlineCreateIterResultObject: |
return ReduceCreateIterResultObject(node); |
+ case Runtime::kInlineDateField: |
+ return ReduceDateField(node); |
case Runtime::kInlineDeoptimizeNow: |
return ReduceDeoptimizeNow(node); |
case Runtime::kInlineDoubleHi: |
@@ -101,6 +103,8 @@ |
return ReduceToPrimitive(node); |
case Runtime::kInlineToString: |
return ReduceToString(node); |
+ case Runtime::kInlineThrowNotDateError: |
+ return ReduceThrowNotDateError(node); |
case Runtime::kInlineCall: |
return ReduceCall(node); |
case Runtime::kInlineTailCall: |
@@ -134,6 +138,24 @@ |
high); |
ReplaceWithValue(node, value); |
return Replace(value); |
+} |
+ |
+ |
+Reduction JSIntrinsicLowering::ReduceDateField(Node* node) { |
+ Node* const value = NodeProperties::GetValueInput(node, 0); |
+ Node* const index = NodeProperties::GetValueInput(node, 1); |
+ Node* const effect = NodeProperties::GetEffectInput(node); |
+ Node* const control = NodeProperties::GetControlInput(node); |
+ NumberMatcher mindex(index); |
+ if (mindex.Is(JSDate::kDateValue)) { |
+ return Change( |
+ node, |
+ simplified()->LoadField(AccessBuilder::ForJSDateField( |
+ static_cast<JSDate::FieldIndex>(static_cast<int>(mindex.Value())))), |
+ value, effect, control); |
+ } |
+ // TODO(turbofan): Optimize more patterns. |
+ return NoChange(); |
} |
@@ -502,6 +524,24 @@ |
Reduction JSIntrinsicLowering::ReduceSubString(Node* node) { |
return Change(node, CodeFactory::SubString(isolate()), 3); |
+} |
+ |
+ |
+Reduction JSIntrinsicLowering::ReduceThrowNotDateError(Node* node) { |
+ if (mode() != kDeoptimizationEnabled) return NoChange(); |
+ Node* const frame_state = NodeProperties::GetFrameStateInput(node, 1); |
+ Node* const effect = NodeProperties::GetEffectInput(node); |
+ Node* const control = NodeProperties::GetControlInput(node); |
+ |
+ // TODO(bmeurer): Move MergeControlToEnd() to the AdvancedReducer. |
+ Node* deoptimize = |
+ graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), |
+ frame_state, effect, control); |
+ NodeProperties::MergeControlToEnd(graph(), common(), deoptimize); |
+ |
+ node->TrimInputCount(0); |
+ NodeProperties::ChangeOp(node, common()->Dead()); |
+ return Changed(node); |
} |