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

Unified Diff: src/wasm/wasm-module.cc

Issue 1775353003: [wasm] Memory is exported on the module.exports object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | test/mjsunit/wasm/calls.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index 4d0fcfde6aed2371c5b72409223a519b3fb49c4c..74e60b70e8ad4e2356c60404f4383dce33c71616 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -378,13 +378,6 @@ MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate,
*instance.mem_buffer);
LoadDataSegments(this, instance.mem_start, instance.mem_size);
- if (mem_export) {
- // Export the memory as a named property.
- Handle<String> name = factory->InternalizeUtf8String("memory");
- JSObject::AddProperty(instance.js_object, name, instance.mem_buffer,
- READ_ONLY);
- }
-
//-------------------------------------------------------------------------
// Allocate the globals area if necessary.
//-------------------------------------------------------------------------
@@ -478,7 +471,7 @@ MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate,
//-------------------------------------------------------------------------
// Create and populate the exports object.
//-------------------------------------------------------------------------
- if (export_table.size() > 0) {
+ if (export_table.size() > 0 || mem_export) {
index = 0;
// Create the "exports" object.
Handle<JSFunction> object_function = Handle<JSFunction>(
@@ -499,6 +492,13 @@ MaybeHandle<JSObject> WasmModule::Instantiate(Isolate* isolate,
isolate, &module_env, name, code, instance.js_object, exp.func_index);
JSObject::AddProperty(exports_object, name, function, READ_ONLY);
}
+
+ if (mem_export) {
+ // Export the memory as a named property.
+ Handle<String> name = factory->InternalizeUtf8String("memory");
+ JSObject::AddProperty(exports_object, name, instance.mem_buffer,
+ READ_ONLY);
+ }
}
// Run the start function if one was specified.
« no previous file with comments | « no previous file | test/mjsunit/wasm/calls.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698