| 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..d0043e11bc6bdbe46acef715e8adaa84be0f45a1 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),
|
| @@ -400,8 +399,10 @@ Node* AstGraphBuilder::GetFunctionClosure() {
|
|
|
|
|
| Node* AstGraphBuilder::GetFunctionContext() {
|
| - DCHECK(function_context_ != nullptr);
|
| - return function_context_;
|
| + if (!function_context_.is_set()) {
|
| + function_context_.set(NewOuterContextParam());
|
| + }
|
| + return function_context_.get();
|
| }
|
|
|
|
|
| @@ -442,8 +443,8 @@ bool AstGraphBuilder::CreateGraph() {
|
| }
|
|
|
| // Initialize the incoming context.
|
| - function_context_ = NewOuterContextParam();
|
| - ContextScope incoming(this, scope, function_context_);
|
| + Node* outer_context = GetFunctionContext();
|
| + ContextScope incoming(this, scope, outer_context);
|
|
|
| // Build receiver check for sloppy mode if necessary.
|
| // TODO(mstarzinger/verwaest): Should this be moved back into the CallIC?
|
| @@ -456,7 +457,7 @@ 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(outer_context, closure);
|
| ContextScope top_context(this, scope, inner_context);
|
| CreateGraphBody();
|
| } else {
|
|
|