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

Side by Side Diff: src/objects.h

Issue 8914: Add support for API accessors that prohibit overwriting by accessors... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 1 month 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 // Lookup a property. If found, the result is valid and has 1273 // Lookup a property. If found, the result is valid and has
1274 // detailed information. 1274 // detailed information.
1275 void LocalLookup(String* name, LookupResult* result); 1275 void LocalLookup(String* name, LookupResult* result);
1276 void Lookup(String* name, LookupResult* result); 1276 void Lookup(String* name, LookupResult* result);
1277 1277
1278 // The following lookup functions skip interceptors. 1278 // The following lookup functions skip interceptors.
1279 void LocalLookupRealNamedProperty(String* name, LookupResult* result); 1279 void LocalLookupRealNamedProperty(String* name, LookupResult* result);
1280 void LookupRealNamedProperty(String* name, LookupResult* result); 1280 void LookupRealNamedProperty(String* name, LookupResult* result);
1281 void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result); 1281 void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result);
1282 void LookupCallbackSetterInPrototypes(String* name, LookupResult* result); 1282 void LookupCallbackSetterInPrototypes(String* name, LookupResult* result);
1283 void LookupCallback(String* name, LookupResult* result);
1283 1284
1284 // Returns the number of properties on this object filtering out properties 1285 // Returns the number of properties on this object filtering out properties
1285 // with the specified attributes (ignoring interceptors). 1286 // with the specified attributes (ignoring interceptors).
1286 int NumberOfLocalProperties(PropertyAttributes filter); 1287 int NumberOfLocalProperties(PropertyAttributes filter);
1287 // Returns the number of enumerable properties (ignoring interceptors). 1288 // Returns the number of enumerable properties (ignoring interceptors).
1288 int NumberOfEnumProperties(); 1289 int NumberOfEnumProperties();
1289 // Fill in details for properties into storage. 1290 // Fill in details for properties into storage.
1290 void GetLocalPropertyNames(FixedArray* storage); 1291 void GetLocalPropertyNames(FixedArray* storage);
1291 1292
1292 // Returns the number of properties on this object filtering out properties 1293 // Returns the number of properties on this object filtering out properties
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 inline void set_has_instance_call_handler() { 2358 inline void set_has_instance_call_handler() {
2358 set_bit_field(bit_field() | (1 << kHasInstanceCallHandler)); 2359 set_bit_field(bit_field() | (1 << kHasInstanceCallHandler));
2359 } 2360 }
2360 2361
2361 inline bool has_instance_call_handler() { 2362 inline bool has_instance_call_handler() {
2362 return ((1 << kHasInstanceCallHandler) & bit_field()) != 0; 2363 return ((1 << kHasInstanceCallHandler) & bit_field()) != 0;
2363 } 2364 }
2364 2365
2365 // Tells whether the instance needs security checks when accessing its 2366 // Tells whether the instance needs security checks when accessing its
2366 // properties. 2367 // properties.
2367 inline void set_is_access_check_needed() { 2368 inline void set_is_access_check_needed(bool access_check_needed);
2368 set_bit_field(bit_field() | (1 << kIsAccessCheckNeeded)); 2369 inline bool is_access_check_needed();
2369 }
2370
2371 inline bool is_access_check_needed() {
2372 return ((1 << kIsAccessCheckNeeded) & bit_field()) != 0;
2373 }
2374 2370
2375 // [prototype]: implicit prototype object. 2371 // [prototype]: implicit prototype object.
2376 DECL_ACCESSORS(prototype, Object) 2372 DECL_ACCESSORS(prototype, Object)
2377 2373
2378 // [constructor]: points back to the function responsible for this map. 2374 // [constructor]: points back to the function responsible for this map.
2379 DECL_ACCESSORS(constructor, Object) 2375 DECL_ACCESSORS(constructor, Object)
2380 2376
2381 // [instance descriptors]: describes the object. 2377 // [instance descriptors]: describes the object.
2382 DECL_ACCESSORS(instance_descriptors, DescriptorArray) 2378 DECL_ACCESSORS(instance_descriptors, DescriptorArray)
2383 2379
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
3710 DECL_ACCESSORS(data, Object) 3706 DECL_ACCESSORS(data, Object)
3711 DECL_ACCESSORS(name, Object) 3707 DECL_ACCESSORS(name, Object)
3712 DECL_ACCESSORS(flag, Smi) 3708 DECL_ACCESSORS(flag, Smi)
3713 3709
3714 inline bool all_can_read(); 3710 inline bool all_can_read();
3715 inline void set_all_can_read(bool value); 3711 inline void set_all_can_read(bool value);
3716 3712
3717 inline bool all_can_write(); 3713 inline bool all_can_write();
3718 inline void set_all_can_write(bool value); 3714 inline void set_all_can_write(bool value);
3719 3715
3716 inline bool prohibits_overwriting();
3717 inline void set_prohibits_overwriting(bool value);
3718
3720 inline PropertyAttributes property_attributes(); 3719 inline PropertyAttributes property_attributes();
3721 inline void set_property_attributes(PropertyAttributes attributes); 3720 inline void set_property_attributes(PropertyAttributes attributes);
3722 3721
3723 static inline AccessorInfo* cast(Object* obj); 3722 static inline AccessorInfo* cast(Object* obj);
3724 3723
3725 #ifdef DEBUG 3724 #ifdef DEBUG
3726 void AccessorInfoPrint(); 3725 void AccessorInfoPrint();
3727 void AccessorInfoVerify(); 3726 void AccessorInfoVerify();
3728 #endif 3727 #endif
3729 3728
3730 static const int kGetterOffset = HeapObject::kHeaderSize; 3729 static const int kGetterOffset = HeapObject::kHeaderSize;
3731 static const int kSetterOffset = kGetterOffset + kPointerSize; 3730 static const int kSetterOffset = kGetterOffset + kPointerSize;
3732 static const int kDataOffset = kSetterOffset + kPointerSize; 3731 static const int kDataOffset = kSetterOffset + kPointerSize;
3733 static const int kNameOffset = kDataOffset + kPointerSize; 3732 static const int kNameOffset = kDataOffset + kPointerSize;
3734 static const int kFlagOffset = kNameOffset + kPointerSize; 3733 static const int kFlagOffset = kNameOffset + kPointerSize;
3735 static const int kSize = kFlagOffset + kPointerSize; 3734 static const int kSize = kFlagOffset + kPointerSize;
3736 3735
3737 private: 3736 private:
3738 // Bit positions in flag. 3737 // Bit positions in flag.
3739 static const int kAllCanReadBit = 0; 3738 static const int kAllCanReadBit = 0;
3740 static const int kAllCanWriteBit = 1; 3739 static const int kAllCanWriteBit = 1;
3741 class AttributesField: public BitField<PropertyAttributes, 2, 3> {}; 3740 static const int kProhibitsOverwritingBit = 2;
3741 class AttributesField: public BitField<PropertyAttributes, 3, 3> {};
3742 3742
3743 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo); 3743 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorInfo);
3744 }; 3744 };
3745 3745
3746 3746
3747 class AccessCheckInfo: public Struct { 3747 class AccessCheckInfo: public Struct {
3748 public: 3748 public:
3749 DECL_ACCESSORS(named_callback, Object) 3749 DECL_ACCESSORS(named_callback, Object)
3750 DECL_ACCESSORS(indexed_callback, Object) 3750 DECL_ACCESSORS(indexed_callback, Object)
3751 DECL_ACCESSORS(data, Object) 3751 DECL_ACCESSORS(data, Object)
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
4133 } else { 4133 } else {
4134 value &= ~(1 << bit_position); 4134 value &= ~(1 << bit_position);
4135 } 4135 }
4136 return value; 4136 return value;
4137 } 4137 }
4138 }; 4138 };
4139 4139
4140 } } // namespace v8::internal 4140 } } // namespace v8::internal
4141 4141
4142 #endif // V8_OBJECTS_H_ 4142 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698