Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: src/ic.cc

Issue 8305001: Introduce HTransitionElementsKind instruction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: nits fixed Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ic.h ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 } 1728 }
1729 1729
1730 1730
1731 MaybeObject* KeyedStoreIC::GetElementStubWithoutMapCheck( 1731 MaybeObject* KeyedStoreIC::GetElementStubWithoutMapCheck(
1732 bool is_js_array, 1732 bool is_js_array,
1733 ElementsKind elements_kind) { 1733 ElementsKind elements_kind) {
1734 return KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode(); 1734 return KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode();
1735 } 1735 }
1736 1736
1737 1737
1738 // If |map| is contained in |maps_list|, returns |map|; otherwise returns NULL.
1739 Map* GetMapIfPresent(Map* map, MapList* maps_list) {
1740 for (int i = 0; i < maps_list->length(); ++i) {
1741 if (maps_list->at(i) == map) return map;
1742 }
1743 return NULL;
1744 }
1745
1746
1747 // Returns the most generic transitioned map for |map| that's found in
1748 // |maps_list|, or NULL if no transitioned map for |map| is found at all.
1749 Map* GetTransitionedMap(Map* map, MapList* maps_list) {
1750 ElementsKind elements_kind = map->elements_kind();
1751 if (elements_kind == FAST_ELEMENTS) {
1752 return NULL;
1753 }
1754 if (elements_kind == FAST_DOUBLE_ELEMENTS) {
1755 bool dummy = true;
1756 Map* fast_map = map->LookupElementsTransitionMap(FAST_ELEMENTS, &dummy);
1757 if (fast_map == NULL) return NULL;
1758 return GetMapIfPresent(fast_map, maps_list);
1759 }
1760 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) {
1761 bool dummy = true;
1762 Map* double_map = map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS,
1763 &dummy);
1764 // In the current implementation, if the DOUBLE map doesn't exist, the
1765 // FAST map can't exist either.
1766 if (double_map == NULL) return NULL;
1767 Map* fast_map = map->LookupElementsTransitionMap(FAST_ELEMENTS, &dummy);
1768 if (fast_map == NULL) {
1769 return GetMapIfPresent(double_map, maps_list);
1770 }
1771 // Both double_map and fast_map are non-NULL. Return fast_map if it's in
1772 // maps_list, double_map otherwise.
1773 Map* fast_map_present = GetMapIfPresent(fast_map, maps_list);
1774 if (fast_map_present != NULL) return fast_map_present;
1775 return GetMapIfPresent(double_map, maps_list);
1776 }
1777 return NULL;
1778 }
1779
1780
1781 MaybeObject* KeyedStoreIC::ComputePolymorphicStub( 1738 MaybeObject* KeyedStoreIC::ComputePolymorphicStub(
1782 MapList* receiver_maps, 1739 MapList* receiver_maps,
1783 StrictModeFlag strict_mode) { 1740 StrictModeFlag strict_mode) {
1784 // Collect MONOMORPHIC stubs for all target_receiver_maps. 1741 // Collect MONOMORPHIC stubs for all target_receiver_maps.
1785 CodeList handler_ics(receiver_maps->length()); 1742 CodeList handler_ics(receiver_maps->length());
1786 MapList transitioned_maps(receiver_maps->length()); 1743 MapList transitioned_maps(receiver_maps->length());
1787 for (int i = 0; i < receiver_maps->length(); ++i) { 1744 for (int i = 0; i < receiver_maps->length(); ++i) {
1788 Map* receiver_map(receiver_maps->at(i)); 1745 Map* receiver_map(receiver_maps->at(i));
1789 MaybeObject* maybe_cached_stub = NULL; 1746 MaybeObject* maybe_cached_stub = NULL;
1790 Map* transitioned_map = GetTransitionedMap(receiver_map, receiver_maps); 1747 Map* transitioned_map = receiver_map->FindTransitionedMap(receiver_maps);
1791 if (transitioned_map != NULL) { 1748 if (transitioned_map != NULL) {
1792 maybe_cached_stub = FastElementsConversionStub( 1749 maybe_cached_stub = FastElementsConversionStub(
1793 receiver_map->elements_kind(), // original elements_kind 1750 receiver_map->elements_kind(), // original elements_kind
1794 transitioned_map->elements_kind(), 1751 transitioned_map->elements_kind(),
1795 receiver_map->instance_type() == JS_ARRAY_TYPE, // is_js_array 1752 receiver_map->instance_type() == JS_ARRAY_TYPE, // is_js_array
1796 strict_mode).TryGetCode(); 1753 strict_mode).TryGetCode();
1797 } else { 1754 } else {
1798 maybe_cached_stub = ComputeMonomorphicStubWithoutMapCheck( 1755 maybe_cached_stub = ComputeMonomorphicStubWithoutMapCheck(
1799 receiver_map, strict_mode); 1756 receiver_map, strict_mode);
1800 } 1757 }
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 #undef ADDR 2565 #undef ADDR
2609 }; 2566 };
2610 2567
2611 2568
2612 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2569 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2613 return IC_utilities[id]; 2570 return IC_utilities[id];
2614 } 2571 }
2615 2572
2616 2573
2617 } } // namespace v8::internal 2574 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698