| Index: src/arm/assembler-arm.cc
|
| ===================================================================
|
| --- src/arm/assembler-arm.cc (revision 12285)
|
| +++ src/arm/assembler-arm.cc (working copy)
|
| @@ -302,7 +302,8 @@
|
| : AssemblerBase(arg_isolate),
|
| recorded_ast_id_(TypeFeedbackId::None()),
|
| positions_recorder_(this),
|
| - emit_debug_code_(FLAG_debug_code) {
|
| + emit_debug_code_(FLAG_debug_code),
|
| + predictable_code_size_(false) {
|
| if (buffer == NULL) {
|
| // Do our own buffer management.
|
| if (buffer_size <= kMinimalBufferSize) {
|
| @@ -784,13 +785,14 @@
|
| // if they can be encoded in the ARM's 12 bits of immediate-offset instruction
|
| // space. There is no guarantee that the relocated location can be similarly
|
| // encoded.
|
| -bool Operand::must_use_constant_pool() const {
|
| +bool Operand::must_use_constant_pool(const Assembler* assembler) const {
|
| if (rmode_ == RelocInfo::EXTERNAL_REFERENCE) {
|
| #ifdef DEBUG
|
| if (!Serializer::enabled()) {
|
| Serializer::TooLateToEnableNow();
|
| }
|
| #endif // def DEBUG
|
| + if (assembler != NULL && assembler->predictable_code_size()) return true;
|
| return Serializer::enabled();
|
| } else if (rmode_ == RelocInfo::NONE) {
|
| return false;
|
| @@ -799,16 +801,17 @@
|
| }
|
|
|
|
|
| -bool Operand::is_single_instruction(Instr instr) const {
|
| +bool Operand::is_single_instruction(const Assembler* assembler,
|
| + Instr instr) const {
|
| if (rm_.is_valid()) return true;
|
| uint32_t dummy1, dummy2;
|
| - if (must_use_constant_pool() ||
|
| + if (must_use_constant_pool(assembler) ||
|
| !fits_shifter(imm32_, &dummy1, &dummy2, &instr)) {
|
| // The immediate operand cannot be encoded as a shifter operand, or use of
|
| // constant pool is required. For a mov instruction not setting the
|
| // condition code additional instruction conventions can be used.
|
| if ((instr & ~kCondMask) == 13*B21) { // mov, S not set
|
| - if (must_use_constant_pool() ||
|
| + if (must_use_constant_pool(assembler) ||
|
| !CpuFeatures::IsSupported(ARMv7)) {
|
| // mov instruction will be an ldr from constant pool (one instruction).
|
| return true;
|
| @@ -842,7 +845,7 @@
|
| // Immediate.
|
| uint32_t rotate_imm;
|
| uint32_t immed_8;
|
| - if (x.must_use_constant_pool() ||
|
| + if (x.must_use_constant_pool(this) ||
|
| !fits_shifter(x.imm32_, &rotate_imm, &immed_8, &instr)) {
|
| // The immediate operand cannot be encoded as a shifter operand, so load
|
| // it first to register ip and change the original instruction to use ip.
|
| @@ -851,7 +854,7 @@
|
| CHECK(!rn.is(ip)); // rn should never be ip, or will be trashed
|
| Condition cond = Instruction::ConditionField(instr);
|
| if ((instr & ~kCondMask) == 13*B21) { // mov, S not set
|
| - if (x.must_use_constant_pool() ||
|
| + if (x.must_use_constant_pool(this) ||
|
| !CpuFeatures::IsSupported(ARMv7)) {
|
| RecordRelocInfo(x.rmode_, x.imm32_);
|
| ldr(rd, MemOperand(pc, 0), cond);
|
| @@ -863,7 +866,7 @@
|
| } else {
|
| // If this is not a mov or mvn instruction we may still be able to avoid
|
| // a constant pool entry by using mvn or movw.
|
| - if (!x.must_use_constant_pool() &&
|
| + if (!x.must_use_constant_pool(this) &&
|
| (instr & kMovMvnMask) != kMovMvnPattern) {
|
| mov(ip, x, LeaveCC, cond);
|
| } else {
|
| @@ -1388,7 +1391,7 @@
|
| // Immediate.
|
| uint32_t rotate_imm;
|
| uint32_t immed_8;
|
| - if (src.must_use_constant_pool() ||
|
| + if (src.must_use_constant_pool(this) ||
|
| !fits_shifter(src.imm32_, &rotate_imm, &immed_8, NULL)) {
|
| // Immediate operand cannot be encoded, load it first to register ip.
|
| RecordRelocInfo(src.rmode_, src.imm32_);
|
|
|