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 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 // descriptor array is returned to the smaller maps by installing a reduced | 1777 // descriptor array is returned to the smaller maps by installing a reduced |
1778 // copy of the descriptor array in the old_map. | 1778 // copy of the descriptor array in the old_map. |
1779 | 1779 |
1780 // This phase is executed before creating the new map since it requires | 1780 // This phase is executed before creating the new map since it requires |
1781 // allocation that may fail. | 1781 // allocation that may fail. |
1782 if (!old_target->StoresOwnDescriptors()) { | 1782 if (!old_target->StoresOwnDescriptors()) { |
1783 DescriptorArray* old_descriptors = old_map->instance_descriptors(); | 1783 DescriptorArray* old_descriptors = old_map->instance_descriptors(); |
1784 | 1784 |
1785 old_target->SetBackPointer(GetHeap()->undefined_value()); | 1785 old_target->SetBackPointer(GetHeap()->undefined_value()); |
1786 MaybeObject* maybe_failure = old_target->SetDescriptors(old_descriptors); | 1786 MaybeObject* maybe_failure = old_target->SetDescriptors(old_descriptors); |
| 1787 // Reset the backpointer before returning failure, otherwise the map ends up |
| 1788 // with an undefined backpointer and no descriptors, losing its own |
| 1789 // descriptors. Setting the backpointer always succeeds. |
| 1790 old_target->SetBackPointer(old_map); |
1787 if (maybe_failure->IsFailure()) return maybe_failure; | 1791 if (maybe_failure->IsFailure()) return maybe_failure; |
1788 old_target->SetBackPointer(old_map); | |
1789 | 1792 |
1790 old_map->set_owns_descriptors(true); | 1793 old_map->set_owns_descriptors(true); |
1791 } | 1794 } |
1792 | 1795 |
1793 MaybeObject* maybe_result = | 1796 MaybeObject* maybe_result = |
1794 ConvertDescriptorToField(name, new_value, attributes); | 1797 ConvertDescriptorToField(name, new_value, attributes); |
1795 if (!maybe_result->To(&result)) return maybe_result; | 1798 if (!maybe_result->To(&result)) return maybe_result; |
1796 | 1799 |
1797 if (!HasFastProperties()) return result; | 1800 if (!HasFastProperties()) return result; |
1798 | 1801 |
(...skipping 11703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13502 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13505 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13503 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13506 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13504 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13507 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13505 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13508 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13506 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13509 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13507 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13510 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13508 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13511 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13509 } | 13512 } |
13510 | 13513 |
13511 } } // namespace v8::internal | 13514 } } // namespace v8::internal |
OLD | NEW |