Index: src/ia32/lithium-codegen-ia32.cc |
=================================================================== |
--- src/ia32/lithium-codegen-ia32.cc (revision 6848) |
+++ src/ia32/lithium-codegen-ia32.cc (working copy) |
@@ -55,7 +55,9 @@ |
// 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); |
+ // We can use up to RelocInfo::kMaxCallSize bytes for storing call, |
+ // if this includes a long variable length pc-jump. |
+ codegen_->AddRelocPadding(RelocInfo::kMaxCallSize); |
} |
codegen_->RecordSafepoint(pointers_, deoptimization_index_); |
} |
@@ -78,6 +80,7 @@ |
return GeneratePrologue() && |
GenerateBody() && |
GenerateDeferredCode() && |
+ GenerateRelocPadding() && |
GenerateSafepointTable(); |
} |
@@ -122,6 +125,15 @@ |
} |
+bool LCodeGen::GenerateRelocPadding() { |
+ while(reloc_padding_count_ > 0) { |
+ __ RecordComment(RelocInfo::kFillerCommentString, true); |
+ reloc_padding_count_ -= RelocInfo::kRelocCommentSize; |
+ } |
+ return !is_aborted(); |
+} |
+ |
+ |
bool LCodeGen::GeneratePrologue() { |
ASSERT(is_generating()); |
@@ -382,6 +394,13 @@ |
ASSERT(instr != NULL); |
LPointerMap* pointers = instr->pointer_map(); |
RecordPosition(pointers->position()); |
Søren Thygesen Gjesse
2011/02/21 13:27:20
Move this comment and code to after the '__ call'?
|
+ // A call will only take up 1 byte in the reloc_info, but patching in the |
+ // deoptimizer will take up two since it uses RUNTIME_ENTY as relocation |
+ // mode to avoid issues with GC. Any pc-jumps will be the same for both |
+ // relocation info objects since we patch at the same spot as the original |
+ // call. |
+ AddRelocPadding(1); |
+ |
if (!adjusted) { |
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
} |
@@ -2302,9 +2321,9 @@ |
__ CallSelf(); |
} else { |
// This is an indirect call and will not be recorded in the reloc info. |
- // Add a comment to the reloc info in case we need to patch this during |
- // deoptimization. |
- __ RecordComment(RelocInfo::kFillerCommentString, true); |
+ // We can use up to RelocInfo::kMaxCallSize bytes for storing call, if |
+ // this includes a long variable length pc-jump. |
+ AddRelocPadding(RelocInfo::kMaxCallSize); |
__ call(FieldOperand(edi, JSFunction::kCodeEntryOffset)); |
} |