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

Side by Side Diff: src/objects.cc

Issue 10989076: Restore the descriptor array before returning allocation failure. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | « 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 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 // descriptor array is returned to the smaller maps by installing a reduced 1775 // descriptor array is returned to the smaller maps by installing a reduced
1776 // copy of the descriptor array in the old_map. 1776 // copy of the descriptor array in the old_map.
1777 1777
1778 // This phase is executed before creating the new map since it requires 1778 // This phase is executed before creating the new map since it requires
1779 // allocation that may fail. 1779 // allocation that may fail.
1780 if (!old_target->StoresOwnDescriptors()) { 1780 if (!old_target->StoresOwnDescriptors()) {
1781 DescriptorArray* old_descriptors = old_map->instance_descriptors(); 1781 DescriptorArray* old_descriptors = old_map->instance_descriptors();
1782 1782
1783 old_target->SetBackPointer(GetHeap()->undefined_value()); 1783 old_target->SetBackPointer(GetHeap()->undefined_value());
1784 MaybeObject* maybe_failure = old_target->SetDescriptors(old_descriptors); 1784 MaybeObject* maybe_failure = old_target->SetDescriptors(old_descriptors);
1785 // Reset the backpointer before returning failure, otherwise the map ends up
1786 // with an undefined backpointer and no descriptors, losing its own
1787 // descriptors. Setting the backpointer always succeeds.
1788 old_target->SetBackPointer(old_map);
1785 if (maybe_failure->IsFailure()) return maybe_failure; 1789 if (maybe_failure->IsFailure()) return maybe_failure;
1786 old_target->SetBackPointer(old_map);
1787 1790
1788 old_map->set_owns_descriptors(true); 1791 old_map->set_owns_descriptors(true);
1789 } 1792 }
1790 1793
1791 MaybeObject* maybe_result = 1794 MaybeObject* maybe_result =
1792 ConvertDescriptorToField(name, new_value, attributes); 1795 ConvertDescriptorToField(name, new_value, attributes);
1793 if (!maybe_result->To(&result)) return maybe_result; 1796 if (!maybe_result->To(&result)) return maybe_result;
1794 1797
1795 if (!HasFastProperties()) return result; 1798 if (!HasFastProperties()) return result;
1796 1799
(...skipping 11748 matching lines...) Expand 10 before | Expand all | Expand 10 after
13545 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13548 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13546 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13549 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13547 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13550 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13548 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13551 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13549 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13552 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13550 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13553 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13551 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13554 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13552 } 13555 }
13553 13556
13554 } } // namespace v8::internal 13557 } } // 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