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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 } | 220 } |
221 | 221 |
222 v8::WasmCompiledModule::UncompiledBytes uncompressed_bytes = { | 222 v8::WasmCompiledModule::UncompiledBytes uncompressed_bytes = { |
223 std::unique_ptr<const uint8_t[]>(const_cast<const uint8_t*>(bytes)), | 223 std::unique_ptr<const uint8_t[]>(const_cast<const uint8_t*>(bytes)), |
224 bytes_size}; | 224 bytes_size}; |
225 | 225 |
226 v8::Isolate::CreateParams create_params; | 226 v8::Isolate::CreateParams create_params; |
227 create_params.array_buffer_allocator = | 227 create_params.array_buffer_allocator = |
228 CcTest::InitIsolateOnce()->array_buffer_allocator(); | 228 CcTest::InitIsolateOnce()->array_buffer_allocator(); |
229 | 229 |
230 for (int i = 0; i < 2; ++i) { | 230 for (int i = 0; i < 3; ++i) { |
231 v8::Isolate* v8_isolate = v8::Isolate::New(create_params); | 231 v8::Isolate* v8_isolate = v8::Isolate::New(create_params); |
232 if (i == 1) { | 232 if (i == 1) { |
233 // Mess with the serialized data to force recompilation. | 233 // Mess the header. |
bradnelson
2016/10/12 19:10:25
Mess with?
Mircea Trofin
2016/10/12 20:32:06
Done.
| |
234 DCHECK_NE(0, data.first.get()[0]); | |
235 const_cast<uint8_t*>(data.first.get())[0] = 0; | |
bradnelson
2016/10/12 19:10:25
Kinda bad. Maybe create an accessor that's a frien
Mircea Trofin
2016/10/12 20:32:06
Done.
| |
236 } | |
237 | |
238 if (i == 2) { | |
239 // Reset the compiled module data. | |
234 data.first.reset(); | 240 data.first.reset(); |
235 data.second = 0; | 241 data.second = 0; |
236 } | 242 } |
237 { | 243 { |
238 v8::Isolate::Scope isolate_scope(v8_isolate); | 244 v8::Isolate::Scope isolate_scope(v8_isolate); |
239 v8::HandleScope new_scope(v8_isolate); | 245 v8::HandleScope new_scope(v8_isolate); |
240 v8::Local<v8::Context> new_ctx = v8::Context::New(v8_isolate); | 246 v8::Local<v8::Context> new_ctx = v8::Context::New(v8_isolate); |
241 new_ctx->Enter(); | 247 new_ctx->Enter(); |
242 isolate = reinterpret_cast<Isolate*>(v8_isolate); | 248 isolate = reinterpret_cast<Isolate*>(v8_isolate); |
243 testing::SetupIsolateForWasmModule(isolate); | 249 testing::SetupIsolateForWasmModule(isolate); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
527 | 533 |
528 TEST(Run_WasmModule_Global_f32) { | 534 TEST(Run_WasmModule_Global_f32) { |
529 RunWasmModuleGlobalInitTest<float>(kAstF32, -983.9f); | 535 RunWasmModuleGlobalInitTest<float>(kAstF32, -983.9f); |
530 RunWasmModuleGlobalInitTest<float>(kAstF32, 1122.99f); | 536 RunWasmModuleGlobalInitTest<float>(kAstF32, 1122.99f); |
531 } | 537 } |
532 | 538 |
533 TEST(Run_WasmModule_Global_f64) { | 539 TEST(Run_WasmModule_Global_f64) { |
534 RunWasmModuleGlobalInitTest<double>(kAstF64, -833.9); | 540 RunWasmModuleGlobalInitTest<double>(kAstF64, -833.9); |
535 RunWasmModuleGlobalInitTest<double>(kAstF64, 86374.25); | 541 RunWasmModuleGlobalInitTest<double>(kAstF64, 86374.25); |
536 } | 542 } |
OLD | NEW |