| Index: src/x64/lithium-codegen-x64.cc
|
| diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
|
| index 14d31c572eb9a3203c332383b32981d5bf9727df..a84b5698ddc86aa8bd2ae3c729b853bd19d3aeb7 100644
|
| --- a/src/x64/lithium-codegen-x64.cc
|
| +++ b/src/x64/lithium-codegen-x64.cc
|
| @@ -649,7 +649,27 @@ void LCodeGen::DeoptimizeIf(Condition cc,
|
| return;
|
| }
|
|
|
| - ASSERT(FLAG_deopt_every_n_times == 0); // Not yet implemented on x64.
|
| + if (FLAG_deopt_every_n_times != 0 && !info()->IsStub()) {
|
| + ExternalReference count = ExternalReference::stress_deopt_count(isolate());
|
| + Label no_deopt;
|
| + __ pushfq();
|
| + __ push(rax);
|
| + Operand count_operand = masm()->ExternalOperand(count, kScratchRegister);
|
| + __ movl(rax, count_operand);
|
| + __ subl(rax, Immediate(1));
|
| + __ j(not_zero, &no_deopt, Label::kNear);
|
| + if (FLAG_trap_on_deopt) __ int3();
|
| + __ movl(rax, Immediate(FLAG_deopt_every_n_times));
|
| + __ movl(count_operand, rax);
|
| + __ pop(rax);
|
| + __ popfq();
|
| + ASSERT(frame_is_built_);
|
| + __ call(entry, RelocInfo::RUNTIME_ENTRY);
|
| + __ bind(&no_deopt);
|
| + __ movl(count_operand, rax);
|
| + __ pop(rax);
|
| + __ popfq();
|
| + }
|
|
|
| if (info()->ShouldTrapOnDeopt()) {
|
| Label done;
|
|
|