| 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/objects-inl.h" | 8 #include "src/objects-inl.h" |
| 9 #include "src/snapshot/code-serializer.h" | 9 #include "src/snapshot/code-serializer.h" |
| 10 #include "src/version.h" | 10 #include "src/version.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 265 |
| 266 void DeserializeAndRun() { | 266 void DeserializeAndRun() { |
| 267 ErrorThrower thrower(current_isolate(), ""); | 267 ErrorThrower thrower(current_isolate(), ""); |
| 268 v8::Local<v8::WasmCompiledModule> deserialized_module; | 268 v8::Local<v8::WasmCompiledModule> deserialized_module; |
| 269 CHECK(Deserialize().ToLocal(&deserialized_module)); | 269 CHECK(Deserialize().ToLocal(&deserialized_module)); |
| 270 Handle<WasmModuleObject> module_object = Handle<WasmModuleObject>::cast( | 270 Handle<WasmModuleObject> module_object = Handle<WasmModuleObject>::cast( |
| 271 v8::Utils::OpenHandle(*deserialized_module)); | 271 v8::Utils::OpenHandle(*deserialized_module)); |
| 272 { | 272 { |
| 273 DisallowHeapAllocation assume_no_gc; | 273 DisallowHeapAllocation assume_no_gc; |
| 274 Handle<WasmCompiledModule> compiled_part( | 274 Handle<WasmCompiledModule> compiled_part( |
| 275 WasmCompiledModule::cast(module_object->GetInternalField(0)), | 275 WasmCompiledModule::cast(module_object->GetEmbedderField(0)), |
| 276 current_isolate()); | 276 current_isolate()); |
| 277 CHECK_EQ(memcmp(compiled_part->module_bytes()->GetCharsAddress(), | 277 CHECK_EQ(memcmp(compiled_part->module_bytes()->GetCharsAddress(), |
| 278 wire_bytes().first, wire_bytes().second), | 278 wire_bytes().first, wire_bytes().second), |
| 279 0); | 279 0); |
| 280 } | 280 } |
| 281 Handle<JSObject> instance = | 281 Handle<JSObject> instance = |
| 282 SyncInstantiate(current_isolate(), &thrower, module_object, | 282 SyncInstantiate(current_isolate(), &thrower, module_object, |
| 283 Handle<JSReceiver>::null(), | 283 Handle<JSReceiver>::null(), |
| 284 MaybeHandle<JSArrayBuffer>()) | 284 MaybeHandle<JSArrayBuffer>()) |
| 285 .ToHandleChecked(); | 285 .ToHandleChecked(); |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 }; | 967 }; |
| 968 | 968 |
| 969 testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, | 969 testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, |
| 970 data + arraysize(data), | 970 data + arraysize(data), |
| 971 ModuleOrigin::kWasmOrigin); | 971 ModuleOrigin::kWasmOrigin); |
| 972 // It should not be possible to instantiate this module. | 972 // It should not be possible to instantiate this module. |
| 973 CHECK(thrower.error()); | 973 CHECK(thrower.error()); |
| 974 } | 974 } |
| 975 Cleanup(); | 975 Cleanup(); |
| 976 } | 976 } |
| OLD | NEW |