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 "hydrogen.h" | 5 #include "hydrogen.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "v8.h" | 9 #include "v8.h" |
10 #include "allocation-site-scopes.h" | 10 #include "allocation-site-scopes.h" |
(...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1670 HObjectAccess::ForHeapNumberValueHighestBits()); | 1670 HObjectAccess::ForHeapNumberValueHighestBits()); |
1671 HValue* hash = AddUncasted<HBitwise>(Token::BIT_XOR, low, high); | 1671 HValue* hash = AddUncasted<HBitwise>(Token::BIT_XOR, low, high); |
1672 hash = AddUncasted<HBitwise>(Token::BIT_AND, hash, mask); | 1672 hash = AddUncasted<HBitwise>(Token::BIT_AND, hash, mask); |
1673 | 1673 |
1674 // Load the key. | 1674 // Load the key. |
1675 HValue* key_index = AddUncasted<HShl>(hash, graph()->GetConstant1()); | 1675 HValue* key_index = AddUncasted<HShl>(hash, graph()->GetConstant1()); |
1676 HValue* key = Add<HLoadKeyed>(number_string_cache, key_index, | 1676 HValue* key = Add<HLoadKeyed>(number_string_cache, key_index, |
1677 static_cast<HValue*>(NULL), | 1677 static_cast<HValue*>(NULL), |
1678 FAST_ELEMENTS, ALLOW_RETURN_HOLE); | 1678 FAST_ELEMENTS, ALLOW_RETURN_HOLE); |
1679 | 1679 |
1680 // Check if key is a heap number (the number string cache contains only | 1680 // Check if the key is a heap number and compare it with the object. |
1681 // SMIs and heap number, so it is sufficient to do a SMI check here). | |
Jakob Kummerow
2014/05/30 16:56:52
This comment is a lie! Unused entries in the cache
| |
1682 IfBuilder if_keyisnotsmi(this); | 1681 IfBuilder if_keyisnotsmi(this); |
1683 HValue* keyisnotsmi = if_keyisnotsmi.IfNot<HIsSmiAndBranch>(key); | 1682 HValue* keyisnotsmi = if_keyisnotsmi.IfNot<HIsSmiAndBranch>(key); |
1684 if_keyisnotsmi.Then(); | 1683 if_keyisnotsmi.Then(); |
1685 { | 1684 { |
1686 // Check if values of key and object match. | 1685 IfBuilder if_keyisheapnumber(this); |
Jakob Kummerow
2014/05/30 16:56:52
This entire block is actually unchanged, just inde
| |
1687 IfBuilder if_keyeqobject(this); | 1686 if_keyisheapnumber.If<HCompareMap>( |
1688 if_keyeqobject.If<HCompareNumericAndBranch>( | 1687 key, isolate()->factory()->heap_number_map()); |
1689 Add<HLoadNamedField>(key, keyisnotsmi, | 1688 if_keyisheapnumber.Then(); |
1690 HObjectAccess::ForHeapNumberValue()), | |
1691 Add<HLoadNamedField>(object, objectisnumber, | |
1692 HObjectAccess::ForHeapNumberValue()), | |
1693 Token::EQ); | |
1694 if_keyeqobject.Then(); | |
1695 { | 1689 { |
1696 // Make the key_index available. | 1690 // Check if values of key and object match. |
1697 Push(key_index); | 1691 IfBuilder if_keyeqobject(this); |
1692 if_keyeqobject.If<HCompareNumericAndBranch>( | |
1693 Add<HLoadNamedField>(key, keyisnotsmi, | |
1694 HObjectAccess::ForHeapNumberValue()), | |
1695 Add<HLoadNamedField>(object, objectisnumber, | |
1696 HObjectAccess::ForHeapNumberValue()), | |
1697 Token::EQ); | |
1698 if_keyeqobject.Then(); | |
1699 { | |
1700 // Make the key_index available. | |
1701 Push(key_index); | |
1702 } | |
1703 if_keyeqobject.JoinContinuation(&found); | |
1698 } | 1704 } |
1699 if_keyeqobject.JoinContinuation(&found); | 1705 if_keyisheapnumber.JoinContinuation(&found); |
1700 } | 1706 } |
1701 if_keyisnotsmi.JoinContinuation(&found); | 1707 if_keyisnotsmi.JoinContinuation(&found); |
1702 } | 1708 } |
1703 if_objectisnumber.Else(); | 1709 if_objectisnumber.Else(); |
1704 { | 1710 { |
1705 if (type->Is(Type::Number())) { | 1711 if (type->Is(Type::Number())) { |
1706 if_objectisnumber.Deopt("Expected heap number"); | 1712 if_objectisnumber.Deopt("Expected heap number"); |
1707 } | 1713 } |
1708 } | 1714 } |
1709 if_objectisnumber.JoinContinuation(&found); | 1715 if_objectisnumber.JoinContinuation(&found); |
(...skipping 10078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11788 if (ShouldProduceTraceOutput()) { | 11794 if (ShouldProduceTraceOutput()) { |
11789 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11795 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11790 } | 11796 } |
11791 | 11797 |
11792 #ifdef DEBUG | 11798 #ifdef DEBUG |
11793 graph_->Verify(false); // No full verify. | 11799 graph_->Verify(false); // No full verify. |
11794 #endif | 11800 #endif |
11795 } | 11801 } |
11796 | 11802 |
11797 } } // namespace v8::internal | 11803 } } // namespace v8::internal |
OLD | NEW |