| OLD | NEW |
| 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 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2058 compiled_module->set_asm_js_offset_tables(offset_tables); | 2058 compiled_module->set_asm_js_offset_tables(offset_tables); |
| 2059 } | 2059 } |
| 2060 | 2060 |
| 2061 return CreateWasmModuleObject(isolate, compiled_module, origin); | 2061 return CreateWasmModuleObject(isolate, compiled_module, origin); |
| 2062 } | 2062 } |
| 2063 | 2063 |
| 2064 bool wasm::ValidateModuleBytes(Isolate* isolate, const byte* start, | 2064 bool wasm::ValidateModuleBytes(Isolate* isolate, const byte* start, |
| 2065 const byte* end, ErrorThrower* thrower, | 2065 const byte* end, ErrorThrower* thrower, |
| 2066 ModuleOrigin origin) { | 2066 ModuleOrigin origin) { |
| 2067 ModuleResult result = DecodeWasmModule(isolate, start, end, false, origin); | 2067 ModuleResult result = DecodeWasmModule(isolate, start, end, false, origin); |
| 2068 if (result.ok()) { | 2068 if (result.val) { |
| 2069 DCHECK_NOT_NULL(result.val); | |
| 2070 delete result.val; | 2069 delete result.val; |
| 2071 return true; | 2070 } else { |
| 2071 DCHECK(!result.ok()); |
| 2072 } | 2072 } |
| 2073 return false; | 2073 return result.ok(); |
| 2074 } | 2074 } |
| 2075 | 2075 |
| 2076 MaybeHandle<JSArrayBuffer> wasm::GetInstanceMemory(Isolate* isolate, | 2076 MaybeHandle<JSArrayBuffer> wasm::GetInstanceMemory(Isolate* isolate, |
| 2077 Handle<JSObject> instance) { | 2077 Handle<JSObject> instance) { |
| 2078 Object* mem = instance->GetInternalField(kWasmMemArrayBuffer); | 2078 Object* mem = instance->GetInternalField(kWasmMemArrayBuffer); |
| 2079 DCHECK(IsWasmInstance(*instance)); | 2079 DCHECK(IsWasmInstance(*instance)); |
| 2080 if (mem->IsUndefined(isolate)) return MaybeHandle<JSArrayBuffer>(); | 2080 if (mem->IsUndefined(isolate)) return MaybeHandle<JSArrayBuffer>(); |
| 2081 return Handle<JSArrayBuffer>(JSArrayBuffer::cast(mem)); | 2081 return Handle<JSArrayBuffer>(JSArrayBuffer::cast(mem)); |
| 2082 } | 2082 } |
| 2083 | 2083 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2240 CHECK_NOT_NULL(result.val); | 2240 CHECK_NOT_NULL(result.val); |
| 2241 module = const_cast<WasmModule*>(result.val); | 2241 module = const_cast<WasmModule*>(result.val); |
| 2242 } | 2242 } |
| 2243 | 2243 |
| 2244 Handle<WasmModuleWrapper> module_wrapper = | 2244 Handle<WasmModuleWrapper> module_wrapper = |
| 2245 WasmModuleWrapper::New(isolate, module); | 2245 WasmModuleWrapper::New(isolate, module); |
| 2246 | 2246 |
| 2247 compiled_module->set_module_wrapper(module_wrapper); | 2247 compiled_module->set_module_wrapper(module_wrapper); |
| 2248 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); | 2248 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); |
| 2249 } | 2249 } |
| OLD | NEW |