OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 MUST_USE_RESULT MaybeObject* ToObject(Context* native_context); | 1526 MUST_USE_RESULT MaybeObject* ToObject(Context* native_context); |
1527 | 1527 |
1528 // Converts this to a Smi if possible. | 1528 // Converts this to a Smi if possible. |
1529 // Failure is returned otherwise. | 1529 // Failure is returned otherwise. |
1530 static MUST_USE_RESULT inline Handle<Object> ToSmi(Isolate* isolate, | 1530 static MUST_USE_RESULT inline Handle<Object> ToSmi(Isolate* isolate, |
1531 Handle<Object> object); | 1531 Handle<Object> object); |
1532 MUST_USE_RESULT inline MaybeObject* ToSmi(); | 1532 MUST_USE_RESULT inline MaybeObject* ToSmi(); |
1533 | 1533 |
1534 void Lookup(Name* name, LookupResult* result); | 1534 void Lookup(Name* name, LookupResult* result); |
1535 | 1535 |
| 1536 // Property access. |
| 1537 MUST_USE_RESULT inline MaybeObject* GetProperty(Name* key); |
| 1538 |
| 1539 // TODO(yangguo): this should eventually replace the non-handlified version. |
1536 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithReceiver( | 1540 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithReceiver( |
1537 Handle<Object> object, | 1541 Handle<Object> object, |
1538 Handle<Object> receiver, | 1542 Handle<Object> receiver, |
1539 Handle<Name> name, | 1543 Handle<Name> name, |
1540 PropertyAttributes* attributes); | 1544 PropertyAttributes* attributes); |
1541 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( | 1545 MUST_USE_RESULT MaybeObject* GetPropertyWithReceiver( |
| 1546 Object* receiver, |
| 1547 Name* key, |
| 1548 PropertyAttributes* attributes); |
| 1549 |
| 1550 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyOrElement( |
1542 Handle<Object> object, | 1551 Handle<Object> object, |
1543 Handle<Name> key); | 1552 Handle<Name> key); |
1544 | 1553 |
1545 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1554 static Handle<Object> GetProperty(Handle<Object> object, |
1546 Handle<Object> object, | 1555 Handle<Name> key); |
1547 Handle<Name> key); | |
1548 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( | 1556 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( |
1549 Handle<Object> object, | 1557 Handle<Object> object, |
1550 Handle<Object> receiver, | 1558 Handle<Object> receiver, |
1551 LookupResult* result, | 1559 LookupResult* result, |
1552 Handle<Name> key, | 1560 Handle<Name> key, |
1553 PropertyAttributes* attributes); | 1561 PropertyAttributes* attributes); |
1554 | 1562 |
| 1563 MUST_USE_RESULT MaybeObject* GetProperty(Object* receiver, |
| 1564 LookupResult* result, |
| 1565 Name* key, |
| 1566 PropertyAttributes* attributes); |
| 1567 |
1555 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( | 1568 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( |
1556 Handle<Object> object, | 1569 Handle<Object> object, |
1557 Handle<Object> receiver, | 1570 Handle<Object> receiver, |
1558 Handle<JSReceiver> getter); | 1571 Handle<JSReceiver> getter); |
1559 | 1572 |
1560 MUST_USE_RESULT static inline MaybeHandle<Object> GetElement( | 1573 MUST_USE_RESULT static inline MaybeHandle<Object> GetElement( |
1561 Isolate* isolate, | 1574 Isolate* isolate, |
1562 Handle<Object> object, | 1575 Handle<Object> object, |
1563 uint32_t index); | 1576 uint32_t index); |
1564 | 1577 |
| 1578 // For use when we know that no exception can be thrown. |
| 1579 static inline Handle<Object> GetElementNoExceptionThrown( |
| 1580 Isolate* isolate, |
| 1581 Handle<Object> object, |
| 1582 uint32_t index); |
| 1583 |
1565 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithReceiver( | 1584 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithReceiver( |
1566 Isolate* isolate, | 1585 Isolate* isolate, |
1567 Handle<Object> object, | 1586 Handle<Object> object, |
1568 Handle<Object> receiver, | 1587 Handle<Object> receiver, |
1569 uint32_t index); | 1588 uint32_t index); |
1570 | 1589 |
1571 // Return the object's prototype (might be Heap::null_value()). | 1590 // Return the object's prototype (might be Heap::null_value()). |
1572 Object* GetPrototype(Isolate* isolate); | 1591 Object* GetPrototype(Isolate* isolate); |
1573 Map* GetMarkerMap(Isolate* isolate); | 1592 Map* GetMarkerMap(Isolate* isolate); |
1574 | 1593 |
(...skipping 6208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7783 | 7802 |
7784 // [global context]: the most recent (i.e. innermost) global context. | 7803 // [global context]: the most recent (i.e. innermost) global context. |
7785 DECL_ACCESSORS(global_context, Context) | 7804 DECL_ACCESSORS(global_context, Context) |
7786 | 7805 |
7787 // [global receiver]: the global receiver object of the context | 7806 // [global receiver]: the global receiver object of the context |
7788 DECL_ACCESSORS(global_receiver, JSObject) | 7807 DECL_ACCESSORS(global_receiver, JSObject) |
7789 | 7808 |
7790 // Retrieve the property cell used to store a property. | 7809 // Retrieve the property cell used to store a property. |
7791 PropertyCell* GetPropertyCell(LookupResult* result); | 7810 PropertyCell* GetPropertyCell(LookupResult* result); |
7792 | 7811 |
| 7812 // This is like GetProperty, but is used when you know the lookup won't fail |
| 7813 // by throwing an exception. This is for the debug and builtins global |
| 7814 // objects, where it is known which properties can be expected to be present |
| 7815 // on the object. |
| 7816 static inline Handle<Object> GetPropertyNoExceptionThrown( |
| 7817 Handle<GlobalObject> global, |
| 7818 Handle<Name> name); |
| 7819 |
7793 // Casting. | 7820 // Casting. |
7794 static inline GlobalObject* cast(Object* obj); | 7821 static inline GlobalObject* cast(Object* obj); |
7795 | 7822 |
7796 // Layout description. | 7823 // Layout description. |
7797 static const int kBuiltinsOffset = JSObject::kHeaderSize; | 7824 static const int kBuiltinsOffset = JSObject::kHeaderSize; |
7798 static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize; | 7825 static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize; |
7799 static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize; | 7826 static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize; |
7800 static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize; | 7827 static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize; |
7801 static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize; | 7828 static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize; |
7802 | 7829 |
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9811 public: | 9838 public: |
9812 // [handler]: The handler property. | 9839 // [handler]: The handler property. |
9813 DECL_ACCESSORS(handler, Object) | 9840 DECL_ACCESSORS(handler, Object) |
9814 | 9841 |
9815 // [hash]: The hash code property (undefined if not initialized yet). | 9842 // [hash]: The hash code property (undefined if not initialized yet). |
9816 DECL_ACCESSORS(hash, Object) | 9843 DECL_ACCESSORS(hash, Object) |
9817 | 9844 |
9818 // Casting. | 9845 // Casting. |
9819 static inline JSProxy* cast(Object* obj); | 9846 static inline JSProxy* cast(Object* obj); |
9820 | 9847 |
9821 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithHandler( | 9848 MUST_USE_RESULT MaybeObject* GetPropertyWithHandler( |
9822 Handle<JSProxy> proxy, | 9849 Object* receiver, |
9823 Handle<Object> receiver, | 9850 Name* name); |
9824 Handle<Name> name); | 9851 MUST_USE_RESULT MaybeObject* GetElementWithHandler( |
9825 MUST_USE_RESULT static inline MaybeHandle<Object> GetElementWithHandler( | 9852 Object* receiver, |
9826 Handle<JSProxy> proxy, | |
9827 Handle<Object> receiver, | |
9828 uint32_t index); | 9853 uint32_t index); |
9829 | 9854 |
9830 // If the handler defines an accessor property with a setter, invoke it. | 9855 // If the handler defines an accessor property with a setter, invoke it. |
9831 // If it defines an accessor property without a setter, or a data property | 9856 // If it defines an accessor property without a setter, or a data property |
9832 // that is read-only, throw. In all these cases set '*done' to true, | 9857 // that is read-only, throw. In all these cases set '*done' to true, |
9833 // otherwise set it to false. | 9858 // otherwise set it to false. |
9834 MUST_USE_RESULT | 9859 MUST_USE_RESULT |
9835 static MaybeHandle<Object> SetPropertyViaPrototypesWithHandler( | 9860 static MaybeHandle<Object> SetPropertyViaPrototypesWithHandler( |
9836 Handle<JSProxy> proxy, | 9861 Handle<JSProxy> proxy, |
9837 Handle<JSReceiver> receiver, | 9862 Handle<JSReceiver> receiver, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9888 private: | 9913 private: |
9889 friend class JSReceiver; | 9914 friend class JSReceiver; |
9890 | 9915 |
9891 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithHandler( | 9916 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithHandler( |
9892 Handle<JSProxy> proxy, | 9917 Handle<JSProxy> proxy, |
9893 Handle<JSReceiver> receiver, | 9918 Handle<JSReceiver> receiver, |
9894 Handle<Name> name, | 9919 Handle<Name> name, |
9895 Handle<Object> value, | 9920 Handle<Object> value, |
9896 PropertyAttributes attributes, | 9921 PropertyAttributes attributes, |
9897 StrictMode strict_mode); | 9922 StrictMode strict_mode); |
9898 MUST_USE_RESULT static inline MaybeHandle<Object> SetElementWithHandler( | 9923 MUST_USE_RESULT static MaybeHandle<Object> SetElementWithHandler( |
9899 Handle<JSProxy> proxy, | 9924 Handle<JSProxy> proxy, |
9900 Handle<JSReceiver> receiver, | 9925 Handle<JSReceiver> receiver, |
9901 uint32_t index, | 9926 uint32_t index, |
9902 Handle<Object> value, | 9927 Handle<Object> value, |
9903 StrictMode strict_mode); | 9928 StrictMode strict_mode); |
9904 | 9929 |
9905 static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name); | 9930 static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name); |
9906 static inline bool HasElementWithHandler(Handle<JSProxy> proxy, | 9931 static bool HasElementWithHandler(Handle<JSProxy> proxy, uint32_t index); |
9907 uint32_t index); | |
9908 | 9932 |
9909 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithHandler( | 9933 MUST_USE_RESULT static MaybeHandle<Object> DeletePropertyWithHandler( |
9910 Handle<JSProxy> proxy, | 9934 Handle<JSProxy> proxy, |
9911 Handle<Name> name, | 9935 Handle<Name> name, |
9912 DeleteMode mode); | 9936 DeleteMode mode); |
9913 MUST_USE_RESULT static MaybeHandle<Object> DeleteElementWithHandler( | 9937 MUST_USE_RESULT static MaybeHandle<Object> DeleteElementWithHandler( |
9914 Handle<JSProxy> proxy, | 9938 Handle<JSProxy> proxy, |
9915 uint32_t index, | 9939 uint32_t index, |
9916 DeleteMode mode); | 9940 DeleteMode mode); |
9917 | 9941 |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11024 } else { | 11048 } else { |
11025 value &= ~(1 << bit_position); | 11049 value &= ~(1 << bit_position); |
11026 } | 11050 } |
11027 return value; | 11051 return value; |
11028 } | 11052 } |
11029 }; | 11053 }; |
11030 | 11054 |
11031 } } // namespace v8::internal | 11055 } } // namespace v8::internal |
11032 | 11056 |
11033 #endif // V8_OBJECTS_H_ | 11057 #endif // V8_OBJECTS_H_ |
OLD | NEW |