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

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

Issue 1380113002: [turbofan] Call FastNewContextStub for function context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment. Created 5 years, 3 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/js-operator.h » ('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 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());
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698