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

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

Issue 2642683002: [wasm][asm.js] Store foreign init function for asm.js as internal field. (Closed)
Patch Set: Created 3 years, 11 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/asmjs/asm-js.cc ('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-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index 74fa1bf93031e2ab31088ca0b8696f36078a04b8..9e150f66e63542b5f338c8d93b09f03e4060a90c 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -16,6 +16,8 @@
#include "src/snapshot/snapshot.h"
#include "src/v8.h"
+#include "src/asmjs/asm-wasm-builder.h"
+
#include "src/wasm/function-body-decoder.h"
#include "src/wasm/module-decoder.h"
#include "src/wasm/wasm-js.h"
@@ -677,7 +679,8 @@ static void InstanceFinalizer(const v8::WeakCallbackInfo<void>& data) {
ResetCompiledModule(isolate, owner, compiled_module);
} else {
DCHECK(next->value()->IsFixedArray());
- wasm_module->SetInternalField(0, next->value());
+ wasm_module->SetInternalField(WasmModuleObject::kCompiledModule,
+ next->value());
DCHECK_NULL(prev);
WasmCompiledModule::cast(next->value())->reset_weak_prev_instance();
}
@@ -1423,7 +1426,8 @@ class WasmInstanceBuilder {
compiled_module_->set_weak_wasm_module(
original.ToHandleChecked()->weak_wasm_module());
}
- module_object_->SetInternalField(0, *compiled_module_);
+ module_object_->SetInternalField(WasmModuleObject::kCompiledModule,
+ *compiled_module_);
compiled_module_->set_weak_owning_instance(link_to_owning_instance);
GlobalHandles::MakeWeak(global_handle.location(),
global_handle.location(), &InstanceFinalizer,
@@ -1967,6 +1971,16 @@ class WasmInstanceBuilder {
continue;
}
}
+ // Put special asm.js functions on internal fields.
+ if (module_->origin == kAsmJsOrigin) {
+ Handle<String> foreign_init(isolate_->factory()->InternalizeUtf8String(
+ AsmWasmBuilder::foreign_init_name));
+ if (String::Equals(foreign_init, name)) {
+ module_object_->SetInternalField(WasmModuleObject::kAsmForeignInit,
+ *desc.value());
+ continue;
+ }
+ }
v8::Maybe<bool> status = JSReceiver::DefineOwnProperty(
isolate_, exports_object, name, &desc, Object::THROW_ON_ERROR);
if (!status.IsJust()) {
« no previous file with comments | « src/asmjs/asm-js.cc ('k') | src/wasm/wasm-objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698