| OLD | NEW |
| 1 | 1 |
| 2 // Copyright 2012 the V8 project authors. All rights reserved. | 2 // Copyright 2012 the V8 project authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 7 | 7 |
| 8 #if V8_TARGET_ARCH_MIPS | 8 #if V8_TARGET_ARCH_MIPS |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 3146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3157 | 3157 |
| 3158 | 3158 |
| 3159 void MacroAssembler::BranchLong(Label* L, BranchDelaySlot bdslot) { | 3159 void MacroAssembler::BranchLong(Label* L, BranchDelaySlot bdslot) { |
| 3160 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT && | 3160 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT && |
| 3161 (!L->is_bound() || is_near_r6(L))) { | 3161 (!L->is_bound() || is_near_r6(L))) { |
| 3162 BranchShortHelperR6(0, L); | 3162 BranchShortHelperR6(0, L); |
| 3163 } else { | 3163 } else { |
| 3164 BlockTrampolinePoolScope block_trampoline_pool(this); | 3164 BlockTrampolinePoolScope block_trampoline_pool(this); |
| 3165 uint32_t imm32; | 3165 uint32_t imm32; |
| 3166 imm32 = jump_address(L); | 3166 imm32 = jump_address(L); |
| 3167 { | 3167 if (IsMipsArchVariant(kMips32r6) && bdslot != USE_DELAY_SLOT) { |
| 3168 BlockGrowBufferScope block_buf_growth(this); | 3168 uint32_t lui_offset, jic_offset; |
| 3169 // Buffer growth (and relocation) must be blocked for internal references | 3169 UnpackTargetAddressUnsigned(imm32, lui_offset, jic_offset); |
| 3170 // until associated instructions are emitted and available to be patched. | 3170 { |
| 3171 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); | 3171 BlockGrowBufferScope block_buf_growth(this); |
| 3172 lui(at, (imm32 & kHiMask) >> kLuiShift); | 3172 // Buffer growth (and relocation) must be blocked for internal |
| 3173 ori(at, at, (imm32 & kImm16Mask)); | 3173 // references until associated instructions are emitted and |
| 3174 // available to be patched. |
| 3175 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); |
| 3176 lui(at, lui_offset); |
| 3177 jic(at, jic_offset); |
| 3178 } |
| 3179 CheckBuffer(); |
| 3180 } else { |
| 3181 { |
| 3182 BlockGrowBufferScope block_buf_growth(this); |
| 3183 // Buffer growth (and relocation) must be blocked for internal |
| 3184 // references |
| 3185 // until associated instructions are emitted and available to be |
| 3186 // patched. |
| 3187 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); |
| 3188 lui(at, (imm32 & kHiMask) >> kLuiShift); |
| 3189 ori(at, at, (imm32 & kImm16Mask)); |
| 3190 } |
| 3191 CheckBuffer(); |
| 3192 jr(at); |
| 3193 // Emit a nop in the branch delay slot if required. |
| 3194 if (bdslot == PROTECT) nop(); |
| 3174 } | 3195 } |
| 3175 jr(at); | |
| 3176 | |
| 3177 // Emit a nop in the branch delay slot if required. | |
| 3178 if (bdslot == PROTECT) nop(); | |
| 3179 } | 3196 } |
| 3180 } | 3197 } |
| 3181 | 3198 |
| 3182 | 3199 |
| 3183 void MacroAssembler::BranchAndLinkLong(Label* L, BranchDelaySlot bdslot) { | 3200 void MacroAssembler::BranchAndLinkLong(Label* L, BranchDelaySlot bdslot) { |
| 3184 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT && | 3201 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT && |
| 3185 (!L->is_bound() || is_near_r6(L))) { | 3202 (!L->is_bound() || is_near_r6(L))) { |
| 3186 BranchAndLinkShortHelperR6(0, L); | 3203 BranchAndLinkShortHelperR6(0, L); |
| 3187 } else { | 3204 } else { |
| 3188 BlockTrampolinePoolScope block_trampoline_pool(this); | 3205 BlockTrampolinePoolScope block_trampoline_pool(this); |
| 3189 uint32_t imm32; | 3206 uint32_t imm32; |
| 3190 imm32 = jump_address(L); | 3207 imm32 = jump_address(L); |
| 3191 { | 3208 if (IsMipsArchVariant(kMips32r6) && bdslot != USE_DELAY_SLOT) { |
| 3192 BlockGrowBufferScope block_buf_growth(this); | 3209 uint32_t lui_offset, jic_offset; |
| 3193 // Buffer growth (and relocation) must be blocked for internal references | 3210 UnpackTargetAddressUnsigned(imm32, lui_offset, jic_offset); |
| 3194 // until associated instructions are emitted and available to be patched. | 3211 { |
| 3195 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); | 3212 BlockGrowBufferScope block_buf_growth(this); |
| 3196 lui(at, (imm32 & kHiMask) >> kLuiShift); | 3213 // Buffer growth (and relocation) must be blocked for internal |
| 3197 ori(at, at, (imm32 & kImm16Mask)); | 3214 // references until associated instructions are emitted and |
| 3215 // available to be patched. |
| 3216 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); |
| 3217 lui(at, lui_offset); |
| 3218 jialc(at, jic_offset); |
| 3219 } |
| 3220 CheckBuffer(); |
| 3221 } else { |
| 3222 { |
| 3223 BlockGrowBufferScope block_buf_growth(this); |
| 3224 // Buffer growth (and relocation) must be blocked for internal |
| 3225 // references |
| 3226 // until associated instructions are emitted and available to be |
| 3227 // patched. |
| 3228 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); |
| 3229 lui(at, (imm32 & kHiMask) >> kLuiShift); |
| 3230 ori(at, at, (imm32 & kImm16Mask)); |
| 3231 } |
| 3232 jalr(at); |
| 3233 // Emit a nop in the branch delay slot if required. |
| 3234 if (bdslot == PROTECT) nop(); |
| 3198 } | 3235 } |
| 3199 jalr(at); | |
| 3200 | |
| 3201 // Emit a nop in the branch delay slot if required. | |
| 3202 if (bdslot == PROTECT) nop(); | |
| 3203 } | 3236 } |
| 3204 } | 3237 } |
| 3205 | 3238 |
| 3206 | 3239 |
| 3207 void MacroAssembler::DropAndRet(int drop) { | 3240 void MacroAssembler::DropAndRet(int drop) { |
| 3208 DCHECK(is_int16(drop * kPointerSize)); | 3241 DCHECK(is_int16(drop * kPointerSize)); |
| 3209 Ret(USE_DELAY_SLOT); | 3242 Ret(USE_DELAY_SLOT); |
| 3210 addiu(sp, sp, drop * kPointerSize); | 3243 addiu(sp, sp, drop * kPointerSize); |
| 3211 } | 3244 } |
| 3212 | 3245 |
| (...skipping 2622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5835 if (mag.shift > 0) sra(result, result, mag.shift); | 5868 if (mag.shift > 0) sra(result, result, mag.shift); |
| 5836 srl(at, dividend, 31); | 5869 srl(at, dividend, 31); |
| 5837 Addu(result, result, Operand(at)); | 5870 Addu(result, result, Operand(at)); |
| 5838 } | 5871 } |
| 5839 | 5872 |
| 5840 | 5873 |
| 5841 } // namespace internal | 5874 } // namespace internal |
| 5842 } // namespace v8 | 5875 } // namespace v8 |
| 5843 | 5876 |
| 5844 #endif // V8_TARGET_ARCH_MIPS | 5877 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |