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

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

Issue 1677373002: Adding support for asm.js foreign globals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 10 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/wasm/asm-wasm-builder.cc ('k') | test/mjsunit/wasm/asm-wasm.js » ('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 add9c5373c18b4a7d0ae9ce2458bd8c0cfdf2782..663e4b56b1b07975b61aba64a7e7d67ef7fde33a 100644
--- a/src/wasm/wasm-js.cc
+++ b/src/wasm/wasm-js.cc
@@ -99,9 +99,8 @@ void VerifyFunction(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (result.val) delete result.val;
}
-
-v8::internal::wasm::WasmModuleIndex* TranslateAsmModule(i::ParseInfo* info,
- ErrorThrower* thrower) {
+v8::internal::wasm::WasmModuleIndex* TranslateAsmModule(
+ i::ParseInfo* info, i::Handle<i::Object> foreign, ErrorThrower* thrower) {
info->set_global();
info->set_lazy(false);
info->set_allow_lazy_parsing(false);
@@ -125,7 +124,7 @@ v8::internal::wasm::WasmModuleIndex* TranslateAsmModule(i::ParseInfo* info,
}
auto module = v8::internal::wasm::AsmWasmBuilder(
- info->isolate(), info->zone(), info->literal())
+ info->isolate(), info->zone(), info->literal(), foreign)
.Run();
return module;
}
@@ -189,7 +188,13 @@ void InstantiateModuleFromAsm(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::Handle<i::Script> script = factory->NewScript(Utils::OpenHandle(*source));
i::ParseInfo info(&zone, script);
- auto module = TranslateAsmModule(&info, &thrower);
+ i::Handle<i::Object> foreign;
+ if (args.Length() > 1 && args[1]->IsObject()) {
+ Local<Object> local_foreign = Local<Object>::Cast(args[1]);
+ foreign = v8::Utils::OpenHandle(*local_foreign);
+ }
+
+ auto module = TranslateAsmModule(&info, foreign, &thrower);
if (module == nullptr) {
return;
}
« no previous file with comments | « src/wasm/asm-wasm-builder.cc ('k') | test/mjsunit/wasm/asm-wasm.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698