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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 934293002: [turbofan] Simply context specialization and fix for OSR. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index c33cc60ce573afa4b9270c3f83a8588e3f085421..d502099f5aa23cb9b0835c73afc86314d1a4a93c 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -379,7 +379,6 @@ AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info,
globals_(0, local_zone),
execution_control_(nullptr),
execution_context_(nullptr),
- function_context_(nullptr),
input_buffer_size_(0),
input_buffer_(nullptr),
exit_control_(nullptr),
@@ -399,10 +398,7 @@ Node* AstGraphBuilder::GetFunctionClosure() {
}
-Node* AstGraphBuilder::GetFunctionContext() {
- DCHECK(function_context_ != nullptr);
- return function_context_;
-}
+Node* AstGraphBuilder::GetFunctionContext() { return function_context_.get(); }
Node* AstGraphBuilder::NewOuterContextParam() {
@@ -420,7 +416,7 @@ Node* AstGraphBuilder::NewCurrentContextOsrValue() {
}
-bool AstGraphBuilder::CreateGraph() {
+bool AstGraphBuilder::CreateGraph(bool constant_context) {
Scope* scope = info()->scope();
DCHECK(graph() != NULL);
@@ -442,8 +438,12 @@ bool AstGraphBuilder::CreateGraph() {
}
// Initialize the incoming context.
- function_context_ = NewOuterContextParam();
- ContextScope incoming(this, scope, function_context_);
+ if (constant_context) {
Michael Starzinger 2015/02/18 17:37:32 nit: Can we move this logic into GetFunctionContex
titzer 2015/02/19 09:53:04 As discussed in person, I've moved this into Creat
+ function_context_.set(jsgraph()->HeapConstant(info()->context()));
+ } else {
+ function_context_.set(NewOuterContextParam());
+ }
+ ContextScope incoming(this, scope, function_context_.get());
// Build receiver check for sloppy mode if necessary.
// TODO(mstarzinger/verwaest): Should this be moved back into the CallIC?
@@ -456,7 +456,8 @@ bool AstGraphBuilder::CreateGraph() {
if (heap_slots > 0) {
// Push a new inner context scope for the function.
Node* closure = GetFunctionClosure();
- Node* inner_context = BuildLocalFunctionContext(function_context_, closure);
+ Node* inner_context =
+ BuildLocalFunctionContext(function_context_.get(), closure);
ContextScope top_context(this, scope, inner_context);
ok = CreateGraphBody();
} else {
@@ -3041,6 +3042,7 @@ void AstGraphBuilder::Environment::Merge(Environment* other) {
graph()->NewNode(common()->Merge(1), arraysize(inputs), inputs, true);
effect_dependency_ = other->effect_dependency_;
values_ = other->values_;
+ contexts_ = other->contexts_;
return;
}

Powered by Google App Engine
This is Rietveld 408576698