| Index: src/compiler/ast-graph-builder.cc
|
| diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
|
| index f8f010d816ad1f91c6164539c7a751eca53b7e4b..42a1cb82e35c736399bdf0c7ad0d128ce6ae4447 100644
|
| --- a/src/compiler/ast-graph-builder.cc
|
| +++ b/src/compiler/ast-graph-builder.cc
|
| @@ -535,10 +535,10 @@ bool AstGraphBuilder::CreateGraph(bool stack_check) {
|
| env.RawParameterBind(0, patched_receiver);
|
| }
|
|
|
| - // Build function context only if there are context allocated variables.
|
| + // Build local context only if there are context allocated variables.
|
| if (info()->num_heap_slots() > 0) {
|
| - // Push a new inner context scope for the function.
|
| - Node* inner_context = BuildLocalFunctionContext(GetFunctionContext());
|
| + // Push a new inner context scope for the current activation.
|
| + Node* inner_context = BuildLocalActivationContext(GetFunctionContext());
|
| ContextScope top_context(this, scope, inner_context);
|
| CreateGraphBody(stack_check);
|
| } else {
|
| @@ -3093,15 +3093,13 @@ Node* AstGraphBuilder::BuildPatchReceiverToGlobalProxy(Node* receiver) {
|
| }
|
|
|
|
|
| -Node* AstGraphBuilder::BuildLocalFunctionContext(Node* context) {
|
| +Node* AstGraphBuilder::BuildLocalActivationContext(Node* context) {
|
| Scope* scope = info()->scope();
|
| - Node* closure = GetFunctionClosure();
|
|
|
| // Allocate a new local context.
|
| - Node* local_context =
|
| - scope->is_script_scope()
|
| - ? BuildLocalScriptContext(scope)
|
| - : NewNode(javascript()->CreateFunctionContext(), closure);
|
| + Node* local_context = scope->is_script_scope()
|
| + ? BuildLocalScriptContext(scope)
|
| + : BuildLocalFunctionContext(scope);
|
|
|
| if (scope->has_this_declaration() && scope->receiver()->IsContextSlot()) {
|
| Node* receiver = environment()->RawParameterLookup(0);
|
| @@ -3128,6 +3126,18 @@ Node* AstGraphBuilder::BuildLocalFunctionContext(Node* context) {
|
| }
|
|
|
|
|
| +Node* AstGraphBuilder::BuildLocalFunctionContext(Scope* scope) {
|
| + DCHECK(scope->is_function_scope());
|
| +
|
| + // Allocate a new local context.
|
| + int slot_count = scope->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
|
| + const Operator* op = javascript()->CreateFunctionContext(slot_count);
|
| + Node* local_context = NewNode(op, GetFunctionClosure());
|
| +
|
| + return local_context;
|
| +}
|
| +
|
| +
|
| Node* AstGraphBuilder::BuildLocalScriptContext(Scope* scope) {
|
| DCHECK(scope->is_script_scope());
|
|
|
|
|