Revision: 20880
Author: [email protected]
Date: Tue Apr 22 10:49:28 2014 UTC
Log: Optimize numeric comparison with known successors.
[email protected]
Review URL: https://codereview.chromium.org/246133005
http://code.google.com/p/v8/source/detail?r=20880
Modified:
/branches/bleeding_edge/src/arm/lithium-arm.cc
/branches/bleeding_edge/src/arm64/lithium-arm64.cc
/branches/bleeding_edge/src/hydrogen-instructions.cc
/branches/bleeding_edge/src/hydrogen-instructions.h
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.cc
/branches/bleeding_edge/src/mips/lithium-mips.cc
/branches/bleeding_edge/src/x64/lithium-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Tue Apr 22 08:28:14 2014
UTC
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc Tue Apr 22 10:49:28 2014
UTC
@@ -1676,6 +1676,8 @@
LInstruction* LChunkBuilder::DoCompareNumericAndBranch(
HCompareNumericAndBranch* instr) {
+ LInstruction* goto_instr = CheckElideControlInstruction(instr);
+ if (goto_instr != NULL) return goto_instr;
Representation r = instr->representation();
if (r.IsSmiOrInteger32()) {
ASSERT(instr->left()->representation().Equals(r));
=======================================
--- /branches/bleeding_edge/src/arm64/lithium-arm64.cc Tue Apr 22 08:28:14
2014 UTC
+++ /branches/bleeding_edge/src/arm64/lithium-arm64.cc Tue Apr 22 10:49:28
2014 UTC
@@ -1251,8 +1251,9 @@
LInstruction* LChunkBuilder::DoCompareNumericAndBranch(
HCompareNumericAndBranch* instr) {
+ LInstruction* goto_instr = CheckElideControlInstruction(instr);
+ if (goto_instr != NULL) return goto_instr;
Representation r = instr->representation();
-
if (r.IsSmiOrInteger32()) {
ASSERT(instr->left()->representation().Equals(r));
ASSERT(instr->right()->representation().Equals(r));
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Wed Apr 16
11:41:09 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen-instructions.cc Tue Apr 22
10:49:28 2014 UTC
@@ -3301,6 +3301,21 @@
HInferRepresentationPhase* h_infer) {
ChangeRepresentation(value()->representation());
}
+
+
+bool HCompareNumericAndBranch::KnownSuccessorBlock(HBasicBlock** block) {
+ if (left() == right() &&
+ left()->representation().IsSmiOrInteger32()) {
+ *block = (token() == Token::EQ ||
+ token() == Token::EQ_STRICT ||
+ token() == Token::LTE ||
+ token() == Token::GTE)
+ ? FirstSuccessor() : SecondSuccessor();
+ return true;
+ }
+ *block = NULL;
+ return false;
+}
bool HCompareMinusZeroAndBranch::KnownSuccessorBlock(HBasicBlock** block) {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Tue Apr 22 07:24:05
2014 UTC
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Tue Apr 22 10:49:28
2014 UTC
@@ -4218,6 +4218,9 @@
virtual Representation observed_input_representation(int index)
V8_OVERRIDE {
return observed_input_representation_[index];
}
+
+ virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE;
+
virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
void SetOperandPositions(Zone* zone,
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Tue Apr 22 08:34:44 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc Tue Apr 22 10:49:28 2014 UTC
@@ -1314,11 +1314,8 @@
HValue* max_gap =
Add<HConstant>(static_cast<int32_t>(JSObject::kMaxGap));
HValue* max_capacity = AddUncasted<HAdd>(current_capacity, max_gap);
- IfBuilder key_checker(this);
- key_checker.If<HCompareNumericAndBranch>(key, max_capacity, Token::LT);
- key_checker.Then();
- key_checker.ElseDeopt("Key out of capacity range");
- key_checker.End();
+
+ Add<HBoundsCheck>(key, max_capacity);
HValue* new_capacity = BuildNewElementsCapacity(key);
HValue* new_elements = BuildGrowElementsCapacity(object, elements,
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Tue Apr 22 08:28:14
2014 UTC
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Tue Apr 22 10:49:28
2014 UTC
@@ -1677,6 +1677,8 @@
LInstruction* LChunkBuilder::DoCompareNumericAndBranch(
HCompareNumericAndBranch* instr) {
+ LInstruction* goto_instr = CheckElideControlInstruction(instr);
+ if (goto_instr != NULL) return goto_instr;
Representation r = instr->representation();
if (r.IsSmiOrInteger32()) {
ASSERT(instr->left()->representation().Equals(r));
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.cc Fri Apr 4 15:17:37
2014 UTC
+++ /branches/bleeding_edge/src/mips/lithium-mips.cc Tue Apr 22 10:49:28
2014 UTC
@@ -1626,6 +1626,8 @@
LInstruction* LChunkBuilder::DoCompareNumericAndBranch(
HCompareNumericAndBranch* instr) {
+ LInstruction* goto_instr = CheckElideControlInstruction(instr);
+ if (goto_instr != NULL) return goto_instr;
Representation r = instr->representation();
if (r.IsSmiOrInteger32()) {
ASSERT(instr->left()->representation().Equals(r));
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Tue Apr 22 08:28:14 2014
UTC
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc Tue Apr 22 10:49:28 2014
UTC
@@ -1621,6 +1621,8 @@
LInstruction* LChunkBuilder::DoCompareNumericAndBranch(
HCompareNumericAndBranch* instr) {
+ LInstruction* goto_instr = CheckElideControlInstruction(instr);
+ if (goto_instr != NULL) return goto_instr;
Representation r = instr->representation();
if (r.IsSmiOrInteger32()) {
ASSERT(instr->left()->representation().Equals(r));
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.