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

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

Issue 2500443004: [wasm] OOB traps: build protected instruction list during codegen (Closed)
Patch Set: Merging with master Created 4 years, 1 month 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
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.
//--------------------------------------------------------------------------
{

Powered by Google App Engine
This is Rietveld 408576698