Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: src/api.cc

Issue 2695813005: [wasm] Split the compilation and instantiation API into sync and async methods. (Closed)
Patch Set: [wasm] Split the compilation and instantiation API into sync and async methods. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.h ('k') | src/asmjs/asm-js.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7581 matching lines...) Expand 10 before | Expand all | Expand 10 after
7592 return ret; 7592 return ret;
7593 } 7593 }
7594 return Compile(isolate, wire_bytes.first, wire_bytes.second); 7594 return Compile(isolate, wire_bytes.first, wire_bytes.second);
7595 } 7595 }
7596 7596
7597 MaybeLocal<WasmCompiledModule> WasmCompiledModule::Compile(Isolate* isolate, 7597 MaybeLocal<WasmCompiledModule> WasmCompiledModule::Compile(Isolate* isolate,
7598 const uint8_t* start, 7598 const uint8_t* start,
7599 size_t length) { 7599 size_t length) {
7600 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 7600 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
7601 i::wasm::ErrorThrower thrower(i_isolate, "WasmCompiledModule::Deserialize()"); 7601 i::wasm::ErrorThrower thrower(i_isolate, "WasmCompiledModule::Deserialize()");
7602 i::MaybeHandle<i::JSObject> maybe_compiled = 7602 i::MaybeHandle<i::JSObject> maybe_compiled = i::wasm::SyncCompile(
7603 i::wasm::CreateModuleObjectFromBytes( 7603 i_isolate, &thrower, i::wasm::ModuleWireBytes(start, start + length));
7604 i_isolate, start, start + length, &thrower,
7605 i::wasm::ModuleOrigin::kWasmOrigin, i::Handle<i::Script>::null(),
7606 i::Vector<const uint8_t>::empty());
7607 if (maybe_compiled.is_null()) return MaybeLocal<WasmCompiledModule>(); 7604 if (maybe_compiled.is_null()) return MaybeLocal<WasmCompiledModule>();
7608 return Local<WasmCompiledModule>::Cast( 7605 return Local<WasmCompiledModule>::Cast(
7609 Utils::ToLocal(maybe_compiled.ToHandleChecked())); 7606 Utils::ToLocal(maybe_compiled.ToHandleChecked()));
7610 } 7607 }
7611 7608
7612 // static 7609 // static
7613 v8::ArrayBuffer::Allocator* v8::ArrayBuffer::Allocator::NewDefaultAllocator() { 7610 v8::ArrayBuffer::Allocator* v8::ArrayBuffer::Allocator::NewDefaultAllocator() {
7614 return new ArrayBufferAllocator(); 7611 return new ArrayBufferAllocator();
7615 } 7612 }
7616 7613
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after
10273 Address callback_address = 10270 Address callback_address =
10274 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10271 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10275 VMState<EXTERNAL> state(isolate); 10272 VMState<EXTERNAL> state(isolate);
10276 ExternalCallbackScope call_scope(isolate, callback_address); 10273 ExternalCallbackScope call_scope(isolate, callback_address);
10277 callback(info); 10274 callback(info);
10278 } 10275 }
10279 10276
10280 10277
10281 } // namespace internal 10278 } // namespace internal
10282 } // namespace v8 10279 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.h ('k') | src/asmjs/asm-js.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698