| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
| (...skipping 8656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8667 } else { | 8667 } else { |
| 8668 ASSERT_EQ(kLastIndexOf, mode); | 8668 ASSERT_EQ(kLastIndexOf, mode); |
| 8669 initial = length; | 8669 initial = length; |
| 8670 terminating = graph()->GetConstant0(); | 8670 terminating = graph()->GetConstant0(); |
| 8671 token = Token::GT; | 8671 token = Token::GT; |
| 8672 direction = LoopBuilder::kPreDecrement; | 8672 direction = LoopBuilder::kPreDecrement; |
| 8673 } | 8673 } |
| 8674 | 8674 |
| 8675 Push(graph()->GetConstantMinus1()); | 8675 Push(graph()->GetConstantMinus1()); |
| 8676 if (IsFastDoubleElementsKind(kind) || IsFastSmiElementsKind(kind)) { | 8676 if (IsFastDoubleElementsKind(kind) || IsFastSmiElementsKind(kind)) { |
| 8677 // Make sure that we can actually compare numbers correctly below, see |
| 8678 // https://code.google.com/p/chromium/issues/detail?id=407946 for details. |
| 8679 search_element = AddUncasted<HForceRepresentation>( |
| 8680 search_element, IsFastSmiElementsKind(kind) ? Representation::Smi() |
| 8681 : Representation::Double()); |
| 8682 |
| 8677 LoopBuilder loop(this, context(), direction); | 8683 LoopBuilder loop(this, context(), direction); |
| 8678 { | 8684 { |
| 8679 HValue* index = loop.BeginBody(initial, terminating, token); | 8685 HValue* index = loop.BeginBody(initial, terminating, token); |
| 8680 HValue* element = AddUncasted<HLoadKeyed>( | 8686 HValue* element = AddUncasted<HLoadKeyed>( |
| 8681 elements, index, static_cast<HValue*>(NULL), | 8687 elements, index, static_cast<HValue*>(NULL), |
| 8682 kind, ALLOW_RETURN_HOLE); | 8688 kind, ALLOW_RETURN_HOLE); |
| 8683 IfBuilder if_issame(this); | 8689 IfBuilder if_issame(this); |
| 8684 if (IsFastDoubleElementsKind(kind)) { | 8690 if_issame.If<HCompareNumericAndBranch>(element, search_element, |
| 8685 if_issame.If<HCompareNumericAndBranch>( | 8691 Token::EQ_STRICT); |
| 8686 element, search_element, Token::EQ_STRICT); | |
| 8687 } else { | |
| 8688 if_issame.If<HCompareObjectEqAndBranch>(element, search_element); | |
| 8689 } | |
| 8690 if_issame.Then(); | 8692 if_issame.Then(); |
| 8691 { | 8693 { |
| 8692 Drop(1); | 8694 Drop(1); |
| 8693 Push(index); | 8695 Push(index); |
| 8694 loop.Break(); | 8696 loop.Break(); |
| 8695 } | 8697 } |
| 8696 if_issame.End(); | 8698 if_issame.End(); |
| 8697 } | 8699 } |
| 8698 loop.EndBody(); | 8700 loop.EndBody(); |
| 8699 } else { | 8701 } else { |
| (...skipping 3647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12347 if (ShouldProduceTraceOutput()) { | 12349 if (ShouldProduceTraceOutput()) { |
| 12348 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12350 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 12349 } | 12351 } |
| 12350 | 12352 |
| 12351 #ifdef DEBUG | 12353 #ifdef DEBUG |
| 12352 graph_->Verify(false); // No full verify. | 12354 graph_->Verify(false); // No full verify. |
| 12353 #endif | 12355 #endif |
| 12354 } | 12356 } |
| 12355 | 12357 |
| 12356 } } // namespace v8::internal | 12358 } } // namespace v8::internal |
| OLD | NEW |