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/wasm/module-decoder.h" | 8 #include "src/wasm/module-decoder.h" |
9 #include "src/wasm/wasm-macro-gen.h" | 9 #include "src/wasm/wasm-macro-gen.h" |
10 #include "src/wasm/wasm-module-builder.h" | 10 #include "src/wasm/wasm-module-builder.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 v8::WasmCompiledModule::SerializedModule data; | 202 v8::WasmCompiledModule::SerializedModule data; |
203 { | 203 { |
204 HandleScope scope(isolate); | 204 HandleScope scope(isolate); |
205 testing::SetupIsolateForWasmModule(isolate); | 205 testing::SetupIsolateForWasmModule(isolate); |
206 | 206 |
207 ModuleResult decoding_result = DecodeWasmModule( | 207 ModuleResult decoding_result = DecodeWasmModule( |
208 isolate, &zone, buffer.begin(), buffer.end(), false, kWasmOrigin); | 208 isolate, &zone, buffer.begin(), buffer.end(), false, kWasmOrigin); |
209 std::unique_ptr<const WasmModule> module(decoding_result.val); | 209 std::unique_ptr<const WasmModule> module(decoding_result.val); |
210 CHECK(!decoding_result.failed()); | 210 CHECK(!decoding_result.failed()); |
211 | 211 |
212 MaybeHandle<FixedArray> compiled_module = | 212 MaybeHandle<WasmCompiledModule> compiled_module = |
213 module->CompileFunctions(isolate, &thrower); | 213 module->CompileFunctions(isolate, &thrower); |
214 CHECK(!compiled_module.is_null()); | 214 CHECK(!compiled_module.is_null()); |
215 Handle<JSObject> module_obj = CreateCompiledModuleObject( | 215 Handle<JSObject> module_obj = CreateCompiledModuleObject( |
216 isolate, compiled_module.ToHandleChecked(), ModuleOrigin::kWasmOrigin); | 216 isolate, compiled_module.ToHandleChecked(), ModuleOrigin::kWasmOrigin); |
217 v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj); | 217 v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj); |
218 CHECK(v8_module_obj->IsWebAssemblyCompiledModule()); | 218 CHECK(v8_module_obj->IsWebAssemblyCompiledModule()); |
219 | 219 |
220 v8::Local<v8::WasmCompiledModule> v8_compiled_module = | 220 v8::Local<v8::WasmCompiledModule> v8_compiled_module = |
221 v8_module_obj.As<v8::WasmCompiledModule>(); | 221 v8_module_obj.As<v8::WasmCompiledModule>(); |
222 v8::Local<v8::String> uncompiled_bytes = | 222 v8::Local<v8::String> uncompiled_bytes = |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 535 |
536 TEST(Run_WasmModule_Global_f32) { | 536 TEST(Run_WasmModule_Global_f32) { |
537 RunWasmModuleGlobalInitTest<float>(kAstF32, -983.9f); | 537 RunWasmModuleGlobalInitTest<float>(kAstF32, -983.9f); |
538 RunWasmModuleGlobalInitTest<float>(kAstF32, 1122.99f); | 538 RunWasmModuleGlobalInitTest<float>(kAstF32, 1122.99f); |
539 } | 539 } |
540 | 540 |
541 TEST(Run_WasmModule_Global_f64) { | 541 TEST(Run_WasmModule_Global_f64) { |
542 RunWasmModuleGlobalInitTest<double>(kAstF64, -833.9); | 542 RunWasmModuleGlobalInitTest<double>(kAstF64, -833.9); |
543 RunWasmModuleGlobalInitTest<double>(kAstF64, 86374.25); | 543 RunWasmModuleGlobalInitTest<double>(kAstF64, 86374.25); |
544 } | 544 } |
OLD | NEW |