Commit ebb77c37 authored by chunyang.dai's avatar chunyang.dai Committed by Commit bot

X87: Externalize deoptimization reasons.

port 2491a639 (r26463)

original commit message:

   Externalize deoptimization reasons.
   1) The hardcoded strings were converted into DeoptReason enum.

   2) Deopt comment were converted into a pair location and deopt reason entries so
      the deopt reason tracking mode would less affect the size of the RelocInfo table and heap.

   3) DeoptReason entry in RelocInfo reuses kCommentTag value and generates short entry in RelocInfo table.

BUG=

Review URL: https://codereview.chromium.org/867243005

Cr-Commit-Position: refs/heads/master@{#26526}
parent 215e6bcb
......@@ -1919,6 +1919,15 @@ void Assembler::RecordComment(const char* msg, bool force) {
}
void Assembler::RecordDeoptReason(const int reason, const int raw_position) {
if (FLAG_trace_deopt) {
EnsureSpace ensure_space(this);
RecordRelocInfo(RelocInfo::POSITION, raw_position);
RecordRelocInfo(RelocInfo::DEOPT_REASON, reason);
}
}
void Assembler::GrowBuffer() {
DCHECK(buffer_overflow());
if (!own_buffer_) FATAL("external code buffer is too small");
......
......@@ -935,6 +935,10 @@ class Assembler : public AssemblerBase {
// write a comment.
void RecordComment(const char* msg, bool force = false);
// Record a deoptimization reason that can be used by a log or cpu profiler.
// Use --trace-deopt to enable.
void RecordDeoptReason(const int reason, const int raw_position);
// Writes a single byte or word of data in the code stream. Used for
// inline tables, e.g., jump-tables.
void db(uint8_t data);
......
......@@ -1080,7 +1080,7 @@ void LCodeGen::RegisterEnvironmentForDeoptimization(
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
const char* detail,
Deoptimizer::DeoptReason deopt_reason,
Deoptimizer::BailoutType bailout_type) {
LEnvironment* environment = instr->environment();
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
......@@ -1144,7 +1144,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
}
Deoptimizer::Reason reason(instr->hydrogen_value()->position().raw(),
instr->Mnemonic(), detail);
instr->Mnemonic(), deopt_reason);
DCHECK(info()->IsStub() || frame_is_built_);
if (cc == no_condition && frame_is_built_) {
DeoptComment(reason);
......@@ -1168,11 +1168,11 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
const char* detail) {
Deoptimizer::DeoptReason deopt_reason) {
Deoptimizer::BailoutType bailout_type = info()->IsStub()
? Deoptimizer::LAZY
: Deoptimizer::EAGER;
DeoptimizeIf(cc, instr, detail, bailout_type);
DeoptimizeIf(cc, instr, deopt_reason, bailout_type);
}
......@@ -5311,7 +5311,7 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) {
__ bind(&check_false);
__ cmp(input_reg, factory()->false_value());
DeoptimizeIf(not_equal, instr,
Deoptimizer::kNotAHeapNumberUndefinedTrueFalse);
Deoptimizer::kNotAHeapNumberUndefinedBoolean);
__ Move(input_reg, Immediate(0));
} else {
// TODO(olivf) Converting a number on the fpu is actually quite slow. We
......
......@@ -229,9 +229,11 @@ class LCodeGen: public LCodeGenBase {
void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
Safepoint::DeoptMode mode);
void DeoptimizeIf(Condition cc, LInstruction* instr, const char* detail,
void DeoptimizeIf(Condition cc, LInstruction* instr,
Deoptimizer::DeoptReason deopt_reason,
Deoptimizer::BailoutType bailout_type);
void DeoptimizeIf(Condition cc, LInstruction* instr, const char* detail);
void DeoptimizeIf(Condition cc, LInstruction* instr,
Deoptimizer::DeoptReason deopt_reason);
bool DeoptEveryNTimes() {
return FLAG_deopt_every_n_times != 0 && !info()->IsStub();
......
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