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

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
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/control-reducer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 30bdcfb29702987ee000983ae7aa011ae28c19d1..4b1fa1c85a605c960d5a7aa299aba4c547530e63 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,9 +398,10 @@ Node* AstGraphBuilder::GetFunctionClosure() {
}
-Node* AstGraphBuilder::GetFunctionContext() {
- DCHECK(function_context_ != nullptr);
- return function_context_;
+void AstGraphBuilder::CreateFunctionContext(bool constant_context) {
+ function_context_.set(constant_context
+ ? jsgraph()->HeapConstant(info()->context())
+ : NewOuterContextParam());
}
@@ -420,7 +420,7 @@ Node* AstGraphBuilder::NewCurrentContextOsrValue() {
}
-bool AstGraphBuilder::CreateGraph() {
+bool AstGraphBuilder::CreateGraph(bool constant_context) {
Scope* scope = info()->scope();
DCHECK(graph() != NULL);
@@ -442,8 +442,8 @@ bool AstGraphBuilder::CreateGraph() {
}
// Initialize the incoming context.
- function_context_ = NewOuterContextParam();
- ContextScope incoming(this, scope, function_context_);
+ CreateFunctionContext(constant_context);
+ 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);
CreateGraphBody();
} else {
@@ -2760,10 +2761,9 @@ Node* AstGraphBuilder::BuildLoadBuiltinsObject() {
Node* AstGraphBuilder::BuildLoadGlobalObject() {
- Node* context = GetFunctionContext();
const Operator* load_op =
javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true);
- return NewNode(load_op, context);
+ return NewNode(load_op, function_context_.get());
}
@@ -3023,6 +3023,7 @@ void AstGraphBuilder::UpdateControlDependencyToLeaveFunction(Node* exit) {
void AstGraphBuilder::Environment::Merge(Environment* other) {
DCHECK(values_.size() == other->values_.size());
+ // TODO(titzer): make context stack heights match.
DCHECK(contexts_.size() <= other->contexts_.size());
// Nothing to do if the other environment is dead.
@@ -3037,6 +3038,10 @@ void AstGraphBuilder::Environment::Merge(Environment* other) {
graph()->NewNode(common()->Merge(1), arraysize(inputs), inputs, true);
effect_dependency_ = other->effect_dependency_;
values_ = other->values_;
+ // TODO(titzer): make context stack heights match.
+ size_t min = std::min(contexts_.size(), other->contexts_.size());
+ contexts_ = other->contexts_;
+ contexts_.resize(min, nullptr);
return;
}
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/control-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698