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

Unified Diff: src/objects.cc

Issue 2302783002: [modules] Basic support of exports (Closed)
Patch Set: Disable module tests for deopt fuzzer. 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-debug.cc » ('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 20701a73edf89ec5cc5d13e3352ba397bab55fc5..d271ab760016de43b65760ecdaa9fdcec77bd5fc 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -19470,5 +19470,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
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698