| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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( | 318 decoding_result.val->CompileFunctions( |
| 319 serialization_isolate, module_wrapper, &thrower, | 319 serialization_isolate, module_wrapper, &thrower, |
| 320 ModuleWireBytes(buffer.begin(), buffer.end())); | 320 ModuleWireBytes(buffer.begin(), buffer.end()), |
| 321 Handle<Script>::null(), Vector<const byte>::empty()); |
| 321 CHECK(!compiled_module.is_null()); | 322 CHECK(!compiled_module.is_null()); |
| 322 Handle<JSObject> module_obj = WasmModuleObject::New( | 323 Handle<JSObject> module_obj = WasmModuleObject::New( |
| 323 serialization_isolate, compiled_module.ToHandleChecked()); | 324 serialization_isolate, compiled_module.ToHandleChecked()); |
| 324 v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj); | 325 v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj); |
| 325 CHECK(v8_module_obj->IsWebAssemblyCompiledModule()); | 326 CHECK(v8_module_obj->IsWebAssemblyCompiledModule()); |
| 326 | 327 |
| 327 v8::Local<v8::WasmCompiledModule> v8_compiled_module = | 328 v8::Local<v8::WasmCompiledModule> v8_compiled_module = |
| 328 v8_module_obj.As<v8::WasmCompiledModule>(); | 329 v8_module_obj.As<v8::WasmCompiledModule>(); |
| 329 v8::Local<v8::String> uncompiled_bytes = | 330 v8::Local<v8::String> uncompiled_bytes = |
| 330 v8_compiled_module->GetWasmWireBytes(); | 331 v8_compiled_module->GetWasmWireBytes(); |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 }; | 909 }; |
| 909 | 910 |
| 910 testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, | 911 testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, |
| 911 data + arraysize(data), | 912 data + arraysize(data), |
| 912 ModuleOrigin::kWasmOrigin); | 913 ModuleOrigin::kWasmOrigin); |
| 913 // It should be possible to instantiate this module. | 914 // It should be possible to instantiate this module. |
| 914 CHECK(!thrower.error()); | 915 CHECK(!thrower.error()); |
| 915 } | 916 } |
| 916 Cleanup(); | 917 Cleanup(); |
| 917 } | 918 } |
| OLD | NEW |