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

Unified Diff: src/wasm/wasm-module.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-js.cc ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.h
diff --git a/src/wasm/wasm-module.h b/src/wasm/wasm-module.h
index ffb02bb8f41d4d9329165dd6141919e8447cb064..cd237566bfec1aecfc8e943a3ab8e9a1959fafb8 100644
--- a/src/wasm/wasm-module.h
+++ b/src/wasm/wasm-module.h
@@ -28,7 +28,6 @@ class WasmMemoryObject;
namespace compiler {
class CallDescriptor;
-class WasmCompilationUnit;
}
namespace wasm {
@@ -217,18 +216,6 @@ struct V8_EXPORT_PRIVATE WasmModule {
~WasmModule() {
if (owned_zone) delete owned_zone;
}
-
- // Creates a new instantiation of the module in the given isolate.
- static MaybeHandle<WasmInstanceObject> Instantiate(
- Isolate* isolate, ErrorThrower* thrower,
- Handle<WasmModuleObject> wasm_module, Handle<JSReceiver> ffi,
- Handle<JSArrayBuffer> memory = Handle<JSArrayBuffer>::null());
-
- MaybeHandle<WasmCompiledModule> CompileFunctions(
- Isolate* isolate, Handle<Managed<WasmModule>> module_wrapper,
- ErrorThrower* thrower, const ModuleWireBytes& wire_bytes,
- Handle<Script> asm_js_script,
- Vector<const byte> asm_js_offset_table_bytes) const;
};
typedef Managed<WasmModule> WasmModuleWrapper;
@@ -359,6 +346,7 @@ struct V8_EXPORT_PRIVATE ModuleEnv {
return instance->function_code[index];
}
+ // TODO(titzer): move these into src/compiler/wasm-compiler.cc
static compiler::CallDescriptor* GetWasmCallDescriptor(Zone* zone,
FunctionSig* sig);
static compiler::CallDescriptor* GetI32WasmCallDescriptor(
@@ -425,11 +413,6 @@ V8_EXPORT_PRIVATE Handle<JSArray> GetCustomSections(
Isolate* isolate, Handle<WasmModuleObject> module, Handle<String> name,
ErrorThrower* thrower);
-V8_EXPORT_PRIVATE bool ValidateModuleBytes(Isolate* isolate, const byte* start,
- const byte* end,
- ErrorThrower* thrower,
- ModuleOrigin origin);
-
// Get the offset of the code of a function within a module.
int GetFunctionCodeOffset(Handle<WasmCompiledModule> compiled_module,
int func_index);
@@ -464,15 +447,43 @@ void UpdateDispatchTables(Isolate* isolate, Handle<FixedArray> dispatch_tables,
void GrowDispatchTables(Isolate* isolate, Handle<FixedArray> dispatch_tables,
uint32_t old_size, uint32_t count);
-namespace testing {
+//============================================================================
+//== Compilation and instantiation ===========================================
+//============================================================================
+V8_EXPORT_PRIVATE bool SyncValidate(Isolate* isolate, ErrorThrower* thrower,
+ const ModuleWireBytes& bytes);
+
+V8_EXPORT_PRIVATE MaybeHandle<WasmModuleObject> SyncCompileTranslatedAsmJs(
+ Isolate* isolate, ErrorThrower* thrower, const ModuleWireBytes& bytes,
+ Handle<Script> asm_js_script, Vector<const byte> asm_js_offset_table_bytes);
+
+V8_EXPORT_PRIVATE MaybeHandle<WasmModuleObject> SyncCompile(
+ Isolate* isolate, ErrorThrower* thrower, const ModuleWireBytes& bytes);
+
+V8_EXPORT_PRIVATE MaybeHandle<WasmInstanceObject> SyncInstantiate(
+ Isolate* isolate, ErrorThrower* thrower,
+ Handle<WasmModuleObject> module_object, MaybeHandle<JSReceiver> imports,
+ MaybeHandle<JSArrayBuffer> memory);
+V8_EXPORT_PRIVATE void AsyncCompile(Isolate* isolate, Handle<JSPromise> promise,
+ const ModuleWireBytes& bytes);
+
+V8_EXPORT_PRIVATE void AsyncInstantiate(Isolate* isolate,
+ Handle<JSPromise> promise,
+ Handle<WasmModuleObject> module_object,
+ MaybeHandle<JSReceiver> imports);
+
+V8_EXPORT_PRIVATE void AsyncCompileAndInstantiate(
+ Isolate* isolate, Handle<JSPromise> promise, const ModuleWireBytes& bytes,
+ MaybeHandle<JSReceiver> imports);
+
+namespace testing {
void ValidateInstancesChain(Isolate* isolate,
Handle<WasmModuleObject> module_obj,
int instance_count);
void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj);
void ValidateOrphanedInstance(Isolate* isolate,
Handle<WasmInstanceObject> instance);
-
} // namespace testing
} // namespace wasm
} // namespace internal
« no previous file with comments | « src/wasm/wasm-js.cc ('k') | src/wasm/wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698