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

Side by Side Diff: src/ast/scopes.cc

Issue 2578103002: [parsing] Be less pessimistic about maybe_assigned of parameters. (Closed)
Patch Set: Remove unused var. Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/parsing/parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/ast/ast.h" 10 #include "src/ast/ast.h"
(...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 // The same parameter may occur multiple times in the parameters_ list. 1929 // The same parameter may occur multiple times in the parameters_ list.
1930 // If it does, and if it is not copied into the context object, it must 1930 // If it does, and if it is not copied into the context object, it must
1931 // receive the highest parameter index for that parameter; thus iteration 1931 // receive the highest parameter index for that parameter; thus iteration
1932 // order is relevant! 1932 // order is relevant!
1933 for (int i = num_parameters() - 1; i >= 0; --i) { 1933 for (int i = num_parameters() - 1; i >= 0; --i) {
1934 Variable* var = params_[i]; 1934 Variable* var = params_[i];
1935 DCHECK(!has_rest_ || var != rest_parameter()); 1935 DCHECK(!has_rest_ || var != rest_parameter());
1936 DCHECK_EQ(this, var->scope()); 1936 DCHECK_EQ(this, var->scope());
1937 if (uses_sloppy_arguments) { 1937 if (uses_sloppy_arguments) {
1938 var->set_is_used(); 1938 var->set_is_used();
1939 var->set_maybe_assigned();
1939 var->ForceContextAllocation(); 1940 var->ForceContextAllocation();
1940 } 1941 }
1941 AllocateParameter(var, i); 1942 AllocateParameter(var, i);
1942 } 1943 }
1943 } 1944 }
1944 1945
1945 void DeclarationScope::AllocateParameter(Variable* var, int index) { 1946 void DeclarationScope::AllocateParameter(Variable* var, int index) {
1946 if (MustAllocate(var)) { 1947 if (MustAllocate(var)) {
1947 if (MustAllocateInContext(var)) { 1948 if (MustAllocateInContext(var)) {
1948 DCHECK(var->IsUnallocated() || var->IsContextSlot()); 1949 DCHECK(var->IsUnallocated() || var->IsContextSlot());
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 Variable* function = 2113 Variable* function =
2113 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 2114 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
2114 bool is_function_var_in_context = 2115 bool is_function_var_in_context =
2115 function != nullptr && function->IsContextSlot(); 2116 function != nullptr && function->IsContextSlot();
2116 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 2117 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
2117 (is_function_var_in_context ? 1 : 0); 2118 (is_function_var_in_context ? 1 : 0);
2118 } 2119 }
2119 2120
2120 } // namespace internal 2121 } // namespace internal
2121 } // namespace v8 2122 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698