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

Unified Diff: src/compiler/x64/code-generator-x64.cc

Issue 2500443004: [wasm] OOB traps: build protected instruction list during codegen (Closed)
Patch Set: Code review feedback Created 4 years 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/compiler/x64/code-generator-x64.cc
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc
index 745ac5084166e80b649898fbd5f163ac57ce0af4..b61f89f3c282fe9583e84605ef93e17a8cef281b 100644
--- a/src/compiler/x64/code-generator-x64.cc
+++ b/src/compiler/x64/code-generator-x64.cc
@@ -270,18 +270,21 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
class WasmOutOfLineTrap final : public OutOfLineCode {
public:
- WasmOutOfLineTrap(CodeGenerator* gen, Address pc, bool frame_elided,
+ WasmOutOfLineTrap(CodeGenerator* gen, int pc, bool frame_elided,
Register context, int32_t position)
: OutOfLineCode(gen),
+ gen_(gen),
pc_(pc),
frame_elided_(frame_elided),
context_(context),
position_(position) {}
+ // TODO(eholk): Refactor this method to take the code generator as a
+ // parameter.
void Generate() final {
- // TODO(eholk): record pc_ and the current pc in a table so that
- // the signal handler can find it.
- USE(pc_);
+ int current_pc = __ pc_offset();
+
+ gen_->AddProtectedInstruction(pc_, current_pc);
if (frame_elided_) {
__ EnterFrame(StackFrame::WASM);
@@ -296,7 +299,8 @@ class WasmOutOfLineTrap final : public OutOfLineCode {
}
private:
- Address pc_;
+ CodeGenerator* gen_;
+ int pc_;
bool frame_elided_;
Register context_;
int32_t position_;
@@ -1897,7 +1901,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ movl(i.OutputRegister(), i.InputOperand(0));
}
} else {
- Address pc = __ pc();
+ int pc = __ pc_offset();
__ movl(i.OutputRegister(), i.MemoryOperand());
if (arch_opcode == kX64TrapMovl) {

Powered by Google App Engine
This is Rietveld 408576698