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

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

Issue 1216823003: MIPS64: Fix hidden bug in relocations for j and jal. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 5 years, 5 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits.h> // For LONG_MIN, LONG_MAX. 5 #include <limits.h> // For LONG_MIN, LONG_MAX.
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS64 9 #if V8_TARGET_ARCH_MIPS64
10 10
(...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2748 void MacroAssembler::BranchAndLink(Label* L, Condition cond, Register rs, 2748 void MacroAssembler::BranchAndLink(Label* L, Condition cond, Register rs,
2749 const Operand& rt, 2749 const Operand& rt,
2750 BranchDelaySlot bdslot) { 2750 BranchDelaySlot bdslot) {
2751 if (L->is_bound()) { 2751 if (L->is_bound()) {
2752 if (is_near(L)) { 2752 if (is_near(L)) {
2753 BranchAndLinkShort(L, cond, rs, rt, bdslot); 2753 BranchAndLinkShort(L, cond, rs, rt, bdslot);
2754 } else { 2754 } else {
2755 Label skip; 2755 Label skip;
2756 Condition neg_cond = NegateCondition(cond); 2756 Condition neg_cond = NegateCondition(cond);
2757 BranchShort(&skip, neg_cond, rs, rt); 2757 BranchShort(&skip, neg_cond, rs, rt);
2758 J(L, bdslot); 2758 J(L, bdslot);
paul.l... 2015/08/01 17:02:22 This should be Jal(L, bdslot), was incorrect from
2759 bind(&skip); 2759 bind(&skip);
2760 } 2760 }
2761 } else { 2761 } else {
2762 if (is_trampoline_emitted()) { 2762 if (is_trampoline_emitted()) {
2763 Label skip; 2763 Label skip;
2764 Condition neg_cond = NegateCondition(cond); 2764 Condition neg_cond = NegateCondition(cond);
2765 BranchShort(&skip, neg_cond, rs, rt); 2765 BranchShort(&skip, neg_cond, rs, rt);
2766 Jal(L, bdslot); 2766 Jal(L, bdslot);
2767 bind(&skip); 2767 bind(&skip);
2768 } else { 2768 } else {
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
3186 void MacroAssembler::Ret(Condition cond, 3186 void MacroAssembler::Ret(Condition cond,
3187 Register rs, 3187 Register rs,
3188 const Operand& rt, 3188 const Operand& rt,
3189 BranchDelaySlot bd) { 3189 BranchDelaySlot bd) {
3190 Jump(ra, cond, rs, rt, bd); 3190 Jump(ra, cond, rs, rt, bd);
3191 } 3191 }
3192 3192
3193 3193
3194 void MacroAssembler::J(Label* L, BranchDelaySlot bdslot) { 3194 void MacroAssembler::J(Label* L, BranchDelaySlot bdslot) {
3195 BlockTrampolinePoolScope block_trampoline_pool(this); 3195 BlockTrampolinePoolScope block_trampoline_pool(this);
3196
3197 uint64_t imm28;
3198 imm28 = jump_address(L);
3199 { 3196 {
3200 BlockGrowBufferScope block_buf_growth(this); 3197 BlockGrowBufferScope block_buf_growth(this);
3201 // Buffer growth (and relocation) must be blocked for internal references 3198 // Buffer growth (and relocation) must be blocked for internal references
3202 // until associated instructions are emitted and available to be patched. 3199 // until associated instructions are emitted and available to be patched.
3203 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); 3200 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED);
3204 j(imm28); 3201 j(L);
3205 } 3202 }
3206 // Emit a nop in the branch delay slot if required. 3203 // Emit a nop in the branch delay slot if required.
3207 if (bdslot == PROTECT) nop(); 3204 if (bdslot == PROTECT) nop();
3208 } 3205 }
3209 3206
3210 3207
3211 void MacroAssembler::Jal(Label* L, BranchDelaySlot bdslot) { 3208 void MacroAssembler::Jal(Label* L, BranchDelaySlot bdslot) {
3212 BlockTrampolinePoolScope block_trampoline_pool(this); 3209 BlockTrampolinePoolScope block_trampoline_pool(this);
3213
3214 uint64_t imm28;
3215 imm28 = jump_address(L);
3216 { 3210 {
3217 BlockGrowBufferScope block_buf_growth(this); 3211 BlockGrowBufferScope block_buf_growth(this);
3218 // Buffer growth (and relocation) must be blocked for internal references 3212 // Buffer growth (and relocation) must be blocked for internal references
3219 // until associated instructions are emitted and available to be patched. 3213 // until associated instructions are emitted and available to be patched.
3220 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED); 3214 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE_ENCODED);
3221 jal(imm28); 3215 jal(L);
3222 } 3216 }
3223 // Emit a nop in the branch delay slot if required. 3217 // Emit a nop in the branch delay slot if required.
3224 if (bdslot == PROTECT) nop(); 3218 if (bdslot == PROTECT) nop();
3225 } 3219 }
3226 3220
3227 3221
3228 void MacroAssembler::Jr(Label* L, BranchDelaySlot bdslot) { 3222 void MacroAssembler::Jr(Label* L, BranchDelaySlot bdslot) {
3229 BlockTrampolinePoolScope block_trampoline_pool(this); 3223 BlockTrampolinePoolScope block_trampoline_pool(this);
3230 3224
3231 uint64_t imm64; 3225 uint64_t imm64;
(...skipping 3113 matching lines...) Expand 10 before | Expand all | Expand 10 after
6345 if (mag.shift > 0) sra(result, result, mag.shift); 6339 if (mag.shift > 0) sra(result, result, mag.shift);
6346 srl(at, dividend, 31); 6340 srl(at, dividend, 31);
6347 Addu(result, result, Operand(at)); 6341 Addu(result, result, Operand(at));
6348 } 6342 }
6349 6343
6350 6344
6351 } // namespace internal 6345 } // namespace internal
6352 } // namespace v8 6346 } // namespace v8
6353 6347
6354 #endif // V8_TARGET_ARCH_MIPS64 6348 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« src/mips64/assembler-mips64.cc ('K') | « src/mips64/constants-mips64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698