port
2491a639bf46da4bfdcf65329305ee3053aa5fec (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}
}
+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");
// 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);
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);
}
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);
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);
}
__ 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
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();