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 "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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 PrintList("context slots", Context::MIN_CONTEXT_SLOTS, | 751 PrintList("context slots", Context::MIN_CONTEXT_SLOTS, |
752 ContextLocalNameEntriesIndex(), | 752 ContextLocalNameEntriesIndex(), |
753 ContextLocalNameEntriesIndex() + ContextLocalCount(), this); | 753 ContextLocalNameEntriesIndex() + ContextLocalCount(), this); |
754 } | 754 } |
755 | 755 |
756 PrintF("}\n"); | 756 PrintF("}\n"); |
757 } | 757 } |
758 #endif // DEBUG | 758 #endif // DEBUG |
759 | 759 |
760 | 760 |
761 //--------------------------------------------------------------------------- | |
762 // ModuleInfo. | |
763 | |
764 Handle<ModuleInfo> ModuleInfo::Create(Isolate* isolate, | |
765 ModuleDescriptor* descriptor, | |
766 Scope* scope) { | |
767 Handle<ModuleInfo> info = Allocate(isolate, descriptor->Length()); | |
768 info->set_host_index(descriptor->Index()); | |
769 int i = 0; | |
770 for (ModuleDescriptor::Iterator it = descriptor->iterator(); !it.done(); | |
771 it.Advance(), ++i) { | |
772 Variable* var = scope->LookupLocal(it.local_name()); | |
773 info->set_name(i, *(it.export_name()->string())); | |
774 info->set_mode(i, var->mode()); | |
775 DCHECK(var->index() >= 0); | |
776 info->set_index(i, var->index()); | |
777 } | |
778 DCHECK(i == info->length()); | |
779 return info; | |
780 } | |
781 | |
782 } // namespace internal | 761 } // namespace internal |
783 } // namespace v8 | 762 } // namespace v8 |
OLD | NEW |