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

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

Issue 2651833003: [wasm] Move protected instruction info to RelocInfo (Closed)
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/v8/v8 into trap-relocinfo Created 3 years, 11 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/trap-handler/trap-handler.h ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index bd559c56a338e91c6f3e37445dc1bec3b6053f57..3021fb55b9b67d917ae25093b62f298302c93779 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -1407,7 +1407,7 @@ class WasmInstanceBuilder {
//--------------------------------------------------------------------------
// Unpack and notify signal handler of protected instructions.
//--------------------------------------------------------------------------
- {
+ if (FLAG_wasm_trap_handler) {
for (int i = 0; i < code_table->length(); ++i) {
Handle<Code> code = code_table->GetValueChecked<Code>(isolate_, i);
@@ -1415,21 +1415,17 @@ class WasmInstanceBuilder {
continue;
}
- FixedArray* protected_instructions = code->protected_instructions();
- DCHECK(protected_instructions != nullptr);
+ const intptr_t base = reinterpret_cast<intptr_t>(code->entry());
+
Zone zone(isolate_->allocator(), "Wasm Module");
ZoneVector<trap_handler::ProtectedInstructionData> unpacked(&zone);
- for (int i = 0; i < protected_instructions->length();
- i += Code::kTrapDataSize) {
+ const int mode_mask =
+ RelocInfo::ModeMask(RelocInfo::WASM_PROTECTED_INSTRUCTION_LANDING);
+ for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) {
trap_handler::ProtectedInstructionData data;
- data.instr_offset =
- protected_instructions
- ->GetValueChecked<Smi>(isolate_, i + Code::kTrapCodeOffset)
- ->value();
+ data.instr_offset = it.rinfo()->data();
data.landing_offset =
- protected_instructions
- ->GetValueChecked<Smi>(isolate_, i + Code::kTrapLandingOffset)
- ->value();
+ reinterpret_cast<intptr_t>(it.rinfo()->pc()) - base;
unpacked.emplace_back(data);
}
// TODO(eholk): Register the protected instruction information once the
« no previous file with comments | « src/trap-handler/trap-handler.h ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698