Index: src/wasm/wasm-module.h |
diff --git a/src/wasm/wasm-module.h b/src/wasm/wasm-module.h |
index 2b7f28063cd2325aa96592daa5df558a5212abde..dc5f0ec2b15b4bbca8325fc2e7521986cf2cf3f5 100644 |
--- a/src/wasm/wasm-module.h |
+++ b/src/wasm/wasm-module.h |
@@ -31,6 +31,17 @@ class WasmCompilationUnit; |
namespace wasm { |
class ErrorThrower; |
+// TODO(eholk): Move this into trap-handler.h once those files land. |
+struct ProtectedInstructionData { |
titzer
2016/11/16 18:06:47
I think it'd be best to move this into the compile
Eric Holk
2016/11/18 02:19:46
Done.
|
+ /// The offset of this instruction from the start of its code object. |
+ int32_t instr_offset; |
+ |
+ /// The offset of the landing pad from the start of its code object. |
+ // |
+ // TODO(eholk): Using a single landing pad and store parameters here. |
+ int32_t landing_offset; |
+}; |
+ |
const size_t kMaxModuleSize = 1024 * 1024 * 1024; |
const size_t kMaxFunctionSize = 128 * 1024; |
const size_t kMaxStringSize = 256; |
@@ -172,6 +183,8 @@ struct WasmExport { |
enum ModuleOrigin { kWasmOrigin, kAsmJsOrigin }; |
+typedef std::vector<ProtectedInstructionData> ProtectedInstructionList; |
+ |
// Static representation of a module. |
struct V8_EXPORT_PRIVATE WasmModule { |
static const uint32_t kPageSize = 0x10000; // Page size, 64kb. |
@@ -180,6 +193,8 @@ struct V8_EXPORT_PRIVATE WasmModule { |
static const size_t kSpecMaxPages = 65536; // Maximum according to the spec |
static const size_t kV8MaxTableSize = 16 * 1024 * 1024; |
+ enum TrapFields { kTrapCodeOffset, kTrapLandingOffset, kTrapDataSize }; |
+ |
Zone* owned_zone; |
const byte* module_start = nullptr; // starting address for the module bytes |
const byte* module_end = nullptr; // end address for the module bytes |
@@ -261,6 +276,10 @@ struct V8_EXPORT_PRIVATE WasmModule { |
Handle<JSReceiver> ffi, |
Handle<JSArrayBuffer> memory); |
+ Handle<FixedArray> PackProtectedInstructions( |
+ const std::vector<ProtectedInstructionList>& protected_instructions, |
+ Factory* factory) const; |
+ |
MaybeHandle<WasmCompiledModule> CompileFunctions( |
Isolate* isolate, Handle<Managed<WasmModule>> module_wrapper, |
ErrorThrower* thrower) const; |
@@ -278,6 +297,11 @@ struct WasmInstance { |
Handle<JSArrayBuffer> globals_buffer; // Handle to array buffer of globals. |
std::vector<Handle<FixedArray>> function_tables; // indirect function tables. |
std::vector<Handle<Code>> function_code; // code objects for each function. |
+ std::vector<ProtectedInstructionList> protected_instructions; // Instructions |
titzer
2016/11/16 18:06:47
I think this should somehow be associated with the
Eric Holk
2016/11/18 02:19:46
Done.
|
+ // that are |
+ // protected by |
+ // the signal |
+ // handler. |
// -- raw memory ------------------------------------------------------------ |
byte* mem_start = nullptr; // start of linear memory. |
uint32_t mem_size = 0; // size of the linear memory. |
@@ -287,7 +311,8 @@ struct WasmInstance { |
explicit WasmInstance(const WasmModule* m) |
: module(m), |
function_tables(m->function_tables.size()), |
- function_code(m->functions.size()) {} |
+ function_code(m->functions.size()), |
+ protected_instructions(m->functions.size()) {} |
}; |
// Interface provided to the decoder/graph builder which contains only |