Commit 439a4256 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Ensure space for lazy deoptimization before calling IC.

Port r15808 (cc16b500)

Original commit message:
If IC triggers deoptimization, then subsequent patching might get invalid
target address that was overwritten.

BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15811 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 232c5585
......@@ -271,6 +271,7 @@ bool LCodeGen::GenerateBody() {
instr->CompileToNative(this);
}
EnsureSpaceForLazyDeopt();
last_lazy_deopt_pc_ = masm()->pc_offset();
return !is_aborted();
}
......@@ -5634,12 +5635,12 @@ void LCodeGen::EnsureSpaceForLazyDeopt() {
padding_size -= Assembler::kInstrSize;
}
}
last_lazy_deopt_pc_ = masm()->pc_offset();
}
void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
EnsureSpaceForLazyDeopt();
last_lazy_deopt_pc_ = masm()->pc_offset();
ASSERT(instr->HasEnvironment());
LEnvironment* env = instr->environment();
RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
......@@ -5695,6 +5696,7 @@ void LCodeGen::DoStackCheck(LStackCheck* instr) {
StackCheckStub stub;
CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
EnsureSpaceForLazyDeopt();
last_lazy_deopt_pc_ = masm()->pc_offset();
__ bind(&done);
RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index());
......@@ -5706,6 +5708,7 @@ void LCodeGen::DoStackCheck(LStackCheck* instr) {
__ LoadRoot(at, Heap::kStackLimitRootIndex);
__ Branch(deferred_stack_check->entry(), lo, sp, Operand(at));
EnsureSpaceForLazyDeopt();
last_lazy_deopt_pc_ = masm()->pc_offset();
__ bind(instr->done_label());
deferred_stack_check->SetExit(instr->done_label());
RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
......
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