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

Side by Side Diff: src/wasm/wasm-module.cc

Issue 2384513002: [wasm] Implement WebAssembly.validate() (Closed)
Patch Set: Address review comments. Created 4 years, 2 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <memory> 5 #include <memory>
6 6
7 #include "src/base/atomic-utils.h" 7 #include "src/base/atomic-utils.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 9
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 return nothing; 1806 return nothing;
1807 } 1807 }
1808 MaybeHandle<FixedArray> compiled_module = 1808 MaybeHandle<FixedArray> compiled_module =
1809 decoded_module->CompileFunctions(isolate, thrower); 1809 decoded_module->CompileFunctions(isolate, thrower);
1810 if (compiled_module.is_null()) return nothing; 1810 if (compiled_module.is_null()) return nothing;
1811 1811
1812 return CreateCompiledModuleObject(isolate, compiled_module.ToHandleChecked(), 1812 return CreateCompiledModuleObject(isolate, compiled_module.ToHandleChecked(),
1813 origin); 1813 origin);
1814 } 1814 }
1815 1815
1816 bool ValidateModuleBytes(Isolate* isolate, const byte* start, const byte* end,
1817 ErrorThrower* thrower, ModuleOrigin origin) {
1818 Zone zone(isolate->allocator());
1819 ModuleResult result =
1820 DecodeWasmModule(isolate, &zone, start, end, false, origin);
1821 if (result.ok()) {
1822 DCHECK_NOT_NULL(result.val);
1823 delete result.val;
1824 return true;
1825 }
1826 return false;
1827 }
1828
1816 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate, 1829 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate,
1817 Handle<JSObject> instance) { 1830 Handle<JSObject> instance) {
1818 Object* mem = instance->GetInternalField(kWasmMemArrayBuffer); 1831 Object* mem = instance->GetInternalField(kWasmMemArrayBuffer);
1819 DCHECK(IsWasmObject(*instance)); 1832 DCHECK(IsWasmObject(*instance));
1820 if (mem->IsUndefined(isolate)) return MaybeHandle<JSArrayBuffer>(); 1833 if (mem->IsUndefined(isolate)) return MaybeHandle<JSArrayBuffer>();
1821 return Handle<JSArrayBuffer>(JSArrayBuffer::cast(mem)); 1834 return Handle<JSArrayBuffer>(JSArrayBuffer::cast(mem));
1822 } 1835 }
1823 1836
1824 void SetInstanceMemory(Handle<JSObject> instance, JSArrayBuffer* buffer) { 1837 void SetInstanceMemory(Handle<JSObject> instance, JSArrayBuffer* buffer) {
1825 DisallowHeapAllocation no_gc; 1838 DisallowHeapAllocation no_gc;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 FixedArray* compiled_module = 1889 FixedArray* compiled_module =
1877 FixedArray::cast(instance->GetInternalField(kWasmCompiledModule)); 1890 FixedArray::cast(instance->GetInternalField(kWasmCompiledModule));
1878 CHECK_NOT_NULL(GetModuleObject(compiled_module)); 1891 CHECK_NOT_NULL(GetModuleObject(compiled_module));
1879 CHECK(GetModuleObject(compiled_module)->cleared()); 1892 CHECK(GetModuleObject(compiled_module)->cleared());
1880 } 1893 }
1881 1894
1882 } // namespace testing 1895 } // namespace testing
1883 } // namespace wasm 1896 } // namespace wasm
1884 } // namespace internal 1897 } // namespace internal
1885 } // namespace v8 1898 } // namespace v8
OLDNEW
« 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