Revision: 7072
Author: [email protected]
Date: Mon Mar 7 02:30:58 2011
Log: X64: Ensure that there is always room for a call between recoreded
safepoints.
Fixes issue 1234.
BUG=v8:1234
Review URL: http://codereview.chromium.org/6624053
http://code.google.com/p/v8/source/detail?r=7072
Modified:
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon Mar 7
00:35:19 2011
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon Mar 7
02:30:58 2011
@@ -48,23 +48,39 @@
: codegen_(codegen),
pointers_(pointers),
deoptimization_index_(deoptimization_index),
- ensure_reloc_space_(ensure_reloc_space) { }
+ ensure_reloc_space_(ensure_reloc_space),
+ previous_safepoint_position_(-kMinSafepointSize) { }
virtual ~SafepointGenerator() { }
virtual void Generate() {
+ // Ensure that we have enough space after the previous safepoint
position
+ // for the generated code there.
+ int position = codegen_->masm()->pc_offset();
+ ASSERT(position > previous_safepoint_position_);
+ if (position < previous_safepoint_position_ + kMinSafepointSize) {
+ int padding_size =
+ previous_safepoint_position_ + kMinSafepointSize - position;
+ STATIC_ASSERT(kMinSafepointSize <= 9); // One multibyte nop is
enough.
+ codegen_->masm()->nop(padding_size);
+ position += padding_size;
+ }
// Ensure that we have enough space in the reloc info to patch
// this with calls when doing deoptimization.
if (ensure_reloc_space_) {
codegen_->masm()->RecordComment(RelocInfo::kFillerCommentString,
true);
}
codegen_->RecordSafepoint(pointers_, deoptimization_index_);
+ previous_safepoint_position_ = position;
}
private:
+ static const int kMinSafepointSize =
+ MacroAssembler::kShortCallInstructionLength;
LCodeGen* codegen_;
LPointerMap* pointers_;
int deoptimization_index_;
bool ensure_reloc_space_;
+ int previous_safepoint_position_;
};
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev