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

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

Issue 2578103002: [parsing] Be less pessimistic about maybe_assigned of parameters. (Closed)
Patch Set: 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') | test/cctest/test-parsing.cc » ('J')
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 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 // The same parameter may occur multiple times in the parameters_ list. 1920 // The same parameter may occur multiple times in the parameters_ list.
1921 // If it does, and if it is not copied into the context object, it must 1921 // If it does, and if it is not copied into the context object, it must
1922 // receive the highest parameter index for that parameter; thus iteration 1922 // receive the highest parameter index for that parameter; thus iteration
1923 // order is relevant! 1923 // order is relevant!
1924 for (int i = num_parameters() - 1; i >= 0; --i) { 1924 for (int i = num_parameters() - 1; i >= 0; --i) {
1925 Variable* var = params_[i]; 1925 Variable* var = params_[i];
1926 DCHECK(!has_rest_ || var != rest_parameter()); 1926 DCHECK(!has_rest_ || var != rest_parameter());
1927 DCHECK_EQ(this, var->scope()); 1927 DCHECK_EQ(this, var->scope());
1928 if (uses_sloppy_arguments) { 1928 if (uses_sloppy_arguments) {
1929 var->set_is_used(); 1929 var->set_is_used();
1930 var->set_maybe_assigned();
1930 var->ForceContextAllocation(); 1931 var->ForceContextAllocation();
1931 } 1932 }
1932 AllocateParameter(var, i); 1933 AllocateParameter(var, i);
1933 } 1934 }
1934 } 1935 }
1935 1936
1936 void DeclarationScope::AllocateParameter(Variable* var, int index) { 1937 void DeclarationScope::AllocateParameter(Variable* var, int index) {
1937 if (MustAllocate(var)) { 1938 if (MustAllocate(var)) {
1938 if (MustAllocateInContext(var)) { 1939 if (MustAllocateInContext(var)) {
1939 DCHECK(var->IsUnallocated() || var->IsContextSlot()); 1940 DCHECK(var->IsUnallocated() || var->IsContextSlot());
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 Variable* function = 2104 Variable* function =
2104 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr; 2105 is_function_scope() ? AsDeclarationScope()->function_var() : nullptr;
2105 bool is_function_var_in_context = 2106 bool is_function_var_in_context =
2106 function != nullptr && function->IsContextSlot(); 2107 function != nullptr && function->IsContextSlot();
2107 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - 2108 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS -
2108 (is_function_var_in_context ? 1 : 0); 2109 (is_function_var_in_context ? 1 : 0);
2109 } 2110 }
2110 2111
2111 } // namespace internal 2112 } // namespace internal
2112 } // namespace v8 2113 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.h » ('j') | test/cctest/test-parsing.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698