diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index 79a5cd546b..b8050d4678 100644 --- a/src/arm/lithium-arm.cc +++ b/src/arm/lithium-arm.cc @@ -1676,6 +1676,8 @@ LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { 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)); diff --git a/src/arm64/lithium-arm64.cc b/src/arm64/lithium-arm64.cc index 8682e2b82f..68f839f6f1 100644 --- a/src/arm64/lithium-arm64.cc +++ b/src/arm64/lithium-arm64.cc @@ -1251,8 +1251,9 @@ LInstruction* LChunkBuilder::DoClassOfTestAndBranch( 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)); diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index 22a7586a99..495a435f9e 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -3303,6 +3303,21 @@ void HCompareHoleAndBranch::InferRepresentation( } +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) { if (FLAG_fold_constants && value()->IsConstant()) { HConstant* constant = HConstant::cast(value()); diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index ee4056bc7e..6f3dabd98d 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -4218,6 +4218,9 @@ class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { 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, diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 90968373a5..d2624161bc 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -1314,11 +1314,8 @@ HValue* HGraphBuilder::BuildCheckForCapacityGrow( HValue* max_gap = Add(static_cast(JSObject::kMaxGap)); HValue* max_capacity = AddUncasted(current_capacity, max_gap); - IfBuilder key_checker(this); - key_checker.If(key, max_capacity, Token::LT); - key_checker.Then(); - key_checker.ElseDeopt("Key out of capacity range"); - key_checker.End(); + + Add(key, max_capacity); HValue* new_capacity = BuildNewElementsCapacity(key); HValue* new_elements = BuildGrowElementsCapacity(object, elements, diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc index f61fd9aae2..ffd8d861d2 100644 --- a/src/ia32/lithium-ia32.cc +++ b/src/ia32/lithium-ia32.cc @@ -1677,6 +1677,8 @@ LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { 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)); diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc index e4a7a65d65..a5fed5fa68 100644 --- a/src/mips/lithium-mips.cc +++ b/src/mips/lithium-mips.cc @@ -1626,6 +1626,8 @@ LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { 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)); diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index 5b13e39783..256268b4ad 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -1621,6 +1621,8 @@ LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { 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));