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

Side by Side Diff: src/objects.cc

Issue 88026: Added ForceSet on objects (Closed)
Patch Set: Added docs for ForceSet Created 11 years, 8 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
« include/v8.h ('K') | « src/handles.cc ('k') | src/runtime.h » ('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 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after
1776 // ADDED TO CLONE 1776 // ADDED TO CLONE
1777 LookupResult result_struct; 1777 LookupResult result_struct;
1778 LocalLookup(name, &result_struct); 1778 LocalLookup(name, &result_struct);
1779 LookupResult* result = &result_struct; 1779 LookupResult* result = &result_struct;
1780 // END ADDED TO CLONE 1780 // END ADDED TO CLONE
1781 // Check access rights if needed. 1781 // Check access rights if needed.
1782 if (IsAccessCheckNeeded() 1782 if (IsAccessCheckNeeded()
1783 && !Top::MayNamedAccess(this, name, v8::ACCESS_SET)) { 1783 && !Top::MayNamedAccess(this, name, v8::ACCESS_SET)) {
1784 return SetPropertyWithFailedAccessCheck(result, name, value); 1784 return SetPropertyWithFailedAccessCheck(result, name, value);
1785 } 1785 }
1786
1787 if (IsJSGlobalProxy()) {
1788 Object* proto = GetPrototype();
1789 if (proto->IsNull()) return value;
1790 ASSERT(proto->IsJSGlobalObject());
1791 return JSObject::cast(proto)->IgnoreAttributesAndSetLocalProperty(
1792 name,
1793 value,
1794 attributes);
1795 }
1796
1786 // Check for accessor in prototype chain removed here in clone. 1797 // Check for accessor in prototype chain removed here in clone.
1787 if (result->IsNotFound()) { 1798 if (result->IsNotFound()) {
1788 return AddProperty(name, value, attributes); 1799 return AddProperty(name, value, attributes);
1789 } 1800 }
1790 if (!result->IsLoaded()) { 1801 if (!result->IsLoaded()) {
1791 return SetLazyProperty(result, name, value, attributes); 1802 return SetLazyProperty(result, name, value, attributes);
1792 } 1803 }
1793 // Check of IsReadOnly removed from here in clone. 1804 // Check of IsReadOnly removed from here in clone.
1794 switch (result->type()) { 1805 switch (result->type()) {
1795 case NORMAL: 1806 case NORMAL:
1796 property_dictionary()->ValueAtPut(result->GetDictionaryEntry(), value); 1807 property_dictionary()->ValueAtPut(result->GetDictionaryEntry(), value);
1797 return value; 1808 return value;
1798 case FIELD: 1809 case FIELD:
1799 return FastPropertyAtPut(result->GetFieldIndex(), value); 1810 return FastPropertyAtPut(result->GetFieldIndex(), value);
1800 case MAP_TRANSITION: 1811 case MAP_TRANSITION:
1801 if (attributes == result->GetAttributes()) { 1812 if (attributes == result->GetAttributes()) {
1802 // Only use map transition if the attributes match. 1813 // Only use map transition if the attributes match.
1803 return AddFastPropertyUsingMap(result->GetTransitionMap(), 1814 return AddFastPropertyUsingMap(result->GetTransitionMap(),
1804 name, 1815 name,
1805 value); 1816 value);
1806 } else {
1807 return ConvertDescriptorToField(name, value, attributes);
1808 } 1817 }
1818 return ConvertDescriptorToField(name, value, attributes);
1809 case CONSTANT_FUNCTION: 1819 case CONSTANT_FUNCTION:
1810 if (value == result->GetConstantFunction()) return value; 1820 if (value == result->GetConstantFunction()) return value;
1811 // Only replace the function if necessary. 1821 // Only replace the function if necessary.
1812 return ConvertDescriptorToFieldAndMapTransition(name, value, attributes); 1822 return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
1813 case CALLBACKS: 1823 case CALLBACKS: case INTERCEPTOR:
Mads Ager (chromium) 2009/04/21 13:24:16 Two lines?
1814 return SetPropertyWithCallback(result->GetCallbackObject(), 1824 // Override callback in clone
1815 name, 1825 return ConvertDescriptorToField(name, value, attributes);
1816 value,
1817 result->holder());
1818 case INTERCEPTOR:
1819 return SetPropertyWithInterceptor(name, value, attributes);
1820 case CONSTANT_TRANSITION: 1826 case CONSTANT_TRANSITION:
1821 // Replace with a MAP_TRANSITION to a new map with a FIELD, even 1827 // Replace with a MAP_TRANSITION to a new map with a FIELD, even
1822 // if the value is a function. 1828 // if the value is a function.
1823 return ConvertDescriptorToFieldAndMapTransition(name, value, attributes); 1829 return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
1824 case NULL_DESCRIPTOR: 1830 case NULL_DESCRIPTOR:
1825 return ConvertDescriptorToFieldAndMapTransition(name, value, attributes); 1831 return ConvertDescriptorToFieldAndMapTransition(name, value, attributes);
1826 default: 1832 default:
1827 UNREACHABLE(); 1833 UNREACHABLE();
1828 } 1834 }
1829 UNREACHABLE(); 1835 UNREACHABLE();
(...skipping 5578 matching lines...) Expand 10 before | Expand all | Expand 10 after
7408 // No break point. 7414 // No break point.
7409 if (break_point_objects()->IsUndefined()) return 0; 7415 if (break_point_objects()->IsUndefined()) return 0;
7410 // Single beak point. 7416 // Single beak point.
7411 if (!break_point_objects()->IsFixedArray()) return 1; 7417 if (!break_point_objects()->IsFixedArray()) return 1;
7412 // Multiple break points. 7418 // Multiple break points.
7413 return FixedArray::cast(break_point_objects())->length(); 7419 return FixedArray::cast(break_point_objects())->length();
7414 } 7420 }
7415 #endif 7421 #endif
7416 7422
7417 } } // namespace v8::internal 7423 } } // namespace v8::internal
OLDNEW
« include/v8.h ('K') | « src/handles.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698