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 7524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7535 return ret; | 7535 return ret; |
7536 } | 7536 } |
7537 return Compile(isolate, wire_bytes.first, wire_bytes.second); | 7537 return Compile(isolate, wire_bytes.first, wire_bytes.second); |
7538 } | 7538 } |
7539 | 7539 |
7540 MaybeLocal<WasmCompiledModule> WasmCompiledModule::Compile(Isolate* isolate, | 7540 MaybeLocal<WasmCompiledModule> WasmCompiledModule::Compile(Isolate* isolate, |
7541 const uint8_t* start, | 7541 const uint8_t* start, |
7542 size_t length) { | 7542 size_t length) { |
7543 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 7543 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
7544 i::wasm::ErrorThrower thrower(i_isolate, "WasmCompiledModule::Deserialize()"); | 7544 i::wasm::ErrorThrower thrower(i_isolate, "WasmCompiledModule::Deserialize()"); |
7545 i::MaybeHandle<i::JSObject> maybe_compiled = | 7545 i::MaybeHandle<i::JSObject> maybe_compiled = i::wasm::SyncCompile( |
7546 i::wasm::CreateModuleObjectFromBytes( | 7546 i_isolate, &thrower, i::wasm::ModuleWireBytes(start, start + length)); |
7547 i_isolate, start, start + length, &thrower, | |
7548 i::wasm::ModuleOrigin::kWasmOrigin, i::Handle<i::Script>::null(), | |
7549 i::Vector<const uint8_t>::empty()); | |
7550 if (maybe_compiled.is_null()) return MaybeLocal<WasmCompiledModule>(); | 7547 if (maybe_compiled.is_null()) return MaybeLocal<WasmCompiledModule>(); |
7551 return Local<WasmCompiledModule>::Cast( | 7548 return Local<WasmCompiledModule>::Cast( |
7552 Utils::ToLocal(maybe_compiled.ToHandleChecked())); | 7549 Utils::ToLocal(maybe_compiled.ToHandleChecked())); |
7553 } | 7550 } |
7554 | 7551 |
7555 // static | 7552 // static |
7556 v8::ArrayBuffer::Allocator* v8::ArrayBuffer::Allocator::NewDefaultAllocator() { | 7553 v8::ArrayBuffer::Allocator* v8::ArrayBuffer::Allocator::NewDefaultAllocator() { |
7557 return new ArrayBufferAllocator(); | 7554 return new ArrayBufferAllocator(); |
7558 } | 7555 } |
7559 | 7556 |
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10216 Address callback_address = | 10213 Address callback_address = |
10217 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10214 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
10218 VMState<EXTERNAL> state(isolate); | 10215 VMState<EXTERNAL> state(isolate); |
10219 ExternalCallbackScope call_scope(isolate, callback_address); | 10216 ExternalCallbackScope call_scope(isolate, callback_address); |
10220 callback(info); | 10217 callback(info); |
10221 } | 10218 } |
10222 | 10219 |
10223 | 10220 |
10224 } // namespace internal | 10221 } // namespace internal |
10225 } // namespace v8 | 10222 } // namespace v8 |
OLD | NEW |