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

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

Issue 1916343002: [debugger] do not expose temporary variables introduced by the parser. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | src/debug/debug-frames.cc » ('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 "src/ast/scopeinfo.h" 5 #include "src/ast/scopeinfo.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 } 431 }
432 432
433 433
434 MaybeAssignedFlag ScopeInfo::ContextLocalMaybeAssignedFlag(int var) { 434 MaybeAssignedFlag ScopeInfo::ContextLocalMaybeAssignedFlag(int var) {
435 DCHECK(0 <= var && var < ContextLocalCount() + ContextGlobalCount()); 435 DCHECK(0 <= var && var < ContextLocalCount() + ContextGlobalCount());
436 int info_index = ContextLocalInfoEntriesIndex() + var; 436 int info_index = ContextLocalInfoEntriesIndex() + var;
437 int value = Smi::cast(get(info_index))->value(); 437 int value = Smi::cast(get(info_index))->value();
438 return ContextLocalMaybeAssignedFlag::decode(value); 438 return ContextLocalMaybeAssignedFlag::decode(value);
439 } 439 }
440 440
441 441 bool ScopeInfo::VariableIsSynthetic(String* name) {
442 bool ScopeInfo::LocalIsSynthetic(int var) {
443 DCHECK(0 <= var && var < LocalCount());
444 // There's currently no flag stored on the ScopeInfo to indicate that a 442 // There's currently no flag stored on the ScopeInfo to indicate that a
445 // variable is a compiler-introduced temporary. However, to avoid conflict 443 // variable is a compiler-introduced temporary. However, to avoid conflict
446 // with user declarations, the current temporaries like .generator_object and 444 // with user declarations, the current temporaries like .generator_object and
447 // .result start with a dot, so we can use that as a flag. It's a hack! 445 // .result start with a dot, so we can use that as a flag. It's a hack!
448 Handle<String> name(LocalName(var)); 446 return name->length() == 0 || name->Get(0) == '.' ||
449 return (name->length() > 0 && name->Get(0) == '.') || 447 name->Equals(name->GetHeap()->this_string());
450 name->Equals(*GetIsolate()->factory()->this_string());
451 } 448 }
452 449
453 450
454 int ScopeInfo::StackSlotIndex(String* name) { 451 int ScopeInfo::StackSlotIndex(String* name) {
455 DCHECK(name->IsInternalizedString()); 452 DCHECK(name->IsInternalizedString());
456 if (length() > 0) { 453 if (length() > 0) {
457 int first_slot_index = Smi::cast(get(StackLocalFirstSlotIndex()))->value(); 454 int first_slot_index = Smi::cast(get(StackLocalFirstSlotIndex()))->value();
458 int start = StackLocalEntriesIndex(); 455 int start = StackLocalEntriesIndex();
459 int end = StackLocalEntriesIndex() + StackLocalCount(); 456 int end = StackLocalEntriesIndex() + StackLocalCount();
460 for (int i = start; i < end; ++i) { 457 for (int i = start; i < end; ++i) {
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 info->set_mode(i, var->mode()); 774 info->set_mode(i, var->mode());
778 DCHECK(var->index() >= 0); 775 DCHECK(var->index() >= 0);
779 info->set_index(i, var->index()); 776 info->set_index(i, var->index());
780 } 777 }
781 DCHECK(i == info->length()); 778 DCHECK(i == info->length());
782 return info; 779 return info;
783 } 780 }
784 781
785 } // namespace internal 782 } // namespace internal
786 } // namespace v8 783 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/debug/debug-frames.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698