Commit 7617705d authored by tebbi's avatar tebbi Committed by Commit bot

[turbofan] Attach source positions to deopt info.

R=bmeurer@chromium.org,jarin@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2366993002
Cr-Commit-Position: refs/heads/master@{#39733}
parent f1be3907
......@@ -753,8 +753,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
Deoptimizer::BailoutType bailout_type =
Deoptimizer::BailoutType(MiscField::decode(instr->opcode()));
CodeGenResult result =
AssembleDeoptimizerCall(deopt_state_id, bailout_type);
CodeGenResult result = AssembleDeoptimizerCall(
deopt_state_id, bailout_type, current_source_position_);
if (result != kSuccess) return result;
break;
}
......@@ -1639,7 +1639,8 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
}
CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
int deoptimization_id, Deoptimizer::BailoutType bailout_type) {
int deoptimization_id, Deoptimizer::BailoutType bailout_type,
SourcePosition pos) {
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
isolate(), deoptimization_id, bailout_type);
// TODO(turbofan): We should be able to generate better code by sharing the
......@@ -1648,7 +1649,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts;
DeoptimizeReason deoptimization_reason =
GetDeoptimizationReason(deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id);
__ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
__ CheckConstPool(false, false);
return kSuccess;
......
......@@ -780,8 +780,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
Deoptimizer::BailoutType bailout_type =
Deoptimizer::BailoutType(MiscField::decode(instr->opcode()));
CodeGenResult result =
AssembleDeoptimizerCall(deopt_state_id, bailout_type);
CodeGenResult result = AssembleDeoptimizerCall(
deopt_state_id, bailout_type, current_source_position_);
if (result != kSuccess) return result;
break;
}
......@@ -1752,13 +1752,14 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
}
CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
int deoptimization_id, Deoptimizer::BailoutType bailout_type) {
int deoptimization_id, Deoptimizer::BailoutType bailout_type,
SourcePosition pos) {
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
isolate(), deoptimization_id, bailout_type);
if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts;
DeoptimizeReason deoptimization_reason =
GetDeoptimizationReason(deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id);
__ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
return kSuccess;
}
......
......@@ -170,15 +170,17 @@ class InstructionOperandConverter {
// Eager deoptimization exit.
class DeoptimizationExit : public ZoneObject {
public:
explicit DeoptimizationExit(int deoptimization_id)
: deoptimization_id_(deoptimization_id) {}
explicit DeoptimizationExit(int deoptimization_id, SourcePosition pos)
: deoptimization_id_(deoptimization_id), pos_(pos) {}
int deoptimization_id() const { return deoptimization_id_; }
Label* label() { return &label_; }
SourcePosition pos() const { return pos_; }
private:
int const deoptimization_id_;
Label label_;
SourcePosition const pos_;
};
// Generator for out-of-line code that is emitted after the main code is done.
......
......@@ -188,7 +188,8 @@ Handle<Code> CodeGenerator::GenerateCode() {
// Assemble all eager deoptimization exits.
for (DeoptimizationExit* exit : deoptimization_exits_) {
masm()->bind(exit->label());
AssembleDeoptimizerCall(exit->deoptimization_id(), Deoptimizer::EAGER);
AssembleDeoptimizerCall(exit->deoptimization_id(), Deoptimizer::EAGER,
exit->pos());
}
// Ensure there is space for lazy deoptimization in the code.
......@@ -924,8 +925,8 @@ DeoptimizationExit* CodeGenerator::AddDeoptimizationExit(
Instruction* instr, size_t frame_state_offset) {
int const deoptimization_id = BuildTranslation(
instr, -1, frame_state_offset, OutputFrameStateCombine::Ignore());
DeoptimizationExit* const exit =
new (zone()) DeoptimizationExit(deoptimization_id);
DeoptimizationExit* const exit = new (zone())
DeoptimizationExit(deoptimization_id, current_source_position_);
deoptimization_exits_.push_back(exit);
return exit;
}
......
......@@ -120,7 +120,8 @@ class CodeGenerator final : public GapResolver::Assembler {
void AssembleArchTableSwitch(Instruction* instr);
CodeGenResult AssembleDeoptimizerCall(int deoptimization_id,
Deoptimizer::BailoutType bailout_type);
Deoptimizer::BailoutType bailout_type,
SourcePosition pos);
// Generates an architecture-specific, descriptor-specific prologue
// to set up a stack frame.
......
......@@ -646,8 +646,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
Deoptimizer::BailoutType bailout_type =
Deoptimizer::BailoutType(MiscField::decode(instr->opcode()));
CodeGenResult result =
AssembleDeoptimizerCall(deopt_state_id, bailout_type);
CodeGenResult result = AssembleDeoptimizerCall(
deopt_state_id, bailout_type, current_source_position_);
if (result != kSuccess) return result;
break;
}
......@@ -1783,13 +1783,14 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
}
CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
int deoptimization_id, Deoptimizer::BailoutType bailout_type) {
int deoptimization_id, Deoptimizer::BailoutType bailout_type,
SourcePosition pos) {
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
isolate(), deoptimization_id, bailout_type);
if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts;
DeoptimizeReason deoptimization_reason =
GetDeoptimizationReason(deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id);
__ call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
return kSuccess;
}
......
......@@ -707,8 +707,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
Deoptimizer::BailoutType bailout_type =
Deoptimizer::BailoutType(MiscField::decode(instr->opcode()));
CodeGenResult result =
AssembleDeoptimizerCall(deopt_state_id, bailout_type);
CodeGenResult result = AssembleDeoptimizerCall(
deopt_state_id, bailout_type, current_source_position_);
if (result != kSuccess) return result;
break;
}
......@@ -1877,13 +1877,14 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
}
CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
int deoptimization_id, Deoptimizer::BailoutType bailout_type) {
int deoptimization_id, Deoptimizer::BailoutType bailout_type,
SourcePosition pos) {
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
isolate(), deoptimization_id, bailout_type);
if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts;
DeoptimizeReason deoptimization_reason =
GetDeoptimizationReason(deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id);
__ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
return kSuccess;
}
......
......@@ -716,8 +716,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
Deoptimizer::BailoutType bailout_type =
Deoptimizer::BailoutType(MiscField::decode(instr->opcode()));
CodeGenResult result =
AssembleDeoptimizerCall(deopt_state_id, bailout_type);
CodeGenResult result = AssembleDeoptimizerCall(
deopt_state_id, bailout_type, current_source_position_);
if (result != kSuccess) return result;
break;
}
......@@ -2199,13 +2199,14 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
}
CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
int deoptimization_id, Deoptimizer::BailoutType bailout_type) {
int deoptimization_id, Deoptimizer::BailoutType bailout_type,
SourcePosition pos) {
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
isolate(), deoptimization_id, bailout_type);
if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts;
DeoptimizeReason deoptimization_reason =
GetDeoptimizationReason(deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id);
__ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
return kSuccess;
}
......
......@@ -1087,8 +1087,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
Deoptimizer::BailoutType bailout_type =
Deoptimizer::BailoutType(MiscField::decode(instr->opcode()));
CodeGenResult result =
AssembleDeoptimizerCall(deopt_state_id, bailout_type);
CodeGenResult result = AssembleDeoptimizerCall(
deopt_state_id, bailout_type, current_source_position_);
if (result != kSuccess) return result;
break;
}
......@@ -2068,7 +2068,8 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
}
CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
int deoptimization_id, Deoptimizer::BailoutType bailout_type) {
int deoptimization_id, Deoptimizer::BailoutType bailout_type,
SourcePosition pos) {
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
isolate(), deoptimization_id, bailout_type);
// TODO(turbofan): We should be able to generate better code by sharing the
......@@ -2077,7 +2078,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts;
DeoptimizeReason deoptimization_reason =
GetDeoptimizationReason(deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id);
__ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
return kSuccess;
}
......
......@@ -989,8 +989,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
Deoptimizer::BailoutType bailout_type =
Deoptimizer::BailoutType(MiscField::decode(instr->opcode()));
CodeGenResult result =
AssembleDeoptimizerCall(deopt_state_id, bailout_type);
CodeGenResult result = AssembleDeoptimizerCall(
deopt_state_id, bailout_type, current_source_position_);
if (result != kSuccess) return result;
break;
}
......@@ -2192,7 +2192,8 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
}
CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
int deoptimization_id, Deoptimizer::BailoutType bailout_type) {
int deoptimization_id, Deoptimizer::BailoutType bailout_type,
SourcePosition pos) {
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
isolate(), deoptimization_id, bailout_type);
// TODO(turbofan): We should be able to generate better code by sharing the
......@@ -2201,7 +2202,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts;
DeoptimizeReason deoptimization_reason =
GetDeoptimizationReason(deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id);
__ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
return kSuccess;
}
......
......@@ -910,8 +910,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore());
Deoptimizer::BailoutType bailout_type =
Deoptimizer::BailoutType(MiscField::decode(instr->opcode()));
CodeGenResult result =
AssembleDeoptimizerCall(deopt_state_id, bailout_type);
CodeGenResult result = AssembleDeoptimizerCall(
deopt_state_id, bailout_type, current_source_position_);
if (result != kSuccess) return result;
break;
}
......@@ -2304,13 +2304,14 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
}
CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
int deoptimization_id, Deoptimizer::BailoutType bailout_type) {
int deoptimization_id, Deoptimizer::BailoutType bailout_type,
SourcePosition pos) {
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
isolate(), deoptimization_id, bailout_type);
if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts;
DeoptimizeReason deoptimization_reason =
GetDeoptimizationReason(deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id);
__ call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
return kSuccess;
}
......
......@@ -743,8 +743,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
Deoptimizer::BailoutType bailout_type =
Deoptimizer::BailoutType(MiscField::decode(instr->opcode()));
CodeGenResult result =
AssembleDeoptimizerCall(deopt_state_id, bailout_type);
CodeGenResult result = AssembleDeoptimizerCall(
deopt_state_id, bailout_type, current_source_position_);
if (result != kSuccess) return result;
break;
}
......@@ -2238,13 +2238,14 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
}
CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall(
int deoptimization_id, Deoptimizer::BailoutType bailout_type) {
int deoptimization_id, Deoptimizer::BailoutType bailout_type,
SourcePosition pos) {
Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
isolate(), deoptimization_id, bailout_type);
if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts;
DeoptimizeReason deoptimization_reason =
GetDeoptimizationReason(deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id);
__ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id);
__ call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
return kSuccess;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment