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

Unified Diff: src/objects.cc

Issue 2302783002: [modules] Basic support of exports (Closed)
Patch Set: . 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
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index fce862b2579627425f2f17c208520df8fc2f27b0..bca5bb8afa2e10545370e0fe585eccedc62d8bc1 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -19343,5 +19343,28 @@ bool JSReceiver::HasProxyInPrototype(Isolate* isolate) {
return false;
}
+void JSModule::CreateExport(Handle<JSModule> 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();
+}
+
+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));
+ cell->set_value(*value);
+}
+
+Handle<Object> JSModule::LoadExport(Handle<JSModule> module,
+ Handle<String> name) {
+ Isolate* isolate = module->GetIsolate();
+ LookupIterator it(module, name);
+ Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it));
+ return handle(cell->value(), isolate);
+}
+
} // namespace internal
} // namespace v8
« src/interpreter/bytecode-generator.cc ('K') | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698