Revision: 11278
Author: [email protected]
Date: Wed Apr 11 07:08:11 2012
Log: Skip canonicalization check in LStoreKeyedFastDoubleElement when
it is not needed:
- if value is a result of integer32 to double conversion (can't be NaN);
- if value was loaded from fast double backing store (already
canonicalized).
[email protected]
Review URL: https://chromiumcodereview.appspot.com/10054009
http://code.google.com/p/v8/source/detail?r=11278
Modified:
/branches/bleeding_edge/src/arm/lithium-arm.h
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/hydrogen-instructions.cc
/branches/bleeding_edge/src/hydrogen-instructions.h
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.h
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.h
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h Wed Apr 11 06:40:55 2012
+++ /branches/bleeding_edge/src/arm/lithium-arm.h Wed Apr 11 07:08:11 2012
@@ -1752,6 +1752,8 @@
LOperand* elements() { return inputs_[0]; }
LOperand* key() { return inputs_[1]; }
LOperand* value() { return inputs_[2]; }
+
+ bool NeedsCanonicalization() { return
hydrogen()->NeedsCanonicalization(); }
};
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Wed Apr 11
06:40:55 2012
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Wed Apr 11
07:08:11 2012
@@ -3624,7 +3624,6 @@
Register scratch = scratch0();
bool key_is_constant = instr->key()->IsConstantOperand();
int constant_key = 0;
- Label not_nan;
// Calculate the effective address of the slot in the array to store the
// double value.
@@ -3647,13 +3646,15 @@
Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag));
}
- // Check for NaN. All NaNs must be canonicalized.
- __ VFPCompareAndSetFlags(value, value);
-
- // Only load canonical NaN if the comparison above set the overflow.
- __ Vmov(value, FixedDoubleArray::canonical_not_the_hole_nan_as_double(),
vs);
-
- __ bind(¬_nan);
+ if (instr->NeedsCanonicalization()) {
+ // Check for NaN. All NaNs must be canonicalized.
+ __ VFPCompareAndSetFlags(value, value);
+ // Only load canonical NaN if the comparison above set the overflow.
+ __ Vmov(value,
+ FixedDoubleArray::canonical_not_the_hole_nan_as_double(),
+ vs);
+ }
+
__ vstr(value, scratch, 0);
}
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Wed Apr 11
06:40:55 2012
+++ /branches/bleeding_edge/src/hydrogen-instructions.cc Wed Apr 11
07:08:11 2012
@@ -2091,6 +2091,17 @@
}
return NULL;
}
+
+
+bool HStoreKeyedFastDoubleElement::NeedsCanonicalization() {
+ // If value was loaded from unboxed double backing store or
+ // converted from an integer then we don't have to canonicalize it.
+ if (value()->IsLoadKeyedFastDoubleElement() ||
+ (value()->IsChange() &&
HChange::cast(value())->from().IsInteger32())) {
+ return false;
+ }
+ return true;
+}
#define
H_CONSTANT_INT32(val) \
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Wed Apr 11 06:40:55
2012
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Wed Apr 11 07:08:11
2012
@@ -4225,6 +4225,8 @@
bool NeedsWriteBarrier() {
return StoringValueNeedsWriteBarrier(value());
}
+
+ bool NeedsCanonicalization();
virtual void PrintDataTo(StringStream* stream);
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Wed Apr 11
06:40:55 2012
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Wed Apr 11
07:08:11 2012
@@ -3469,15 +3469,18 @@
void LCodeGen::DoStoreKeyedFastDoubleElement(
LStoreKeyedFastDoubleElement* instr) {
XMMRegister value = ToDoubleRegister(instr->value());
- Label have_value;
-
- __ ucomisd(value, value);
- __ j(parity_odd, &have_value); // NaN.
-
- ExternalReference canonical_nan_reference =
- ExternalReference::address_of_canonical_non_hole_nan();
- __ movdbl(value, Operand::StaticVariable(canonical_nan_reference));
- __ bind(&have_value);
+
+ if (instr->NeedsCanonicalization()) {
+ Label have_value;
+
+ __ ucomisd(value, value);
+ __ j(parity_odd, &have_value); // NaN.
+
+ ExternalReference canonical_nan_reference =
+ ExternalReference::address_of_canonical_non_hole_nan();
+ __ movdbl(value, Operand::StaticVariable(canonical_nan_reference));
+ __ bind(&have_value);
+ }
Operand double_store_operand = BuildFastArrayOperand(
instr->elements(), instr->key(), FAST_DOUBLE_ELEMENTS,
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.h Wed Apr 11 06:40:55 2012
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.h Wed Apr 11 07:08:11 2012
@@ -1800,6 +1800,8 @@
LOperand* elements() { return inputs_[0]; }
LOperand* key() { return inputs_[1]; }
LOperand* value() { return inputs_[2]; }
+
+ bool NeedsCanonicalization() { return
hydrogen()->NeedsCanonicalization(); }
};
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Wed Apr 11
06:40:55 2012
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Wed Apr 11
07:08:11 2012
@@ -3430,16 +3430,20 @@
void LCodeGen::DoStoreKeyedFastDoubleElement(
LStoreKeyedFastDoubleElement* instr) {
XMMRegister value = ToDoubleRegister(instr->value());
- Label have_value;
-
- __ ucomisd(value, value);
- __ j(parity_odd, &have_value); // NaN.
-
- __ Set(kScratchRegister, BitCast<uint64_t>(
- FixedDoubleArray::canonical_not_the_hole_nan_as_double()));
- __ movq(value, kScratchRegister);
-
- __ bind(&have_value);
+
+ if (instr->NeedsCanonicalization()) {
+ Label have_value;
+
+ __ ucomisd(value, value);
+ __ j(parity_odd, &have_value); // NaN.
+
+ __ Set(kScratchRegister, BitCast<uint64_t>(
+ FixedDoubleArray::canonical_not_the_hole_nan_as_double()));
+ __ movq(value, kScratchRegister);
+
+ __ bind(&have_value);
+ }
+
Operand double_store_operand = BuildFastArrayOperand(
instr->elements(), instr->key(), FAST_DOUBLE_ELEMENTS,
FixedDoubleArray::kHeaderSize - kHeapObjectTag);
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h Wed Apr 11 06:40:55 2012
+++ /branches/bleeding_edge/src/x64/lithium-x64.h Wed Apr 11 07:08:11 2012
@@ -1720,6 +1720,8 @@
LOperand* elements() { return inputs_[0]; }
LOperand* key() { return inputs_[1]; }
LOperand* value() { return inputs_[2]; }
+
+ bool NeedsCanonicalization() { return
hydrogen()->NeedsCanonicalization(); }
};
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev