MIPS: Align emitting a trampoline pool to instruction size boundaries.

Assembler::db() could start a trampoline pool at wrong pc position.

TEST: mjsunit/asm/embenchen/zlib

BUG=

Review-Url: https://codereview.chromium.org/1994143002
Cr-Commit-Position: refs/heads/master@{#36374}
This commit is contained in:
balazs.kilvady 2016-05-19 10:14:01 -07:00 committed by Commit bot
parent 0cc770493e
commit 65aa64ac8d
2 changed files with 20 additions and 0 deletions

View File

@ -463,6 +463,8 @@ void Assembler::EmitHelper(Instr x, CompactBranchType is_compact_branch) {
CheckTrampolinePoolQuick();
}
template <>
inline void Assembler::EmitHelper(uint8_t x);
template <typename T>
void Assembler::EmitHelper(T x) {
@ -471,6 +473,14 @@ void Assembler::EmitHelper(T x) {
CheckTrampolinePoolQuick();
}
template <>
void Assembler::EmitHelper(uint8_t x) {
*reinterpret_cast<uint8_t*>(pc_) = x;
pc_ += sizeof(x);
if (reinterpret_cast<intptr_t>(pc_) % kInstrSize == 0) {
CheckTrampolinePoolQuick();
}
}
void Assembler::emit(Instr x, CompactBranchType is_compact_branch) {
if (!is_buffer_growth_blocked()) {

View File

@ -445,6 +445,8 @@ void Assembler::EmitHelper(Instr x, CompactBranchType is_compact_branch) {
CheckTrampolinePoolQuick();
}
template <>
inline void Assembler::EmitHelper(uint8_t x);
template <typename T>
void Assembler::EmitHelper(T x) {
@ -453,6 +455,14 @@ void Assembler::EmitHelper(T x) {
CheckTrampolinePoolQuick();
}
template <>
void Assembler::EmitHelper(uint8_t x) {
*reinterpret_cast<uint8_t*>(pc_) = x;
pc_ += sizeof(x);
if (reinterpret_cast<intptr_t>(pc_) % kInstrSize == 0) {
CheckTrampolinePoolQuick();
}
}
void Assembler::emit(Instr x, CompactBranchType is_compact_branch) {
if (!is_buffer_growth_blocked()) {