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

Side by Side Diff: test/cctest/wasm/test-run-wasm-module.cc

Issue 2494603002: [wasm] cctest - explicit WriteOneByte null termination opt-out (Closed)
Patch Set: fix Created 4 years, 1 month 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 | « no previous file | no next file » | 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 <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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 serialization_isolate, compiled_module.ToHandleChecked(), 321 serialization_isolate, compiled_module.ToHandleChecked(),
322 ModuleOrigin::kWasmOrigin); 322 ModuleOrigin::kWasmOrigin);
323 v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj); 323 v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj);
324 CHECK(v8_module_obj->IsWebAssemblyCompiledModule()); 324 CHECK(v8_module_obj->IsWebAssemblyCompiledModule());
325 325
326 v8::Local<v8::WasmCompiledModule> v8_compiled_module = 326 v8::Local<v8::WasmCompiledModule> v8_compiled_module =
327 v8_module_obj.As<v8::WasmCompiledModule>(); 327 v8_module_obj.As<v8::WasmCompiledModule>();
328 v8::Local<v8::String> uncompiled_bytes = 328 v8::Local<v8::String> uncompiled_bytes =
329 v8_compiled_module->GetWasmWireBytes(); 329 v8_compiled_module->GetWasmWireBytes();
330 bytes_size = static_cast<size_t>(uncompiled_bytes->Length()); 330 bytes_size = static_cast<size_t>(uncompiled_bytes->Length());
331 bytes = zone()->NewArray<uint8_t>(uncompiled_bytes->Length()); 331 bytes = zone()->NewArray<uint8_t>(bytes_size);
332 uncompiled_bytes->WriteOneByte(bytes); 332 uncompiled_bytes->WriteOneByte(bytes, 0, uncompiled_bytes->Length(),
333 v8::String::NO_NULL_TERMINATION);
333 // keep alive data_ until the end 334 // keep alive data_ until the end
334 data_ = v8_compiled_module->Serialize(); 335 data_ = v8_compiled_module->Serialize();
335 } 336 }
336 337
337 wire_bytes_ = {const_cast<const uint8_t*>(bytes), bytes_size}; 338 wire_bytes_ = {const_cast<const uint8_t*>(bytes), bytes_size};
338 339
339 serialized_bytes_ = {data_.first.get(), data_.second}; 340 serialized_bytes_ = {data_.first.get(), data_.second};
340 341
341 v8::Isolate::CreateParams create_params; 342 v8::Isolate::CreateParams create_params;
342 create_params.array_buffer_allocator = 343 create_params.array_buffer_allocator =
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 796
796 TEST(Run_WasmModule_Global_f32) { 797 TEST(Run_WasmModule_Global_f32) {
797 RunWasmModuleGlobalInitTest<float>(kAstF32, -983.9f); 798 RunWasmModuleGlobalInitTest<float>(kAstF32, -983.9f);
798 RunWasmModuleGlobalInitTest<float>(kAstF32, 1122.99f); 799 RunWasmModuleGlobalInitTest<float>(kAstF32, 1122.99f);
799 } 800 }
800 801
801 TEST(Run_WasmModule_Global_f64) { 802 TEST(Run_WasmModule_Global_f64) {
802 RunWasmModuleGlobalInitTest<double>(kAstF64, -833.9); 803 RunWasmModuleGlobalInitTest<double>(kAstF64, -833.9);
803 RunWasmModuleGlobalInitTest<double>(kAstF64, 86374.25); 804 RunWasmModuleGlobalInitTest<double>(kAstF64, 86374.25);
804 } 805 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698