Chromium Code Reviews| 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 3084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3095 | 3095 |
| 3096 | 3096 |
| 3097 void MacroAssembler::BranchLong(Label* L, BranchDelaySlot bdslot) { | 3097 void MacroAssembler::BranchLong(Label* L, BranchDelaySlot bdslot) { |
| 3098 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT && | 3098 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT && |
| 3099 (!L->is_bound() || is_near_r6(L))) { | 3099 (!L->is_bound() || is_near_r6(L))) { |
| 3100 BranchShortHelperR6(0, L); | 3100 BranchShortHelperR6(0, L); |
| 3101 } else { | 3101 } else { |
| 3102 BlockTrampolinePoolScope block_trampoline_pool(this); | 3102 BlockTrampolinePoolScope block_trampoline_pool(this); |
| 3103 uint32_t imm32; | 3103 uint32_t imm32; |
| 3104 imm32 = jump_address(L); | 3104 imm32 = jump_address(L); |
| 3105 { | 3105 if (IsMipsArchVariant(kMips32r6) && bdslot != USE_DELAY_SLOT) { |
| 3106 BlockGrowBufferScope block_buf_growth(this); | 3106 and_(at, at, at); |
|
paul.l...
2016/01/11 22:34:57
What's the reason for this and()? If it needs to b
miran.karic
2016/02/18 08:38:05
Done.
| |
| 3107 // Buffer growth (and relocation) must be blocked for internal references | 3107 uint32_t lui_offset, jic_offset; |
| 3108 // until associated instructions are emitted and available to be patched. | 3108 unpackTargetAddressUnsigned(imm32, lui_offset, jic_offset); |
| 3109 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); | 3109 { |
| 3110 lui(at, (imm32 & kHiMask) >> kLuiShift); | 3110 BlockGrowBufferScope block_buf_growth(this); |
| 3111 ori(at, at, (imm32 & kImm16Mask)); | 3111 // Buffer growth (and relocation) must be blocked for internal |
| 3112 // references until associated instructions are emitted and | |
| 3113 // available to be patched. | |
| 3114 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); | |
| 3115 lui(at, lui_offset); | |
| 3116 jic(at, jic_offset); | |
| 3117 } | |
| 3118 CheckBuffer(); | |
| 3119 } else { | |
| 3120 { | |
| 3121 BlockGrowBufferScope block_buf_growth(this); | |
| 3122 // Buffer growth (and relocation) must be blocked for internal | |
| 3123 // references | |
| 3124 // until associated instructions are emitted and available to be | |
| 3125 // patched. | |
| 3126 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); | |
| 3127 lui(at, (imm32 & kHiMask) >> kLuiShift); | |
| 3128 ori(at, at, (imm32 & kImm16Mask)); | |
| 3129 } | |
| 3130 CheckBuffer(); | |
| 3131 jr(at); | |
| 3132 // Emit a nop in the branch delay slot if required. | |
| 3133 if (bdslot == PROTECT) nop(); | |
| 3112 } | 3134 } |
| 3113 jr(at); | |
| 3114 | |
| 3115 // Emit a nop in the branch delay slot if required. | |
| 3116 if (bdslot == PROTECT) nop(); | |
| 3117 } | 3135 } |
| 3118 } | 3136 } |
| 3119 | 3137 |
| 3120 | 3138 |
| 3121 void MacroAssembler::BranchAndLinkLong(Label* L, BranchDelaySlot bdslot) { | 3139 void MacroAssembler::BranchAndLinkLong(Label* L, BranchDelaySlot bdslot) { |
| 3122 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT && | 3140 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT && |
| 3123 (!L->is_bound() || is_near_r6(L))) { | 3141 (!L->is_bound() || is_near_r6(L))) { |
| 3124 BranchAndLinkShortHelperR6(0, L); | 3142 BranchAndLinkShortHelperR6(0, L); |
| 3125 } else { | 3143 } else { |
| 3126 BlockTrampolinePoolScope block_trampoline_pool(this); | 3144 BlockTrampolinePoolScope block_trampoline_pool(this); |
| 3127 uint32_t imm32; | 3145 uint32_t imm32; |
| 3128 imm32 = jump_address(L); | 3146 imm32 = jump_address(L); |
| 3129 { | 3147 if (IsMipsArchVariant(kMips32r6) && bdslot != USE_DELAY_SLOT) { |
| 3130 BlockGrowBufferScope block_buf_growth(this); | 3148 uint32_t lui_offset, jic_offset; |
| 3131 // Buffer growth (and relocation) must be blocked for internal references | 3149 unpackTargetAddressUnsigned(imm32, lui_offset, jic_offset); |
| 3132 // until associated instructions are emitted and available to be patched. | 3150 { |
| 3133 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); | 3151 BlockGrowBufferScope block_buf_growth(this); |
| 3134 lui(at, (imm32 & kHiMask) >> kLuiShift); | 3152 // Buffer growth (and relocation) must be blocked for internal |
| 3135 ori(at, at, (imm32 & kImm16Mask)); | 3153 // references until associated instructions are emitted and |
| 3154 // available to be patched. | |
| 3155 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); | |
| 3156 lui(at, lui_offset); | |
| 3157 jialc(at, jic_offset); | |
| 3158 } | |
| 3159 CheckBuffer(); | |
| 3160 } else { | |
| 3161 { | |
| 3162 BlockGrowBufferScope block_buf_growth(this); | |
| 3163 // Buffer growth (and relocation) must be blocked for internal | |
| 3164 // references | |
| 3165 // until associated instructions are emitted and available to be | |
| 3166 // patched. | |
| 3167 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); | |
| 3168 lui(at, (imm32 & kHiMask) >> kLuiShift); | |
| 3169 ori(at, at, (imm32 & kImm16Mask)); | |
| 3170 } | |
| 3171 jalr(at); | |
| 3172 // Emit a nop in the branch delay slot if required. | |
| 3173 if (bdslot == PROTECT) nop(); | |
| 3136 } | 3174 } |
| 3137 jalr(at); | |
| 3138 | |
| 3139 // Emit a nop in the branch delay slot if required. | |
| 3140 if (bdslot == PROTECT) nop(); | |
| 3141 } | 3175 } |
| 3142 } | 3176 } |
| 3143 | 3177 |
| 3144 | 3178 |
| 3145 void MacroAssembler::DropAndRet(int drop) { | 3179 void MacroAssembler::DropAndRet(int drop) { |
| 3146 DCHECK(is_int16(drop * kPointerSize)); | 3180 DCHECK(is_int16(drop * kPointerSize)); |
| 3147 Ret(USE_DELAY_SLOT); | 3181 Ret(USE_DELAY_SLOT); |
| 3148 addiu(sp, sp, drop * kPointerSize); | 3182 addiu(sp, sp, drop * kPointerSize); |
| 3149 } | 3183 } |
| 3150 | 3184 |
| (...skipping 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5766 if (mag.shift > 0) sra(result, result, mag.shift); | 5800 if (mag.shift > 0) sra(result, result, mag.shift); |
| 5767 srl(at, dividend, 31); | 5801 srl(at, dividend, 31); |
| 5768 Addu(result, result, Operand(at)); | 5802 Addu(result, result, Operand(at)); |
| 5769 } | 5803 } |
| 5770 | 5804 |
| 5771 | 5805 |
| 5772 } // namespace internal | 5806 } // namespace internal |
| 5773 } // namespace v8 | 5807 } // namespace v8 |
| 5774 | 5808 |
| 5775 #endif // V8_TARGET_ARCH_MIPS | 5809 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |