OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 if (stub->ic_state() == MONOMORPHIC) { | 1586 if (stub->ic_state() == MONOMORPHIC) { |
1587 result->Add(Map::cast(stub->FindFirstMap())); | 1587 result->Add(Map::cast(stub->FindFirstMap())); |
1588 } else { | 1588 } else { |
1589 ASSERT(stub->ic_state() == MEGAMORPHIC); | 1589 ASSERT(stub->ic_state() == MEGAMORPHIC); |
1590 AssertNoAllocation no_allocation; | 1590 AssertNoAllocation no_allocation; |
1591 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 1591 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
1592 for (RelocIterator it(stub, mask); !it.done(); it.next()) { | 1592 for (RelocIterator it(stub, mask); !it.done(); it.next()) { |
1593 RelocInfo* info = it.rinfo(); | 1593 RelocInfo* info = it.rinfo(); |
1594 Object* object = info->target_object(); | 1594 Object* object = info->target_object(); |
1595 ASSERT(object->IsMap()); | 1595 ASSERT(object->IsMap()); |
1596 result->Add(Map::cast(object)); | 1596 AddOneReceiverMapIfMissing(result, Map::cast(object)); |
1597 } | 1597 } |
1598 } | 1598 } |
1599 } | 1599 } |
1600 } | 1600 } |
1601 | 1601 |
1602 | 1602 |
1603 MaybeObject* KeyedIC::ComputeStub(JSObject* receiver, | 1603 MaybeObject* KeyedIC::ComputeStub(JSObject* receiver, |
1604 StubKind stub_kind, | 1604 StubKind stub_kind, |
1605 StrictModeFlag strict_mode, | 1605 StrictModeFlag strict_mode, |
1606 Code* generic_stub) { | 1606 Code* generic_stub) { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1774 if (fast_map_present != NULL) return fast_map_present; | 1774 if (fast_map_present != NULL) return fast_map_present; |
1775 return GetMapIfPresent(double_map, maps_list); | 1775 return GetMapIfPresent(double_map, maps_list); |
1776 } | 1776 } |
1777 return NULL; | 1777 return NULL; |
1778 } | 1778 } |
1779 | 1779 |
1780 | 1780 |
1781 MaybeObject* KeyedStoreIC::ComputePolymorphicStub( | 1781 MaybeObject* KeyedStoreIC::ComputePolymorphicStub( |
1782 MapList* receiver_maps, | 1782 MapList* receiver_maps, |
1783 StrictModeFlag strict_mode) { | 1783 StrictModeFlag strict_mode) { |
1784 // TODO(yangguo): <remove> | |
1785 Code* generic_stub = (strict_mode == kStrictMode) | |
1786 ? isolate()->builtins()->builtin(Builtins::kKeyedStoreIC_Generic_Strict) | |
1787 : isolate()->builtins()->builtin(Builtins::kKeyedStoreIC_Generic); | |
1788 // </remove> | |
1789 | |
1790 // Collect MONOMORPHIC stubs for all target_receiver_maps. | 1784 // Collect MONOMORPHIC stubs for all target_receiver_maps. |
1791 CodeList handler_ics(receiver_maps->length()); | 1785 CodeList handler_ics(receiver_maps->length()); |
1792 MapList transitioned_maps(receiver_maps->length()); | 1786 MapList transitioned_maps(receiver_maps->length()); |
1793 for (int i = 0; i < receiver_maps->length(); ++i) { | 1787 for (int i = 0; i < receiver_maps->length(); ++i) { |
1794 Map* receiver_map(receiver_maps->at(i)); | 1788 Map* receiver_map(receiver_maps->at(i)); |
1795 MaybeObject* maybe_cached_stub = NULL; | 1789 MaybeObject* maybe_cached_stub = NULL; |
1796 Map* transitioned_map = GetTransitionedMap(receiver_map, receiver_maps); | 1790 Map* transitioned_map = GetTransitionedMap(receiver_map, receiver_maps); |
1797 if (transitioned_map != NULL) { | 1791 if (transitioned_map != NULL) { |
1798 // TODO(yangguo): Enable this code! | 1792 maybe_cached_stub = FastElementsConversionStub( |
1799 // maybe_cached_stub = FastElementsConversionStub( | 1793 receiver_map->elements_kind(), // original elements_kind |
1800 // receiver_map->elements_kind(), // original elements_kind | 1794 transitioned_map->elements_kind(), |
1801 // transitioned_map->elements_kind(), | 1795 receiver_map->instance_type() == JS_ARRAY_TYPE, // is_js_array |
1802 // receiver_map->instance_type() == JS_ARRAY_TYPE, // is_js_array | 1796 strict_mode).TryGetCode(); |
1803 // strict_mode_).TryGetCode(); | |
1804 // TODO(yangguo): <remove> | |
1805 maybe_cached_stub = generic_stub; | |
1806 // </remove> | |
1807 } else { | 1797 } else { |
1808 maybe_cached_stub = ComputeMonomorphicStubWithoutMapCheck( | 1798 maybe_cached_stub = ComputeMonomorphicStubWithoutMapCheck( |
1809 receiver_map, strict_mode); | 1799 receiver_map, strict_mode); |
1810 } | 1800 } |
1811 Code* cached_stub; | 1801 Code* cached_stub; |
1812 if (!maybe_cached_stub->To(&cached_stub)) return maybe_cached_stub; | 1802 if (!maybe_cached_stub->To(&cached_stub)) return maybe_cached_stub; |
1813 handler_ics.Add(cached_stub); | 1803 handler_ics.Add(cached_stub); |
1814 transitioned_maps.Add(transitioned_map); | 1804 transitioned_maps.Add(transitioned_map); |
1815 } | 1805 } |
1816 Object* object; | 1806 Object* object; |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2618 #undef ADDR | 2608 #undef ADDR |
2619 }; | 2609 }; |
2620 | 2610 |
2621 | 2611 |
2622 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2612 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2623 return IC_utilities[id]; | 2613 return IC_utilities[id]; |
2624 } | 2614 } |
2625 | 2615 |
2626 | 2616 |
2627 } } // namespace v8::internal | 2617 } } // namespace v8::internal |
OLD | NEW |