Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1697)

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 1807263003: MIPS: Replace JR/JALR with JIC/JIALC for r6 part 2 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips/assembler-mips.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3034 matching lines...) Expand 10 before | Expand all | Expand 10 after
3045 return false; 3045 return false;
3046 } 3046 }
3047 3047
3048 3048
3049 void MacroAssembler::Jump(Register target, 3049 void MacroAssembler::Jump(Register target,
3050 Condition cond, 3050 Condition cond,
3051 Register rs, 3051 Register rs,
3052 const Operand& rt, 3052 const Operand& rt,
3053 BranchDelaySlot bd) { 3053 BranchDelaySlot bd) {
3054 BlockTrampolinePoolScope block_trampoline_pool(this); 3054 BlockTrampolinePoolScope block_trampoline_pool(this);
3055 if (cond == cc_always) { 3055 if (IsMipsArchVariant(kMips32r6) && bd == PROTECT) {
3056 jr(target); 3056 if (cond == cc_always) {
3057 jic(target, 0);
3058 } else {
3059 BRANCH_ARGS_CHECK(cond, rs, rt);
3060 Branch(2, NegateCondition(cond), rs, rt);
3061 jic(target, 0);
3062 }
3057 } else { 3063 } else {
3058 BRANCH_ARGS_CHECK(cond, rs, rt); 3064 if (cond == cc_always) {
3059 Branch(2, NegateCondition(cond), rs, rt); 3065 jr(target);
3060 jr(target); 3066 } else {
3067 BRANCH_ARGS_CHECK(cond, rs, rt);
3068 Branch(2, NegateCondition(cond), rs, rt);
3069 jr(target);
3070 }
3071 // Emit a nop in the branch delay slot if required.
3072 if (bd == PROTECT) nop();
3061 } 3073 }
3062 // Emit a nop in the branch delay slot if required.
3063 if (bd == PROTECT)
3064 nop();
3065 } 3074 }
3066 3075
3067 3076
3068 void MacroAssembler::Jump(intptr_t target, 3077 void MacroAssembler::Jump(intptr_t target,
3069 RelocInfo::Mode rmode, 3078 RelocInfo::Mode rmode,
3070 Condition cond, 3079 Condition cond,
3071 Register rs, 3080 Register rs,
3072 const Operand& rt, 3081 const Operand& rt,
3073 BranchDelaySlot bd) { 3082 BranchDelaySlot bd) {
3074 Label skip; 3083 Label skip;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3112 const Operand& rt, 3121 const Operand& rt,
3113 BranchDelaySlot bd) { 3122 BranchDelaySlot bd) {
3114 int size = 0; 3123 int size = 0;
3115 3124
3116 if (cond == cc_always) { 3125 if (cond == cc_always) {
3117 size += 1; 3126 size += 1;
3118 } else { 3127 } else {
3119 size += 3; 3128 size += 3;
3120 } 3129 }
3121 3130
3122 if (bd == PROTECT) 3131 if (bd == PROTECT && !IsMipsArchVariant(kMips32r6)) size += 1;
3123 size += 1;
3124 3132
3125 return size * kInstrSize; 3133 return size * kInstrSize;
3126 } 3134 }
3127 3135
3128 3136
3129 // Note: To call gcc-compiled C code on mips, you must call thru t9. 3137 // Note: To call gcc-compiled C code on mips, you must call thru t9.
3130 void MacroAssembler::Call(Register target, 3138 void MacroAssembler::Call(Register target,
3131 Condition cond, 3139 Condition cond,
3132 Register rs, 3140 Register rs,
3133 const Operand& rt, 3141 const Operand& rt,
3134 BranchDelaySlot bd) { 3142 BranchDelaySlot bd) {
3135 #ifdef DEBUG 3143 #ifdef DEBUG
3136 int size = IsPrevInstrCompactBranch() ? kInstrSize : 0; 3144 int size = IsPrevInstrCompactBranch() ? kInstrSize : 0;
3137 #endif 3145 #endif
3138 3146
3139 BlockTrampolinePoolScope block_trampoline_pool(this); 3147 BlockTrampolinePoolScope block_trampoline_pool(this);
3140 Label start; 3148 Label start;
3141 bind(&start); 3149 bind(&start);
3142 if (cond == cc_always) { 3150 if (IsMipsArchVariant(kMips32r6) && bd == PROTECT) {
3143 jalr(target); 3151 if (cond == cc_always) {
3152 jialc(target, 0);
3153 } else {
3154 BRANCH_ARGS_CHECK(cond, rs, rt);
3155 Branch(2, NegateCondition(cond), rs, rt);
3156 jialc(target, 0);
3157 }
3144 } else { 3158 } else {
3145 BRANCH_ARGS_CHECK(cond, rs, rt); 3159 if (cond == cc_always) {
3146 Branch(2, NegateCondition(cond), rs, rt); 3160 jalr(target);
3147 jalr(target); 3161 } else {
3162 BRANCH_ARGS_CHECK(cond, rs, rt);
3163 Branch(2, NegateCondition(cond), rs, rt);
3164 jalr(target);
3165 }
3166 // Emit a nop in the branch delay slot if required.
3167 if (bd == PROTECT) nop();
3148 } 3168 }
3149 // Emit a nop in the branch delay slot if required.
3150 if (bd == PROTECT)
3151 nop();
3152 3169
3153 #ifdef DEBUG 3170 #ifdef DEBUG
3154 CHECK_EQ(size + CallSize(target, cond, rs, rt, bd), 3171 CHECK_EQ(size + CallSize(target, cond, rs, rt, bd),
3155 SizeOfCodeGeneratedSince(&start)); 3172 SizeOfCodeGeneratedSince(&start));
3156 #endif 3173 #endif
3157 } 3174 }
3158 3175
3159 3176
3160 int MacroAssembler::CallSize(Address target, 3177 int MacroAssembler::CallSize(Address target,
3161 RelocInfo::Mode rmode, 3178 RelocInfo::Mode rmode,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
3232 3249
3233 3250
3234 void MacroAssembler::BranchLong(Label* L, BranchDelaySlot bdslot) { 3251 void MacroAssembler::BranchLong(Label* L, BranchDelaySlot bdslot) {
3235 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT && 3252 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT &&
3236 (!L->is_bound() || is_near_r6(L))) { 3253 (!L->is_bound() || is_near_r6(L))) {
3237 BranchShortHelperR6(0, L); 3254 BranchShortHelperR6(0, L);
3238 } else { 3255 } else {
3239 BlockTrampolinePoolScope block_trampoline_pool(this); 3256 BlockTrampolinePoolScope block_trampoline_pool(this);
3240 uint32_t imm32; 3257 uint32_t imm32;
3241 imm32 = jump_address(L); 3258 imm32 = jump_address(L);
3242 if (IsMipsArchVariant(kMips32r6) && bdslot != USE_DELAY_SLOT) { 3259 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT) {
3243 uint32_t lui_offset, jic_offset; 3260 uint32_t lui_offset, jic_offset;
3244 UnpackTargetAddressUnsigned(imm32, lui_offset, jic_offset); 3261 UnpackTargetAddressUnsigned(imm32, lui_offset, jic_offset);
3245 { 3262 {
3246 BlockGrowBufferScope block_buf_growth(this); 3263 BlockGrowBufferScope block_buf_growth(this);
3247 // Buffer growth (and relocation) must be blocked for internal 3264 // Buffer growth (and relocation) must be blocked for internal
3248 // references until associated instructions are emitted and 3265 // references until associated instructions are emitted and
3249 // available to be patched. 3266 // available to be patched.
3250 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); 3267 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED);
3251 lui(at, lui_offset); 3268 lui(at, lui_offset);
3252 jic(at, jic_offset); 3269 jic(at, jic_offset);
(...skipping 20 matching lines...) Expand all
3273 3290
3274 3291
3275 void MacroAssembler::BranchAndLinkLong(Label* L, BranchDelaySlot bdslot) { 3292 void MacroAssembler::BranchAndLinkLong(Label* L, BranchDelaySlot bdslot) {
3276 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT && 3293 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT &&
3277 (!L->is_bound() || is_near_r6(L))) { 3294 (!L->is_bound() || is_near_r6(L))) {
3278 BranchAndLinkShortHelperR6(0, L); 3295 BranchAndLinkShortHelperR6(0, L);
3279 } else { 3296 } else {
3280 BlockTrampolinePoolScope block_trampoline_pool(this); 3297 BlockTrampolinePoolScope block_trampoline_pool(this);
3281 uint32_t imm32; 3298 uint32_t imm32;
3282 imm32 = jump_address(L); 3299 imm32 = jump_address(L);
3283 if (IsMipsArchVariant(kMips32r6) && bdslot != USE_DELAY_SLOT) { 3300 if (IsMipsArchVariant(kMips32r6) && bdslot == PROTECT) {
3284 uint32_t lui_offset, jic_offset; 3301 uint32_t lui_offset, jic_offset;
3285 UnpackTargetAddressUnsigned(imm32, lui_offset, jic_offset); 3302 UnpackTargetAddressUnsigned(imm32, lui_offset, jic_offset);
3286 { 3303 {
3287 BlockGrowBufferScope block_buf_growth(this); 3304 BlockGrowBufferScope block_buf_growth(this);
3288 // Buffer growth (and relocation) must be blocked for internal 3305 // Buffer growth (and relocation) must be blocked for internal
3289 // references until associated instructions are emitted and 3306 // references until associated instructions are emitted and
3290 // available to be patched. 3307 // available to be patched.
3291 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); 3308 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED);
3292 lui(at, lui_offset); 3309 lui(at, lui_offset);
3293 jialc(at, jic_offset); 3310 jialc(at, jic_offset);
3294 } 3311 }
3295 CheckBuffer(); 3312 CheckBuffer();
3296 } else { 3313 } else {
3297 { 3314 {
3298 BlockGrowBufferScope block_buf_growth(this); 3315 BlockGrowBufferScope block_buf_growth(this);
3299 // Buffer growth (and relocation) must be blocked for internal 3316 // Buffer growth (and relocation) must be blocked for internal
3300 // references 3317 // references
3301 // until associated instructions are emitted and available to be 3318 // until associated instructions are emitted and available to be
3302 // patched. 3319 // patched.
3303 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); 3320 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED);
3304 lui(at, (imm32 & kHiMask) >> kLuiShift); 3321 lui(at, (imm32 & kHiMask) >> kLuiShift);
3305 ori(at, at, (imm32 & kImm16Mask)); 3322 ori(at, at, (imm32 & kImm16Mask));
3306 } 3323 }
3324 CheckBuffer();
3307 jalr(at); 3325 jalr(at);
3308 // Emit a nop in the branch delay slot if required. 3326 // Emit a nop in the branch delay slot if required.
3309 if (bdslot == PROTECT) nop(); 3327 if (bdslot == PROTECT) nop();
3310 } 3328 }
3311 } 3329 }
3312 } 3330 }
3313 3331
3314 3332
3315 void MacroAssembler::DropAndRet(int drop) { 3333 void MacroAssembler::DropAndRet(int drop) {
3316 DCHECK(is_int16(drop * kPointerSize)); 3334 DCHECK(is_int16(drop * kPointerSize));
(...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after
6032 if (mag.shift > 0) sra(result, result, mag.shift); 6050 if (mag.shift > 0) sra(result, result, mag.shift);
6033 srl(at, dividend, 31); 6051 srl(at, dividend, 31);
6034 Addu(result, result, Operand(at)); 6052 Addu(result, result, Operand(at));
6035 } 6053 }
6036 6054
6037 6055
6038 } // namespace internal 6056 } // namespace internal
6039 } // namespace v8 6057 } // namespace v8
6040 6058
6041 #endif // V8_TARGET_ARCH_MIPS 6059 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698