OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 | 1592 |
1593 | 1593 |
1594 KeyedAccessStoreMode KeyedStoreIC::GetStoreMode(Handle<JSObject> receiver, | 1594 KeyedAccessStoreMode KeyedStoreIC::GetStoreMode(Handle<JSObject> receiver, |
1595 Handle<Object> key, | 1595 Handle<Object> key, |
1596 Handle<Object> value) { | 1596 Handle<Object> value) { |
1597 ASSERT(!key->ToSmi()->IsFailure()); | 1597 ASSERT(!key->ToSmi()->IsFailure()); |
1598 Smi* smi_key = NULL; | 1598 Smi* smi_key = NULL; |
1599 key->ToSmi()->To(&smi_key); | 1599 key->ToSmi()->To(&smi_key); |
1600 int index = smi_key->value(); | 1600 int index = smi_key->value(); |
1601 bool oob_access = IsOutOfBoundsAccess(receiver, index); | 1601 bool oob_access = IsOutOfBoundsAccess(receiver, index); |
1602 bool allow_growth = receiver->IsJSArray() && oob_access; | 1602 // Don't consider this a growing store if the store would send the receiver to |
| 1603 // dictionary mode. |
| 1604 bool allow_growth = receiver->IsJSArray() && oob_access && |
| 1605 !receiver->WouldConvertToSlowElements(key); |
1603 if (allow_growth) { | 1606 if (allow_growth) { |
1604 // Handle growing array in stub if necessary. | 1607 // Handle growing array in stub if necessary. |
1605 if (receiver->HasFastSmiElements()) { | 1608 if (receiver->HasFastSmiElements()) { |
1606 if (value->IsHeapNumber()) { | 1609 if (value->IsHeapNumber()) { |
1607 if (receiver->HasFastHoleyElements()) { | 1610 if (receiver->HasFastHoleyElements()) { |
1608 return STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE; | 1611 return STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE; |
1609 } else { | 1612 } else { |
1610 return STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE; | 1613 return STORE_AND_GROW_TRANSITION_SMI_TO_DOUBLE; |
1611 } | 1614 } |
1612 } | 1615 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 } | 1720 } |
1718 } else if (key_is_smi_like && | 1721 } else if (key_is_smi_like && |
1719 !(target().is_identical_to(sloppy_arguments_stub()))) { | 1722 !(target().is_identical_to(sloppy_arguments_stub()))) { |
1720 // We should go generic if receiver isn't a dictionary, but our | 1723 // We should go generic if receiver isn't a dictionary, but our |
1721 // prototype chain does have dictionary elements. This ensures that | 1724 // prototype chain does have dictionary elements. This ensures that |
1722 // other non-dictionary receivers in the polymorphic case benefit | 1725 // other non-dictionary receivers in the polymorphic case benefit |
1723 // from fast path keyed stores. | 1726 // from fast path keyed stores. |
1724 if (!(receiver->map()->DictionaryElementsInPrototypeChainOnly())) { | 1727 if (!(receiver->map()->DictionaryElementsInPrototypeChainOnly())) { |
1725 KeyedAccessStoreMode store_mode = | 1728 KeyedAccessStoreMode store_mode = |
1726 GetStoreMode(receiver, key, value); | 1729 GetStoreMode(receiver, key, value); |
1727 // Use the generic stub if the store would send the receiver to | 1730 stub = StoreElementStub(receiver, store_mode); |
1728 // dictionary mode. | |
1729 if (!IsGrowStoreMode(store_mode) || | |
1730 !receiver->WouldConvertToSlowElements(key)) { | |
1731 stub = StoreElementStub(receiver, store_mode); | |
1732 } | |
1733 } | 1731 } |
1734 } | 1732 } |
1735 } | 1733 } |
1736 } | 1734 } |
1737 } | 1735 } |
1738 | 1736 |
1739 if (!is_target_set()) { | 1737 if (!is_target_set()) { |
1740 if (*stub == *generic_stub()) { | 1738 if (*stub == *generic_stub()) { |
1741 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "set generic"); | 1739 TRACE_GENERIC_IC(isolate(), "KeyedStoreIC", "set generic"); |
1742 } | 1740 } |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2843 #undef ADDR | 2841 #undef ADDR |
2844 }; | 2842 }; |
2845 | 2843 |
2846 | 2844 |
2847 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2845 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2848 return IC_utilities[id]; | 2846 return IC_utilities[id]; |
2849 } | 2847 } |
2850 | 2848 |
2851 | 2849 |
2852 } } // namespace v8::internal | 2850 } } // namespace v8::internal |
OLD | NEW |