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

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

Issue 961973002: [turbofan] First shot at eager deoptimization in Turbofan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix 2 Created 5 years, 10 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/mips/code-generator-mips.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 bbddc992e3c62de14e7664ee8904210c1c6cef63..87e74b73d95f619369456c62a42fd86d08eccb27 100644
--- a/src/compiler/js-intrinsic-lowering.cc
+++ b/src/compiler/js-intrinsic-lowering.cc
@@ -20,8 +20,9 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange();
const Runtime::Function* const f =
Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id());
- if (f->intrinsic_type != Runtime::IntrinsicType::INLINE) return NoChange();
switch (f->function_id) {
+ case Runtime::kDeoptimizeNow:
Michael Starzinger 2015/03/04 23:36:42 Would it be possible to move the function to INLIN
Jarin 2015/03/05 06:32:15 It would be possible, but we would also have to im
+ return ReduceDeoptimizeNow(node);
case Runtime::kInlineIsSmi:
return ReduceInlineIsSmi(node);
case Runtime::kInlineIsNonNegativeSmi:
@@ -41,6 +42,46 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
}
+Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) {
+ if (!FLAG_turbo_deoptimization) return NoChange();
+
+ Node* frame_state = NodeProperties::GetFrameStateInput(node);
+ DCHECK_EQ(frame_state->opcode(), IrOpcode::kFrameState);
+
+ Node* effect = NodeProperties::GetEffectInput(node);
+ Node* control = NodeProperties::GetControlInput(node);
+
+ // We are making the continuation after the call dead. To
+ // model this, we generate if (true) statement with deopt
+ // in the true branch and continuation in the false branch.
+ Node* branch =
+ graph()->NewNode(common()->Branch(), jsgraph()->TrueConstant(), control);
+
+ // False branch - the original continuation.
+ Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
+ NodeProperties::ReplaceWithValue(node, jsgraph()->UndefinedConstant(), effect,
+ if_false);
+
+ // True branch: deopt.
+ Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
+ Node* deopt =
+ graph()->NewNode(common()->Deoptimize(), frame_state, effect, if_true);
+
+ // Connect the deopt to the merge exiting the graph.
+ Node* end_pred = NodeProperties::GetControlInput(graph()->end());
+ if (end_pred->opcode() == IrOpcode::kMerge) {
+ int inputs = end_pred->op()->ControlInputCount() + 1;
+ end_pred->AppendInput(graph()->zone(), deopt);
+ end_pred->set_op(common()->Merge(inputs));
+ } else {
+ Node* merge = graph()->NewNode(common()->Merge(2), end_pred, deopt);
+ NodeProperties::ReplaceControlInput(graph()->end(), merge);
+ }
+
+ return Changed(deopt);
+}
+
+
Reduction JSIntrinsicLowering::ReduceInlineIsSmi(Node* node) {
return Change(node, simplified()->ObjectIsSmi());
}
« no previous file with comments | « src/compiler/js-intrinsic-lowering.h ('k') | src/compiler/mips/code-generator-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698