Chromium Code Reviews| OLD | NEW | 
|---|---|
| 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/ast/context-slot-cache.h" | 7 #include "src/ast/context-slot-cache.h" | 
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" | 
| 9 #include "src/ast/variables.h" | 9 #include "src/ast/variables.h" | 
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" | 
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 611 | 611 | 
| 612 bool ScopeInfo::VariableIsSynthetic(String* name) { | 612 bool ScopeInfo::VariableIsSynthetic(String* name) { | 
| 613 // There's currently no flag stored on the ScopeInfo to indicate that a | 613 // There's currently no flag stored on the ScopeInfo to indicate that a | 
| 614 // variable is a compiler-introduced temporary. However, to avoid conflict | 614 // variable is a compiler-introduced temporary. However, to avoid conflict | 
| 615 // with user declarations, the current temporaries like .generator_object and | 615 // with user declarations, the current temporaries like .generator_object and | 
| 616 // .result start with a dot, so we can use that as a flag. It's a hack! | 616 // .result start with a dot, so we can use that as a flag. It's a hack! | 
| 617 return name->length() == 0 || name->Get(0) == '.' || | 617 return name->length() == 0 || name->Get(0) == '.' || | 
| 618 name->Equals(name->GetHeap()->this_string()); | 618 name->Equals(name->GetHeap()->this_string()); | 
| 619 } | 619 } | 
| 620 | 620 | 
| 621 bool Scope::VariableIsSynthetic(const AstRawString* name) { | |
| 
 
adamk
2016/09/19 20:01:25
Yikes, I think this should be in scopes.cc. If you
 
 | |
| 622 // There's currently no flag stored on the ScopeInfo to indicate that a | |
| 623 // variable is a compiler-introduced temporary. However, to avoid conflict | |
| 624 // with user declarations, the current temporaries like .generator_object and | |
| 625 // .result start with a dot, so we can use that as a flag. It's a hack! | |
| 626 return name->length() == 0 || name->FirstCharacter() == '.' || | |
| 627 name->IsOneByteEqualTo("this"); | |
| 628 } | |
| 621 | 629 | 
| 622 int ScopeInfo::StackSlotIndex(String* name) { | 630 int ScopeInfo::StackSlotIndex(String* name) { | 
| 623 DCHECK(name->IsInternalizedString()); | 631 DCHECK(name->IsInternalizedString()); | 
| 624 if (length() > 0) { | 632 if (length() > 0) { | 
| 625 int first_slot_index = Smi::cast(get(StackLocalFirstSlotIndex()))->value(); | 633 int first_slot_index = Smi::cast(get(StackLocalFirstSlotIndex()))->value(); | 
| 626 int start = StackLocalNamesIndex(); | 634 int start = StackLocalNamesIndex(); | 
| 627 int end = start + StackLocalCount(); | 635 int end = start + StackLocalCount(); | 
| 628 for (int i = start; i < end; ++i) { | 636 for (int i = start; i < end; ++i) { | 
| 629 if (name == get(i)) { | 637 if (name == get(i)) { | 
| 630 return i - start + first_slot_index; | 638 return i - start + first_slot_index; | 
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 } | 882 } | 
| 875 | 883 | 
| 876 Handle<ModuleInfo> result = isolate->factory()->NewModuleInfo(); | 884 Handle<ModuleInfo> result = isolate->factory()->NewModuleInfo(); | 
| 877 result->set(kSpecialExportsIndex, *special_exports); | 885 result->set(kSpecialExportsIndex, *special_exports); | 
| 878 result->set(kRegularExportsIndex, *regular_exports); | 886 result->set(kRegularExportsIndex, *regular_exports); | 
| 879 return result; | 887 return result; | 
| 880 } | 888 } | 
| 881 | 889 | 
| 882 } // namespace internal | 890 } // namespace internal | 
| 883 } // namespace v8 | 891 } // namespace v8 | 
| OLD | NEW |