Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1006)

Unified Diff: src/x64/lithium-codegen-x64.cc

Issue 7212025: Add support for lazy deoptimization from deferred stack checks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index 952174dced37af4e1281bc53b6df2eecd1f2bfb7..d8d7af612e6c4b196f638aed00e3fc755ff09393 100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -275,11 +275,34 @@ bool LCodeGen::GenerateJumpTable() {
bool LCodeGen::GenerateDeferredCode() {
ASSERT(is_generating());
- for (int i = 0; !is_aborted() && i < deferred_.length(); i++) {
- LDeferredCode* code = deferred_[i];
- __ bind(code->entry());
- code->Generate();
- __ jmp(code->exit());
+ Label last_jump;
+ if (deferred_.length() > 0) {
+ for (int i = 0; !is_aborted() && i < deferred_.length(); i++) {
+ LDeferredCode* code = deferred_[i];
+ __ bind(code->entry());
+ code->Generate();
+#ifdef DEBUG
+ if (i == (deferred_.length() - 1)) {
+ __ bind(&last_jump);
+ }
+#endif
+ __ jmp(code->exit());
+ }
+
+ // Reserve some space to ensure that the last piece of deferred code
+ // have room for lazy bailout.
+ int padding =
+ Deoptimizer::patch_size() - masm_->SizeOfCodeGeneratedSince(&last_jump);
+ if (padding > 0) {
+ while (padding > 9) {
+ __ nop(9);
+ padding -= 9;
+ }
+ __ nop(padding);
+ }
+
+ ASSERT(Deoptimizer::patch_size() <=
+ masm_->SizeOfCodeGeneratedSince(&last_jump));
}
// Deferred code is the last part of the instruction sequence. Mark
@@ -3987,8 +4010,16 @@ void LCodeGen::DoIn(LIn* instr) {
void LCodeGen::DoDeferredStackCheck(LStackCheck* instr) {
- PushSafepointRegistersScope scope(this);
- CallRuntimeFromDeferred(Runtime::kStackGuard, 0, instr);
+ {
+ PushSafepointRegistersScope scope(this);
+ __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
+ __ CallRuntimeSaveDoubles(Runtime::kStackGuard);
+ RegisterLazyDeoptimization(instr, RECORD_SAFEPOINT_WITH_REGISTERS, 0);
+ }
+
+ // The gap code includes the restoring of the safepoint registers.
+ int pc = masm()->pc_offset();
+ safepoints_.SetPcAfterGap(pc);
}

Powered by Google App Engine
This is Rietveld 408576698