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

Side by Side Diff: src/debug/debug-scopes.cc

Issue 2465283004: [modules] Maintain array of cells for imports and local exports. (Closed)
Patch Set: Rename parameter also in header file. Created 4 years, 1 month 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/ast/modules.cc ('k') | src/factory.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/debug/debug-scopes.h" 5 #include "src/debug/debug-scopes.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/debug/debug.h" 10 #include "src/debug/debug.h"
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 void ScopeIterator::CopyModuleVarsToScopeObject(Handle<ScopeInfo> scope_info, 787 void ScopeIterator::CopyModuleVarsToScopeObject(Handle<ScopeInfo> scope_info,
788 Handle<Context> context, 788 Handle<Context> context,
789 Handle<JSObject> scope_object) { 789 Handle<JSObject> scope_object) {
790 Isolate* isolate = scope_info->GetIsolate(); 790 Isolate* isolate = scope_info->GetIsolate();
791 791
792 int module_variable_count = 792 int module_variable_count =
793 Smi::cast(scope_info->get(scope_info->ModuleVariableCountIndex())) 793 Smi::cast(scope_info->get(scope_info->ModuleVariableCountIndex()))
794 ->value(); 794 ->value();
795 for (int i = 0; i < module_variable_count; ++i) { 795 for (int i = 0; i < module_variable_count; ++i) {
796 Handle<String> local_name; 796 Handle<String> local_name;
797 bool is_export; 797 Handle<Object> value;
798 { 798 {
799 String* name; 799 String* name;
800 int index; 800 int index;
801 scope_info->ModuleVariable(i, &name, &index); 801 scope_info->ModuleVariable(i, &name, &index);
802 CHECK(!ScopeInfo::VariableIsSynthetic(name)); 802 CHECK(!ScopeInfo::VariableIsSynthetic(name));
803 local_name = handle(name, isolate); 803 local_name = handle(name, isolate);
804 DCHECK_NE(index, 0); 804 value = Module::LoadVariable(handle(context->module(), isolate), index);
805 is_export = index > 0;
806 }
807
808 Handle<Object> value;
809 if (is_export) {
810 value =
811 Module::LoadExport(handle(context->module(), isolate), local_name);
812 } else {
813 Handle<ModuleInfo> module_info(scope_info->ModuleDescriptorInfo(),
814 isolate);
815 Handle<ModuleInfoEntry> entry =
816 ModuleInfo::LookupRegularImport(module_info, local_name);
817 Handle<String> import_name(String::cast(entry->import_name()), isolate);
818 value = Module::LoadImport(handle(context->module(), isolate),
819 import_name, entry->module_request());
820 } 805 }
821 806
822 // Reflect variables under TDZ as undefined in scope object. 807 // Reflect variables under TDZ as undefined in scope object.
823 if (value->IsTheHole(isolate)) continue; 808 if (value->IsTheHole(isolate)) continue;
824 // This should always succeed. 809 // This should always succeed.
825 // TODO(verwaest): Use AddDataProperty instead. 810 // TODO(verwaest): Use AddDataProperty instead.
826 JSObject::SetOwnPropertyIgnoreAttributes(scope_object, local_name, value, 811 JSObject::SetOwnPropertyIgnoreAttributes(scope_object, local_name, value,
827 NONE) 812 NONE)
828 .Check(); 813 .Check();
829 } 814 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); 856 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden());
872 if (beg_pos <= position && position < end_pos) { 857 if (beg_pos <= position && position < end_pos) {
873 GetNestedScopeChain(isolate, inner_scope, position); 858 GetNestedScopeChain(isolate, inner_scope, position);
874 return; 859 return;
875 } 860 }
876 } 861 }
877 } 862 }
878 863
879 } // namespace internal 864 } // namespace internal
880 } // namespace v8 865 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/modules.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698