| 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 | 7 |
| 8 #include "src/snapshot/code-serializer.h" | 8 #include "src/snapshot/code-serializer.h" |
| 9 #include "src/version.h" | 9 #include "src/version.h" |
| 10 #include "src/wasm/module-decoder.h" | 10 #include "src/wasm/module-decoder.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 308 |
| 309 ModuleResult decoding_result = | 309 ModuleResult decoding_result = |
| 310 DecodeWasmModule(serialization_isolate, buffer.begin(), buffer.end(), | 310 DecodeWasmModule(serialization_isolate, buffer.begin(), buffer.end(), |
| 311 false, kWasmOrigin); | 311 false, kWasmOrigin); |
| 312 CHECK(!decoding_result.failed()); | 312 CHECK(!decoding_result.failed()); |
| 313 | 313 |
| 314 Handle<WasmModuleWrapper> module_wrapper = WasmModuleWrapper::New( | 314 Handle<WasmModuleWrapper> module_wrapper = WasmModuleWrapper::New( |
| 315 serialization_isolate, const_cast<WasmModule*>(decoding_result.val)); | 315 serialization_isolate, const_cast<WasmModule*>(decoding_result.val)); |
| 316 | 316 |
| 317 MaybeHandle<WasmCompiledModule> compiled_module = | 317 MaybeHandle<WasmCompiledModule> compiled_module = |
| 318 decoding_result.val->CompileFunctions(serialization_isolate, | 318 decoding_result.val->CompileFunctions( |
| 319 module_wrapper, &thrower); | 319 serialization_isolate, module_wrapper, &thrower, |
| 320 ModuleWireBytes(buffer.begin(), buffer.end())); |
| 320 CHECK(!compiled_module.is_null()); | 321 CHECK(!compiled_module.is_null()); |
| 321 Handle<JSObject> module_obj = WasmModuleObject::New( | 322 Handle<JSObject> module_obj = WasmModuleObject::New( |
| 322 serialization_isolate, compiled_module.ToHandleChecked()); | 323 serialization_isolate, compiled_module.ToHandleChecked()); |
| 323 v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj); | 324 v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj); |
| 324 CHECK(v8_module_obj->IsWebAssemblyCompiledModule()); | 325 CHECK(v8_module_obj->IsWebAssemblyCompiledModule()); |
| 325 | 326 |
| 326 v8::Local<v8::WasmCompiledModule> v8_compiled_module = | 327 v8::Local<v8::WasmCompiledModule> v8_compiled_module = |
| 327 v8_module_obj.As<v8::WasmCompiledModule>(); | 328 v8_module_obj.As<v8::WasmCompiledModule>(); |
| 328 v8::Local<v8::String> uncompiled_bytes = | 329 v8::Local<v8::String> uncompiled_bytes = |
| 329 v8_compiled_module->GetWasmWireBytes(); | 330 v8_compiled_module->GetWasmWireBytes(); |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 }; | 908 }; |
| 908 | 909 |
| 909 testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, | 910 testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, |
| 910 data + arraysize(data), | 911 data + arraysize(data), |
| 911 ModuleOrigin::kWasmOrigin); | 912 ModuleOrigin::kWasmOrigin); |
| 912 // It should be possible to instantiate this module. | 913 // It should be possible to instantiate this module. |
| 913 CHECK(!thrower.error()); | 914 CHECK(!thrower.error()); |
| 914 } | 915 } |
| 915 Cleanup(); | 916 Cleanup(); |
| 916 } | 917 } |
| OLD | NEW |