Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 93eb616b326da462344eb6ec889b0fbcfeb6646d..31a11621829f1c03cb6348f3183cc3f1893999ae 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 = __ ExternalOperand(count, kScratchRegister); |
Weiliang
2013/11/07 09:20:11
drive-by comments
use masm()-> instead of __ here
|
+ __ 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; |