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

Unified Diff: src/mips64/assembler-mips64.cc

Issue 942123002: MIPS: Fix label position types in binding code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/assembler-mips64.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/assembler-mips64.cc
diff --git a/src/mips64/assembler-mips64.cc b/src/mips64/assembler-mips64.cc
index 4ce970da332c9e3a2a6ff0fbed5fedef7209a1c3..9fdcf759449fe1158db28097bbb495a8bd696713 100644
--- a/src/mips64/assembler-mips64.cc
+++ b/src/mips64/assembler-mips64.cc
@@ -32,7 +32,6 @@
// modified significantly by Google Inc.
// Copyright 2012 the V8 project authors. All rights reserved.
-
#include "src/v8.h"
#if V8_TARGET_ARCH_MIPS64
@@ -635,7 +634,7 @@ bool Assembler::IsAndImmediate(Instr instr) {
}
-int64_t Assembler::target_at(int64_t pos, bool is_internal) {
+int Assembler::target_at(int pos, bool is_internal) {
if (is_internal) {
int64_t* p = reinterpret_cast<int64_t*>(buffer_ + pos);
int64_t address = *p;
@@ -643,7 +642,8 @@ int64_t Assembler::target_at(int64_t pos, bool is_internal) {
return kEndOfChain;
} else {
int64_t instr_address = reinterpret_cast<int64_t>(p);
- int64_t delta = instr_address - address;
+ DCHECK(instr_address - address < INT_MAX);
+ int delta = static_cast<int>(instr_address - address);
DCHECK(pos > delta);
return pos - delta;
}
@@ -689,7 +689,8 @@ int64_t Assembler::target_at(int64_t pos, bool is_internal) {
return kEndOfChain;
} else {
uint64_t instr_address = reinterpret_cast<int64_t>(buffer_ + pos);
- int64_t delta = instr_address - imm;
+ DCHECK(instr_address - imm < INT_MAX);
+ int delta = static_cast<int>(instr_address - imm);
DCHECK(pos > delta);
return pos - delta;
}
@@ -701,7 +702,7 @@ int64_t Assembler::target_at(int64_t pos, bool is_internal) {
} else {
uint64_t instr_address = reinterpret_cast<int64_t>(buffer_ + pos);
instr_address &= kImm28Mask;
- int64_t delta = instr_address - imm28;
+ int delta = static_cast<int>(instr_address - imm28);
DCHECK(pos > delta);
return pos - delta;
}
@@ -709,8 +710,7 @@ int64_t Assembler::target_at(int64_t pos, bool is_internal) {
}
-void Assembler::target_at_put(int64_t pos, int64_t target_pos,
- bool is_internal) {
+void Assembler::target_at_put(int pos, int target_pos, bool is_internal) {
if (is_internal) {
uint64_t imm = reinterpret_cast<uint64_t>(buffer_) + target_pos;
*reinterpret_cast<uint64_t*>(buffer_ + pos) = imm;
@@ -796,7 +796,7 @@ void Assembler::print(Label* L) {
void Assembler::bind_to(Label* L, int pos) {
DCHECK(0 <= pos && pos <= pc_offset()); // Must have valid binding position.
- int32_t trampoline_pos = kInvalidSlotPos;
+ int trampoline_pos = kInvalidSlotPos;
bool is_internal = false;
if (L->is_linked() && !trampoline_emitted_) {
unbound_labels_count_--;
@@ -804,8 +804,8 @@ void Assembler::bind_to(Label* L, int pos) {
}
while (L->is_linked()) {
- int32_t fixup_pos = L->pos();
- int32_t dist = pos - fixup_pos;
+ int fixup_pos = L->pos();
+ int dist = pos - fixup_pos;
is_internal = internal_reference_positions_.find(fixup_pos) !=
internal_reference_positions_.end();
next(L, is_internal); // Call next before overwriting link with target at
« no previous file with comments | « src/mips64/assembler-mips64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698