Commit 9af578a7 authored by balazs.kilvady's avatar balazs.kilvady Committed by Commit bot

MIPS64: Enable shorten-64-to-32 warning.

Port cdc43bc5

Original commit message:
Enable clang's shorten-64-to-32 warning flag on ARM64, and fix the warnings
that arise.

BUG=

Review URL: https://codereview.chromium.org/1133163005

Cr-Commit-Position: refs/heads/master@{#28990}
parent dd96c47a
...@@ -473,7 +473,8 @@ ...@@ -473,7 +473,8 @@
], ],
'ldflags': [ '-pthread', ], 'ldflags': [ '-pthread', ],
'conditions': [ 'conditions': [
[ 'clang==1 and (v8_target_arch=="x64" or v8_target_arch=="arm64")', { [ 'clang==1 and (v8_target_arch=="x64" or v8_target_arch=="arm64" \
or v8_target_arch=="mips64el")', {
'cflags': [ '-Wshorten-64-to-32' ], 'cflags': [ '-Wshorten-64-to-32' ],
}], }],
[ 'host_arch=="ppc64" and OS!="aix"', { [ 'host_arch=="ppc64" and OS!="aix"', {
...@@ -657,6 +658,12 @@ ...@@ -657,6 +658,12 @@
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x', # -std=gnu++0x 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x', # -std=gnu++0x
}, },
'conditions': [
['v8_target_arch=="x64" or v8_target_arch=="arm64" \
or v8_target_arch=="mips64el"', {
'xcode_settings': {'WARNING_CFLAGS': ['-Wshorten-64-to-32']},
}],
]
}], }],
], ],
'target_conditions': [ 'target_conditions': [
......
...@@ -111,7 +111,7 @@ TimeDelta TimeDelta::FromMachTimespec(struct mach_timespec ts) { ...@@ -111,7 +111,7 @@ TimeDelta TimeDelta::FromMachTimespec(struct mach_timespec ts) {
struct mach_timespec TimeDelta::ToMachTimespec() const { struct mach_timespec TimeDelta::ToMachTimespec() const {
struct mach_timespec ts; struct mach_timespec ts;
DCHECK(delta_ >= 0); DCHECK(delta_ >= 0);
ts.tv_sec = delta_ / Time::kMicrosecondsPerSecond; ts.tv_sec = static_cast<unsigned>(delta_ / Time::kMicrosecondsPerSecond);
ts.tv_nsec = (delta_ % Time::kMicrosecondsPerSecond) * ts.tv_nsec = (delta_ % Time::kMicrosecondsPerSecond) *
Time::kNanosecondsPerMicrosecond; Time::kNanosecondsPerMicrosecond;
return ts; return ts;
......
...@@ -310,7 +310,7 @@ FPUCondition FlagsConditionToConditionCmpD(bool& predicate, ...@@ -310,7 +310,7 @@ FPUCondition FlagsConditionToConditionCmpD(bool& predicate,
__ Daddu(at, i.InputRegister(2), offset); \ __ Daddu(at, i.InputRegister(2), offset); \
__ asm_instr(result, MemOperand(at, 0)); \ __ asm_instr(result, MemOperand(at, 0)); \
} else { \ } else { \
auto offset = i.InputOperand(0).immediate(); \ int offset = static_cast<int>(i.InputOperand(0).immediate()); \
__ Branch(ool->entry(), ls, i.InputRegister(1), Operand(offset)); \ __ Branch(ool->entry(), ls, i.InputRegister(1), Operand(offset)); \
__ asm_instr(result, MemOperand(i.InputRegister(2), offset)); \ __ asm_instr(result, MemOperand(i.InputRegister(2), offset)); \
} \ } \
...@@ -328,7 +328,7 @@ FPUCondition FlagsConditionToConditionCmpD(bool& predicate, ...@@ -328,7 +328,7 @@ FPUCondition FlagsConditionToConditionCmpD(bool& predicate,
__ Daddu(at, i.InputRegister(2), offset); \ __ Daddu(at, i.InputRegister(2), offset); \
__ asm_instr(result, MemOperand(at, 0)); \ __ asm_instr(result, MemOperand(at, 0)); \
} else { \ } else { \
auto offset = i.InputOperand(0).immediate(); \ int offset = static_cast<int>(i.InputOperand(0).immediate()); \
__ Branch(ool->entry(), ls, i.InputRegister(1), Operand(offset)); \ __ Branch(ool->entry(), ls, i.InputRegister(1), Operand(offset)); \
__ asm_instr(result, MemOperand(i.InputRegister(2), offset)); \ __ asm_instr(result, MemOperand(i.InputRegister(2), offset)); \
} \ } \
...@@ -346,7 +346,7 @@ FPUCondition FlagsConditionToConditionCmpD(bool& predicate, ...@@ -346,7 +346,7 @@ FPUCondition FlagsConditionToConditionCmpD(bool& predicate,
__ Daddu(at, i.InputRegister(3), offset); \ __ Daddu(at, i.InputRegister(3), offset); \
__ asm_instr(value, MemOperand(at, 0)); \ __ asm_instr(value, MemOperand(at, 0)); \
} else { \ } else { \
auto offset = i.InputOperand(0).immediate(); \ int offset = static_cast<int>(i.InputOperand(0).immediate()); \
auto value = i.Input##width##Register(2); \ auto value = i.Input##width##Register(2); \
__ Branch(&done, ls, i.InputRegister(1), Operand(offset)); \ __ Branch(&done, ls, i.InputRegister(1), Operand(offset)); \
__ asm_instr(value, MemOperand(i.InputRegister(3), offset)); \ __ asm_instr(value, MemOperand(i.InputRegister(3), offset)); \
...@@ -365,7 +365,7 @@ FPUCondition FlagsConditionToConditionCmpD(bool& predicate, ...@@ -365,7 +365,7 @@ FPUCondition FlagsConditionToConditionCmpD(bool& predicate,
__ Daddu(at, i.InputRegister(3), offset); \ __ Daddu(at, i.InputRegister(3), offset); \
__ asm_instr(value, MemOperand(at, 0)); \ __ asm_instr(value, MemOperand(at, 0)); \
} else { \ } else { \
auto offset = i.InputOperand(0).immediate(); \ int offset = static_cast<int>(i.InputOperand(0).immediate()); \
auto value = i.InputRegister(2); \ auto value = i.InputRegister(2); \
__ Branch(&done, ls, i.InputRegister(1), Operand(offset)); \ __ Branch(&done, ls, i.InputRegister(1), Operand(offset)); \
__ asm_instr(value, MemOperand(i.InputRegister(3), offset)); \ __ asm_instr(value, MemOperand(i.InputRegister(3), offset)); \
...@@ -559,24 +559,27 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { ...@@ -559,24 +559,27 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
if (instr->InputAt(1)->IsRegister()) { if (instr->InputAt(1)->IsRegister()) {
__ sllv(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); __ sllv(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1));
} else { } else {
int32_t imm = i.InputOperand(1).immediate(); int64_t imm = i.InputOperand(1).immediate();
__ sll(i.OutputRegister(), i.InputRegister(0), imm); __ sll(i.OutputRegister(), i.InputRegister(0),
static_cast<uint16_t>(imm));
} }
break; break;
case kMips64Shr: case kMips64Shr:
if (instr->InputAt(1)->IsRegister()) { if (instr->InputAt(1)->IsRegister()) {
__ srlv(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); __ srlv(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1));
} else { } else {
int32_t imm = i.InputOperand(1).immediate(); int64_t imm = i.InputOperand(1).immediate();
__ srl(i.OutputRegister(), i.InputRegister(0), imm); __ srl(i.OutputRegister(), i.InputRegister(0),
static_cast<uint16_t>(imm));
} }
break; break;
case kMips64Sar: case kMips64Sar:
if (instr->InputAt(1)->IsRegister()) { if (instr->InputAt(1)->IsRegister()) {
__ srav(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); __ srav(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1));
} else { } else {
int32_t imm = i.InputOperand(1).immediate(); int64_t imm = i.InputOperand(1).immediate();
__ sra(i.OutputRegister(), i.InputRegister(0), imm); __ sra(i.OutputRegister(), i.InputRegister(0),
static_cast<uint16_t>(imm));
} }
break; break;
case kMips64Ext: case kMips64Ext:
...@@ -591,11 +594,13 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { ...@@ -591,11 +594,13 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
if (instr->InputAt(1)->IsRegister()) { if (instr->InputAt(1)->IsRegister()) {
__ dsllv(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); __ dsllv(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1));
} else { } else {
int32_t imm = i.InputOperand(1).immediate(); int64_t imm = i.InputOperand(1).immediate();
if (imm < 32) { if (imm < 32) {
__ dsll(i.OutputRegister(), i.InputRegister(0), imm); __ dsll(i.OutputRegister(), i.InputRegister(0),
static_cast<uint16_t>(imm));
} else { } else {
__ dsll32(i.OutputRegister(), i.InputRegister(0), imm - 32); __ dsll32(i.OutputRegister(), i.InputRegister(0),
static_cast<uint16_t>(imm - 32));
} }
} }
break; break;
...@@ -603,11 +608,13 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { ...@@ -603,11 +608,13 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
if (instr->InputAt(1)->IsRegister()) { if (instr->InputAt(1)->IsRegister()) {
__ dsrlv(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); __ dsrlv(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1));
} else { } else {
int32_t imm = i.InputOperand(1).immediate(); int64_t imm = i.InputOperand(1).immediate();
if (imm < 32) { if (imm < 32) {
__ dsrl(i.OutputRegister(), i.InputRegister(0), imm); __ dsrl(i.OutputRegister(), i.InputRegister(0),
static_cast<uint16_t>(imm));
} else { } else {
__ dsrl32(i.OutputRegister(), i.InputRegister(0), imm - 32); __ dsrl32(i.OutputRegister(), i.InputRegister(0),
static_cast<uint16_t>(imm - 32));
} }
} }
break; break;
...@@ -615,7 +622,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { ...@@ -615,7 +622,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
if (instr->InputAt(1)->IsRegister()) { if (instr->InputAt(1)->IsRegister()) {
__ dsrav(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); __ dsrav(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1));
} else { } else {
int32_t imm = i.InputOperand(1).immediate(); int64_t imm = i.InputOperand(1).immediate();
if (imm < 32) { if (imm < 32) {
__ dsra(i.OutputRegister(), i.InputRegister(0), imm); __ dsra(i.OutputRegister(), i.InputRegister(0), imm);
} else { } else {
...@@ -1096,7 +1103,7 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) { ...@@ -1096,7 +1103,7 @@ void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) {
Label here; Label here;
__ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count));
__ BlockTrampolinePoolFor(case_count * 2 + 7); __ BlockTrampolinePoolFor(static_cast<int>(case_count) * 2 + 7);
// Ensure that dd-ed labels use 8 byte aligned addresses. // Ensure that dd-ed labels use 8 byte aligned addresses.
if ((masm()->pc_offset() & 7) != 0) { if ((masm()->pc_offset() & 7) != 0) {
__ nop(); __ nop();
......
...@@ -393,7 +393,7 @@ void InstructionSelector::VisitInt64Mul(Node* node) { ...@@ -393,7 +393,7 @@ void InstructionSelector::VisitInt64Mul(Node* node) {
Int64BinopMatcher m(node); Int64BinopMatcher m(node);
// TODO(dusmil): Add optimization for shifts larger than 32. // TODO(dusmil): Add optimization for shifts larger than 32.
if (m.right().HasValue() && m.right().Value() > 0) { if (m.right().HasValue() && m.right().Value() > 0) {
int64_t value = m.right().Value(); int32_t value = static_cast<int32_t>(m.right().Value());
if (base::bits::IsPowerOfTwo32(value)) { if (base::bits::IsPowerOfTwo32(value)) {
Emit(kMips64Dshl | AddressingModeField::encode(kMode_None), Emit(kMips64Dshl | AddressingModeField::encode(kMode_None),
g.DefineAsRegister(node), g.UseRegister(m.left().node()), g.DefineAsRegister(node), g.UseRegister(m.left().node()),
...@@ -666,8 +666,8 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { ...@@ -666,8 +666,8 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
FrameStateDescriptor* frame_state_descriptor = nullptr; FrameStateDescriptor* frame_state_descriptor = nullptr;
if (descriptor->NeedsFrameState()) { if (descriptor->NeedsFrameState()) {
frame_state_descriptor = frame_state_descriptor = GetFrameStateDescriptor(
GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); node->InputAt(static_cast<int>(descriptor->InputCount())));
} }
CallBuffer buffer(zone(), descriptor, frame_state_descriptor); CallBuffer buffer(zone(), descriptor, frame_state_descriptor);
...@@ -675,12 +675,12 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { ...@@ -675,12 +675,12 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
// Compute InstructionOperands for inputs and outputs. // Compute InstructionOperands for inputs and outputs.
InitializeCallBuffer(node, &buffer, true, false); InitializeCallBuffer(node, &buffer, true, false);
int push_count = buffer.pushed_nodes.size(); const int32_t push_count = static_cast<int32_t>(buffer.pushed_nodes.size());
if (push_count > 0) { if (push_count > 0) {
Emit(kMips64StackClaim, g.NoOutput(), Emit(kMips64StackClaim, g.NoOutput(),
g.TempImmediate(push_count << kPointerSizeLog2)); g.TempImmediate(push_count << kPointerSizeLog2));
} }
int slot = buffer.pushed_nodes.size() - 1; int32_t slot = push_count - 1;
for (Node* node : base::Reversed(buffer.pushed_nodes)) { for (Node* node : base::Reversed(buffer.pushed_nodes)) {
Emit(kMips64StoreToStackSlot, g.NoOutput(), g.UseRegister(node), Emit(kMips64StoreToStackSlot, g.NoOutput(), g.UseRegister(node),
g.TempImmediate(slot << kPointerSizeLog2)); g.TempImmediate(slot << kPointerSizeLog2));
...@@ -771,12 +771,12 @@ void InstructionSelector::VisitTailCall(Node* node) { ...@@ -771,12 +771,12 @@ void InstructionSelector::VisitTailCall(Node* node) {
// Compute InstructionOperands for inputs and outputs. // Compute InstructionOperands for inputs and outputs.
InitializeCallBuffer(node, &buffer, true, false); InitializeCallBuffer(node, &buffer, true, false);
int push_count = buffer.pushed_nodes.size(); const int32_t push_count = static_cast<int32_t>(buffer.pushed_nodes.size());
if (push_count > 0) { if (push_count > 0) {
Emit(kMips64StackClaim, g.NoOutput(), Emit(kMips64StackClaim, g.NoOutput(),
g.TempImmediate(push_count << kPointerSizeLog2)); g.TempImmediate(push_count << kPointerSizeLog2));
} }
int slot = buffer.pushed_nodes.size() - 1; int slot = push_count - 1;
for (Node* node : base::Reversed(buffer.pushed_nodes)) { for (Node* node : base::Reversed(buffer.pushed_nodes)) {
Emit(kMips64StoreToStackSlot, g.NoOutput(), g.UseRegister(node), Emit(kMips64StoreToStackSlot, g.NoOutput(), g.UseRegister(node),
g.TempImmediate(slot << kPointerSizeLog2)); g.TempImmediate(slot << kPointerSizeLog2));
......
...@@ -57,14 +57,16 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm, ...@@ -57,14 +57,16 @@ static void ProbeTable(Isolate* isolate, MacroAssembler* masm,
__ Branch(&miss, ne, name, Operand(at)); __ Branch(&miss, ne, name, Operand(at));
// Check the map matches. // Check the map matches.
__ ld(at, MemOperand(base_addr, map_off_addr - key_off_addr)); __ ld(at, MemOperand(base_addr,
static_cast<int32_t>(map_off_addr - key_off_addr)));
__ ld(scratch2, FieldMemOperand(receiver, HeapObject::kMapOffset)); __ ld(scratch2, FieldMemOperand(receiver, HeapObject::kMapOffset));
__ Branch(&miss, ne, at, Operand(scratch2)); __ Branch(&miss, ne, at, Operand(scratch2));
// Get the code entry from the cache. // Get the code entry from the cache.
Register code = scratch2; Register code = scratch2;
scratch2 = no_reg; scratch2 = no_reg;
__ ld(code, MemOperand(base_addr, value_off_addr - key_off_addr)); __ ld(code, MemOperand(base_addr,
static_cast<int32_t>(value_off_addr - key_off_addr)));
// Check that the flags match what we're looking for. // Check that the flags match what we're looking for.
Register flags_reg = base_addr; Register flags_reg = base_addr;
......
...@@ -211,13 +211,14 @@ Operand::Operand(Handle<Object> handle) { ...@@ -211,13 +211,14 @@ Operand::Operand(Handle<Object> handle) {
} }
MemOperand::MemOperand(Register rm, int64_t offset) : Operand(rm) { MemOperand::MemOperand(Register rm, int32_t offset) : Operand(rm) {
offset_ = offset; offset_ = offset;
} }
MemOperand::MemOperand(Register rm, int64_t unit, int64_t multiplier, MemOperand::MemOperand(Register rm, int32_t unit, int32_t multiplier,
OffsetAddend offset_addend) : Operand(rm) { OffsetAddend offset_addend)
: Operand(rm) {
offset_ = unit * multiplier + offset_addend; offset_ = unit * multiplier + offset_addend;
} }
...@@ -290,7 +291,8 @@ void Assembler::GetCode(CodeDesc* desc) { ...@@ -290,7 +291,8 @@ void Assembler::GetCode(CodeDesc* desc) {
desc->buffer = buffer_; desc->buffer = buffer_;
desc->buffer_size = buffer_size_; desc->buffer_size = buffer_size_;
desc->instr_size = pc_offset(); desc->instr_size = pc_offset();
desc->reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); desc->reloc_size =
static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer.pos());
desc->origin = this; desc->origin = this;
} }
...@@ -741,7 +743,7 @@ void Assembler::target_at_put(int pos, int target_pos, bool is_internal) { ...@@ -741,7 +743,7 @@ void Assembler::target_at_put(int pos, int target_pos, bool is_internal) {
DCHECK((imm28 & 3) == 0); DCHECK((imm28 & 3) == 0);
instr &= ~kImm26Mask; instr &= ~kImm26Mask;
uint32_t imm26 = imm28 >> 2; uint32_t imm26 = static_cast<uint32_t>(imm28 >> 2);
DCHECK(is_uint26(imm26)); DCHECK(is_uint26(imm26));
instr_at_put(pos, instr | (imm26 & kImm26Mask)); instr_at_put(pos, instr | (imm26 & kImm26Mask));
...@@ -1385,7 +1387,7 @@ void Assembler::j(int64_t target) { ...@@ -1385,7 +1387,7 @@ void Assembler::j(int64_t target) {
DCHECK(in_range && ((target & 3) == 0)); DCHECK(in_range && ((target & 3) == 0));
} }
#endif #endif
GenInstrJump(J, (target >> 2) & kImm26Mask); GenInstrJump(J, static_cast<uint32_t>(target >> 2) & kImm26Mask);
} }
...@@ -1414,7 +1416,7 @@ void Assembler::jal(int64_t target) { ...@@ -1414,7 +1416,7 @@ void Assembler::jal(int64_t target) {
} }
#endif #endif
positions_recorder()->WriteRecordedPositions(); positions_recorder()->WriteRecordedPositions();
GenInstrJump(JAL, (target >> 2) & kImm26Mask); GenInstrJump(JAL, static_cast<uint32_t>(target >> 2) & kImm26Mask);
} }
...@@ -2901,7 +2903,8 @@ void Assembler::GrowBuffer() { ...@@ -2901,7 +2903,8 @@ void Assembler::GrowBuffer() {
desc.buffer = NewArray<byte>(desc.buffer_size); desc.buffer = NewArray<byte>(desc.buffer_size);
desc.instr_size = pc_offset(); desc.instr_size = pc_offset();
desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); desc.reloc_size =
static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer.pos());
// Copy the data. // Copy the data.
intptr_t pc_delta = desc.buffer - buffer_; intptr_t pc_delta = desc.buffer - buffer_;
......
...@@ -404,8 +404,8 @@ class MemOperand : public Operand { ...@@ -404,8 +404,8 @@ class MemOperand : public Operand {
offset_zero = 0 offset_zero = 0
}; };
explicit MemOperand(Register rn, int64_t offset = 0); explicit MemOperand(Register rn, int32_t offset = 0);
explicit MemOperand(Register rn, int64_t unit, int64_t multiplier, explicit MemOperand(Register rn, int32_t unit, int32_t multiplier,
OffsetAddend offset_addend = offset_zero); OffsetAddend offset_addend = offset_zero);
int32_t offset() const { return offset_; } int32_t offset() const { return offset_; }
...@@ -1138,7 +1138,9 @@ class Assembler : public AssemblerBase { ...@@ -1138,7 +1138,9 @@ class Assembler : public AssemblerBase {
inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; } inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; }
// Get the number of bytes available in the buffer. // Get the number of bytes available in the buffer.
inline int available_space() const { return reloc_info_writer.pos() - pc_; } inline intptr_t available_space() const {
return reloc_info_writer.pos() - pc_;
}
// Read/patch instructions. // Read/patch instructions.
static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); }
......
...@@ -272,7 +272,7 @@ void Decoder::PrintXImm21(Instruction* instr) { ...@@ -272,7 +272,7 @@ void Decoder::PrintXImm21(Instruction* instr) {
// Print 26-bit immediate value. // Print 26-bit immediate value.
void Decoder::PrintXImm26(Instruction* instr) { void Decoder::PrintXImm26(Instruction* instr) {
uint32_t imm = instr->Imm26Value() << kImmFieldShift; uint32_t imm = static_cast<uint32_t>(instr->Imm26Value()) << kImmFieldShift;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm); out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "0x%x", imm);
} }
......
...@@ -489,7 +489,7 @@ int32_t LCodeGen::ToInteger32(LConstantOperand* op) const { ...@@ -489,7 +489,7 @@ int32_t LCodeGen::ToInteger32(LConstantOperand* op) const {
} }
int32_t LCodeGen::ToRepresentation_donotuse(LConstantOperand* op, int64_t LCodeGen::ToRepresentation_donotuse(LConstantOperand* op,
const Representation& r) const { const Representation& r) const {
HConstant* constant = chunk_->LookupConstant(op); HConstant* constant = chunk_->LookupConstant(op);
int32_t value = constant->Integer32Value(); int32_t value = constant->Integer32Value();
......
...@@ -75,7 +75,7 @@ class LCodeGen: public LCodeGenBase { ...@@ -75,7 +75,7 @@ class LCodeGen: public LCodeGenBase {
DoubleRegister EmitLoadDoubleRegister(LOperand* op, DoubleRegister EmitLoadDoubleRegister(LOperand* op,
FloatRegister flt_scratch, FloatRegister flt_scratch,
DoubleRegister dbl_scratch); DoubleRegister dbl_scratch);
int32_t ToRepresentation_donotuse(LConstantOperand* op, int64_t ToRepresentation_donotuse(LConstantOperand* op,
const Representation& r) const; const Representation& r) const;
int32_t ToInteger32(LConstantOperand* op) const; int32_t ToInteger32(LConstantOperand* op) const;
Smi* ToSmi(LConstantOperand* op) const; Smi* ToSmi(LConstantOperand* op) const;
......
This diff is collapsed.
This diff is collapsed.
...@@ -326,57 +326,55 @@ class Simulator { ...@@ -326,57 +326,55 @@ class Simulator {
inline int32_t SetDoubleLOW(double* addr); inline int32_t SetDoubleLOW(double* addr);
// functions called from DecodeTypeRegister // functions called from DecodeTypeRegister
void DecodeTypeRegisterCOP1(Instruction* instr, const int32_t& rs_reg, void DecodeTypeRegisterCOP1(Instruction* instr, const int32_t rs_reg,
const int64_t& rs, const uint64_t& rs_u, const int64_t rs, const uint64_t rs_u,
const int32_t& rt_reg, const int64_t& rt, const int32_t rt_reg, const int64_t rt,
const uint64_t& rt_u, const int32_t& rd_reg, const uint64_t rt_u, const int32_t rd_reg,
const int32_t& fr_reg, const int32_t& fs_reg, const int32_t fr_reg, const int32_t fs_reg,
const int32_t& ft_reg, const int32_t& fd_reg, const int32_t ft_reg, const int32_t fd_reg,
int64_t& alu_out); int64_t& alu_out);
void DecodeTypeRegisterCOP1X(Instruction* instr, const int32_t& fr_reg, void DecodeTypeRegisterCOP1X(Instruction* instr, const int32_t fr_reg,
const int32_t& fs_reg, const int32_t& ft_reg, const int32_t fs_reg, const int32_t ft_reg,
const int32_t& fd_reg); const int32_t fd_reg);
void DecodeTypeRegisterSPECIAL( void DecodeTypeRegisterSPECIAL(
Instruction* instr, const int64_t& rs_reg, const int64_t& rs, Instruction* instr, const int32_t rs_reg, const int64_t rs,
const uint64_t& rs_u, const int64_t& rt_reg, const int64_t& rt, const uint64_t rs_u, const int32_t rt_reg, const int64_t rt,
const uint64_t& rt_u, const int64_t& rd_reg, const int32_t& fr_reg, const uint64_t rt_u, const int32_t rd_reg, const int32_t fr_reg,
const int32_t& fs_reg, const int32_t& ft_reg, const int64_t& fd_reg, const int32_t fs_reg, const int32_t ft_reg, const int32_t fd_reg,
int64_t& i64hilo, uint64_t& u64hilo, int64_t& alu_out, bool& do_interrupt, const int64_t i64hilo, const uint64_t u64hilo, const int64_t alu_out,
int64_t& current_pc, int64_t& next_pc, int64_t& return_addr_reg, const bool do_interrupt, const int64_t current_pc, const int64_t next_pc,
int64_t& i128resultH, int64_t& i128resultL); const int32_t return_addr_reg, const int64_t i128resultH,
const int64_t i128resultL);
void DecodeTypeRegisterSPECIAL2(Instruction* instr, const int64_t& rd_reg,
int64_t& alu_out);
void DecodeTypeRegisterSPECIAL3(Instruction* instr, const int64_t& rt_reg, void DecodeTypeRegisterSPECIAL2(Instruction* instr, const int32_t rd_reg,
const int64_t& rd_reg, int64_t& alu_out); const int64_t alu_out);
void DecodeTypeRegisterSRsType(Instruction* instr, const int32_t& fs_reg, void DecodeTypeRegisterSPECIAL3(Instruction* instr, const int32_t rt_reg,
const int32_t& ft_reg, const int32_t& fd_reg); const int32_t rd_reg, const int64_t alu_out);
void DecodeTypeRegisterDRsType(Instruction* instr, const int32_t& fs_reg, void DecodeTypeRegisterSRsType(Instruction* instr, const int32_t fs_reg,
const int32_t& ft_reg, const int32_t& fd_reg); const int32_t ft_reg, const int32_t fd_reg);
void DecodeTypeRegisterWRsType(Instruction* instr, const int32_t& fs_reg, void DecodeTypeRegisterDRsType(Instruction* instr, const int32_t fs_reg,
const int32_t& ft_reg, const int32_t& fd_reg, const int32_t ft_reg, const int32_t fd_reg);
void DecodeTypeRegisterWRsType(Instruction* instr, const int32_t fs_reg,
const int32_t ft_reg, const int32_t fd_reg,
int64_t& alu_out); int64_t& alu_out);
void DecodeTypeRegisterLRsType(Instruction* instr, const int32_t& fs_reg, void DecodeTypeRegisterLRsType(Instruction* instr, const int32_t fs_reg,
const int32_t& fd_reg, const int32_t& ft_reg); const int32_t fd_reg, const int32_t ft_reg);
// Executing is handled based on the instruction type. // Executing is handled based on the instruction type.
void DecodeTypeRegister(Instruction* instr); void DecodeTypeRegister(Instruction* instr);
// Helper function for DecodeTypeRegister. // Helper function for DecodeTypeRegister.
void ConfigureTypeRegister(Instruction* instr, void ConfigureTypeRegister(Instruction* instr, int64_t* alu_out,
int64_t* alu_out, int64_t* i64hilo, uint64_t* u64hilo,
int64_t* i64hilo, int64_t* next_pc, int* return_addr_reg,
uint64_t* u64hilo, bool* do_interrupt, int64_t* result128H,
int64_t* next_pc,
int64_t* return_addr_reg,
bool* do_interrupt,
int64_t* result128H,
int64_t* result128L); int64_t* result128L);
void DecodeTypeImmediate(Instruction* instr); void DecodeTypeImmediate(Instruction* instr);
...@@ -418,7 +416,7 @@ class Simulator { ...@@ -418,7 +416,7 @@ class Simulator {
// ICache. // ICache.
static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr); static void CheckICache(v8::internal::HashMap* i_cache, Instruction* instr);
static void FlushOnePage(v8::internal::HashMap* i_cache, intptr_t start, static void FlushOnePage(v8::internal::HashMap* i_cache, intptr_t start,
int size); size_t size);
static CachePage* GetCachePage(v8::internal::HashMap* i_cache, void* page); static CachePage* GetCachePage(v8::internal::HashMap* i_cache, void* page);
enum Exception { enum Exception {
...@@ -498,12 +496,14 @@ class Simulator { ...@@ -498,12 +496,14 @@ class Simulator {
#ifdef MIPS_ABI_N64 #ifdef MIPS_ABI_N64
#define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
Simulator::current(Isolate::Current())->Call( \ static_cast<int>( \
entry, 10, p0, p1, p2, p3, p4, p5, p6, p7, NULL, p8) Simulator::current(Isolate::Current()) \
->Call(entry, 10, p0, p1, p2, p3, p4, p5, p6, p7, NULL, p8))
#else // Must be O32 Abi. #else // Must be O32 Abi.
#define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
Simulator::current(Isolate::Current())->Call( \ static_cast<int>( \
entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8) Simulator::current(Isolate::Current()) \
->Call(entry, 10, p0, p1, p2, p3, NULL, p4, p5, p6, p7, p8))
#endif // MIPS_ABI_N64 #endif // MIPS_ABI_N64
......
...@@ -3121,8 +3121,9 @@ TEST(jump_tables1) { ...@@ -3121,8 +3121,9 @@ TEST(jump_tables1) {
#endif #endif
F1 f = FUNCTION_CAST<F1>(code->entry()); F1 f = FUNCTION_CAST<F1>(code->entry());
for (int i = 0; i < kNumCases; ++i) { for (int i = 0; i < kNumCases; ++i) {
int res = reinterpret_cast<int64_t>(CALL_GENERATED_CODE(f, i, 0, 0, 0, 0)); int64_t res = reinterpret_cast<int64_t>(
::printf("f(%d) = %d\n", i, res); CALL_GENERATED_CODE(f, i, 0, 0, 0, 0));
::printf("f(%d) = %" PRId64 "\n", i, res);
CHECK_EQ(values[i], static_cast<int>(res)); CHECK_EQ(values[i], static_cast<int>(res));
} }
} }
...@@ -3192,8 +3193,9 @@ TEST(jump_tables2) { ...@@ -3192,8 +3193,9 @@ TEST(jump_tables2) {
#endif #endif
F1 f = FUNCTION_CAST<F1>(code->entry()); F1 f = FUNCTION_CAST<F1>(code->entry());
for (int i = 0; i < kNumCases; ++i) { for (int i = 0; i < kNumCases; ++i) {
int res = reinterpret_cast<int64_t>(CALL_GENERATED_CODE(f, i, 0, 0, 0, 0)); int64_t res = reinterpret_cast<int64_t>(
::printf("f(%d) = %d\n", i, res); CALL_GENERATED_CODE(f, i, 0, 0, 0, 0));
::printf("f(%d) = %" PRId64 "\n", i, res);
CHECK_EQ(values[i], res); CHECK_EQ(values[i], res);
} }
} }
......
...@@ -144,7 +144,8 @@ int32_t RunGeneratedCodeCallWrapper(ConvertDToIFunc func, ...@@ -144,7 +144,8 @@ int32_t RunGeneratedCodeCallWrapper(ConvertDToIFunc func,
double from) { double from) {
#ifdef USE_SIMULATOR #ifdef USE_SIMULATOR
Simulator::current(Isolate::Current())->CallFP(FUNCTION_ADDR(func), from, 0.); Simulator::current(Isolate::Current())->CallFP(FUNCTION_ADDR(func), from, 0.);
return Simulator::current(Isolate::Current())->get_register(v0.code()); return static_cast<int32_t>(
Simulator::current(Isolate::Current())->get_register(v0.code()));
#else #else
return (*func)(from); return (*func)(from);
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment