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

Side by Side Diff: src/objects.h

Issue 7799026: Make proxies work as prototypes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing Kevin's comments. Created 9 years, 3 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/ic.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 String* key, 840 String* key,
841 PropertyAttributes* attributes); 841 PropertyAttributes* attributes);
842 MUST_USE_RESULT MaybeObject* GetProperty(Object* receiver, 842 MUST_USE_RESULT MaybeObject* GetProperty(Object* receiver,
843 LookupResult* result, 843 LookupResult* result,
844 String* key, 844 String* key,
845 PropertyAttributes* attributes); 845 PropertyAttributes* attributes);
846 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver, 846 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver,
847 Object* structure, 847 Object* structure,
848 String* name, 848 String* name,
849 Object* holder); 849 Object* holder);
850 MUST_USE_RESULT MaybeObject* GetPropertyWithHandler(Object* receiver,
851 String* name,
852 Object* handler);
853 MUST_USE_RESULT MaybeObject* GetPropertyWithDefinedGetter(Object* receiver, 850 MUST_USE_RESULT MaybeObject* GetPropertyWithDefinedGetter(Object* receiver,
854 JSFunction* getter); 851 JSFunction* getter);
855 852
856 inline MaybeObject* GetElement(uint32_t index); 853 inline MaybeObject* GetElement(uint32_t index);
857 // For use when we know that no exception can be thrown. 854 // For use when we know that no exception can be thrown.
858 inline Object* GetElementNoExceptionThrown(uint32_t index); 855 inline Object* GetElementNoExceptionThrown(uint32_t index);
859 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); 856 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index);
860 857
861 // Return the object's prototype (might be Heap::null_value()). 858 // Return the object's prototype (might be Heap::null_value()).
862 Object* GetPrototype(); 859 Object* GetPrototype();
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 // Can cause GC. 1378 // Can cause GC.
1382 MUST_USE_RESULT MaybeObject* SetProperty(String* key, 1379 MUST_USE_RESULT MaybeObject* SetProperty(String* key,
1383 Object* value, 1380 Object* value,
1384 PropertyAttributes attributes, 1381 PropertyAttributes attributes,
1385 StrictModeFlag strict_mode); 1382 StrictModeFlag strict_mode);
1386 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result, 1383 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result,
1387 String* key, 1384 String* key,
1388 Object* value, 1385 Object* value,
1389 PropertyAttributes attributes, 1386 PropertyAttributes attributes,
1390 StrictModeFlag strict_mode); 1387 StrictModeFlag strict_mode);
1388 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSFunction* setter,
1389 Object* value);
1391 1390
1392 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); 1391 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode);
1393 1392
1394 // Returns the class name ([[Class]] property in the specification). 1393 // Returns the class name ([[Class]] property in the specification).
1395 String* class_name(); 1394 String* class_name();
1396 1395
1397 // Returns the constructor name (the name (possibly, inferred name) of the 1396 // Returns the constructor name (the name (possibly, inferred name) of the
1398 // function that was used to instantiate the object). 1397 // function that was used to instantiate the object).
1399 String* constructor_name(); 1398 String* constructor_name();
1400 1399
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); 1518 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements();
1520 1519
1521 // Collects elements starting at index 0. 1520 // Collects elements starting at index 0.
1522 // Undefined values are placed after non-undefined values. 1521 // Undefined values are placed after non-undefined values.
1523 // Returns the number of non-undefined values. 1522 // Returns the number of non-undefined values.
1524 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); 1523 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit);
1525 // As PrepareElementsForSort, but only on objects where elements is 1524 // As PrepareElementsForSort, but only on objects where elements is
1526 // a dictionary, and it will stay a dictionary. 1525 // a dictionary, and it will stay a dictionary.
1527 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); 1526 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit);
1528 1527
1528 // Can cause GC.
1529 MUST_USE_RESULT MaybeObject* SetPropertyForResult(LookupResult* result, 1529 MUST_USE_RESULT MaybeObject* SetPropertyForResult(LookupResult* result,
1530 String* key, 1530 String* key,
1531 Object* value, 1531 Object* value,
1532 PropertyAttributes attributes, 1532 PropertyAttributes attributes,
1533 StrictModeFlag strict_mode); 1533 StrictModeFlag strict_mode);
1534 MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck( 1534 MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck(
1535 LookupResult* result, 1535 LookupResult* result,
1536 String* name, 1536 String* name,
1537 Object* value, 1537 Object* value,
1538 bool check_prototype, 1538 bool check_prototype,
1539 StrictModeFlag strict_mode); 1539 StrictModeFlag strict_mode);
1540 MUST_USE_RESULT MaybeObject* SetPropertyWithCallback( 1540 MUST_USE_RESULT MaybeObject* SetPropertyWithCallback(
1541 Object* structure, 1541 Object* structure,
1542 String* name, 1542 String* name,
1543 Object* value, 1543 Object* value,
1544 JSObject* holder, 1544 JSObject* holder,
1545 StrictModeFlag strict_mode); 1545 StrictModeFlag strict_mode);
1546 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSFunction* setter,
1547 Object* value);
1548 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor( 1546 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor(
1549 String* name, 1547 String* name,
1550 Object* value, 1548 Object* value,
1551 PropertyAttributes attributes, 1549 PropertyAttributes attributes,
1552 StrictModeFlag strict_mode); 1550 StrictModeFlag strict_mode);
1553 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor( 1551 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor(
1554 String* name, 1552 String* name,
1555 Object* value, 1553 Object* value,
1556 PropertyAttributes attributes, 1554 PropertyAttributes attributes,
1557 StrictModeFlag strict_mode); 1555 StrictModeFlag strict_mode);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 1764
1767 // Get the header size for a JSObject. Used to compute the index of 1765 // Get the header size for a JSObject. Used to compute the index of
1768 // internal fields as well as the number of internal fields. 1766 // internal fields as well as the number of internal fields.
1769 inline int GetHeaderSize(); 1767 inline int GetHeaderSize();
1770 1768
1771 inline int GetInternalFieldCount(); 1769 inline int GetInternalFieldCount();
1772 inline int GetInternalFieldOffset(int index); 1770 inline int GetInternalFieldOffset(int index);
1773 inline Object* GetInternalField(int index); 1771 inline Object* GetInternalField(int index);
1774 inline void SetInternalField(int index, Object* value); 1772 inline void SetInternalField(int index, Object* value);
1775 1773
1776 // Lookup a property. If found, the result is valid and has
1777 // detailed information.
1778 void LocalLookup(String* name, LookupResult* result);
1779
1780 // The following lookup functions skip interceptors. 1774 // The following lookup functions skip interceptors.
1781 void LocalLookupRealNamedProperty(String* name, LookupResult* result); 1775 void LocalLookupRealNamedProperty(String* name, LookupResult* result);
1782 void LookupRealNamedProperty(String* name, LookupResult* result); 1776 void LookupRealNamedProperty(String* name, LookupResult* result);
1783 void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result); 1777 void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result);
1784 void LookupCallbackSetterInPrototypes(String* name, LookupResult* result); 1778 void LookupCallbackSetterInPrototypes(String* name, LookupResult* result);
1785 MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes( 1779 MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes(
1786 uint32_t index, Object* value, bool* found, StrictModeFlag strict_mode); 1780 uint32_t index, Object* value, bool* found, StrictModeFlag strict_mode);
1787 void LookupCallback(String* name, LookupResult* result); 1781 void LookupCallback(String* name, LookupResult* result);
1788 1782
1789 // Returns the number of properties on this object filtering out properties 1783 // Returns the number of properties on this object filtering out properties
(...skipping 4792 matching lines...) Expand 10 before | Expand all | Expand 10 after
6582 class JSProxy: public JSReceiver { 6576 class JSProxy: public JSReceiver {
6583 public: 6577 public:
6584 // [handler]: The handler property. 6578 // [handler]: The handler property.
6585 DECL_ACCESSORS(handler, Object) 6579 DECL_ACCESSORS(handler, Object)
6586 6580
6587 // Casting. 6581 // Casting.
6588 static inline JSProxy* cast(Object* obj); 6582 static inline JSProxy* cast(Object* obj);
6589 6583
6590 bool HasPropertyWithHandler(String* name); 6584 bool HasPropertyWithHandler(String* name);
6591 6585
6586 MUST_USE_RESULT MaybeObject* GetPropertyWithHandler(
6587 Object* receiver,
6588 String* name);
6589
6592 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler( 6590 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler(
6593 String* name, 6591 String* name,
6594 Object* value, 6592 Object* value,
6595 PropertyAttributes attributes, 6593 PropertyAttributes attributes,
6596 StrictModeFlag strict_mode); 6594 StrictModeFlag strict_mode);
6597 6595
6598 MUST_USE_RESULT MaybeObject* DeletePropertyWithHandler( 6596 MUST_USE_RESULT MaybeObject* DeletePropertyWithHandler(
6599 String* name, 6597 String* name,
6600 DeleteMode mode); 6598 DeleteMode mode);
6601 6599
6602 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( 6600 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler(
6603 JSReceiver* receiver, 6601 JSReceiver* receiver,
6604 String* name, 6602 String* name);
6605 bool* has_exception);
6606 6603
6607 // Turn this into an (empty) JSObject. 6604 // Turn this into an (empty) JSObject.
6608 void Fix(); 6605 void Fix();
6609 6606
6610 // Initializes the body after the handler slot. 6607 // Initializes the body after the handler slot.
6611 inline void InitializeBody(int object_size, Object* value); 6608 inline void InitializeBody(int object_size, Object* value);
6612 6609
6610 // Invoke a trap by name. If the trap does not exist on this's handler,
6611 // but derived_trap is non-NULL, invoke that instead. May cause GC.
6612 Handle<Object> CallTrap(const char* name,
6613 Handle<Object> derived_trap,
6614 int argc,
6615 Handle<Object> args[]);
6616
6613 // Dispatched behavior. 6617 // Dispatched behavior.
6614 #ifdef OBJECT_PRINT 6618 #ifdef OBJECT_PRINT
6615 inline void JSProxyPrint() { 6619 inline void JSProxyPrint() {
6616 JSProxyPrint(stdout); 6620 JSProxyPrint(stdout);
6617 } 6621 }
6618 void JSProxyPrint(FILE* out); 6622 void JSProxyPrint(FILE* out);
6619 #endif 6623 #endif
6620 #ifdef DEBUG 6624 #ifdef DEBUG
6621 void JSProxyVerify(); 6625 void JSProxyVerify();
6622 #endif 6626 #endif
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
7351 } else { 7355 } else {
7352 value &= ~(1 << bit_position); 7356 value &= ~(1 << bit_position);
7353 } 7357 }
7354 return value; 7358 return value;
7355 } 7359 }
7356 }; 7360 };
7357 7361
7358 } } // namespace v8::internal 7362 } } // namespace v8::internal
7359 7363
7360 #endif // V8_OBJECTS_H_ 7364 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698