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

Side by Side Diff: src/scopeinfo.cc

Issue 422923004: Track usage of "this" and "arguments" in Scope (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix nits Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/scopes.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/scopeinfo.h" 9 #include "src/scopeinfo.h"
10 #include "src/scopes.h" 10 #include "src/scopes.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 return 0; 164 return 0;
165 } 165 }
166 166
167 167
168 int ScopeInfo::ContextLength() { 168 int ScopeInfo::ContextLength() {
169 if (length() > 0) { 169 if (length() > 0) {
170 int context_locals = ContextLocalCount(); 170 int context_locals = ContextLocalCount();
171 bool function_name_context_slot = 171 bool function_name_context_slot =
172 FunctionVariableField::decode(Flags()) == CONTEXT; 172 FunctionVariableField::decode(Flags()) == CONTEXT;
173 bool has_context = context_locals > 0 || 173 bool has_context = context_locals > 0 || function_name_context_slot ||
174 function_name_context_slot || 174 scope_type() == WITH_SCOPE ||
175 scope_type() == WITH_SCOPE || 175 (scope_type() == ARROW_SCOPE && CallsEval()) ||
176 (scope_type() == FUNCTION_SCOPE && CallsEval()) || 176 (scope_type() == FUNCTION_SCOPE && CallsEval()) ||
177 scope_type() == MODULE_SCOPE; 177 scope_type() == MODULE_SCOPE;
178 if (has_context) { 178 if (has_context) {
179 return Context::MIN_CONTEXT_SLOTS + context_locals + 179 return Context::MIN_CONTEXT_SLOTS + context_locals +
180 (function_name_context_slot ? 1 : 0); 180 (function_name_context_slot ? 1 : 0);
181 } 181 }
182 } 182 }
183 return 0; 183 return 0;
184 } 184 }
185 185
186 186
187 bool ScopeInfo::HasFunctionName() { 187 bool ScopeInfo::HasFunctionName() {
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 } else { 564 } else {
565 DCHECK(var->index() >= 0); 565 DCHECK(var->index() >= 0);
566 info->set_index(i, var->index()); 566 info->set_index(i, var->index());
567 } 567 }
568 } 568 }
569 DCHECK(i == info->length()); 569 DCHECK(i == info->length());
570 return info; 570 return info;
571 } 571 }
572 572
573 } } // namespace v8::internal 573 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698