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

Side by Side Diff: src/objects.cc

Issue 6113004: Version 3.0.7 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 9 years, 11 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 | « src/objects.h ('k') | src/objects-debug.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 JSObject::cast(pt)->LocalLookupRealNamedProperty(name, result); 1816 JSObject::cast(pt)->LocalLookupRealNamedProperty(name, result);
1817 if (result->IsProperty() && (result->type() != INTERCEPTOR)) return; 1817 if (result->IsProperty() && (result->type() != INTERCEPTOR)) return;
1818 } 1818 }
1819 result->NotFound(); 1819 result->NotFound();
1820 } 1820 }
1821 1821
1822 1822
1823 // We only need to deal with CALLBACKS and INTERCEPTORS 1823 // We only need to deal with CALLBACKS and INTERCEPTORS
1824 MaybeObject* JSObject::SetPropertyWithFailedAccessCheck(LookupResult* result, 1824 MaybeObject* JSObject::SetPropertyWithFailedAccessCheck(LookupResult* result,
1825 String* name, 1825 String* name,
1826 Object* value) { 1826 Object* value,
1827 if (!result->IsProperty()) { 1827 bool check_prototype) {
1828 if (check_prototype && !result->IsProperty()) {
1828 LookupCallbackSetterInPrototypes(name, result); 1829 LookupCallbackSetterInPrototypes(name, result);
1829 } 1830 }
1830 1831
1831 if (result->IsProperty()) { 1832 if (result->IsProperty()) {
1832 if (!result->IsReadOnly()) { 1833 if (!result->IsReadOnly()) {
1833 switch (result->type()) { 1834 switch (result->type()) {
1834 case CALLBACKS: { 1835 case CALLBACKS: {
1835 Object* obj = result->GetCallbackObject(); 1836 Object* obj = result->GetCallbackObject();
1836 if (obj->IsAccessorInfo()) { 1837 if (obj->IsAccessorInfo()) {
1837 AccessorInfo* info = AccessorInfo::cast(obj); 1838 AccessorInfo* info = AccessorInfo::cast(obj);
1838 if (info->all_can_write()) { 1839 if (info->all_can_write()) {
1839 return SetPropertyWithCallback(result->GetCallbackObject(), 1840 return SetPropertyWithCallback(result->GetCallbackObject(),
1840 name, 1841 name,
1841 value, 1842 value,
1842 result->holder()); 1843 result->holder());
1843 } 1844 }
1844 } 1845 }
1845 break; 1846 break;
1846 } 1847 }
1847 case INTERCEPTOR: { 1848 case INTERCEPTOR: {
1848 // Try lookup real named properties. Note that only property can be 1849 // Try lookup real named properties. Note that only property can be
1849 // set is callbacks marked as ALL_CAN_WRITE on the prototype chain. 1850 // set is callbacks marked as ALL_CAN_WRITE on the prototype chain.
1850 LookupResult r; 1851 LookupResult r;
1851 LookupRealNamedProperty(name, &r); 1852 LookupRealNamedProperty(name, &r);
1852 if (r.IsProperty()) { 1853 if (r.IsProperty()) {
1853 return SetPropertyWithFailedAccessCheck(&r, name, value); 1854 return SetPropertyWithFailedAccessCheck(&r, name, value,
1855 check_prototype);
1854 } 1856 }
1855 break; 1857 break;
1856 } 1858 }
1857 default: { 1859 default: {
1858 break; 1860 break;
1859 } 1861 }
1860 } 1862 }
1861 } 1863 }
1862 } 1864 }
1863 1865
(...skipping 20 matching lines...) Expand all
1884 { MaybeObject* maybe_symbol_version = Heap::LookupSymbol(name); 1886 { MaybeObject* maybe_symbol_version = Heap::LookupSymbol(name);
1885 if (maybe_symbol_version->ToObject(&symbol_version)) { 1887 if (maybe_symbol_version->ToObject(&symbol_version)) {
1886 name = String::cast(symbol_version); 1888 name = String::cast(symbol_version);
1887 } 1889 }
1888 } 1890 }
1889 } 1891 }
1890 1892
1891 // Check access rights if needed. 1893 // Check access rights if needed.
1892 if (IsAccessCheckNeeded() 1894 if (IsAccessCheckNeeded()
1893 && !Top::MayNamedAccess(this, name, v8::ACCESS_SET)) { 1895 && !Top::MayNamedAccess(this, name, v8::ACCESS_SET)) {
1894 return SetPropertyWithFailedAccessCheck(result, name, value); 1896 return SetPropertyWithFailedAccessCheck(result, name, value, true);
1895 } 1897 }
1896 1898
1897 if (IsJSGlobalProxy()) { 1899 if (IsJSGlobalProxy()) {
1898 Object* proto = GetPrototype(); 1900 Object* proto = GetPrototype();
1899 if (proto->IsNull()) return value; 1901 if (proto->IsNull()) return value;
1900 ASSERT(proto->IsJSGlobalObject()); 1902 ASSERT(proto->IsJSGlobalObject());
1901 return JSObject::cast(proto)->SetProperty(result, name, value, attributes); 1903 return JSObject::cast(proto)->SetProperty(result, name, value, attributes);
1902 } 1904 }
1903 1905
1904 if (!result->IsProperty() && !IsJSContextExtensionObject()) { 1906 if (!result->IsProperty() && !IsJSContextExtensionObject()) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 return value; 1976 return value;
1975 } 1977 }
1976 1978
1977 1979
1978 // Set a real local property, even if it is READ_ONLY. If the property is not 1980 // Set a real local property, even if it is READ_ONLY. If the property is not
1979 // present, add it with attributes NONE. This code is an exact clone of 1981 // present, add it with attributes NONE. This code is an exact clone of
1980 // SetProperty, with the check for IsReadOnly and the check for a 1982 // SetProperty, with the check for IsReadOnly and the check for a
1981 // callback setter removed. The two lines looking up the LookupResult 1983 // callback setter removed. The two lines looking up the LookupResult
1982 // result are also added. If one of the functions is changed, the other 1984 // result are also added. If one of the functions is changed, the other
1983 // should be. 1985 // should be.
1984 MaybeObject* JSObject::IgnoreAttributesAndSetLocalProperty( 1986 MaybeObject* JSObject::SetLocalPropertyIgnoreAttributes(
1985 String* name, 1987 String* name,
1986 Object* value, 1988 Object* value,
1987 PropertyAttributes attributes) { 1989 PropertyAttributes attributes) {
1988 // Make sure that the top context does not change when doing callbacks or 1990 // Make sure that the top context does not change when doing callbacks or
1989 // interceptor calls. 1991 // interceptor calls.
1990 AssertNoContextChange ncc; 1992 AssertNoContextChange ncc;
1991 LookupResult result; 1993 LookupResult result;
1992 LocalLookup(name, &result); 1994 LocalLookup(name, &result);
1993 // Check access rights if needed. 1995 // Check access rights if needed.
1994 if (IsAccessCheckNeeded() 1996 if (IsAccessCheckNeeded()
1995 && !Top::MayNamedAccess(this, name, v8::ACCESS_SET)) { 1997 && !Top::MayNamedAccess(this, name, v8::ACCESS_SET)) {
1996 return SetPropertyWithFailedAccessCheck(&result, name, value); 1998 return SetPropertyWithFailedAccessCheck(&result, name, value, false);
1997 } 1999 }
1998 2000
1999 if (IsJSGlobalProxy()) { 2001 if (IsJSGlobalProxy()) {
2000 Object* proto = GetPrototype(); 2002 Object* proto = GetPrototype();
2001 if (proto->IsNull()) return value; 2003 if (proto->IsNull()) return value;
2002 ASSERT(proto->IsJSGlobalObject()); 2004 ASSERT(proto->IsJSGlobalObject());
2003 return JSObject::cast(proto)->IgnoreAttributesAndSetLocalProperty( 2005 return JSObject::cast(proto)->SetLocalPropertyIgnoreAttributes(
2004 name, 2006 name,
2005 value, 2007 value,
2006 attributes); 2008 attributes);
2007 } 2009 }
2008 2010
2009 // Check for accessor in prototype chain removed here in clone. 2011 // Check for accessor in prototype chain removed here in clone.
2010 if (!result.IsFound()) { 2012 if (!result.IsFound()) {
2011 // Neither properties nor transitions found. 2013 // Neither properties nor transitions found.
2012 return AddProperty(name, value, attributes); 2014 return AddProperty(name, value, attributes);
2013 } 2015 }
(...skipping 7852 matching lines...) Expand 10 before | Expand all | Expand 10 after
9866 if (break_point_objects()->IsUndefined()) return 0; 9868 if (break_point_objects()->IsUndefined()) return 0;
9867 // Single beak point. 9869 // Single beak point.
9868 if (!break_point_objects()->IsFixedArray()) return 1; 9870 if (!break_point_objects()->IsFixedArray()) return 1;
9869 // Multiple break points. 9871 // Multiple break points.
9870 return FixedArray::cast(break_point_objects())->length(); 9872 return FixedArray::cast(break_point_objects())->length();
9871 } 9873 }
9872 #endif 9874 #endif
9873 9875
9874 9876
9875 } } // namespace v8::internal 9877 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698