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

Side by Side Diff: src/objects.cc

Issue 113197: Fix bug 344: always keep attributes of existing properties. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 7 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 | test/mjsunit/bugs/bug-334.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 return FastPropertyAtPut(result->GetFieldIndex(), value); 1729 return FastPropertyAtPut(result->GetFieldIndex(), value);
1730 case MAP_TRANSITION: 1730 case MAP_TRANSITION:
1731 if (attributes == result->GetAttributes()) { 1731 if (attributes == result->GetAttributes()) {
1732 // Only use map transition if the attributes match. 1732 // Only use map transition if the attributes match.
1733 return AddFastPropertyUsingMap(result->GetTransitionMap(), 1733 return AddFastPropertyUsingMap(result->GetTransitionMap(),
1734 name, 1734 name,
1735 value); 1735 value);
1736 } 1736 }
1737 return ConvertDescriptorToField(name, value, attributes); 1737 return ConvertDescriptorToField(name, value, attributes);
1738 case CONSTANT_FUNCTION: 1738 case CONSTANT_FUNCTION:
1739 // Only replace the function if necessary.
1739 if (value == result->GetConstantFunction()) return value; 1740 if (value == result->GetConstantFunction()) return value;
1740 // Only replace the function if necessary. 1741 // Preserve the attributes of this existing property.
1742 attributes = result->GetAttributes();
1741 return ConvertDescriptorToFieldAndMapTransition(name, value, attributes); 1743 return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
1742 case CALLBACKS: 1744 case CALLBACKS:
1743 return SetPropertyWithCallback(result->GetCallbackObject(), 1745 return SetPropertyWithCallback(result->GetCallbackObject(),
1744 name, 1746 name,
1745 value, 1747 value,
1746 result->holder()); 1748 result->holder());
1747 case INTERCEPTOR: 1749 case INTERCEPTOR:
1748 return SetPropertyWithInterceptor(name, value, attributes); 1750 return SetPropertyWithInterceptor(name, value, attributes);
1749 case CONSTANT_TRANSITION: 1751 case CONSTANT_TRANSITION:
1750 // Replace with a MAP_TRANSITION to a new map with a FIELD, even 1752 // Replace with a MAP_TRANSITION to a new map with a FIELD, even
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 return FastPropertyAtPut(result->GetFieldIndex(), value); 1812 return FastPropertyAtPut(result->GetFieldIndex(), value);
1811 case MAP_TRANSITION: 1813 case MAP_TRANSITION:
1812 if (attributes == result->GetAttributes()) { 1814 if (attributes == result->GetAttributes()) {
1813 // Only use map transition if the attributes match. 1815 // Only use map transition if the attributes match.
1814 return AddFastPropertyUsingMap(result->GetTransitionMap(), 1816 return AddFastPropertyUsingMap(result->GetTransitionMap(),
1815 name, 1817 name,
1816 value); 1818 value);
1817 } 1819 }
1818 return ConvertDescriptorToField(name, value, attributes); 1820 return ConvertDescriptorToField(name, value, attributes);
1819 case CONSTANT_FUNCTION: 1821 case CONSTANT_FUNCTION:
1822 // Only replace the function if necessary.
1820 if (value == result->GetConstantFunction()) return value; 1823 if (value == result->GetConstantFunction()) return value;
1821 // Only replace the function if necessary. 1824 // Preserve the attributes of this existing property.
1825 attributes = result->GetAttributes();
1822 return ConvertDescriptorToFieldAndMapTransition(name, value, attributes); 1826 return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
1823 case CALLBACKS: 1827 case CALLBACKS:
1824 case INTERCEPTOR: 1828 case INTERCEPTOR:
1825 // Override callback in clone 1829 // Override callback in clone
1826 return ConvertDescriptorToField(name, value, attributes); 1830 return ConvertDescriptorToField(name, value, attributes);
1827 case CONSTANT_TRANSITION: 1831 case CONSTANT_TRANSITION:
1828 // Replace with a MAP_TRANSITION to a new map with a FIELD, even 1832 // Replace with a MAP_TRANSITION to a new map with a FIELD, even
1829 // if the value is a function. 1833 // if the value is a function.
1830 return ConvertDescriptorToFieldAndMapTransition(name, value, attributes); 1834 return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
1831 case NULL_DESCRIPTOR: 1835 case NULL_DESCRIPTOR:
(...skipping 5669 matching lines...) Expand 10 before | Expand all | Expand 10 after
7501 // No break point. 7505 // No break point.
7502 if (break_point_objects()->IsUndefined()) return 0; 7506 if (break_point_objects()->IsUndefined()) return 0;
7503 // Single beak point. 7507 // Single beak point.
7504 if (!break_point_objects()->IsFixedArray()) return 1; 7508 if (!break_point_objects()->IsFixedArray()) return 1;
7505 // Multiple break points. 7509 // Multiple break points.
7506 return FixedArray::cast(break_point_objects())->length(); 7510 return FixedArray::cast(break_point_objects())->length();
7507 } 7511 }
7508 #endif 7512 #endif
7509 7513
7510 } } // namespace v8::internal 7514 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/bugs/bug-334.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698