| 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 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 bool owned_descriptors = old_map->owns_descriptors(); | 1799 bool owned_descriptors = old_map->owns_descriptors(); |
| 1800 if (owned_descriptors || | 1800 if (owned_descriptors || |
| 1801 old_target->instance_descriptors() == old_map->instance_descriptors()) { | 1801 old_target->instance_descriptors() == old_map->instance_descriptors()) { |
| 1802 // Since the conversion above generated a new fast map with an additional | 1802 // Since the conversion above generated a new fast map with an additional |
| 1803 // property which can be shared as well, install this descriptor pointer | 1803 // property which can be shared as well, install this descriptor pointer |
| 1804 // along the entire chain of smaller maps; and remove the transition array | 1804 // along the entire chain of smaller maps; and remove the transition array |
| 1805 // that is only in place to hold the descriptor array in the new map. | 1805 // that is only in place to hold the descriptor array in the new map. |
| 1806 Map* map; | 1806 Map* map; |
| 1807 DescriptorArray* new_descriptors = new_map->instance_descriptors(); | 1807 DescriptorArray* new_descriptors = new_map->instance_descriptors(); |
| 1808 DescriptorArray* old_descriptors = old_map->instance_descriptors(); | 1808 DescriptorArray* old_descriptors = old_map->instance_descriptors(); |
| 1809 if (old_descriptors->HasEnumCache()) { |
| 1810 new_descriptors->CopyEnumCacheFrom(old_descriptors); |
| 1811 } |
| 1809 for (Object* current = old_map; | 1812 for (Object* current = old_map; |
| 1810 !current->IsUndefined(); | 1813 !current->IsUndefined(); |
| 1811 current = map->GetBackPointer()) { | 1814 current = map->GetBackPointer()) { |
| 1812 map = Map::cast(current); | 1815 map = Map::cast(current); |
| 1813 if (!map->HasTransitionArray()) break; | 1816 if (!map->HasTransitionArray()) break; |
| 1814 TransitionArray* transitions = map->transitions(); | 1817 TransitionArray* transitions = map->transitions(); |
| 1815 if (transitions->descriptors() != old_descriptors) break; | 1818 if (transitions->descriptors() != old_descriptors) break; |
| 1816 // Invalidate the enum caches only if the map did not own its descriptors. | |
| 1817 if (!owned_descriptors) map->SetEnumLength(Map::kInvalidEnumCache); | |
| 1818 transitions->set_descriptors(new_descriptors); | 1819 transitions->set_descriptors(new_descriptors); |
| 1819 } | 1820 } |
| 1820 old_map->set_owns_descriptors(false); | 1821 old_map->set_owns_descriptors(false); |
| 1821 new_map->ClearTransitions(GetHeap()); | 1822 new_map->ClearTransitions(GetHeap()); |
| 1822 } | 1823 } |
| 1823 | 1824 |
| 1824 old_map->SetTransition(transition_index, new_map); | 1825 old_map->SetTransition(transition_index, new_map); |
| 1825 new_map->SetBackPointer(old_map); | 1826 new_map->SetBackPointer(old_map); |
| 1826 return result; | 1827 return result; |
| 1827 } | 1828 } |
| (...skipping 11680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13508 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13509 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
| 13509 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13510 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
| 13510 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13511 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
| 13511 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13512 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
| 13512 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13513 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
| 13513 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13514 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
| 13514 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13515 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
| 13515 } | 13516 } |
| 13516 | 13517 |
| 13517 } } // namespace v8::internal | 13518 } } // namespace v8::internal |
| OLD | NEW |