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 } | |
1812 for (Object* current = old_map; | 1809 for (Object* current = old_map; |
1813 !current->IsUndefined(); | 1810 !current->IsUndefined(); |
1814 current = map->GetBackPointer()) { | 1811 current = map->GetBackPointer()) { |
1815 map = Map::cast(current); | 1812 map = Map::cast(current); |
1816 if (!map->HasTransitionArray()) break; | 1813 if (!map->HasTransitionArray()) break; |
1817 TransitionArray* transitions = map->transitions(); | 1814 TransitionArray* transitions = map->transitions(); |
1818 if (transitions->descriptors() != old_descriptors) break; | 1815 if (transitions->descriptors() != old_descriptors) break; |
| 1816 map->SetEnumLength(Map::kInvalidEnumCache); |
1819 transitions->set_descriptors(new_descriptors); | 1817 transitions->set_descriptors(new_descriptors); |
1820 } | 1818 } |
1821 old_map->set_owns_descriptors(false); | 1819 old_map->set_owns_descriptors(false); |
1822 new_map->ClearTransitions(GetHeap()); | 1820 new_map->ClearTransitions(GetHeap()); |
1823 } | 1821 } |
1824 | 1822 |
1825 old_map->SetTransition(transition_index, new_map); | 1823 old_map->SetTransition(transition_index, new_map); |
1826 new_map->SetBackPointer(old_map); | 1824 new_map->SetBackPointer(old_map); |
1827 return result; | 1825 return result; |
1828 } | 1826 } |
(...skipping 11687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13516 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13514 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13517 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13515 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13518 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13516 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13519 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13517 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13520 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13518 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13521 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13519 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13522 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13520 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13523 } | 13521 } |
13524 | 13522 |
13525 } } // namespace v8::internal | 13523 } } // namespace v8::internal |
OLD | NEW |