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

Unified Diff: src/arm/macro-assembler-arm.cc

Issue 19560003: [v8-dev] ARM: Make double registers low/high safe (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: src/arm/macro-assembler-arm.cc
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc
index ba80cdafebbd6c2f400d0194e19c300a9f572289..442f49b378eba59846d0e205b617a5c86758ddf4 100644
--- a/src/arm/macro-assembler-arm.cc
+++ b/src/arm/macro-assembler-arm.cc
@@ -792,6 +792,46 @@ void MacroAssembler::Vmov(const DwVfpRegister dst,
}
+void MacroAssembler::VmovHigh(Register dst, DwVfpRegister src) {
+ if (src.code() < 16) {
+ const LowDwVfpRegister loc = LowDwVfpRegister::from_code(src.code());
+ vmov(dst, loc.high());
+ } else {
+ vmov(dst, VmovIndexHi, src);
+ }
+}
+
+
+void MacroAssembler::VmovHigh(DwVfpRegister dst, Register src) {
+ if (dst.code() < 16) {
+ const LowDwVfpRegister loc = LowDwVfpRegister::from_code(dst.code());
+ vmov(loc.high(), src);
+ } else {
+ vmov(dst, VmovIndexHi, src);
+ }
+}
+
+
+void MacroAssembler::VmovLow(Register dst, DwVfpRegister src) {
+ if (src.code() < 16) {
+ const LowDwVfpRegister loc = LowDwVfpRegister::from_code(src.code());
+ vmov(dst, loc.low());
+ } else {
+ vmov(dst, VmovIndexLo, src);
+ }
+}
+
+
+void MacroAssembler::VmovLow(DwVfpRegister dst, Register src) {
+ if (dst.code() < 16) {
+ const LowDwVfpRegister loc = LowDwVfpRegister::from_code(dst.code());
+ vmov(loc.low(), src);
+ } else {
+ vmov(dst, VmovIndexLo, src);
+ }
+}
+
+
void MacroAssembler::ConvertNumberToInt32(Register object,
Register dst,
Register heap_number_map,
@@ -799,7 +839,7 @@ void MacroAssembler::ConvertNumberToInt32(Register object,
Register scratch2,
Register scratch3,
DwVfpRegister double_scratch1,
- DwVfpRegister double_scratch2,
+ LowDwVfpRegister double_scratch2,
Label* not_number) {
Label done;
UntagAndJumpIfSmi(dst, object, &done);
@@ -813,7 +853,7 @@ void MacroAssembler::ConvertNumberToInt32(Register object,
void MacroAssembler::LoadNumber(Register object,
- DwVfpRegister dst,
+ LowDwVfpRegister dst,
Register heap_number_map,
Register scratch,
Label* not_number) {
@@ -838,7 +878,7 @@ void MacroAssembler::LoadNumberAsInt32Double(Register object,
DwVfpRegister double_dst,
Register heap_number_map,
Register scratch,
- DwVfpRegister double_scratch,
+ LowDwVfpRegister double_scratch,
Label* not_int32) {
ASSERT(!scratch.is(object));
ASSERT(!heap_number_map.is(object) && !heap_number_map.is(scratch));
@@ -870,7 +910,7 @@ void MacroAssembler::LoadNumberAsInt32(Register object,
Register heap_number_map,
Register scratch,
DwVfpRegister double_scratch0,
- DwVfpRegister double_scratch1,
+ LowDwVfpRegister double_scratch1,
Label* not_int32) {
ASSERT(!dst.is(object));
ASSERT(!scratch.is(object));
@@ -2066,12 +2106,14 @@ void MacroAssembler::CheckFastSmiElements(Register map,
}
-void MacroAssembler::StoreNumberToDoubleElements(Register value_reg,
- Register key_reg,
- Register elements_reg,
- Register scratch1,
- Label* fail,
- int elements_offset) {
+void MacroAssembler::StoreNumberToDoubleElements(
+ Register value_reg,
+ Register key_reg,
+ Register elements_reg,
+ Register scratch1,
+ LowDwVfpRegister double_scratch0,
+ Label* fail,
+ int elements_offset) {
Label smi_value, store;
// Handle smi values specially.
@@ -2084,23 +2126,24 @@ void MacroAssembler::StoreNumberToDoubleElements(Register value_reg,
fail,
DONT_DO_SMI_CHECK);
- vldr(d0, FieldMemOperand(value_reg, HeapNumber::kValueOffset));
+ vldr(double_scratch0, FieldMemOperand(value_reg, HeapNumber::kValueOffset));
// Force a canonical NaN.
if (emit_debug_code()) {
vmrs(ip);
tst(ip, Operand(kVFPDefaultNaNModeControlBit));
Assert(ne, "Default NaN mode not set");
}
- VFPCanonicalizeNaN(d0);
+ VFPCanonicalizeNaN(double_scratch0);
b(&store);
bind(&smi_value);
- SmiToDouble(d0, value_reg);
+ SmiToDouble(double_scratch0, value_reg);
bind(&store);
add(scratch1, elements_reg, Operand::DoubleOffsetFromSmiKey(key_reg));
- vstr(d0, FieldMemOperand(scratch1,
- FixedDoubleArray::kHeaderSize - elements_offset));
+ vstr(double_scratch0,
+ FieldMemOperand(scratch1,
+ FixedDoubleArray::kHeaderSize - elements_offset));
}
@@ -2406,8 +2449,7 @@ void MacroAssembler::IndexFromHash(Register hash, Register index) {
}
-void MacroAssembler::SmiToDouble(DwVfpRegister value, Register smi) {
- ASSERT(value.code() < 16);
+void MacroAssembler::SmiToDouble(LowDwVfpRegister value, Register smi) {
if (CpuFeatures::IsSupported(VFP3)) {
vmov(value.low(), smi);
vcvt_f64_s32(value, 1);
@@ -2420,7 +2462,7 @@ void MacroAssembler::SmiToDouble(DwVfpRegister value, Register smi) {
void MacroAssembler::TestDoubleIsInt32(DwVfpRegister double_input,
- DwVfpRegister double_scratch) {
+ LowDwVfpRegister double_scratch) {
ASSERT(!double_input.is(double_scratch));
vcvt_s32_f64(double_scratch.low(), double_input);
vcvt_f64_s32(double_scratch, double_scratch.low());
@@ -2430,7 +2472,7 @@ void MacroAssembler::TestDoubleIsInt32(DwVfpRegister double_input,
void MacroAssembler::TryDoubleToInt32Exact(Register result,
DwVfpRegister double_input,
- DwVfpRegister double_scratch) {
+ LowDwVfpRegister double_scratch) {
ASSERT(!double_input.is(double_scratch));
vcvt_s32_f64(double_scratch.low(), double_input);
vmov(result, double_scratch.low());
@@ -2442,13 +2484,15 @@ void MacroAssembler::TryDoubleToInt32Exact(Register result,
void MacroAssembler::TryInt32Floor(Register result,
DwVfpRegister double_input,
Register input_high,
- DwVfpRegister double_scratch,
+ LowDwVfpRegister double_scratch,
Label* done,
Label* exact) {
ASSERT(!result.is(input_high));
ASSERT(!double_input.is(double_scratch));
Label negative, exception;
+ VmovHigh(input_high, double_input);
+
// Test for NaN and infinities.
Sbfx(result, input_high,
HeapNumber::kExponentShift, HeapNumber::kExponentBits);
@@ -2489,7 +2533,7 @@ void MacroAssembler::ECMAToInt32(Register result,
Register scratch,
Register scratch_high,
Register scratch_low,
- DwVfpRegister double_scratch) {
+ LowDwVfpRegister double_scratch) {
ASSERT(!scratch_high.is(result));
ASSERT(!scratch_low.is(result));
ASSERT(!scratch_low.is(scratch_high));
@@ -3143,8 +3187,7 @@ void MacroAssembler::AllocateHeapNumberWithValue(Register result,
// Copies a fixed number of fields of heap objects from src to dst.
void MacroAssembler::CopyFields(Register dst,
Register src,
- DwVfpRegister double_scratch,
- SwVfpRegister single_scratch,
+ LowDwVfpRegister double_scratch,
int field_count) {
int double_count = field_count / (DwVfpRegister::kSizeInBytes / kPointerSize);
for (int i = 0; i < double_count; i++) {
@@ -3157,9 +3200,9 @@ void MacroAssembler::CopyFields(Register dst,
int remain = field_count % (DwVfpRegister::kSizeInBytes / kPointerSize);
if (remain != 0) {
- vldr(single_scratch,
+ vldr(double_scratch.low(),
FieldMemOperand(src, (field_count - 1) * kPointerSize));
- vstr(single_scratch,
+ vstr(double_scratch.low(),
FieldMemOperand(dst, (field_count - 1) * kPointerSize));
}
}
@@ -3660,13 +3703,12 @@ void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) {
void MacroAssembler::ClampDoubleToUint8(Register result_reg,
DwVfpRegister input_reg,
- DwVfpRegister temp_double_reg) {
+ LowDwVfpRegister temp_double_reg) {
Label above_zero;
Label done;
Label in_bounds;
- Vmov(temp_double_reg, 0.0);
- VFPCompareAndSetFlags(input_reg, temp_double_reg);
+ VFPCompareAndSetFlags(input_reg, 0.0);
b(gt, &above_zero);
// Double value is less than zero, NaN or Inf, return 0.
@@ -3688,8 +3730,8 @@ void MacroAssembler::ClampDoubleToUint8(Register result_reg,
// Set rounding mode to round to the nearest integer by clearing bits[23:22].
bic(result_reg, ip, Operand(kVFPRoundingModeMask));
vmsr(result_reg);
- vcvt_s32_f64(input_reg.low(), input_reg, kFPSCRRounding);
- vmov(result_reg, input_reg.low());
+ vcvt_s32_f64(temp_double_reg.low(), input_reg, kFPSCRRounding);
+ vmov(result_reg, temp_double_reg.low());
// Restore FPSCR.
vmsr(ip);
bind(&done);

Powered by Google App Engine
This is Rietveld 408576698