Index: src/wasm/wasm-module.h |
diff --git a/src/wasm/wasm-module.h b/src/wasm/wasm-module.h |
index ffb02bb8f41d4d9329165dd6141919e8447cb064..27a6a4c9cfc40eb05f7cfdc9738aaa109e358ca2 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; |
@@ -260,10 +247,15 @@ struct WasmInstance { |
// on module_bytes, as this storage is only guaranteed to be alive as long as |
// this struct is alive. |
struct V8_EXPORT_PRIVATE ModuleWireBytes { |
+ ModuleWireBytes(Handle<Object> handle, const byte* start, const byte* end) |
+ : handle_(handle), module_bytes_(start, static_cast<int>(end - start)) { |
+ DCHECK_GE(kMaxInt, end - start); |
+ } |
ModuleWireBytes(Vector<const byte> module_bytes) |
ahaas
2017/02/17 13:02:29
I think this constructor should use the explicit k
|
- : module_bytes_(module_bytes) {} |
+ : handle_(Handle<Object>::null()), module_bytes_(module_bytes) {} |
Clemens Hammacher
2017/02/16 20:36:58
This is default-initialized, you can skip it here.
|
ModuleWireBytes(const byte* start, const byte* end) |
- : module_bytes_(start, static_cast<int>(end - start)) { |
+ : handle_(Handle<Object>::null()), |
Clemens Hammacher
2017/02/16 20:36:58
Same here.
|
+ module_bytes_(start, static_cast<int>(end - start)) { |
DCHECK_GE(kMaxInt, end - start); |
} |
@@ -311,6 +303,7 @@ struct V8_EXPORT_PRIVATE ModuleWireBytes { |
int length() const { return module_bytes_.length(); } |
private: |
+ Handle<Object> handle_; |
Clemens Hammacher
2017/02/16 20:36:58
This field seems to be unused.
If I am wrong, can
|
const Vector<const byte> module_bytes_; |
}; |
@@ -359,6 +352,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 +419,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 +453,47 @@ 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, |
+ void* unused, MaybeHandle<JSReceiver> imports); |
Clemens Hammacher
2017/02/16 20:36:58
Wut? "void* unused"? Why is this needed? The compi
|
+ |
+V8_EXPORT_PRIVATE void AsyncCompileAndInstantiate( |
+ Isolate* isolate, Handle<JSPromise> promise, |
+ Handle<WasmModuleObject> module, 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 |