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

Side by Side Diff: src/objects.h

Issue 2123012: Allow to define accessors on objects. (Closed)
Patch Set: Last round of comments Created 10 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
« no previous file with comments | « src/handles.cc ('k') | src/objects.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 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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 1241
1242 inline PropertyAttributes GetPropertyAttribute(String* name); 1242 inline PropertyAttributes GetPropertyAttribute(String* name);
1243 PropertyAttributes GetPropertyAttributeWithReceiver(JSObject* receiver, 1243 PropertyAttributes GetPropertyAttributeWithReceiver(JSObject* receiver,
1244 String* name); 1244 String* name);
1245 PropertyAttributes GetLocalPropertyAttribute(String* name); 1245 PropertyAttributes GetLocalPropertyAttribute(String* name);
1246 1246
1247 Object* DefineAccessor(String* name, bool is_getter, JSFunction* fun, 1247 Object* DefineAccessor(String* name, bool is_getter, JSFunction* fun,
1248 PropertyAttributes attributes); 1248 PropertyAttributes attributes);
1249 Object* LookupAccessor(String* name, bool is_getter); 1249 Object* LookupAccessor(String* name, bool is_getter);
1250 1250
1251 Object* DefineAccessor(AccessorInfo* info);
1252
1251 // Used from Object::GetProperty(). 1253 // Used from Object::GetProperty().
1252 Object* GetPropertyWithFailedAccessCheck(Object* receiver, 1254 Object* GetPropertyWithFailedAccessCheck(Object* receiver,
1253 LookupResult* result, 1255 LookupResult* result,
1254 String* name, 1256 String* name,
1255 PropertyAttributes* attributes); 1257 PropertyAttributes* attributes);
1256 Object* GetPropertyWithInterceptor(JSObject* receiver, 1258 Object* GetPropertyWithInterceptor(JSObject* receiver,
1257 String* name, 1259 String* name,
1258 PropertyAttributes* attributes); 1260 PropertyAttributes* attributes);
1259 Object* GetPropertyPostInterceptor(JSObject* receiver, 1261 Object* GetPropertyPostInterceptor(JSObject* receiver,
1260 String* name, 1262 String* name,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 // Lookup a property. If found, the result is valid and has 1365 // Lookup a property. If found, the result is valid and has
1364 // detailed information. 1366 // detailed information.
1365 void LocalLookup(String* name, LookupResult* result); 1367 void LocalLookup(String* name, LookupResult* result);
1366 void Lookup(String* name, LookupResult* result); 1368 void Lookup(String* name, LookupResult* result);
1367 1369
1368 // The following lookup functions skip interceptors. 1370 // The following lookup functions skip interceptors.
1369 void LocalLookupRealNamedProperty(String* name, LookupResult* result); 1371 void LocalLookupRealNamedProperty(String* name, LookupResult* result);
1370 void LookupRealNamedProperty(String* name, LookupResult* result); 1372 void LookupRealNamedProperty(String* name, LookupResult* result);
1371 void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result); 1373 void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result);
1372 void LookupCallbackSetterInPrototypes(String* name, LookupResult* result); 1374 void LookupCallbackSetterInPrototypes(String* name, LookupResult* result);
1373 Object* LookupCallbackSetterInPrototypes(uint32_t index); 1375 bool SetElementWithCallbackSetterInPrototypes(uint32_t index, Object* value);
1374 void LookupCallback(String* name, LookupResult* result); 1376 void LookupCallback(String* name, LookupResult* result);
1375 1377
1376 // Returns the number of properties on this object filtering out properties 1378 // Returns the number of properties on this object filtering out properties
1377 // with the specified attributes (ignoring interceptors). 1379 // with the specified attributes (ignoring interceptors).
1378 int NumberOfLocalProperties(PropertyAttributes filter); 1380 int NumberOfLocalProperties(PropertyAttributes filter);
1379 // Returns the number of enumerable properties (ignoring interceptors). 1381 // Returns the number of enumerable properties (ignoring interceptors).
1380 int NumberOfEnumProperties(); 1382 int NumberOfEnumProperties();
1381 // Fill in details for properties into storage starting at the specified 1383 // Fill in details for properties into storage starting at the specified
1382 // index. 1384 // index.
1383 void GetLocalPropertyNames(FixedArray* storage, int index); 1385 void GetLocalPropertyNames(FixedArray* storage, int index);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 // Layout description. 1534 // Layout description.
1533 static const int kPropertiesOffset = HeapObject::kHeaderSize; 1535 static const int kPropertiesOffset = HeapObject::kHeaderSize;
1534 static const int kElementsOffset = kPropertiesOffset + kPointerSize; 1536 static const int kElementsOffset = kPropertiesOffset + kPointerSize;
1535 static const int kHeaderSize = kElementsOffset + kPointerSize; 1537 static const int kHeaderSize = kElementsOffset + kPointerSize;
1536 1538
1537 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize); 1539 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize);
1538 1540
1539 Object* GetElementWithInterceptor(JSObject* receiver, uint32_t index); 1541 Object* GetElementWithInterceptor(JSObject* receiver, uint32_t index);
1540 1542
1541 private: 1543 private:
1544 Object* GetElementWithCallback(Object* receiver,
1545 Object* structure,
1546 uint32_t index,
1547 Object* holder);
1548 Object* SetElementWithCallback(Object* structure,
1549 uint32_t index,
1550 Object* value,
1551 JSObject* holder);
1542 Object* SetElementWithInterceptor(uint32_t index, Object* value); 1552 Object* SetElementWithInterceptor(uint32_t index, Object* value);
1543 Object* SetElementWithoutInterceptor(uint32_t index, Object* value); 1553 Object* SetElementWithoutInterceptor(uint32_t index, Object* value);
1544 1554
1545 Object* GetElementPostInterceptor(JSObject* receiver, uint32_t index); 1555 Object* GetElementPostInterceptor(JSObject* receiver, uint32_t index);
1546 1556
1547 Object* DeletePropertyPostInterceptor(String* name, DeleteMode mode); 1557 Object* DeletePropertyPostInterceptor(String* name, DeleteMode mode);
1548 Object* DeletePropertyWithInterceptor(String* name); 1558 Object* DeletePropertyWithInterceptor(String* name);
1549 1559
1550 Object* DeleteElementPostInterceptor(uint32_t index, DeleteMode mode); 1560 Object* DeleteElementPostInterceptor(uint32_t index, DeleteMode mode);
1551 Object* DeleteElementWithInterceptor(uint32_t index); 1561 Object* DeleteElementWithInterceptor(uint32_t index);
(...skipping 10 matching lines...) Expand all
1562 String* name, 1572 String* name,
1563 bool continue_search); 1573 bool continue_search);
1564 PropertyAttributes GetPropertyAttribute(JSObject* receiver, 1574 PropertyAttributes GetPropertyAttribute(JSObject* receiver,
1565 LookupResult* result, 1575 LookupResult* result,
1566 String* name, 1576 String* name,
1567 bool continue_search); 1577 bool continue_search);
1568 1578
1569 // Returns true if most of the elements backing storage is used. 1579 // Returns true if most of the elements backing storage is used.
1570 bool HasDenseElements(); 1580 bool HasDenseElements();
1571 1581
1582 bool CanSetCallback(String* name);
1583 Object* SetElementCallback(uint32_t index,
1584 Object* structure,
1585 PropertyAttributes attributes);
1586 Object* SetPropertyCallback(String* name,
1587 Object* structure,
1588 PropertyAttributes attributes);
1572 Object* DefineGetterSetter(String* name, PropertyAttributes attributes); 1589 Object* DefineGetterSetter(String* name, PropertyAttributes attributes);
1573 1590
1574 void LookupInDescriptor(String* name, LookupResult* result); 1591 void LookupInDescriptor(String* name, LookupResult* result);
1575 1592
1576 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); 1593 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject);
1577 }; 1594 };
1578 1595
1579 1596
1580 // Abstract super class arrays. It provides length behavior. 1597 // Abstract super class arrays. It provides length behavior.
1581 class Array: public HeapObject { 1598 class Array: public HeapObject {
(...skipping 3581 matching lines...) Expand 10 before | Expand all | Expand 10 after
5163 } else { 5180 } else {
5164 value &= ~(1 << bit_position); 5181 value &= ~(1 << bit_position);
5165 } 5182 }
5166 return value; 5183 return value;
5167 } 5184 }
5168 }; 5185 };
5169 5186
5170 } } // namespace v8::internal 5187 } } // namespace v8::internal
5171 5188
5172 #endif // V8_OBJECTS_H_ 5189 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698