OLD | NEW |
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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 3776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3787 | 3787 |
3788 void Map::UpdateFieldType(int descriptor, Handle<Name> name, | 3788 void Map::UpdateFieldType(int descriptor, Handle<Name> name, |
3789 Representation new_representation, | 3789 Representation new_representation, |
3790 Handle<Object> new_wrapped_type) { | 3790 Handle<Object> new_wrapped_type) { |
3791 DCHECK(new_wrapped_type->IsSmi() || new_wrapped_type->IsWeakCell()); | 3791 DCHECK(new_wrapped_type->IsSmi() || new_wrapped_type->IsWeakCell()); |
3792 // We store raw pointers in the queue, so no allocations are allowed. | 3792 // We store raw pointers in the queue, so no allocations are allowed. |
3793 DisallowHeapAllocation no_allocation; | 3793 DisallowHeapAllocation no_allocation; |
3794 PropertyDetails details = instance_descriptors()->GetDetails(descriptor); | 3794 PropertyDetails details = instance_descriptors()->GetDetails(descriptor); |
3795 if (details.type() != DATA) return; | 3795 if (details.type() != DATA) return; |
3796 | 3796 |
3797 Zone zone(GetIsolate()->allocator()); | 3797 Zone zone(GetIsolate()->allocator(), ZONE_NAME); |
3798 ZoneQueue<Map*> backlog(&zone); | 3798 ZoneQueue<Map*> backlog(&zone); |
3799 backlog.push(this); | 3799 backlog.push(this); |
3800 | 3800 |
3801 while (!backlog.empty()) { | 3801 while (!backlog.empty()) { |
3802 Map* current = backlog.front(); | 3802 Map* current = backlog.front(); |
3803 backlog.pop(); | 3803 backlog.pop(); |
3804 | 3804 |
3805 Object* transitions = current->raw_transitions(); | 3805 Object* transitions = current->raw_transitions(); |
3806 int num_transitions = TransitionArray::NumberOfTransitions(transitions); | 3806 int num_transitions = TransitionArray::NumberOfTransitions(transitions); |
3807 for (int i = 0; i < num_transitions; ++i) { | 3807 for (int i = 0; i < num_transitions; ++i) { |
(...skipping 16188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19996 isolate->ThrowIllegalOperation(); | 19996 isolate->ThrowIllegalOperation(); |
19997 return false; | 19997 return false; |
19998 } | 19998 } |
19999 Handle<Module> requested_module = Utils::OpenHandle(*api_requested_module); | 19999 Handle<Module> requested_module = Utils::OpenHandle(*api_requested_module); |
20000 module->requested_modules()->set(i, *requested_module); | 20000 module->requested_modules()->set(i, *requested_module); |
20001 if (!Instantiate(requested_module, context, callback)) { | 20001 if (!Instantiate(requested_module, context, callback)) { |
20002 return false; | 20002 return false; |
20003 } | 20003 } |
20004 } | 20004 } |
20005 | 20005 |
20006 Zone zone(isolate->allocator()); | 20006 Zone zone(isolate->allocator(), ZONE_NAME); |
20007 | 20007 |
20008 // Resolve imports. | 20008 // Resolve imports. |
20009 Handle<FixedArray> regular_imports(module_info->regular_imports(), isolate); | 20009 Handle<FixedArray> regular_imports(module_info->regular_imports(), isolate); |
20010 for (int i = 0, n = regular_imports->length(); i < n; ++i) { | 20010 for (int i = 0, n = regular_imports->length(); i < n; ++i) { |
20011 Handle<ModuleInfoEntry> entry( | 20011 Handle<ModuleInfoEntry> entry( |
20012 ModuleInfoEntry::cast(regular_imports->get(i)), isolate); | 20012 ModuleInfoEntry::cast(regular_imports->get(i)), isolate); |
20013 Handle<String> name(String::cast(entry->import_name()), isolate); | 20013 Handle<String> name(String::cast(entry->import_name()), isolate); |
20014 int module_request = Smi::cast(entry->module_request())->value(); | 20014 int module_request = Smi::cast(entry->module_request())->value(); |
20015 ResolveSet resolve_set(&zone); | 20015 ResolveSet resolve_set(&zone); |
20016 if (ResolveImport(module, name, module_request, true, &resolve_set) | 20016 if (ResolveImport(module, name, module_request, true, &resolve_set) |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20159 // Namespace object already exists. | 20159 // Namespace object already exists. |
20160 return Handle<JSModuleNamespace>::cast(object); | 20160 return Handle<JSModuleNamespace>::cast(object); |
20161 } | 20161 } |
20162 | 20162 |
20163 // Create the namespace object (initially empty). | 20163 // Create the namespace object (initially empty). |
20164 Handle<JSModuleNamespace> ns = isolate->factory()->NewJSModuleNamespace(); | 20164 Handle<JSModuleNamespace> ns = isolate->factory()->NewJSModuleNamespace(); |
20165 ns->set_module(*module); | 20165 ns->set_module(*module); |
20166 module->set_module_namespace(*ns); | 20166 module->set_module_namespace(*ns); |
20167 | 20167 |
20168 // Collect the export names. | 20168 // Collect the export names. |
20169 Zone zone(isolate->allocator()); | 20169 Zone zone(isolate->allocator(), ZONE_NAME); |
20170 UnorderedModuleSet visited(&zone); | 20170 UnorderedModuleSet visited(&zone); |
20171 FetchStarExports(module, &zone, &visited); | 20171 FetchStarExports(module, &zone, &visited); |
20172 Handle<ObjectHashTable> exports(module->exports(), isolate); | 20172 Handle<ObjectHashTable> exports(module->exports(), isolate); |
20173 ZoneVector<Handle<String>> names(&zone); | 20173 ZoneVector<Handle<String>> names(&zone); |
20174 names.reserve(exports->NumberOfElements()); | 20174 names.reserve(exports->NumberOfElements()); |
20175 for (int i = 0, n = exports->Capacity(); i < n; ++i) { | 20175 for (int i = 0, n = exports->Capacity(); i < n; ++i) { |
20176 Handle<Object> key(exports->KeyAt(i), isolate); | 20176 Handle<Object> key(exports->KeyAt(i), isolate); |
20177 if (!exports->IsKey(isolate, *key)) continue; | 20177 if (!exports->IsKey(isolate, *key)) continue; |
20178 DCHECK(exports->ValueAt(i)->IsCell()); | 20178 DCHECK(exports->ValueAt(i)->IsCell()); |
20179 names.push_back(Handle<String>::cast(key)); | 20179 names.push_back(Handle<String>::cast(key)); |
(...skipping 15 matching lines...) Expand all Loading... |
20195 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr)) | 20195 ns, Accessors::ModuleNamespaceEntryInfo(isolate, name, attr)) |
20196 .Check(); | 20196 .Check(); |
20197 } | 20197 } |
20198 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked(); | 20198 JSObject::PreventExtensions(ns, THROW_ON_ERROR).ToChecked(); |
20199 | 20199 |
20200 return ns; | 20200 return ns; |
20201 } | 20201 } |
20202 | 20202 |
20203 } // namespace internal | 20203 } // namespace internal |
20204 } // namespace v8 | 20204 } // namespace v8 |
OLD | NEW |