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

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

Issue 2384513002: [wasm] Implement WebAssembly.validate() (Closed)
Patch Set: 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.val) delete result.val;
Mircea Trofin 2016/09/29 16:47:49 if (result.val != nullptr) or even: if (result.ok
1822 return result.ok();
1823 }
1824
1816 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate, 1825 MaybeHandle<JSArrayBuffer> GetInstanceMemory(Isolate* isolate,
1817 Handle<JSObject> instance) { 1826 Handle<JSObject> instance) {
1818 Object* mem = instance->GetInternalField(kWasmMemArrayBuffer); 1827 Object* mem = instance->GetInternalField(kWasmMemArrayBuffer);
1819 DCHECK(IsWasmObject(*instance)); 1828 DCHECK(IsWasmObject(*instance));
1820 if (mem->IsUndefined(isolate)) return MaybeHandle<JSArrayBuffer>(); 1829 if (mem->IsUndefined(isolate)) return MaybeHandle<JSArrayBuffer>();
1821 return Handle<JSArrayBuffer>(JSArrayBuffer::cast(mem)); 1830 return Handle<JSArrayBuffer>(JSArrayBuffer::cast(mem));
1822 } 1831 }
1823 1832
1824 void SetInstanceMemory(Handle<JSObject> instance, JSArrayBuffer* buffer) { 1833 void SetInstanceMemory(Handle<JSObject> instance, JSArrayBuffer* buffer) {
1825 DisallowHeapAllocation no_gc; 1834 DisallowHeapAllocation no_gc;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 FixedArray* compiled_module = 1885 FixedArray* compiled_module =
1877 FixedArray::cast(instance->GetInternalField(kWasmCompiledModule)); 1886 FixedArray::cast(instance->GetInternalField(kWasmCompiledModule));
1878 CHECK_NOT_NULL(GetModuleObject(compiled_module)); 1887 CHECK_NOT_NULL(GetModuleObject(compiled_module));
1879 CHECK(GetModuleObject(compiled_module)->cleared()); 1888 CHECK(GetModuleObject(compiled_module)->cleared());
1880 } 1889 }
1881 1890
1882 } // namespace testing 1891 } // namespace testing
1883 } // namespace wasm 1892 } // namespace wasm
1884 } // namespace internal 1893 } // namespace internal
1885 } // namespace v8 1894 } // 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