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

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

Issue 2977113002: [wasm] Fix user properties for exported wasm functions and add extensive tests. (Closed)
Patch Set: Address nit Created 3 years, 5 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/heap-symbols.h ('k') | src/wasm/wasm-objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-js.cc
diff --git a/src/wasm/wasm-js.cc b/src/wasm/wasm-js.cc
index c9cd1e7b31de2cf0f73de4f11861955d3390339b..5f775f0d35f28f8550c2db3053c604df6d1a5079 100644
--- a/src/wasm/wasm-js.cc
+++ b/src/wasm/wasm-js.cc
@@ -865,33 +865,15 @@ Handle<JSFunction> InstallGetter(Isolate* isolate, Handle<JSObject> object,
void WasmJs::Install(Isolate* isolate) {
Handle<JSGlobalObject> global = isolate->global_object();
Handle<Context> context(global->native_context(), isolate);
- // Check if the map is already installed and do nothing otherwise.
- if (context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) return;
-
- // Install Maps.
- Handle<Map> prev_map = Handle<Map>(context->sloppy_function_map(), isolate);
-
- InstanceType instance_type = prev_map->instance_type();
- int embedder_fields = JSObject::GetEmbedderFieldCount(*prev_map);
- CHECK_EQ(0, embedder_fields);
- int pre_allocated =
- prev_map->GetInObjectProperties() - prev_map->unused_property_fields();
- int instance_size = 0;
- int in_object_properties = WasmExportedFunction::kFieldCount;
- JSFunction::CalculateInstanceSizeHelper(instance_type, embedder_fields,
- in_object_properties, &instance_size,
- &in_object_properties);
-
- int unused_property_fields = in_object_properties - pre_allocated;
- Handle<Map> map = Map::CopyInitialMap(
- prev_map, instance_size, in_object_properties, unused_property_fields);
-
- context->set_wasm_function_map(*map);
+ // Install the JS API once only.
+ Object* prev = context->get(Context::WASM_MODULE_CONSTRUCTOR_INDEX);
+ if (!prev->IsUndefined(isolate)) {
+ DCHECK(prev->IsJSFunction());
+ return;
+ }
Factory* factory = isolate->factory();
- // Install the JS API.
-
// Setup WebAssembly
Handle<String> name = v8_str(isolate, "WebAssembly");
Handle<JSFunction> cons = factory->NewFunction(isolate->strict_function_map(),
« no previous file with comments | « src/heap-symbols.h ('k') | src/wasm/wasm-objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698