Skip to content
This repository has been archived by the owner on Mar 25, 2018. It is now read-only.

Commit

Permalink
Merged: s390: fix overflowing offset in std and ld
Browse files Browse the repository at this point in the history
Revision: c7ebb14

NOTRY=true
NOPRESUBMIT=true
NOTREECHECKS=true
R=bjaideep@ca.ibm.com, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review-Url: https://codereview.chromium.org/2504483003
Cr-Commit-Position: refs/branch-heads/5.5@{v8#46}
Cr-Branched-From: 3cbd583-refs/heads/5.5.372@{#1}
Cr-Branched-From: b3c8b0c-refs/heads/master@{#40015}
  • Loading branch information
jyan authored and Commit bot committed Nov 15, 2016
1 parent 44a050c commit e7f072b
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions src/crankshaft/s390/lithium-codegen-s390.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ void LCodeGen::SaveCallerDoubles() {
BitVector* doubles = chunk()->allocated_double_registers();
BitVector::Iterator save_iterator(doubles);
while (!save_iterator.Done()) {
__ std(DoubleRegister::from_code(save_iterator.Current()),
MemOperand(sp, count * kDoubleSize));
__ StoreDouble(DoubleRegister::from_code(save_iterator.Current()),
MemOperand(sp, count * kDoubleSize));
save_iterator.Advance();
count++;
}
Expand All @@ -81,8 +81,8 @@ void LCodeGen::RestoreCallerDoubles() {
BitVector::Iterator save_iterator(doubles);
int count = 0;
while (!save_iterator.Done()) {
__ ld(DoubleRegister::from_code(save_iterator.Current()),
MemOperand(sp, count * kDoubleSize));
__ LoadDouble(DoubleRegister::from_code(save_iterator.Current()),
MemOperand(sp, count * kDoubleSize));
save_iterator.Advance();
count++;
}
Expand Down Expand Up @@ -2089,7 +2089,8 @@ void LCodeGen::DoBranch(LBranch* instr) {
EmitBranch(instr, al);
} else if (type.IsHeapNumber()) {
DCHECK(!info()->IsStub());
__ ld(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset));
__ LoadDouble(dbl_scratch,
FieldMemOperand(reg, HeapNumber::kValueOffset));
// Test the double value. Zero and NaN are false.
__ lzdr(kDoubleRegZero);
__ cdbr(dbl_scratch, kDoubleRegZero);
Expand Down Expand Up @@ -2726,7 +2727,7 @@ void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
if (instr->hydrogen()->representation().IsDouble()) {
DCHECK(access.IsInobject());
DoubleRegister result = ToDoubleRegister(instr->result());
__ ld(result, FieldMemOperand(object, offset));
__ LoadDouble(result, FieldMemOperand(object, offset));
return;
}

Expand Down Expand Up @@ -2876,9 +2877,10 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
}
} else { // i.e. elements_kind == EXTERNAL_DOUBLE_ELEMENTS
if (!use_scratch) {
__ ld(result, MemOperand(external_pointer, base_offset));
__ LoadDouble(result, MemOperand(external_pointer, base_offset));
} else {
__ ld(result, MemOperand(scratch0(), external_pointer, base_offset));
__ LoadDouble(result,
MemOperand(scratch0(), external_pointer, base_offset));
}
}
} else {
Expand Down Expand Up @@ -2973,9 +2975,9 @@ void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) {
}

if (!use_scratch) {
__ ld(result, MemOperand(elements, base_offset));
__ LoadDouble(result, MemOperand(elements, base_offset));
} else {
__ ld(result, MemOperand(scratch, elements, base_offset));
__ LoadDouble(result, MemOperand(scratch, elements, base_offset));
}

if (instr->hydrogen()->RequiresHoleCheck()) {
Expand Down Expand Up @@ -3906,7 +3908,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
DCHECK(!hinstr->NeedsWriteBarrier());
DoubleRegister value = ToDoubleRegister(instr->value());
DCHECK(offset >= 0);
__ std(value, FieldMemOperand(object, offset));
__ StoreDouble(value, FieldMemOperand(object, offset));
return;
}

Expand All @@ -3931,7 +3933,7 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) {
if (FLAG_unbox_double_fields && representation.IsDouble()) {
DCHECK(access.IsInobject());
DoubleRegister value = ToDoubleRegister(instr->value());
__ std(value, FieldMemOperand(object, offset));
__ StoreDouble(value, FieldMemOperand(object, offset));
if (hinstr->NeedsWriteBarrier()) {
record_value = ToRegister(instr->value());
}
Expand Down Expand Up @@ -4160,14 +4162,15 @@ void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) {
__ CanonicalizeNaN(double_scratch, value);
DCHECK(address_offset >= 0);
if (use_scratch)
__ std(double_scratch, MemOperand(scratch, elements, address_offset));
__ StoreDouble(double_scratch,
MemOperand(scratch, elements, address_offset));
else
__ std(double_scratch, MemOperand(elements, address_offset));
__ StoreDouble(double_scratch, MemOperand(elements, address_offset));
} else {
if (use_scratch)
__ std(value, MemOperand(scratch, elements, address_offset));
__ StoreDouble(value, MemOperand(scratch, elements, address_offset));
else
__ std(value, MemOperand(elements, address_offset));
__ StoreDouble(value, MemOperand(elements, address_offset));
}
}

Expand Down Expand Up @@ -4748,7 +4751,8 @@ void LCodeGen::EmitNumberUntagD(LNumberUntagD* instr, Register input_reg,
DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber);
}
// load heap number
__ ld(result_reg, FieldMemOperand(input_reg, HeapNumber::kValueOffset));
__ LoadDouble(result_reg,
FieldMemOperand(input_reg, HeapNumber::kValueOffset));
if (deoptimize_on_minus_zero) {
__ TestDoubleIsMinusZero(result_reg, scratch, ip);
DeoptimizeIf(eq, instr, DeoptimizeReason::kMinusZero);
Expand All @@ -4760,7 +4764,8 @@ void LCodeGen::EmitNumberUntagD(LNumberUntagD* instr, Register input_reg,
__ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex);
DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumberUndefined);
__ LoadRoot(scratch, Heap::kNanValueRootIndex);
__ ld(result_reg, FieldMemOperand(scratch, HeapNumber::kValueOffset));
__ LoadDouble(result_reg,
FieldMemOperand(scratch, HeapNumber::kValueOffset));
__ b(&done, Label::kNear);
}
} else {
Expand Down Expand Up @@ -4821,8 +4826,8 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) {
// Deoptimize if we don't have a heap number.
DeoptimizeIf(ne, instr, DeoptimizeReason::kNotAHeapNumber);

__ ld(double_scratch2,
FieldMemOperand(input_reg, HeapNumber::kValueOffset));
__ LoadDouble(double_scratch2,
FieldMemOperand(input_reg, HeapNumber::kValueOffset));
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
// preserve heap number pointer in scratch2 for minus zero check below
__ LoadRR(scratch2, input_reg);
Expand Down Expand Up @@ -5136,7 +5141,7 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {

// Heap number
__ bind(&heap_number);
__ ld(temp_reg, FieldMemOperand(input_reg, HeapNumber::kValueOffset));
__ LoadDouble(temp_reg, FieldMemOperand(input_reg, HeapNumber::kValueOffset));
__ ClampDoubleToUint8(result_reg, temp_reg, double_scratch0());
__ b(&done, Label::kNear);

Expand Down

0 comments on commit e7f072b

Please sign in to comment.