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

Unified Diff: src/objects.cc

Issue 2345823002: [modules] Turn JSModule into Module. (Closed)
Patch Set: Address comments. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-body-descriptors-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 0f6ce61c06f0bd58af6bae4d9887c3cf8b1ac6c1..6df4f2ec59244ec51e004647d928551672a04cf9 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2480,10 +2480,6 @@ void JSObject::JSObjectShortPrint(StringStream* accumulator) {
accumulator->Add("<JS Generator>");
break;
}
- case JS_MODULE_TYPE: {
- accumulator->Add("<JS Module>");
- break;
- }
// All other JSObjects are rather similar to each other (JSObject,
// JSGlobalProxy, JSGlobalObject, JSUndetectable, JSValue).
default: {
@@ -12735,7 +12731,6 @@ bool CanSubclassHaveInobjectProperties(InstanceType instance_type) {
case JS_MAP_ITERATOR_TYPE:
case JS_MAP_TYPE:
case JS_MESSAGE_OBJECT_TYPE:
- case JS_MODULE_TYPE:
case JS_OBJECT_TYPE:
case JS_ERROR_TYPE:
case JS_ARGUMENTS_TYPE:
@@ -19470,26 +19465,27 @@ bool JSReceiver::HasProxyInPrototype(Isolate* isolate) {
return false;
}
-void JSModule::CreateExport(Handle<JSModule> module, Handle<String> name) {
+void Module::CreateExport(Handle<Module> module, Handle<String> name) {
Isolate* isolate = module->GetIsolate();
Handle<Cell> cell =
isolate->factory()->NewCell(isolate->factory()->undefined_value());
- LookupIterator it(module, name);
- JSObject::CreateDataProperty(&it, cell, Object::THROW_ON_ERROR).ToChecked();
+ Handle<ObjectHashTable> exports(module->exports(), isolate);
+ DCHECK(exports->Lookup(name)->IsTheHole(isolate));
+ exports = ObjectHashTable::Put(exports, name, cell);
+ module->set_exports(*exports);
}
-void JSModule::StoreExport(Handle<JSModule> module, Handle<String> name,
- Handle<Object> value) {
- LookupIterator it(module, name);
- Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it));
+void Module::StoreExport(Handle<Module> module, Handle<String> name,
+ Handle<Object> value) {
+ Handle<ObjectHashTable> exports(module->exports());
+ Handle<Cell> cell(Cell::cast(exports->Lookup(name)));
cell->set_value(*value);
}
-Handle<Object> JSModule::LoadExport(Handle<JSModule> module,
- Handle<String> name) {
+Handle<Object> Module::LoadExport(Handle<Module> module, Handle<String> name) {
Isolate* isolate = module->GetIsolate();
- LookupIterator it(module, name);
- Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it));
+ Handle<ObjectHashTable> exports(module->exports(), isolate);
+ Handle<Cell> cell(Cell::cast(exports->Lookup(name)));
return handle(cell->value(), isolate);
}
« no previous file with comments | « src/objects.h ('k') | src/objects-body-descriptors-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698