| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/api.h" | 5 #include "src/api.h" |
| 6 | 6 |
| 7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
| 8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
| 9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
| 10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
| (...skipping 7197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7208 i::WasmCompiledModuleSerializer::SerializeWasmModule(obj->GetIsolate(), | 7208 i::WasmCompiledModuleSerializer::SerializeWasmModule(obj->GetIsolate(), |
| 7209 compiled_part); | 7209 compiled_part); |
| 7210 script_data->ReleaseDataOwnership(); | 7210 script_data->ReleaseDataOwnership(); |
| 7211 | 7211 |
| 7212 size_t size = static_cast<size_t>(script_data->length()); | 7212 size_t size = static_cast<size_t>(script_data->length()); |
| 7213 return {std::unique_ptr<const uint8_t[]>(script_data->data()), size}; | 7213 return {std::unique_ptr<const uint8_t[]>(script_data->data()), size}; |
| 7214 } | 7214 } |
| 7215 | 7215 |
| 7216 MaybeLocal<WasmCompiledModule> WasmCompiledModule::Deserialize( | 7216 MaybeLocal<WasmCompiledModule> WasmCompiledModule::Deserialize( |
| 7217 Isolate* isolate, | 7217 Isolate* isolate, |
| 7218 const WasmCompiledModule::SerializedModule& serialized_module) { | |
| 7219 return Deserialize(isolate, | |
| 7220 {serialized_module.first.get(), serialized_module.second}); | |
| 7221 } | |
| 7222 | |
| 7223 MaybeLocal<WasmCompiledModule> WasmCompiledModule::Deserialize( | |
| 7224 Isolate* isolate, | |
| 7225 const WasmCompiledModule::CallerOwnedBuffer& serialized_module) { | 7218 const WasmCompiledModule::CallerOwnedBuffer& serialized_module) { |
| 7226 int size = static_cast<int>(serialized_module.second); | 7219 int size = static_cast<int>(serialized_module.second); |
| 7227 i::ScriptData sc(serialized_module.first, size); | 7220 i::ScriptData sc(serialized_module.first, size); |
| 7228 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 7221 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 7229 i::MaybeHandle<i::FixedArray> maybe_compiled_part = | 7222 i::MaybeHandle<i::FixedArray> maybe_compiled_part = |
| 7230 i::WasmCompiledModuleSerializer::DeserializeWasmModule(i_isolate, &sc); | 7223 i::WasmCompiledModuleSerializer::DeserializeWasmModule(i_isolate, &sc); |
| 7231 i::Handle<i::FixedArray> compiled_part; | 7224 i::Handle<i::FixedArray> compiled_part; |
| 7232 if (!maybe_compiled_part.ToHandle(&compiled_part)) { | 7225 if (!maybe_compiled_part.ToHandle(&compiled_part)) { |
| 7233 return MaybeLocal<WasmCompiledModule>(); | 7226 return MaybeLocal<WasmCompiledModule>(); |
| 7234 } | 7227 } |
| (...skipping 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9492 Address callback_address = | 9485 Address callback_address = |
| 9493 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9486 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 9494 VMState<EXTERNAL> state(isolate); | 9487 VMState<EXTERNAL> state(isolate); |
| 9495 ExternalCallbackScope call_scope(isolate, callback_address); | 9488 ExternalCallbackScope call_scope(isolate, callback_address); |
| 9496 callback(info); | 9489 callback(info); |
| 9497 } | 9490 } |
| 9498 | 9491 |
| 9499 | 9492 |
| 9500 } // namespace internal | 9493 } // namespace internal |
| 9501 } // namespace v8 | 9494 } // namespace v8 |
| OLD | NEW |