GrowBuffer();
}
if (pc_offset() >= next_veneer_pool_check_) {
- CheckVeneerPool(true);
+ CheckVeneerPool(false, true);
}
if (pc_offset() >= next_constant_pool_check_) {
CheckConstPool(false, true);
// Emit veneers for branches that would go out of range during emission of the
// constant pool.
- CheckVeneerPool(require_jump, kVeneerDistanceMargin + pool_size);
+ CheckVeneerPool(false, require_jump, kVeneerDistanceMargin + pool_size);
Label size_check;
bind(&size_check);
}
-void Assembler::EmitVeneers(bool need_protection, int margin) {
+void Assembler::EmitVeneers(bool force_emit, bool need_protection, int margin) {
BlockPoolsScope scope(this);
RecordComment("[ Veneers");
it = unresolved_branches_.begin();
while (it != unresolved_branches_.end()) {
- if (ShouldEmitVeneer(it->first, margin)) {
+ if (force_emit || ShouldEmitVeneer(it->first, margin)) {
Instruction* branch = InstructionAt(it->second.pc_offset_);
Label* label = it->second.label_;
}
-void Assembler::CheckVeneerPool(bool require_jump,
+void Assembler::CheckVeneerPool(bool force_emit, bool require_jump,
int margin) {
// There is nothing to do if there are no pending veneer pool entries.
if (unresolved_branches_.empty()) {
// emission, such sequences are protected by calls to BlockVeneerPoolFor and
// BlockVeneerPoolScope.
if (is_veneer_pool_blocked()) {
+ ASSERT(!force_emit);
return;
}
// Prefer emitting veneers protected by an existing instruction.
margin *= kVeneerNoProtectionFactor;
}
- if (ShouldEmitVeneers(margin)) {
- EmitVeneers(require_jump, margin);
+ if (force_emit || ShouldEmitVeneers(margin)) {
+ EmitVeneers(force_emit, require_jump, margin);
} else {
next_veneer_pool_check_ =
unresolved_branches_first_limit() - kVeneerDistanceCheckMargin;
// Emits veneers for branches that are approaching their maximum range.
// If need_protection is true, the veneers are protected by a branch jumping
// over the code.
- void EmitVeneers(bool need_protection, int margin = kVeneerDistanceMargin);
+ void EmitVeneers(bool force_emit, bool need_protection,
+ int margin = kVeneerDistanceMargin);
void EmitVeneersGuard() { EmitPoolGuard(); }
// Checks whether veneers need to be emitted at this point.
- void CheckVeneerPool(bool require_jump, int margin = kVeneerDistanceMargin);
+ // If force_emit is set, a veneer is generated for *all* unresolved branches.
+ void CheckVeneerPool(bool force_emit, bool require_jump,
+ int margin = kVeneerDistanceMargin);
class BlockPoolsScope {
}
EmitReturnSequence();
- // Force emit the constant pool, so it doesn't get emitted in the middle
+ // Force emission of the pools, so they don't get emitted in the middle
// of the back edge table.
+ masm()->CheckVeneerPool(true, false);
masm()->CheckConstPool(true, false);
}
bool LCodeGen::GenerateSafepointTable() {
ASSERT(is_done());
+ // We do not know how much data will be emitted for the safepoint table, so
+ // force emission of the veneer pool.
+ masm()->CheckVeneerPool(true, true);
safepoints_.Emit(masm(), GetStackSlotCount());
return !is_aborted();
}
void MacroAssembler::B(Label* label) {
b(label);
- CheckVeneerPool(false);
+ CheckVeneerPool(false, false);
}
ASSERT(allow_macro_instructions_);
ASSERT(!xn.IsZero());
ret(xn);
- CheckVeneerPool(false);
+ CheckVeneerPool(false, false);
}