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

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

Issue 2384513002: [wasm] Implement WebAssembly.validate() (Closed)
Patch Set: Address review comments. Created 4 years, 3 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/wasm-module.h ('k') | test/mjsunit/wasm/instantiate-module-basic.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 a65b357bbb558fa5d12b46937f7d60c7e67a9fde..0dd53d22c826673279d3c6ebc4cb64bfcbfaa05b 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -1813,6 +1813,19 @@ MaybeHandle<JSObject> CreateModuleObjectFromBytes(Isolate* isolate,
origin);
}
+bool ValidateModuleBytes(Isolate* isolate, const byte* start, const byte* end,
+ ErrorThrower* thrower, ModuleOrigin origin) {
+ Zone zone(isolate->allocator());
+ ModuleResult result =
+ DecodeWasmModule(isolate, &zone, start, end, false, origin);
+ if (result.ok()) {
+ DCHECK_NOT_NULL(result.val);
+ delete result.val;
+ return true;
+ }
+ return false;
+}
+
MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate,
Handle<JSObject> instance) {
Object* mem = instance->GetInternalField(kWasmMemArrayBuffer);
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/mjsunit/wasm/instantiate-module-basic.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698