Emit comment with instruction+reason before deopt calls.
Note that we still need to migrate from sometimes emitting those comments by hand to passing a reason explicitly, but this can be done incrementally in separate CLs. R=jarin@chromium.org Review URL: https://codereview.chromium.org/582743002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24061 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
28ff661909
commit
264c7fe3cd
@ -336,21 +336,23 @@ bool LCodeGen::GenerateDeoptJumpTable() {
|
|||||||
|
|
||||||
int length = deopt_jump_table_.length();
|
int length = deopt_jump_table_.length();
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
__ bind(&deopt_jump_table_[i].label);
|
Deoptimizer::JumpTableEntry* table_entry = &deopt_jump_table_[i];
|
||||||
|
__ bind(&table_entry->label);
|
||||||
|
|
||||||
Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type;
|
Deoptimizer::BailoutType type = table_entry->bailout_type;
|
||||||
DCHECK(type == deopt_jump_table_[0].bailout_type);
|
DCHECK(type == deopt_jump_table_[0].bailout_type);
|
||||||
Address entry = deopt_jump_table_[i].address;
|
Address entry = table_entry->address;
|
||||||
int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
|
int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
|
||||||
DCHECK(id != Deoptimizer::kNotDeoptimizationEntry);
|
DCHECK(id != Deoptimizer::kNotDeoptimizationEntry);
|
||||||
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
|
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
|
||||||
|
DeoptComment(table_entry->mnemonic, table_entry->reason);
|
||||||
|
|
||||||
// Second-level deopt table entries are contiguous and small, so instead
|
// Second-level deopt table entries are contiguous and small, so instead
|
||||||
// of loading the full, absolute address of each one, load an immediate
|
// of loading the full, absolute address of each one, load an immediate
|
||||||
// offset which will be added to the base address later.
|
// offset which will be added to the base address later.
|
||||||
__ mov(entry_offset, Operand(entry - base));
|
__ mov(entry_offset, Operand(entry - base));
|
||||||
|
|
||||||
if (deopt_jump_table_[i].needs_frame) {
|
if (table_entry->needs_frame) {
|
||||||
DCHECK(!info()->saves_caller_doubles());
|
DCHECK(!info()->saves_caller_doubles());
|
||||||
if (needs_frame.is_bound()) {
|
if (needs_frame.is_bound()) {
|
||||||
__ b(&needs_frame);
|
__ b(&needs_frame);
|
||||||
@ -847,6 +849,7 @@ void LCodeGen::RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
||||||
|
const char* reason,
|
||||||
Deoptimizer::BailoutType bailout_type) {
|
Deoptimizer::BailoutType bailout_type) {
|
||||||
LEnvironment* environment = instr->environment();
|
LEnvironment* environment = instr->environment();
|
||||||
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
||||||
@ -904,6 +907,7 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
|||||||
// restore caller doubles.
|
// restore caller doubles.
|
||||||
if (condition == al && frame_is_built_ &&
|
if (condition == al && frame_is_built_ &&
|
||||||
!info()->saves_caller_doubles()) {
|
!info()->saves_caller_doubles()) {
|
||||||
|
DeoptComment(instr->Mnemonic(), reason);
|
||||||
__ Call(entry, RelocInfo::RUNTIME_ENTRY);
|
__ Call(entry, RelocInfo::RUNTIME_ENTRY);
|
||||||
} else {
|
} else {
|
||||||
// We often have several deopts to the same entry, reuse the last
|
// We often have several deopts to the same entry, reuse the last
|
||||||
@ -912,9 +916,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
|||||||
(deopt_jump_table_.last().address != entry) ||
|
(deopt_jump_table_.last().address != entry) ||
|
||||||
(deopt_jump_table_.last().bailout_type != bailout_type) ||
|
(deopt_jump_table_.last().bailout_type != bailout_type) ||
|
||||||
(deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
|
(deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
|
||||||
Deoptimizer::JumpTableEntry table_entry(entry,
|
Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason,
|
||||||
bailout_type,
|
bailout_type, !frame_is_built_);
|
||||||
!frame_is_built_);
|
|
||||||
deopt_jump_table_.Add(table_entry, zone());
|
deopt_jump_table_.Add(table_entry, zone());
|
||||||
}
|
}
|
||||||
__ b(condition, &deopt_jump_table_.last().label);
|
__ b(condition, &deopt_jump_table_.last().label);
|
||||||
@ -922,11 +925,12 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr) {
|
void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
||||||
|
const char* reason) {
|
||||||
Deoptimizer::BailoutType bailout_type = info()->IsStub()
|
Deoptimizer::BailoutType bailout_type = info()->IsStub()
|
||||||
? Deoptimizer::LAZY
|
? Deoptimizer::LAZY
|
||||||
: Deoptimizer::EAGER;
|
: Deoptimizer::EAGER;
|
||||||
DeoptimizeIf(condition, instr, bailout_type);
|
DeoptimizeIf(condition, instr, reason, bailout_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5665,8 +5669,7 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
|
|||||||
type = Deoptimizer::LAZY;
|
type = Deoptimizer::LAZY;
|
||||||
}
|
}
|
||||||
|
|
||||||
Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
|
DeoptimizeIf(al, instr, instr->hydrogen()->reason(), type);
|
||||||
DeoptimizeIf(al, instr, type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -235,8 +235,9 @@ class LCodeGen: public LCodeGenBase {
|
|||||||
void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
||||||
Safepoint::DeoptMode mode);
|
Safepoint::DeoptMode mode);
|
||||||
void DeoptimizeIf(Condition condition, LInstruction* instr,
|
void DeoptimizeIf(Condition condition, LInstruction* instr,
|
||||||
Deoptimizer::BailoutType bailout_type);
|
const char* reason, Deoptimizer::BailoutType bailout_type);
|
||||||
void DeoptimizeIf(Condition condition, LInstruction* instr);
|
void DeoptimizeIf(Condition condition, LInstruction* instr,
|
||||||
|
const char* reason = NULL);
|
||||||
|
|
||||||
void AddToTranslation(LEnvironment* environment,
|
void AddToTranslation(LEnvironment* environment,
|
||||||
Translation* translation,
|
Translation* translation,
|
||||||
|
@ -593,11 +593,8 @@ bool LCodeGen::GenerateCode() {
|
|||||||
// the frame (that is done in GeneratePrologue).
|
// the frame (that is done in GeneratePrologue).
|
||||||
FrameScope frame_scope(masm_, StackFrame::NONE);
|
FrameScope frame_scope(masm_, StackFrame::NONE);
|
||||||
|
|
||||||
return GeneratePrologue() &&
|
return GeneratePrologue() && GenerateBody() && GenerateDeferredCode() &&
|
||||||
GenerateBody() &&
|
GenerateJumpTable() && GenerateSafepointTable();
|
||||||
GenerateDeferredCode() &&
|
|
||||||
GenerateDeoptJumpTable() &&
|
|
||||||
GenerateSafepointTable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -827,28 +824,30 @@ bool LCodeGen::GenerateDeferredCode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LCodeGen::GenerateDeoptJumpTable() {
|
bool LCodeGen::GenerateJumpTable() {
|
||||||
Label needs_frame, restore_caller_doubles, call_deopt_entry;
|
Label needs_frame, restore_caller_doubles, call_deopt_entry;
|
||||||
|
|
||||||
if (deopt_jump_table_.length() > 0) {
|
if (jump_table_.length() > 0) {
|
||||||
Comment(";;; -------------------- Jump table --------------------");
|
Comment(";;; -------------------- Jump table --------------------");
|
||||||
Address base = deopt_jump_table_[0]->address;
|
Address base = jump_table_[0]->address;
|
||||||
|
|
||||||
UseScratchRegisterScope temps(masm());
|
UseScratchRegisterScope temps(masm());
|
||||||
Register entry_offset = temps.AcquireX();
|
Register entry_offset = temps.AcquireX();
|
||||||
|
|
||||||
int length = deopt_jump_table_.length();
|
int length = jump_table_.length();
|
||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
__ Bind(&deopt_jump_table_[i]->label);
|
Deoptimizer::JumpTableEntry* table_entry = jump_table_[i];
|
||||||
|
__ Bind(&table_entry->label);
|
||||||
|
|
||||||
Deoptimizer::BailoutType type = deopt_jump_table_[i]->bailout_type;
|
Deoptimizer::BailoutType type = table_entry->bailout_type;
|
||||||
Address entry = deopt_jump_table_[i]->address;
|
Address entry = table_entry->address;
|
||||||
int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
|
int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
|
||||||
if (id == Deoptimizer::kNotDeoptimizationEntry) {
|
if (id == Deoptimizer::kNotDeoptimizationEntry) {
|
||||||
Comment(";;; jump table entry %d.", i);
|
Comment(";;; jump table entry %d.", i);
|
||||||
} else {
|
} else {
|
||||||
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
|
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
|
||||||
}
|
}
|
||||||
|
DeoptComment(table_entry->mnemonic, table_entry->reason);
|
||||||
|
|
||||||
// Second-level deopt table entries are contiguous and small, so instead
|
// Second-level deopt table entries are contiguous and small, so instead
|
||||||
// of loading the full, absolute address of each one, load the base
|
// of loading the full, absolute address of each one, load the base
|
||||||
@ -859,7 +858,7 @@ bool LCodeGen::GenerateDeoptJumpTable() {
|
|||||||
// branch.
|
// branch.
|
||||||
bool last_entry = (i + 1) == length;
|
bool last_entry = (i + 1) == length;
|
||||||
|
|
||||||
if (deopt_jump_table_[i]->needs_frame) {
|
if (table_entry->needs_frame) {
|
||||||
DCHECK(!info()->saves_caller_doubles());
|
DCHECK(!info()->saves_caller_doubles());
|
||||||
if (!needs_frame.is_bound()) {
|
if (!needs_frame.is_bound()) {
|
||||||
// This variant of deopt can only be used with stubs. Since we don't
|
// This variant of deopt can only be used with stubs. Since we don't
|
||||||
@ -997,8 +996,8 @@ void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeBranch(
|
void LCodeGen::DeoptimizeBranch(
|
||||||
LInstruction* instr, BranchType branch_type, Register reg, int bit,
|
LInstruction* instr, const char* reason, BranchType branch_type,
|
||||||
Deoptimizer::BailoutType* override_bailout_type) {
|
Register reg, int bit, Deoptimizer::BailoutType* override_bailout_type) {
|
||||||
LEnvironment* environment = instr->environment();
|
LEnvironment* environment = instr->environment();
|
||||||
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
||||||
Deoptimizer::BailoutType bailout_type =
|
Deoptimizer::BailoutType bailout_type =
|
||||||
@ -1052,91 +1051,98 @@ void LCodeGen::DeoptimizeBranch(
|
|||||||
// Go through jump table if we need to build frame, or restore caller doubles.
|
// Go through jump table if we need to build frame, or restore caller doubles.
|
||||||
if (branch_type == always &&
|
if (branch_type == always &&
|
||||||
frame_is_built_ && !info()->saves_caller_doubles()) {
|
frame_is_built_ && !info()->saves_caller_doubles()) {
|
||||||
|
DeoptComment(instr->Mnemonic(), reason);
|
||||||
__ Call(entry, RelocInfo::RUNTIME_ENTRY);
|
__ Call(entry, RelocInfo::RUNTIME_ENTRY);
|
||||||
} else {
|
} else {
|
||||||
// We often have several deopts to the same entry, reuse the last
|
// We often have several deopts to the same entry, reuse the last
|
||||||
// jump entry if this is the case.
|
// jump entry if this is the case.
|
||||||
if (deopt_jump_table_.is_empty() ||
|
if (jump_table_.is_empty() || (jump_table_.last()->address != entry) ||
|
||||||
(deopt_jump_table_.last()->address != entry) ||
|
(jump_table_.last()->bailout_type != bailout_type) ||
|
||||||
(deopt_jump_table_.last()->bailout_type != bailout_type) ||
|
(jump_table_.last()->needs_frame != !frame_is_built_)) {
|
||||||
(deopt_jump_table_.last()->needs_frame != !frame_is_built_)) {
|
|
||||||
Deoptimizer::JumpTableEntry* table_entry =
|
Deoptimizer::JumpTableEntry* table_entry =
|
||||||
new(zone()) Deoptimizer::JumpTableEntry(entry,
|
new (zone()) Deoptimizer::JumpTableEntry(
|
||||||
bailout_type,
|
entry, instr->Mnemonic(), reason, bailout_type, !frame_is_built_);
|
||||||
!frame_is_built_);
|
jump_table_.Add(table_entry, zone());
|
||||||
deopt_jump_table_.Add(table_entry, zone());
|
|
||||||
}
|
}
|
||||||
__ B(&deopt_jump_table_.last()->label,
|
__ B(&jump_table_.last()->label, branch_type, reg, bit);
|
||||||
branch_type, reg, bit);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::Deoptimize(LInstruction* instr,
|
void LCodeGen::Deoptimize(LInstruction* instr,
|
||||||
Deoptimizer::BailoutType* override_bailout_type) {
|
Deoptimizer::BailoutType* override_bailout_type,
|
||||||
DeoptimizeBranch(instr, always, NoReg, -1, override_bailout_type);
|
const char* reason) {
|
||||||
|
DeoptimizeBranch(instr, reason, always, NoReg, -1, override_bailout_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition cond, LInstruction* instr) {
|
void LCodeGen::DeoptimizeIf(Condition cond, LInstruction* instr,
|
||||||
DeoptimizeBranch(instr, static_cast<BranchType>(cond));
|
const char* reason) {
|
||||||
|
DeoptimizeBranch(instr, reason, static_cast<BranchType>(cond));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIfZero(Register rt, LInstruction* instr) {
|
void LCodeGen::DeoptimizeIfZero(Register rt, LInstruction* instr,
|
||||||
DeoptimizeBranch(instr, reg_zero, rt);
|
const char* reason) {
|
||||||
|
DeoptimizeBranch(instr, reason, reg_zero, rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIfNotZero(Register rt, LInstruction* instr) {
|
void LCodeGen::DeoptimizeIfNotZero(Register rt, LInstruction* instr,
|
||||||
DeoptimizeBranch(instr, reg_not_zero, rt);
|
const char* reason) {
|
||||||
|
DeoptimizeBranch(instr, reason, reg_not_zero, rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIfNegative(Register rt, LInstruction* instr) {
|
void LCodeGen::DeoptimizeIfNegative(Register rt, LInstruction* instr,
|
||||||
|
const char* reason) {
|
||||||
int sign_bit = rt.Is64Bits() ? kXSignBit : kWSignBit;
|
int sign_bit = rt.Is64Bits() ? kXSignBit : kWSignBit;
|
||||||
DeoptimizeIfBitSet(rt, sign_bit, instr);
|
DeoptimizeIfBitSet(rt, sign_bit, instr, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIfSmi(Register rt, LInstruction* instr) {
|
void LCodeGen::DeoptimizeIfSmi(Register rt, LInstruction* instr,
|
||||||
DeoptimizeIfBitClear(rt, MaskToBit(kSmiTagMask), instr);
|
const char* reason) {
|
||||||
|
DeoptimizeIfBitClear(rt, MaskToBit(kSmiTagMask), instr, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIfNotSmi(Register rt, LInstruction* instr) {
|
void LCodeGen::DeoptimizeIfNotSmi(Register rt, LInstruction* instr,
|
||||||
DeoptimizeIfBitSet(rt, MaskToBit(kSmiTagMask), instr);
|
const char* reason) {
|
||||||
|
DeoptimizeIfBitSet(rt, MaskToBit(kSmiTagMask), instr, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIfRoot(Register rt, Heap::RootListIndex index,
|
void LCodeGen::DeoptimizeIfRoot(Register rt, Heap::RootListIndex index,
|
||||||
LInstruction* instr) {
|
LInstruction* instr, const char* reason) {
|
||||||
__ CompareRoot(rt, index);
|
__ CompareRoot(rt, index);
|
||||||
DeoptimizeIf(eq, instr);
|
DeoptimizeIf(eq, instr, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIfNotRoot(Register rt, Heap::RootListIndex index,
|
void LCodeGen::DeoptimizeIfNotRoot(Register rt, Heap::RootListIndex index,
|
||||||
LInstruction* instr) {
|
LInstruction* instr, const char* reason) {
|
||||||
__ CompareRoot(rt, index);
|
__ CompareRoot(rt, index);
|
||||||
DeoptimizeIf(ne, instr);
|
DeoptimizeIf(ne, instr, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIfMinusZero(DoubleRegister input,
|
void LCodeGen::DeoptimizeIfMinusZero(DoubleRegister input, LInstruction* instr,
|
||||||
LInstruction* instr) {
|
const char* reason) {
|
||||||
__ TestForMinusZero(input);
|
__ TestForMinusZero(input);
|
||||||
DeoptimizeIf(vs, instr);
|
DeoptimizeIf(vs, instr, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIfBitSet(Register rt, int bit, LInstruction* instr) {
|
void LCodeGen::DeoptimizeIfBitSet(Register rt, int bit, LInstruction* instr,
|
||||||
DeoptimizeBranch(instr, reg_bit_set, rt, bit);
|
const char* reason) {
|
||||||
|
DeoptimizeBranch(instr, reason, reg_bit_set, rt, bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIfBitClear(Register rt, int bit, LInstruction* instr) {
|
void LCodeGen::DeoptimizeIfBitClear(Register rt, int bit, LInstruction* instr,
|
||||||
DeoptimizeBranch(instr, reg_bit_clear, rt, bit);
|
const char* reason) {
|
||||||
|
DeoptimizeBranch(instr, reason, reg_bit_clear, rt, bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2685,8 +2691,7 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
|
|||||||
type = Deoptimizer::LAZY;
|
type = Deoptimizer::LAZY;
|
||||||
}
|
}
|
||||||
|
|
||||||
Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
|
Deoptimize(instr, &type, instr->hydrogen()->reason());
|
||||||
Deoptimize(instr, &type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class LCodeGen: public LCodeGenBase {
|
|||||||
LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info)
|
LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info)
|
||||||
: LCodeGenBase(chunk, assembler, info),
|
: LCodeGenBase(chunk, assembler, info),
|
||||||
deoptimizations_(4, info->zone()),
|
deoptimizations_(4, info->zone()),
|
||||||
deopt_jump_table_(4, info->zone()),
|
jump_table_(4, info->zone()),
|
||||||
deoptimization_literals_(8, info->zone()),
|
deoptimization_literals_(8, info->zone()),
|
||||||
inlined_function_count_(0),
|
inlined_function_count_(0),
|
||||||
scope_(info->scope()),
|
scope_(info->scope()),
|
||||||
@ -213,24 +213,35 @@ class LCodeGen: public LCodeGenBase {
|
|||||||
Register temp,
|
Register temp,
|
||||||
LOperand* index,
|
LOperand* index,
|
||||||
String::Encoding encoding);
|
String::Encoding encoding);
|
||||||
void DeoptimizeBranch(LInstruction* instr, BranchType branch_type,
|
void DeoptimizeBranch(LInstruction* instr, const char* reason,
|
||||||
Register reg = NoReg, int bit = -1,
|
BranchType branch_type, Register reg = NoReg,
|
||||||
|
int bit = -1,
|
||||||
Deoptimizer::BailoutType* override_bailout_type = NULL);
|
Deoptimizer::BailoutType* override_bailout_type = NULL);
|
||||||
void Deoptimize(LInstruction* instr,
|
void Deoptimize(LInstruction* instr,
|
||||||
Deoptimizer::BailoutType* override_bailout_type = NULL);
|
Deoptimizer::BailoutType* override_bailout_type = NULL,
|
||||||
void DeoptimizeIf(Condition cond, LInstruction* instr);
|
const char* reason = NULL);
|
||||||
void DeoptimizeIfZero(Register rt, LInstruction* instr);
|
void DeoptimizeIf(Condition cond, LInstruction* instr,
|
||||||
void DeoptimizeIfNotZero(Register rt, LInstruction* instr);
|
const char* reason = NULL);
|
||||||
void DeoptimizeIfNegative(Register rt, LInstruction* instr);
|
void DeoptimizeIfZero(Register rt, LInstruction* instr,
|
||||||
void DeoptimizeIfSmi(Register rt, LInstruction* instr);
|
const char* reason = NULL);
|
||||||
void DeoptimizeIfNotSmi(Register rt, LInstruction* instr);
|
void DeoptimizeIfNotZero(Register rt, LInstruction* instr,
|
||||||
|
const char* reason = NULL);
|
||||||
|
void DeoptimizeIfNegative(Register rt, LInstruction* instr,
|
||||||
|
const char* reason = NULL);
|
||||||
|
void DeoptimizeIfSmi(Register rt, LInstruction* instr,
|
||||||
|
const char* reason = NULL);
|
||||||
|
void DeoptimizeIfNotSmi(Register rt, LInstruction* instr,
|
||||||
|
const char* reason = NULL);
|
||||||
void DeoptimizeIfRoot(Register rt, Heap::RootListIndex index,
|
void DeoptimizeIfRoot(Register rt, Heap::RootListIndex index,
|
||||||
LInstruction* instr);
|
LInstruction* instr, const char* reason = NULL);
|
||||||
void DeoptimizeIfNotRoot(Register rt, Heap::RootListIndex index,
|
void DeoptimizeIfNotRoot(Register rt, Heap::RootListIndex index,
|
||||||
LInstruction* instr);
|
LInstruction* instr, const char* reason = NULL);
|
||||||
void DeoptimizeIfMinusZero(DoubleRegister input, LInstruction* instr);
|
void DeoptimizeIfMinusZero(DoubleRegister input, LInstruction* instr,
|
||||||
void DeoptimizeIfBitSet(Register rt, int bit, LInstruction* instr);
|
const char* reason = NULL);
|
||||||
void DeoptimizeIfBitClear(Register rt, int bit, LInstruction* instr);
|
void DeoptimizeIfBitSet(Register rt, int bit, LInstruction* instr,
|
||||||
|
const char* reason = NULL);
|
||||||
|
void DeoptimizeIfBitClear(Register rt, int bit, LInstruction* instr,
|
||||||
|
const char* reason = NULL);
|
||||||
|
|
||||||
MemOperand PrepareKeyedExternalArrayOperand(Register key,
|
MemOperand PrepareKeyedExternalArrayOperand(Register key,
|
||||||
Register base,
|
Register base,
|
||||||
@ -273,7 +284,7 @@ class LCodeGen: public LCodeGenBase {
|
|||||||
void GenerateBodyInstructionPre(LInstruction* instr) OVERRIDE;
|
void GenerateBodyInstructionPre(LInstruction* instr) OVERRIDE;
|
||||||
bool GeneratePrologue();
|
bool GeneratePrologue();
|
||||||
bool GenerateDeferredCode();
|
bool GenerateDeferredCode();
|
||||||
bool GenerateDeoptJumpTable();
|
bool GenerateJumpTable();
|
||||||
bool GenerateSafepointTable();
|
bool GenerateSafepointTable();
|
||||||
|
|
||||||
// Generates the custom OSR entrypoint and sets the osr_pc_offset.
|
// Generates the custom OSR entrypoint and sets the osr_pc_offset.
|
||||||
@ -338,7 +349,7 @@ class LCodeGen: public LCodeGenBase {
|
|||||||
void EnsureSpaceForLazyDeopt(int space_needed) OVERRIDE;
|
void EnsureSpaceForLazyDeopt(int space_needed) OVERRIDE;
|
||||||
|
|
||||||
ZoneList<LEnvironment*> deoptimizations_;
|
ZoneList<LEnvironment*> deoptimizations_;
|
||||||
ZoneList<Deoptimizer::JumpTableEntry*> deopt_jump_table_;
|
ZoneList<Deoptimizer::JumpTableEntry*> jump_table_;
|
||||||
ZoneList<Handle<Object> > deoptimization_literals_;
|
ZoneList<Handle<Object> > deoptimization_literals_;
|
||||||
int inlined_function_count_;
|
int inlined_function_count_;
|
||||||
Scope* const scope_;
|
Scope* const scope_;
|
||||||
|
@ -102,15 +102,19 @@ class Deoptimizer : public Malloced {
|
|||||||
static const int kBailoutTypesWithCodeEntry = SOFT + 1;
|
static const int kBailoutTypesWithCodeEntry = SOFT + 1;
|
||||||
|
|
||||||
struct JumpTableEntry : public ZoneObject {
|
struct JumpTableEntry : public ZoneObject {
|
||||||
inline JumpTableEntry(Address entry,
|
inline JumpTableEntry(Address entry, const char* the_mnemonic,
|
||||||
Deoptimizer::BailoutType type,
|
const char* the_reason, Deoptimizer::BailoutType type,
|
||||||
bool frame)
|
bool frame)
|
||||||
: label(),
|
: label(),
|
||||||
address(entry),
|
address(entry),
|
||||||
|
mnemonic(the_mnemonic),
|
||||||
|
reason(the_reason),
|
||||||
bailout_type(type),
|
bailout_type(type),
|
||||||
needs_frame(frame) { }
|
needs_frame(frame) {}
|
||||||
Label label;
|
Label label;
|
||||||
Address address;
|
Address address;
|
||||||
|
const char* mnemonic;
|
||||||
|
const char* reason;
|
||||||
Deoptimizer::BailoutType bailout_type;
|
Deoptimizer::BailoutType bailout_type;
|
||||||
bool needs_frame;
|
bool needs_frame;
|
||||||
};
|
};
|
||||||
|
@ -383,16 +383,18 @@ bool LCodeGen::GenerateJumpTable() {
|
|||||||
Comment(";;; -------------------- Jump table --------------------");
|
Comment(";;; -------------------- Jump table --------------------");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < jump_table_.length(); i++) {
|
for (int i = 0; i < jump_table_.length(); i++) {
|
||||||
__ bind(&jump_table_[i].label);
|
Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i];
|
||||||
Address entry = jump_table_[i].address;
|
__ bind(&table_entry->label);
|
||||||
Deoptimizer::BailoutType type = jump_table_[i].bailout_type;
|
Address entry = table_entry->address;
|
||||||
|
Deoptimizer::BailoutType type = table_entry->bailout_type;
|
||||||
int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
|
int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
|
||||||
if (id == Deoptimizer::kNotDeoptimizationEntry) {
|
if (id == Deoptimizer::kNotDeoptimizationEntry) {
|
||||||
Comment(";;; jump table entry %d.", i);
|
Comment(";;; jump table entry %d.", i);
|
||||||
} else {
|
} else {
|
||||||
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
|
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
|
||||||
}
|
}
|
||||||
if (jump_table_[i].needs_frame) {
|
DeoptComment(table_entry->mnemonic, table_entry->reason);
|
||||||
|
if (table_entry->needs_frame) {
|
||||||
DCHECK(!info()->saves_caller_doubles());
|
DCHECK(!info()->saves_caller_doubles());
|
||||||
__ push(Immediate(ExternalReference::ForDeoptEntry(entry)));
|
__ push(Immediate(ExternalReference::ForDeoptEntry(entry)));
|
||||||
if (needs_frame.is_bound()) {
|
if (needs_frame.is_bound()) {
|
||||||
@ -826,6 +828,7 @@ void LCodeGen::RegisterEnvironmentForDeoptimization(
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
||||||
|
const char* reason,
|
||||||
Deoptimizer::BailoutType bailout_type) {
|
Deoptimizer::BailoutType bailout_type) {
|
||||||
LEnvironment* environment = instr->environment();
|
LEnvironment* environment = instr->environment();
|
||||||
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
||||||
@ -869,6 +872,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
|||||||
|
|
||||||
DCHECK(info()->IsStub() || frame_is_built_);
|
DCHECK(info()->IsStub() || frame_is_built_);
|
||||||
if (cc == no_condition && frame_is_built_) {
|
if (cc == no_condition && frame_is_built_) {
|
||||||
|
DeoptComment(instr->Mnemonic(), reason);
|
||||||
__ call(entry, RelocInfo::RUNTIME_ENTRY);
|
__ call(entry, RelocInfo::RUNTIME_ENTRY);
|
||||||
} else {
|
} else {
|
||||||
// We often have several deopts to the same entry, reuse the last
|
// We often have several deopts to the same entry, reuse the last
|
||||||
@ -877,9 +881,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
|||||||
jump_table_.last().address != entry ||
|
jump_table_.last().address != entry ||
|
||||||
jump_table_.last().needs_frame != !frame_is_built_ ||
|
jump_table_.last().needs_frame != !frame_is_built_ ||
|
||||||
jump_table_.last().bailout_type != bailout_type) {
|
jump_table_.last().bailout_type != bailout_type) {
|
||||||
Deoptimizer::JumpTableEntry table_entry(entry,
|
Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason,
|
||||||
bailout_type,
|
bailout_type, !frame_is_built_);
|
||||||
!frame_is_built_);
|
|
||||||
jump_table_.Add(table_entry, zone());
|
jump_table_.Add(table_entry, zone());
|
||||||
}
|
}
|
||||||
if (cc == no_condition) {
|
if (cc == no_condition) {
|
||||||
@ -891,11 +894,12 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr) {
|
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
||||||
|
const char* reason) {
|
||||||
Deoptimizer::BailoutType bailout_type = info()->IsStub()
|
Deoptimizer::BailoutType bailout_type = info()->IsStub()
|
||||||
? Deoptimizer::LAZY
|
? Deoptimizer::LAZY
|
||||||
: Deoptimizer::EAGER;
|
: Deoptimizer::EAGER;
|
||||||
DeoptimizeIf(cc, instr, bailout_type);
|
DeoptimizeIf(cc, instr, reason, bailout_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5463,8 +5467,7 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
|
|||||||
if (info()->IsStub() && type == Deoptimizer::EAGER) {
|
if (info()->IsStub() && type == Deoptimizer::EAGER) {
|
||||||
type = Deoptimizer::LAZY;
|
type = Deoptimizer::LAZY;
|
||||||
}
|
}
|
||||||
Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
|
DeoptimizeIf(no_condition, instr, instr->hydrogen()->reason(), type);
|
||||||
DeoptimizeIf(no_condition, instr, type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,9 +209,10 @@ class LCodeGen: public LCodeGenBase {
|
|||||||
|
|
||||||
void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
||||||
Safepoint::DeoptMode mode);
|
Safepoint::DeoptMode mode);
|
||||||
void DeoptimizeIf(Condition cc, LInstruction* instr,
|
void DeoptimizeIf(Condition cc, LInstruction* instr, const char* reason,
|
||||||
Deoptimizer::BailoutType bailout_type);
|
Deoptimizer::BailoutType bailout_type);
|
||||||
void DeoptimizeIf(Condition cc, LInstruction* instr);
|
void DeoptimizeIf(Condition cc, LInstruction* instr,
|
||||||
|
const char* reason = NULL);
|
||||||
|
|
||||||
bool DeoptEveryNTimes() {
|
bool DeoptEveryNTimes() {
|
||||||
return FLAG_deopt_every_n_times != 0 && !info()->IsStub();
|
return FLAG_deopt_every_n_times != 0 && !info()->IsStub();
|
||||||
|
@ -147,6 +147,12 @@ void LCodeGenBase::Comment(const char* format, ...) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LCodeGenBase::DeoptComment(const char* mnemonic, const char* reason) {
|
||||||
|
Comment(";;; deoptimize %s: %s", mnemonic,
|
||||||
|
reason == NULL ? "unknown reason" : reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int LCodeGenBase::GetNextEmittedBlock() const {
|
int LCodeGenBase::GetNextEmittedBlock() const {
|
||||||
for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
|
for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
|
||||||
if (!graph()->blocks()->at(i)->IsReachable()) continue;
|
if (!graph()->blocks()->at(i)->IsReachable()) continue;
|
||||||
|
@ -33,6 +33,7 @@ class LCodeGenBase BASE_EMBEDDED {
|
|||||||
HGraph* graph() const;
|
HGraph* graph() const;
|
||||||
|
|
||||||
void FPRINTF_CHECKING Comment(const char* format, ...);
|
void FPRINTF_CHECKING Comment(const char* format, ...);
|
||||||
|
void DeoptComment(const char* mnemonic, const char* reason);
|
||||||
|
|
||||||
bool GenerateBody();
|
bool GenerateBody();
|
||||||
virtual void GenerateBodyInstructionPre(LInstruction* instr) {}
|
virtual void GenerateBodyInstructionPre(LInstruction* instr) {}
|
||||||
|
@ -821,7 +821,8 @@ void LCodeGen::RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
|||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
||||||
Deoptimizer::BailoutType bailout_type,
|
Deoptimizer::BailoutType bailout_type,
|
||||||
Register src1, const Operand& src2) {
|
Register src1, const Operand& src2,
|
||||||
|
const char* reason) {
|
||||||
LEnvironment* environment = instr->environment();
|
LEnvironment* environment = instr->environment();
|
||||||
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
||||||
DCHECK(environment->HasBeenRegistered());
|
DCHECK(environment->HasBeenRegistered());
|
||||||
@ -867,6 +868,7 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
|||||||
// restore caller doubles.
|
// restore caller doubles.
|
||||||
if (condition == al && frame_is_built_ &&
|
if (condition == al && frame_is_built_ &&
|
||||||
!info()->saves_caller_doubles()) {
|
!info()->saves_caller_doubles()) {
|
||||||
|
DeoptComment(instr->Mnemonic(), reason);
|
||||||
__ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2);
|
__ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2);
|
||||||
} else {
|
} else {
|
||||||
// We often have several deopts to the same entry, reuse the last
|
// We often have several deopts to the same entry, reuse the last
|
||||||
@ -875,9 +877,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
|||||||
(deopt_jump_table_.last().address != entry) ||
|
(deopt_jump_table_.last().address != entry) ||
|
||||||
(deopt_jump_table_.last().bailout_type != bailout_type) ||
|
(deopt_jump_table_.last().bailout_type != bailout_type) ||
|
||||||
(deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
|
(deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
|
||||||
Deoptimizer::JumpTableEntry table_entry(entry,
|
Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason,
|
||||||
bailout_type,
|
bailout_type, !frame_is_built_);
|
||||||
!frame_is_built_);
|
|
||||||
deopt_jump_table_.Add(table_entry, zone());
|
deopt_jump_table_.Add(table_entry, zone());
|
||||||
}
|
}
|
||||||
__ Branch(&deopt_jump_table_.last().label, condition, src1, src2);
|
__ Branch(&deopt_jump_table_.last().label, condition, src1, src2);
|
||||||
@ -886,11 +887,12 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
||||||
Register src1, const Operand& src2) {
|
Register src1, const Operand& src2,
|
||||||
|
const char* reason) {
|
||||||
Deoptimizer::BailoutType bailout_type = info()->IsStub()
|
Deoptimizer::BailoutType bailout_type = info()->IsStub()
|
||||||
? Deoptimizer::LAZY
|
? Deoptimizer::LAZY
|
||||||
: Deoptimizer::EAGER;
|
: Deoptimizer::EAGER;
|
||||||
DeoptimizeIf(condition, instr, bailout_type, src1, src2);
|
DeoptimizeIf(condition, instr, bailout_type, src1, src2, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5676,8 +5678,8 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
|
|||||||
type = Deoptimizer::LAZY;
|
type = Deoptimizer::LAZY;
|
||||||
}
|
}
|
||||||
|
|
||||||
Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
|
DeoptimizeIf(al, instr, type, zero_reg, Operand(zero_reg),
|
||||||
DeoptimizeIf(al, instr, type, zero_reg, Operand(zero_reg));
|
instr->hydrogen()->reason());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -231,10 +231,12 @@ class LCodeGen: public LCodeGenBase {
|
|||||||
void DeoptimizeIf(Condition condition, LInstruction* instr,
|
void DeoptimizeIf(Condition condition, LInstruction* instr,
|
||||||
Deoptimizer::BailoutType bailout_type,
|
Deoptimizer::BailoutType bailout_type,
|
||||||
Register src1 = zero_reg,
|
Register src1 = zero_reg,
|
||||||
const Operand& src2 = Operand(zero_reg));
|
const Operand& src2 = Operand(zero_reg),
|
||||||
|
const char* reason = NULL);
|
||||||
void DeoptimizeIf(Condition condition, LInstruction* instr,
|
void DeoptimizeIf(Condition condition, LInstruction* instr,
|
||||||
Register src1 = zero_reg,
|
Register src1 = zero_reg,
|
||||||
const Operand& src2 = Operand(zero_reg));
|
const Operand& src2 = Operand(zero_reg),
|
||||||
|
const char* reason = NULL);
|
||||||
|
|
||||||
void AddToTranslation(LEnvironment* environment,
|
void AddToTranslation(LEnvironment* environment,
|
||||||
Translation* translation,
|
Translation* translation,
|
||||||
|
@ -774,7 +774,8 @@ void LCodeGen::RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
|||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
||||||
Deoptimizer::BailoutType bailout_type,
|
Deoptimizer::BailoutType bailout_type,
|
||||||
Register src1, const Operand& src2) {
|
Register src1, const Operand& src2,
|
||||||
|
const char* reason) {
|
||||||
LEnvironment* environment = instr->environment();
|
LEnvironment* environment = instr->environment();
|
||||||
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
||||||
DCHECK(environment->HasBeenRegistered());
|
DCHECK(environment->HasBeenRegistered());
|
||||||
@ -820,6 +821,7 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
|||||||
// restore caller doubles.
|
// restore caller doubles.
|
||||||
if (condition == al && frame_is_built_ &&
|
if (condition == al && frame_is_built_ &&
|
||||||
!info()->saves_caller_doubles()) {
|
!info()->saves_caller_doubles()) {
|
||||||
|
DeoptComment(instr->Mnemonic(), reason);
|
||||||
__ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2);
|
__ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2);
|
||||||
} else {
|
} else {
|
||||||
// We often have several deopts to the same entry, reuse the last
|
// We often have several deopts to the same entry, reuse the last
|
||||||
@ -828,9 +830,8 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
|||||||
(deopt_jump_table_.last().address != entry) ||
|
(deopt_jump_table_.last().address != entry) ||
|
||||||
(deopt_jump_table_.last().bailout_type != bailout_type) ||
|
(deopt_jump_table_.last().bailout_type != bailout_type) ||
|
||||||
(deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
|
(deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
|
||||||
Deoptimizer::JumpTableEntry table_entry(entry,
|
Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason,
|
||||||
bailout_type,
|
bailout_type, !frame_is_built_);
|
||||||
!frame_is_built_);
|
|
||||||
deopt_jump_table_.Add(table_entry, zone());
|
deopt_jump_table_.Add(table_entry, zone());
|
||||||
}
|
}
|
||||||
__ Branch(&deopt_jump_table_.last().label, condition, src1, src2);
|
__ Branch(&deopt_jump_table_.last().label, condition, src1, src2);
|
||||||
@ -839,11 +840,12 @@ void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
|
||||||
Register src1, const Operand& src2) {
|
Register src1, const Operand& src2,
|
||||||
|
const char* reason) {
|
||||||
Deoptimizer::BailoutType bailout_type = info()->IsStub()
|
Deoptimizer::BailoutType bailout_type = info()->IsStub()
|
||||||
? Deoptimizer::LAZY
|
? Deoptimizer::LAZY
|
||||||
: Deoptimizer::EAGER;
|
: Deoptimizer::EAGER;
|
||||||
DeoptimizeIf(condition, instr, bailout_type, src1, src2);
|
DeoptimizeIf(condition, instr, bailout_type, src1, src2, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5712,8 +5714,8 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
|
|||||||
type = Deoptimizer::LAZY;
|
type = Deoptimizer::LAZY;
|
||||||
}
|
}
|
||||||
|
|
||||||
Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
|
DeoptimizeIf(al, instr, type, zero_reg, Operand(zero_reg),
|
||||||
DeoptimizeIf(al, instr, type, zero_reg, Operand(zero_reg));
|
instr->hydrogen()->reason());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -232,10 +232,12 @@ class LCodeGen: public LCodeGenBase {
|
|||||||
void DeoptimizeIf(Condition condition, LInstruction* instr,
|
void DeoptimizeIf(Condition condition, LInstruction* instr,
|
||||||
Deoptimizer::BailoutType bailout_type,
|
Deoptimizer::BailoutType bailout_type,
|
||||||
Register src1 = zero_reg,
|
Register src1 = zero_reg,
|
||||||
const Operand& src2 = Operand(zero_reg));
|
const Operand& src2 = Operand(zero_reg),
|
||||||
|
const char* reason = NULL);
|
||||||
void DeoptimizeIf(Condition condition, LInstruction* instr,
|
void DeoptimizeIf(Condition condition, LInstruction* instr,
|
||||||
Register src1 = zero_reg,
|
Register src1 = zero_reg,
|
||||||
const Operand& src2 = Operand(zero_reg));
|
const Operand& src2 = Operand(zero_reg),
|
||||||
|
const char* reason = NULL);
|
||||||
|
|
||||||
void AddToTranslation(LEnvironment* environment,
|
void AddToTranslation(LEnvironment* environment,
|
||||||
Translation* translation,
|
Translation* translation,
|
||||||
|
@ -303,16 +303,18 @@ bool LCodeGen::GenerateJumpTable() {
|
|||||||
Comment(";;; -------------------- Jump table --------------------");
|
Comment(";;; -------------------- Jump table --------------------");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < jump_table_.length(); i++) {
|
for (int i = 0; i < jump_table_.length(); i++) {
|
||||||
__ bind(&jump_table_[i].label);
|
Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i];
|
||||||
Address entry = jump_table_[i].address;
|
__ bind(&table_entry->label);
|
||||||
Deoptimizer::BailoutType type = jump_table_[i].bailout_type;
|
Address entry = table_entry->address;
|
||||||
|
Deoptimizer::BailoutType type = table_entry->bailout_type;
|
||||||
int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
|
int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
|
||||||
if (id == Deoptimizer::kNotDeoptimizationEntry) {
|
if (id == Deoptimizer::kNotDeoptimizationEntry) {
|
||||||
Comment(";;; jump table entry %d.", i);
|
Comment(";;; jump table entry %d.", i);
|
||||||
} else {
|
} else {
|
||||||
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
|
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
|
||||||
}
|
}
|
||||||
if (jump_table_[i].needs_frame) {
|
DeoptComment(table_entry->mnemonic, table_entry->reason);
|
||||||
|
if (table_entry->needs_frame) {
|
||||||
DCHECK(!info()->saves_caller_doubles());
|
DCHECK(!info()->saves_caller_doubles());
|
||||||
__ Move(kScratchRegister, ExternalReference::ForDeoptEntry(entry));
|
__ Move(kScratchRegister, ExternalReference::ForDeoptEntry(entry));
|
||||||
if (needs_frame.is_bound()) {
|
if (needs_frame.is_bound()) {
|
||||||
@ -730,6 +732,7 @@ void LCodeGen::RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
||||||
|
const char* reason,
|
||||||
Deoptimizer::BailoutType bailout_type) {
|
Deoptimizer::BailoutType bailout_type) {
|
||||||
LEnvironment* environment = instr->environment();
|
LEnvironment* environment = instr->environment();
|
||||||
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
||||||
@ -779,6 +782,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
|||||||
// restore caller doubles.
|
// restore caller doubles.
|
||||||
if (cc == no_condition && frame_is_built_ &&
|
if (cc == no_condition && frame_is_built_ &&
|
||||||
!info()->saves_caller_doubles()) {
|
!info()->saves_caller_doubles()) {
|
||||||
|
DeoptComment(instr->Mnemonic(), reason);
|
||||||
__ call(entry, RelocInfo::RUNTIME_ENTRY);
|
__ call(entry, RelocInfo::RUNTIME_ENTRY);
|
||||||
} else {
|
} else {
|
||||||
// We often have several deopts to the same entry, reuse the last
|
// We often have several deopts to the same entry, reuse the last
|
||||||
@ -787,9 +791,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
|||||||
jump_table_.last().address != entry ||
|
jump_table_.last().address != entry ||
|
||||||
jump_table_.last().needs_frame != !frame_is_built_ ||
|
jump_table_.last().needs_frame != !frame_is_built_ ||
|
||||||
jump_table_.last().bailout_type != bailout_type) {
|
jump_table_.last().bailout_type != bailout_type) {
|
||||||
Deoptimizer::JumpTableEntry table_entry(entry,
|
Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason,
|
||||||
bailout_type,
|
bailout_type, !frame_is_built_);
|
||||||
!frame_is_built_);
|
|
||||||
jump_table_.Add(table_entry, zone());
|
jump_table_.Add(table_entry, zone());
|
||||||
}
|
}
|
||||||
if (cc == no_condition) {
|
if (cc == no_condition) {
|
||||||
@ -801,11 +804,12 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr) {
|
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
||||||
|
const char* reason) {
|
||||||
Deoptimizer::BailoutType bailout_type = info()->IsStub()
|
Deoptimizer::BailoutType bailout_type = info()->IsStub()
|
||||||
? Deoptimizer::LAZY
|
? Deoptimizer::LAZY
|
||||||
: Deoptimizer::EAGER;
|
: Deoptimizer::EAGER;
|
||||||
DeoptimizeIf(cc, instr, bailout_type);
|
DeoptimizeIf(cc, instr, reason, bailout_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5647,9 +5651,7 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
|
|||||||
if (info()->IsStub() && type == Deoptimizer::EAGER) {
|
if (info()->IsStub() && type == Deoptimizer::EAGER) {
|
||||||
type = Deoptimizer::LAZY;
|
type = Deoptimizer::LAZY;
|
||||||
}
|
}
|
||||||
|
DeoptimizeIf(no_condition, instr, instr->hydrogen()->reason(), type);
|
||||||
Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
|
|
||||||
DeoptimizeIf(no_condition, instr, type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -206,9 +206,10 @@ class LCodeGen: public LCodeGenBase {
|
|||||||
int argc);
|
int argc);
|
||||||
void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
||||||
Safepoint::DeoptMode mode);
|
Safepoint::DeoptMode mode);
|
||||||
void DeoptimizeIf(Condition cc, LInstruction* instr,
|
void DeoptimizeIf(Condition cc, LInstruction* instr, const char* reason,
|
||||||
Deoptimizer::BailoutType bailout_type);
|
Deoptimizer::BailoutType bailout_type);
|
||||||
void DeoptimizeIf(Condition cc, LInstruction* instr);
|
void DeoptimizeIf(Condition cc, LInstruction* instr,
|
||||||
|
const char* reason = NULL);
|
||||||
|
|
||||||
bool DeoptEveryNTimes() {
|
bool DeoptEveryNTimes() {
|
||||||
return FLAG_deopt_every_n_times != 0 && !info()->IsStub();
|
return FLAG_deopt_every_n_times != 0 && !info()->IsStub();
|
||||||
|
@ -364,16 +364,18 @@ bool LCodeGen::GenerateJumpTable() {
|
|||||||
Comment(";;; -------------------- Jump table --------------------");
|
Comment(";;; -------------------- Jump table --------------------");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < jump_table_.length(); i++) {
|
for (int i = 0; i < jump_table_.length(); i++) {
|
||||||
__ bind(&jump_table_[i].label);
|
Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i];
|
||||||
Address entry = jump_table_[i].address;
|
__ bind(&table_entry->label);
|
||||||
Deoptimizer::BailoutType type = jump_table_[i].bailout_type;
|
Address entry = table_entry->address;
|
||||||
|
Deoptimizer::BailoutType type = table_entry->bailout_type;
|
||||||
int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
|
int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
|
||||||
if (id == Deoptimizer::kNotDeoptimizationEntry) {
|
if (id == Deoptimizer::kNotDeoptimizationEntry) {
|
||||||
Comment(";;; jump table entry %d.", i);
|
Comment(";;; jump table entry %d.", i);
|
||||||
} else {
|
} else {
|
||||||
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
|
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
|
||||||
}
|
}
|
||||||
if (jump_table_[i].needs_frame) {
|
DeoptComment(table_entry->mnemonic, table_entry->reason);
|
||||||
|
if (table_entry->needs_frame) {
|
||||||
DCHECK(!info()->saves_caller_doubles());
|
DCHECK(!info()->saves_caller_doubles());
|
||||||
__ push(Immediate(ExternalReference::ForDeoptEntry(entry)));
|
__ push(Immediate(ExternalReference::ForDeoptEntry(entry)));
|
||||||
if (needs_frame.is_bound()) {
|
if (needs_frame.is_bound()) {
|
||||||
@ -1008,6 +1010,7 @@ void LCodeGen::RegisterEnvironmentForDeoptimization(
|
|||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
||||||
|
const char* reason,
|
||||||
Deoptimizer::BailoutType bailout_type) {
|
Deoptimizer::BailoutType bailout_type) {
|
||||||
LEnvironment* environment = instr->environment();
|
LEnvironment* environment = instr->environment();
|
||||||
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
|
||||||
@ -1062,6 +1065,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
|||||||
|
|
||||||
DCHECK(info()->IsStub() || frame_is_built_);
|
DCHECK(info()->IsStub() || frame_is_built_);
|
||||||
if (cc == no_condition && frame_is_built_) {
|
if (cc == no_condition && frame_is_built_) {
|
||||||
|
DeoptComment(instr->Mnemonic(), reason);
|
||||||
__ call(entry, RelocInfo::RUNTIME_ENTRY);
|
__ call(entry, RelocInfo::RUNTIME_ENTRY);
|
||||||
} else {
|
} else {
|
||||||
// We often have several deopts to the same entry, reuse the last
|
// We often have several deopts to the same entry, reuse the last
|
||||||
@ -1070,9 +1074,8 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
|||||||
jump_table_.last().address != entry ||
|
jump_table_.last().address != entry ||
|
||||||
jump_table_.last().needs_frame != !frame_is_built_ ||
|
jump_table_.last().needs_frame != !frame_is_built_ ||
|
||||||
jump_table_.last().bailout_type != bailout_type) {
|
jump_table_.last().bailout_type != bailout_type) {
|
||||||
Deoptimizer::JumpTableEntry table_entry(entry,
|
Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason,
|
||||||
bailout_type,
|
bailout_type, !frame_is_built_);
|
||||||
!frame_is_built_);
|
|
||||||
jump_table_.Add(table_entry, zone());
|
jump_table_.Add(table_entry, zone());
|
||||||
}
|
}
|
||||||
if (cc == no_condition) {
|
if (cc == no_condition) {
|
||||||
@ -1084,11 +1087,12 @@ void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr) {
|
void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
|
||||||
|
const char* reason) {
|
||||||
Deoptimizer::BailoutType bailout_type = info()->IsStub()
|
Deoptimizer::BailoutType bailout_type = info()->IsStub()
|
||||||
? Deoptimizer::LAZY
|
? Deoptimizer::LAZY
|
||||||
: Deoptimizer::EAGER;
|
: Deoptimizer::EAGER;
|
||||||
DeoptimizeIf(cc, instr, bailout_type);
|
DeoptimizeIf(cc, instr, reason, bailout_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5528,8 +5532,7 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
|
|||||||
if (info()->IsStub() && type == Deoptimizer::EAGER) {
|
if (info()->IsStub() && type == Deoptimizer::EAGER) {
|
||||||
type = Deoptimizer::LAZY;
|
type = Deoptimizer::LAZY;
|
||||||
}
|
}
|
||||||
Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
|
DeoptimizeIf(no_condition, instr, instr->hydrogen()->reason(), type);
|
||||||
DeoptimizeIf(no_condition, instr, type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,9 +234,10 @@ class LCodeGen: public LCodeGenBase {
|
|||||||
|
|
||||||
void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
|
||||||
Safepoint::DeoptMode mode);
|
Safepoint::DeoptMode mode);
|
||||||
void DeoptimizeIf(Condition cc, LInstruction* instr,
|
void DeoptimizeIf(Condition cc, LInstruction* instr, const char* reason,
|
||||||
Deoptimizer::BailoutType bailout_type);
|
Deoptimizer::BailoutType bailout_type);
|
||||||
void DeoptimizeIf(Condition cc, LInstruction* instr);
|
void DeoptimizeIf(Condition cc, LInstruction* instr,
|
||||||
|
const char* reason = NULL);
|
||||||
|
|
||||||
bool DeoptEveryNTimes() {
|
bool DeoptEveryNTimes() {
|
||||||
return FLAG_deopt_every_n_times != 0 && !info()->IsStub();
|
return FLAG_deopt_every_n_times != 0 && !info()->IsStub();
|
||||||
|
Loading…
Reference in New Issue
Block a user