Index: src/wasm/wasm-module.cc |
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc |
index f70467f50dcf87d22122630323370c717fc899fb..6d45ebe32a015141d75f1eb683e2f6e2c601bc41 100644 |
--- a/src/wasm/wasm-module.cc |
+++ b/src/wasm/wasm-module.cc |
@@ -1255,6 +1255,37 @@ class WasmInstanceBuilder { |
FlushICache(isolate_, code_table); |
//-------------------------------------------------------------------------- |
+ // Unpack and notify signal handler of protected instructions. |
+ //-------------------------------------------------------------------------- |
+ { |
+ for (int i = 0; i < code_table->length(); ++i) { |
+ Handle<Code> code = code_table->GetValueChecked<Code>(isolate_, i); |
+ |
+ if (code->kind() != Code::WASM_FUNCTION) { |
+ continue; |
+ } |
+ |
+ FixedArray* protected_instructions = code->protected_instructions(); |
+ |
+ ProtectedInstructionList unpacked; |
+ for (int i = 0; i < protected_instructions->length(); |
+ i += kTrapDataSize) { |
+ ProtectedInstructionData data; |
+ data.instr_offset = |
+ protected_instructions |
+ ->GetValueChecked<Smi>(isolate_, i + kTrapCodeOffset) |
+ ->value(); |
+ data.landing_offset = |
+ protected_instructions |
+ ->GetValueChecked<Smi>(isolate_, i + kTrapLandingOffset) |
+ ->value(); |
+ unpacked.push_back(data); |
+ } |
+ // TODO(eholk): Register the protected instruction information once the |
+ // trap handler is in place. |
+ } |
+ } |
+ |
// Set up and link the new instance. |
//-------------------------------------------------------------------------- |
{ |