OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |