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

Unified Diff: src/compiler/js-call-reducer.cc

Issue 2956843002: [turbofan] Replace uninitialized JSCall nodes with SOFT deopt. (Closed)
Patch Set: Several improvements. Created 3 years, 6 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-call-reducer.h ('k') | src/compiler/js-type-hint-lowering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-call-reducer.cc
diff --git a/src/compiler/js-call-reducer.cc b/src/compiler/js-call-reducer.cc
index 69a1925b0a20bd85011b31c1fc006051715bb58e..79fd6f6d3862d405ef90330c4526bcb957027fb4 100644
--- a/src/compiler/js-call-reducer.cc
+++ b/src/compiler/js-call-reducer.cc
@@ -949,27 +949,22 @@ Reduction JSCallReducer::ReduceJSCall(Node* node) {
if (!p.feedback().IsValid()) return NoChange();
CallICNexus nexus(p.feedback().vector(), p.feedback().slot());
if (nexus.IsUninitialized()) {
- // TODO(turbofan): Tail-calling to a CallIC stub is not supported.
- if (p.tail_call_mode() == TailCallMode::kAllow) return NoChange();
-
- // Insert a CallIC here to collect feedback for uninitialized calls.
- int const arg_count = static_cast<int>(p.arity() - 2);
- Callable callable = CodeFactory::CallIC(isolate(), p.convert_mode());
- CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState;
- CallDescriptor const* const desc = Linkage::GetStubCallDescriptor(
- isolate(), graph()->zone(), callable.descriptor(), arg_count + 1,
- flags);
- Node* stub_code = jsgraph()->HeapConstant(callable.code());
- Node* stub_arity = jsgraph()->Constant(arg_count);
- Node* slot_index =
- jsgraph()->Constant(FeedbackVector::GetIndex(p.feedback().slot()));
- Node* feedback_vector = jsgraph()->HeapConstant(p.feedback().vector());
- node->InsertInput(graph()->zone(), 0, stub_code);
- node->InsertInput(graph()->zone(), 2, stub_arity);
- node->InsertInput(graph()->zone(), 3, slot_index);
- node->InsertInput(graph()->zone(), 4, feedback_vector);
- NodeProperties::ChangeOp(node, common()->Call(desc));
- return Changed(node);
+ if (flags() & kBailoutOnUninitialized) {
+ // Introduce a SOFT deopt if the call {node} wasn't executed so far.
+ Node* frame_state = NodeProperties::FindFrameStateBefore(node);
+ Node* deoptimize = graph()->NewNode(
+ common()->Deoptimize(
+ DeoptimizeKind::kSoft,
+ DeoptimizeReason::kInsufficientTypeFeedbackForCall),
+ frame_state, effect, control);
+ // TODO(bmeurer): This should be on the AdvancedReducer somehow.
+ NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
+ Revisit(graph()->end());
+ node->TrimInputCount(0);
+ NodeProperties::ChangeOp(node, common()->Dead());
+ return Changed(node);
+ }
+ return NoChange();
}
Handle<Object> feedback(nexus.GetFeedback(), isolate());
« no previous file with comments | « src/compiler/js-call-reducer.h ('k') | src/compiler/js-type-hint-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698