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

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

Issue 1742073002: [wasm] Properly plumb the origin of the WASM module from asm.js translation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/module-decoder.cc ('k') | src/wasm/wasm-module.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 543f4947065a8d97a84d3a7758f871d87892fb08..8f9e05b3e3d4522dd8d5d973181300f630468f84 100644
--- a/src/wasm/wasm-js.cc
+++ b/src/wasm/wasm-js.cc
@@ -64,8 +64,9 @@ void VerifyModule(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (thrower.error()) return;
i::Zone zone;
- internal::wasm::ModuleResult result = internal::wasm::DecodeWasmModule(
- isolate, &zone, buffer.start, buffer.end, true, false);
+ internal::wasm::ModuleResult result =
+ internal::wasm::DecodeWasmModule(isolate, &zone, buffer.start, buffer.end,
+ true, internal::wasm::kWasmOrigin);
if (result.failed()) {
thrower.Failed("", result);
@@ -139,10 +140,10 @@ v8::internal::wasm::WasmModuleIndex* TranslateAsmModule(
return module;
}
-
void InstantiateModuleCommon(const v8::FunctionCallbackInfo<v8::Value>& args,
const byte* start, const byte* end,
- ErrorThrower* thrower, bool must_decode) {
+ ErrorThrower* thrower,
+ internal::wasm::ModuleOrigin origin) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
i::Handle<i::JSArrayBuffer> memory = i::Handle<i::JSArrayBuffer>::null();
@@ -156,9 +157,9 @@ void InstantiateModuleCommon(const v8::FunctionCallbackInfo<v8::Value>& args,
// Verification will happen during compilation.
i::Zone zone;
internal::wasm::ModuleResult result = internal::wasm::DecodeWasmModule(
- isolate, &zone, start, end, false, false);
+ isolate, &zone, start, end, false, origin);
- if (result.failed() && must_decode) {
+ if (result.failed() && origin == internal::wasm::kAsmJsOrigin) {
thrower->Error("Asm.js converted module failed to decode");
} else if (result.failed()) {
thrower->Failed("", result);
@@ -209,7 +210,8 @@ void InstantiateModuleFromAsm(const v8::FunctionCallbackInfo<v8::Value>& args) {
return;
}
- InstantiateModuleCommon(args, module->Begin(), module->End(), &thrower, true);
+ InstantiateModuleCommon(args, module->Begin(), module->End(), &thrower,
+ internal::wasm::kAsmJsOrigin);
}
@@ -221,7 +223,8 @@ void InstantiateModule(const v8::FunctionCallbackInfo<v8::Value>& args) {
RawBuffer buffer = GetRawBufferArgument(thrower, args);
if (buffer.start == nullptr) return;
- InstantiateModuleCommon(args, buffer.start, buffer.end, &thrower, false);
+ InstantiateModuleCommon(args, buffer.start, buffer.end, &thrower,
+ internal::wasm::kWasmOrigin);
}
} // namespace
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698