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

Unified Diff: src/compiler/js-inlining.cc

Issue 1221103003: [turbofan] Move context specialization into JSContextSpecializer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix predicate. Created 5 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
Index: src/compiler/js-inlining.cc
diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc
index 81bfd98fd5551f88d9a432a2b3335c0aef53ff66..88d91718e551c7f3abcaa9e0c1dd3c0ad1a6dcb3 100644
--- a/src/compiler/js-inlining.cc
+++ b/src/compiler/js-inlining.cc
@@ -115,8 +115,8 @@ class CopyVisitor {
};
-Reduction JSInliner::InlineCall(Node* call, Node* frame_state, Node* start,
- Node* end) {
+Reduction JSInliner::InlineCall(Node* call, Node* context, Node* frame_state,
+ Node* start, Node* end) {
// The scheduler is smart enough to place our code; we just ensure {control}
// becomes the control input of the start of the inlinee, and {effect} becomes
// the effect input of the start of the inlinee.
@@ -139,14 +139,12 @@ Reduction JSInliner::InlineCall(Node* call, Node* frame_state, Node* start,
if (index < inliner_inputs && index < inlinee_context_index) {
// There is an input from the call, and the index is a value
// projection but not the context, so rewire the input.
- ReplaceWithValue(use, call->InputAt(index));
+ Replace(use, call->InputAt(index));
} else if (index == inlinee_context_index) {
- // TODO(turbofan): We always context specialize inlinees currently, so
- // we should never get here.
- UNREACHABLE();
+ Replace(use, context);
} else if (index < inlinee_context_index) {
// Call has fewer arguments than required, fill with undefined.
- ReplaceWithValue(use, jsgraph_->UndefinedConstant());
+ Replace(use, jsgraph_->UndefinedConstant());
} else {
// We got too many arguments, discard for now.
// TODO(sigurds): Fix to treat arguments array correctly.
@@ -307,13 +305,14 @@ Reduction JSInliner::Reduce(Node* node) {
Graph graph(info.zone());
JSGraph jsgraph(info.isolate(), &graph, jsgraph_->common(),
jsgraph_->javascript(), jsgraph_->machine());
+ AstGraphBuilder graph_builder(local_zone_, &info, &jsgraph);
+ graph_builder.CreateGraph(false);
// The inlinee specializes to the context from the JSFunction object.
// TODO(turbofan): We might want to load the context from the JSFunction at
// runtime in case we only know the SharedFunctionInfo once we have dynamic
// type feedback in the compiler.
- AstGraphBuilder graph_builder(local_zone_, &info, &jsgraph);
- graph_builder.CreateGraph(true, false);
+ Node* context = jsgraph_->Constant(handle(function->context()));
CopyVisitor visitor(&graph, jsgraph_->graph(), info.zone());
visitor.CopyGraph();
@@ -338,7 +337,7 @@ Reduction JSInliner::Reduce(Node* node) {
// Remember that we inlined this function.
info_->AddInlinedFunction(info.shared_info());
- return InlineCall(node, frame_state, start, end);
+ return InlineCall(node, context, frame_state, start, end);
}
} // namespace compiler

Powered by Google App Engine
This is Rietveld 408576698