| 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 7315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7326 !ToLocal<Proxy>(i::JSProxy::New(isolate, target, handler), &result); | 7326 !ToLocal<Proxy>(i::JSProxy::New(isolate, target, handler), &result); |
| 7327 RETURN_ON_FAILED_EXECUTION(Proxy); | 7327 RETURN_ON_FAILED_EXECUTION(Proxy); |
| 7328 RETURN_ESCAPED(result); | 7328 RETURN_ESCAPED(result); |
| 7329 } | 7329 } |
| 7330 | 7330 |
| 7331 Local<String> WasmCompiledModule::GetWasmWireBytes() { | 7331 Local<String> WasmCompiledModule::GetWasmWireBytes() { |
| 7332 i::Handle<i::JSObject> obj = | 7332 i::Handle<i::JSObject> obj = |
| 7333 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this)); | 7333 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this)); |
| 7334 i::Handle<i::WasmCompiledModule> compiled_part = | 7334 i::Handle<i::WasmCompiledModule> compiled_part = |
| 7335 i::handle(i::WasmCompiledModule::cast(obj->GetInternalField(0))); | 7335 i::handle(i::WasmCompiledModule::cast(obj->GetInternalField(0))); |
| 7336 i::Handle<i::String> wire_bytes = compiled_part->module_bytes(); | 7336 i::Handle<i::String> wire_bytes(compiled_part->module_bytes()); |
| 7337 return Local<String>::Cast(Utils::ToLocal(wire_bytes)); | 7337 return Local<String>::Cast(Utils::ToLocal(wire_bytes)); |
| 7338 } | 7338 } |
| 7339 | 7339 |
| 7340 WasmCompiledModule::SerializedModule WasmCompiledModule::Serialize() { | 7340 WasmCompiledModule::SerializedModule WasmCompiledModule::Serialize() { |
| 7341 i::Handle<i::JSObject> obj = | 7341 i::Handle<i::JSObject> obj = |
| 7342 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this)); | 7342 i::Handle<i::JSObject>::cast(Utils::OpenHandle(this)); |
| 7343 i::Handle<i::WasmCompiledModule> compiled_part = | 7343 i::Handle<i::WasmCompiledModule> compiled_part = |
| 7344 i::handle(i::WasmCompiledModule::cast(obj->GetInternalField(0))); | 7344 i::handle(i::WasmCompiledModule::cast(obj->GetInternalField(0))); |
| 7345 | 7345 |
| 7346 std::unique_ptr<i::ScriptData> script_data = | 7346 std::unique_ptr<i::ScriptData> script_data = |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7388 | 7388 |
| 7389 MaybeLocal<WasmCompiledModule> WasmCompiledModule::Compile(Isolate* isolate, | 7389 MaybeLocal<WasmCompiledModule> WasmCompiledModule::Compile(Isolate* isolate, |
| 7390 const uint8_t* start, | 7390 const uint8_t* start, |
| 7391 size_t length) { | 7391 size_t length) { |
| 7392 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 7392 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 7393 i::wasm::ErrorThrower thrower(i_isolate, "WasmCompiledModule::Deserialize()"); | 7393 i::wasm::ErrorThrower thrower(i_isolate, "WasmCompiledModule::Deserialize()"); |
| 7394 i::MaybeHandle<i::JSObject> maybe_compiled = | 7394 i::MaybeHandle<i::JSObject> maybe_compiled = |
| 7395 i::wasm::CreateModuleObjectFromBytes( | 7395 i::wasm::CreateModuleObjectFromBytes( |
| 7396 i_isolate, start, start + length, &thrower, | 7396 i_isolate, start, start + length, &thrower, |
| 7397 i::wasm::ModuleOrigin::kWasmOrigin, i::Handle<i::Script>::null(), | 7397 i::wasm::ModuleOrigin::kWasmOrigin, i::Handle<i::Script>::null(), |
| 7398 nullptr, nullptr); | 7398 i::Vector<const uint8_t>::empty()); |
| 7399 if (maybe_compiled.is_null()) return MaybeLocal<WasmCompiledModule>(); | 7399 if (maybe_compiled.is_null()) return MaybeLocal<WasmCompiledModule>(); |
| 7400 return Local<WasmCompiledModule>::Cast( | 7400 return Local<WasmCompiledModule>::Cast( |
| 7401 Utils::ToLocal(maybe_compiled.ToHandleChecked())); | 7401 Utils::ToLocal(maybe_compiled.ToHandleChecked())); |
| 7402 } | 7402 } |
| 7403 | 7403 |
| 7404 // static | 7404 // static |
| 7405 v8::ArrayBuffer::Allocator* v8::ArrayBuffer::Allocator::NewDefaultAllocator() { | 7405 v8::ArrayBuffer::Allocator* v8::ArrayBuffer::Allocator::NewDefaultAllocator() { |
| 7406 return new ArrayBufferAllocator(); | 7406 return new ArrayBufferAllocator(); |
| 7407 } | 7407 } |
| 7408 | 7408 |
| (...skipping 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9904 Address callback_address = | 9904 Address callback_address = |
| 9905 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9905 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 9906 VMState<EXTERNAL> state(isolate); | 9906 VMState<EXTERNAL> state(isolate); |
| 9907 ExternalCallbackScope call_scope(isolate, callback_address); | 9907 ExternalCallbackScope call_scope(isolate, callback_address); |
| 9908 callback(info); | 9908 callback(info); |
| 9909 } | 9909 } |
| 9910 | 9910 |
| 9911 | 9911 |
| 9912 } // namespace internal | 9912 } // namespace internal |
| 9913 } // namespace v8 | 9913 } // namespace v8 |
| OLD | NEW |