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

Side by Side Diff: src/scopeinfo.cc

Issue 883823002: Implement proper scoping for "this" in arrow functions Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased against master, plus fixes. Only 4 tests failing (+2 in TurboFan) Created 5 years, 10 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
« no previous file with comments | « src/parser.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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 272 }
273 273
274 274
275 bool ScopeInfo::LocalIsSynthetic(int var) { 275 bool ScopeInfo::LocalIsSynthetic(int var) {
276 DCHECK(0 <= var && var < LocalCount()); 276 DCHECK(0 <= var && var < LocalCount());
277 // There's currently no flag stored on the ScopeInfo to indicate that a 277 // There's currently no flag stored on the ScopeInfo to indicate that a
278 // variable is a compiler-introduced temporary. However, to avoid conflict 278 // variable is a compiler-introduced temporary. However, to avoid conflict
279 // with user declarations, the current temporaries like .generator_object and 279 // with user declarations, the current temporaries like .generator_object and
280 // .result start with a dot, so we can use that as a flag. It's a hack! 280 // .result start with a dot, so we can use that as a flag. It's a hack!
281 Handle<String> name(LocalName(var)); 281 Handle<String> name(LocalName(var));
282 return name->length() > 0 && name->Get(0) == '.'; 282 return (name->length() > 0 && name->Get(0) == '.') ||
283 (name->length() == 4 && name->Get(0) == 't' && name->Get(1) == 'h' &&
284 name->Get(2) == 'i' && name->Get(3) == 's');
283 } 285 }
284 286
285 287
286 int ScopeInfo::StackSlotIndex(String* name) { 288 int ScopeInfo::StackSlotIndex(String* name) {
287 DCHECK(name->IsInternalizedString()); 289 DCHECK(name->IsInternalizedString());
288 if (length() > 0) { 290 if (length() > 0) {
289 int start = StackLocalEntriesIndex(); 291 int start = StackLocalEntriesIndex();
290 int end = StackLocalEntriesIndex() + StackLocalCount(); 292 int end = StackLocalEntriesIndex() + StackLocalCount();
291 for (int i = start; i < end; ++i) { 293 for (int i = start; i < end; ++i) {
292 if (name == get(i)) { 294 if (name == get(i)) {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 info->set_name(i, *(it.export_name()->string())); 566 info->set_name(i, *(it.export_name()->string()));
565 info->set_mode(i, var->mode()); 567 info->set_mode(i, var->mode());
566 DCHECK(var->index() >= 0); 568 DCHECK(var->index() >= 0);
567 info->set_index(i, var->index()); 569 info->set_index(i, var->index());
568 } 570 }
569 DCHECK(i == info->length()); 571 DCHECK(i == info->length());
570 return info; 572 return info;
571 } 573 }
572 574
573 } } // namespace v8::internal 575 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698