Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
[arm] Fix missing CheckBuffer for branches.
Browse files Browse the repository at this point in the history
The b, bl and blx methods that take labels basically ignore the constant
pool check and just block the constant pool for the next instruction.
This way a long enough sequence of those instructions will block can
potentially block the constant pool emission for too long.

BUG=v8:4292
LOG=y
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/1223093004

Cr-Commit-Position: refs/heads/master@{#29550}
  • Loading branch information
bmeurer authored and Commit bot committed Jul 9, 2015
1 parent fde4173 commit d055388
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 4 deletions.
18 changes: 18 additions & 0 deletions src/arm/assembler-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,24 @@ void Assembler::bx(Register target, Condition cond) { // v5 and above, plus v4t
}


void Assembler::b(Label* L, Condition cond) {
CheckBuffer();
b(branch_offset(L), cond);
}


void Assembler::bl(Label* L, Condition cond) {
CheckBuffer();
bl(branch_offset(L), cond);
}


void Assembler::blx(Label* L) {
CheckBuffer();
blx(branch_offset(L));
}


// Data-processing instructions.

void Assembler::and_(Register dst, Register src1, const Operand& src2,
Expand Down
8 changes: 4 additions & 4 deletions src/arm/assembler-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -806,11 +806,11 @@ class Assembler : public AssemblerBase {
void bx(Register target, Condition cond = al); // v5 and above, plus v4t

// Convenience branch instructions using labels
void b(Label* L, Condition cond = al) { b(branch_offset(L), cond); }
void b(Label* L, Condition cond = al);
void b(Condition cond, Label* L) { b(L, cond); }
void bl(Label* L, Condition cond = al) { bl(branch_offset(L), cond); }
void bl(Condition cond, Label* L) { bl(branch_offset(L), cond); }
void blx(Label* L) { blx(branch_offset(L)); } // v5 and above
void bl(Label* L, Condition cond = al);
void bl(Condition cond, Label* L) { bl(L, cond); }
void blx(Label* L); // v5 and above

// Data-processing instructions

Expand Down
46 changes: 46 additions & 0 deletions test/cctest/test-assembler-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1981,4 +1981,50 @@ TEST(ARMv8_vrintX) {
#undef CHECK_VRINT
}
}


TEST(regress4292_b) {
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);

Assembler assm(isolate, NULL, 0);
Label end;
__ mov(r0, Operand(isolate->factory()->infinity_value()));
for (int i = 0; i < 1020; ++i) {
__ b(hi, &end);
}
__ bind(&end);
}


TEST(regress4292_bl) {
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);

Assembler assm(isolate, NULL, 0);
Label end;
__ mov(r0, Operand(isolate->factory()->infinity_value()));
for (int i = 0; i < 1020; ++i) {
__ bl(hi, &end);
}
__ bind(&end);
}


TEST(regress4292_blx) {
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);

Assembler assm(isolate, NULL, 0);
Label end;
__ mov(r0, Operand(isolate->factory()->infinity_value()));
for (int i = 0; i < 1020; ++i) {
__ blx(&end);
}
__ bind(&end);
}

#undef __

0 comments on commit d055388

Please sign in to comment.