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

Side by Side Diff: src/objects.cc

Issue 10905262: Clear the EnumLength fields of maps that lose their enumeration cache. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 // transitions with the same key. 1806 // transitions with the same key.
1807 1807
1808 if (old_map->owns_descriptors()) { 1808 if (old_map->owns_descriptors()) {
1809 // If the old map owns its own descriptors, transfer ownership to the 1809 // If the old map owns its own descriptors, transfer ownership to the
1810 // new_map and install its descriptors in the old_map. Since the old_map 1810 // new_map and install its descriptors in the old_map. Since the old_map
1811 // stores the descriptors for the new_map, remove the transition array of 1811 // stores the descriptors for the new_map, remove the transition array of
1812 // the new_map that is only in place to store the descriptors. 1812 // the new_map that is only in place to store the descriptors.
1813 old_map->transitions()->set_descriptors(new_map->instance_descriptors()); 1813 old_map->transitions()->set_descriptors(new_map->instance_descriptors());
1814 new_map->ClearTransitions(GetHeap()); 1814 new_map->ClearTransitions(GetHeap());
1815 old_map->set_owns_descriptors(false); 1815 old_map->set_owns_descriptors(false);
1816 Map* map;
1817 JSGlobalPropertyCell* pointer =
1818 old_map->transitions()->descriptors_pointer();
1819 for (Object* current = old_map;
1820 !current->IsUndefined();
1821 current = map->GetBackPointer()) {
1822 map = Map::cast(current);
1823 if (!map->HasTransitionArray()) break;
1824 TransitionArray* transitions = map->transitions();
1825 if (transitions->descriptors_pointer() != pointer) break;
1826 map->SetEnumLength(Map::kInvalidEnumCache);
1827 }
1816 } else if (old_target->instance_descriptors() == 1828 } else if (old_target->instance_descriptors() ==
1817 old_map->instance_descriptors()) { 1829 old_map->instance_descriptors()) {
1818 // Since the conversion above generated a new fast map with an additional 1830 // Since the conversion above generated a new fast map with an additional
1819 // property which can be shared as well, install this descriptor pointer 1831 // property which can be shared as well, install this descriptor pointer
1820 // along the entire chain of smaller maps; and remove the transition array 1832 // along the entire chain of smaller maps; and remove the transition array
1821 // that is only in place to hold the descriptor array in the new map. 1833 // that is only in place to hold the descriptor array in the new map.
1822 Map* map; 1834 Map* map;
1823 JSGlobalPropertyCell* new_pointer = 1835 JSGlobalPropertyCell* new_pointer =
1824 new_map->transitions()->descriptors_pointer(); 1836 new_map->transitions()->descriptors_pointer();
1825 JSGlobalPropertyCell* old_pointer = 1837 JSGlobalPropertyCell* old_pointer =
1826 old_map->transitions()->descriptors_pointer(); 1838 old_map->transitions()->descriptors_pointer();
1827 for (Object* current = old_map; 1839 for (Object* current = old_map;
1828 !current->IsUndefined(); 1840 !current->IsUndefined();
1829 current = map->GetBackPointer()) { 1841 current = map->GetBackPointer()) {
1830 map = Map::cast(current); 1842 map = Map::cast(current);
1831 if (!map->HasTransitionArray()) break; 1843 if (!map->HasTransitionArray()) break;
1832 TransitionArray* transitions = map->transitions(); 1844 TransitionArray* transitions = map->transitions();
1833 if (transitions->descriptors_pointer() != old_pointer) break; 1845 if (transitions->descriptors_pointer() != old_pointer) break;
1846 map->SetEnumLength(Map::kInvalidEnumCache);
1834 transitions->set_descriptors_pointer(new_pointer); 1847 transitions->set_descriptors_pointer(new_pointer);
1835 } 1848 }
1836 new_map->ClearTransitions(GetHeap()); 1849 new_map->ClearTransitions(GetHeap());
1837 } 1850 }
1838 1851
1839 old_map->SetTransition(transition_index, new_map); 1852 old_map->SetTransition(transition_index, new_map);
1840 new_map->SetBackPointer(old_map); 1853 new_map->SetBackPointer(old_map);
1841 return result; 1854 return result;
1842 } 1855 }
1843 1856
(...skipping 11634 matching lines...) Expand 10 before | Expand all | Expand 10 after
13478 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13491 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13479 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13492 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13480 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13493 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13481 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13494 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13482 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13495 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13483 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13496 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13484 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13497 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13485 } 13498 }
13486 13499
13487 } } // namespace v8::internal 13500 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698