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

Unified Diff: src/compiler/js-intrinsic-lowering.cc

Issue 1574223002: Revert of [builtins] Refactor the remaining Date builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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/js-intrinsic-lowering.h ('k') | src/compiler/linkage.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « src/compiler/js-intrinsic-lowering.h ('k') | src/compiler/linkage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698