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