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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 | 921 |
922 MUST_USE_RESULT MaybeObject* GetProperty(Object* receiver, | 922 MUST_USE_RESULT MaybeObject* GetProperty(Object* receiver, |
923 LookupResult* result, | 923 LookupResult* result, |
924 String* key, | 924 String* key, |
925 PropertyAttributes* attributes); | 925 PropertyAttributes* attributes); |
926 | 926 |
927 MUST_USE_RESULT MaybeObject* GetPropertyWithDefinedGetter(Object* receiver, | 927 MUST_USE_RESULT MaybeObject* GetPropertyWithDefinedGetter(Object* receiver, |
928 JSReceiver* getter); | 928 JSReceiver* getter); |
929 | 929 |
930 static Handle<Object> GetElement(Handle<Object> object, uint32_t index); | 930 static Handle<Object> GetElement(Handle<Object> object, uint32_t index); |
931 inline MaybeObject* GetElement(uint32_t index); | 931 MUST_USE_RESULT inline MaybeObject* GetElement(uint32_t index); |
932 // For use when we know that no exception can be thrown. | 932 // For use when we know that no exception can be thrown. |
933 inline Object* GetElementNoExceptionThrown(uint32_t index); | 933 inline Object* GetElementNoExceptionThrown(uint32_t index); |
934 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); | 934 MUST_USE_RESULT MaybeObject* GetElementWithReceiver(Object* receiver, |
| 935 uint32_t index); |
935 | 936 |
936 // Return the object's prototype (might be Heap::null_value()). | 937 // Return the object's prototype (might be Heap::null_value()). |
937 Object* GetPrototype(); | 938 Object* GetPrototype(); |
938 | 939 |
939 // Returns the permanent hash code associated with this object depending on | 940 // Returns the permanent hash code associated with this object depending on |
940 // the actual object type. Might return a failure in case no hash was | 941 // the actual object type. Might return a failure in case no hash was |
941 // created yet or GC was caused by creation. | 942 // created yet or GC was caused by creation. |
942 MUST_USE_RESULT MaybeObject* GetHash(CreationFlag flag); | 943 MUST_USE_RESULT MaybeObject* GetHash(CreationFlag flag); |
943 | 944 |
944 // Checks whether this object has the same value as the given one. This | 945 // Checks whether this object has the same value as the given one. This |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 | 1597 |
1597 MUST_USE_RESULT MaybeObject* DefineAccessor(String* name, | 1598 MUST_USE_RESULT MaybeObject* DefineAccessor(String* name, |
1598 bool is_getter, | 1599 bool is_getter, |
1599 Object* fun, | 1600 Object* fun, |
1600 PropertyAttributes attributes); | 1601 PropertyAttributes attributes); |
1601 Object* LookupAccessor(String* name, bool is_getter); | 1602 Object* LookupAccessor(String* name, bool is_getter); |
1602 | 1603 |
1603 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); | 1604 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); |
1604 | 1605 |
1605 // Used from Object::GetProperty(). | 1606 // Used from Object::GetProperty(). |
1606 MaybeObject* GetPropertyWithFailedAccessCheck( | 1607 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck( |
1607 Object* receiver, | 1608 Object* receiver, |
1608 LookupResult* result, | 1609 LookupResult* result, |
1609 String* name, | 1610 String* name, |
1610 PropertyAttributes* attributes); | 1611 PropertyAttributes* attributes); |
1611 MaybeObject* GetPropertyWithInterceptor( | 1612 MUST_USE_RESULT MaybeObject* GetPropertyWithInterceptor( |
1612 JSReceiver* receiver, | 1613 JSReceiver* receiver, |
1613 String* name, | 1614 String* name, |
1614 PropertyAttributes* attributes); | 1615 PropertyAttributes* attributes); |
1615 MaybeObject* GetPropertyPostInterceptor( | 1616 MUST_USE_RESULT MaybeObject* GetPropertyPostInterceptor( |
1616 JSReceiver* receiver, | 1617 JSReceiver* receiver, |
1617 String* name, | 1618 String* name, |
1618 PropertyAttributes* attributes); | 1619 PropertyAttributes* attributes); |
1619 MaybeObject* GetLocalPropertyPostInterceptor(JSReceiver* receiver, | 1620 MUST_USE_RESULT MaybeObject* GetLocalPropertyPostInterceptor( |
1620 String* name, | 1621 JSReceiver* receiver, |
1621 PropertyAttributes* attributes); | 1622 String* name, |
| 1623 PropertyAttributes* attributes); |
1622 | 1624 |
1623 // Returns true if this is an instance of an api function and has | 1625 // Returns true if this is an instance of an api function and has |
1624 // been modified since it was created. May give false positives. | 1626 // been modified since it was created. May give false positives. |
1625 bool IsDirty(); | 1627 bool IsDirty(); |
1626 | 1628 |
1627 // If the receiver is a JSGlobalProxy this method will return its prototype, | 1629 // If the receiver is a JSGlobalProxy this method will return its prototype, |
1628 // otherwise the result is the receiver itself. | 1630 // otherwise the result is the receiver itself. |
1629 inline Object* BypassGlobalProxy(); | 1631 inline Object* BypassGlobalProxy(); |
1630 | 1632 |
1631 // Accessors for hidden properties object. | 1633 // Accessors for hidden properties object. |
(...skipping 29 matching lines...) Expand all Loading... |
1661 static Handle<Object> DeleteProperty(Handle<JSObject> obj, | 1663 static Handle<Object> DeleteProperty(Handle<JSObject> obj, |
1662 Handle<String> name); | 1664 Handle<String> name); |
1663 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); | 1665 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); |
1664 | 1666 |
1665 static Handle<Object> DeleteElement(Handle<JSObject> obj, uint32_t index); | 1667 static Handle<Object> DeleteElement(Handle<JSObject> obj, uint32_t index); |
1666 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); | 1668 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); |
1667 | 1669 |
1668 inline void ValidateSmiOnlyElements(); | 1670 inline void ValidateSmiOnlyElements(); |
1669 | 1671 |
1670 // Makes sure that this object can contain HeapObject as elements. | 1672 // Makes sure that this object can contain HeapObject as elements. |
1671 inline MaybeObject* EnsureCanContainHeapObjectElements(); | 1673 MUST_USE_RESULT inline MaybeObject* EnsureCanContainHeapObjectElements(); |
1672 | 1674 |
1673 // Makes sure that this object can contain the specified elements. | 1675 // Makes sure that this object can contain the specified elements. |
1674 inline MaybeObject* EnsureCanContainElements(Object** elements, | 1676 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( |
1675 uint32_t count, | 1677 Object** elements, |
1676 EnsureElementsMode mode); | 1678 uint32_t count, |
1677 inline MaybeObject* EnsureCanContainElements(FixedArrayBase* elements, | 1679 EnsureElementsMode mode); |
1678 EnsureElementsMode mode); | 1680 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( |
1679 MaybeObject* EnsureCanContainElements(Arguments* arguments, | 1681 FixedArrayBase* elements, |
1680 uint32_t first_arg, | 1682 EnsureElementsMode mode); |
1681 uint32_t arg_count, | 1683 MUST_USE_RESULT MaybeObject* EnsureCanContainElements( |
1682 EnsureElementsMode mode); | 1684 Arguments* arguments, |
| 1685 uint32_t first_arg, |
| 1686 uint32_t arg_count, |
| 1687 EnsureElementsMode mode); |
1683 | 1688 |
1684 // Do we want to keep the elements in fast case when increasing the | 1689 // Do we want to keep the elements in fast case when increasing the |
1685 // capacity? | 1690 // capacity? |
1686 bool ShouldConvertToSlowElements(int new_capacity); | 1691 bool ShouldConvertToSlowElements(int new_capacity); |
1687 // Returns true if the backing storage for the slow-case elements of | 1692 // Returns true if the backing storage for the slow-case elements of |
1688 // this object takes up nearly as much space as a fast-case backing | 1693 // this object takes up nearly as much space as a fast-case backing |
1689 // storage would. In that case the JSObject should have fast | 1694 // storage would. In that case the JSObject should have fast |
1690 // elements. | 1695 // elements. |
1691 bool ShouldConvertToFastElements(); | 1696 bool ShouldConvertToFastElements(); |
1692 // Returns true if the elements of JSObject contains only values that can be | 1697 // Returns true if the elements of JSObject contains only values that can be |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 StrictModeFlag strict_mode); | 1760 StrictModeFlag strict_mode); |
1756 | 1761 |
1757 // A Failure object is returned if GC is needed. | 1762 // A Failure object is returned if GC is needed. |
1758 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, | 1763 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, |
1759 Object* value, | 1764 Object* value, |
1760 StrictModeFlag strict_mode, | 1765 StrictModeFlag strict_mode, |
1761 bool check_prototype); | 1766 bool check_prototype); |
1762 | 1767 |
1763 // Returns the index'th element. | 1768 // Returns the index'th element. |
1764 // The undefined object if index is out of bounds. | 1769 // The undefined object if index is out of bounds. |
1765 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); | 1770 MUST_USE_RESULT MaybeObject* GetElementWithInterceptor(Object* receiver, |
| 1771 uint32_t index); |
1766 | 1772 |
1767 enum SetFastElementsCapacityMode { | 1773 enum SetFastElementsCapacityMode { |
1768 kAllowSmiOnlyElements, | 1774 kAllowSmiOnlyElements, |
1769 kForceSmiOnlyElements, | 1775 kForceSmiOnlyElements, |
1770 kDontAllowSmiOnlyElements | 1776 kDontAllowSmiOnlyElements |
1771 }; | 1777 }; |
1772 | 1778 |
1773 // Replace the elements' backing store with fast elements of the given | 1779 // Replace the elements' backing store with fast elements of the given |
1774 // capacity. Update the length for JSArrays. Returns the new backing | 1780 // capacity. Update the length for JSArrays. Returns the new backing |
1775 // store. | 1781 // store. |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2062 static inline int SizeOf(Map* map, HeapObject* object); | 2068 static inline int SizeOf(Map* map, HeapObject* object); |
2063 }; | 2069 }; |
2064 | 2070 |
2065 private: | 2071 private: |
2066 friend class DictionaryElementsAccessor; | 2072 friend class DictionaryElementsAccessor; |
2067 | 2073 |
2068 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, | 2074 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, |
2069 Object* structure, | 2075 Object* structure, |
2070 uint32_t index, | 2076 uint32_t index, |
2071 Object* holder); | 2077 Object* holder); |
2072 MaybeObject* SetElementWithCallback(Object* structure, | 2078 MUST_USE_RESULT MaybeObject* SetElementWithCallback( |
2073 uint32_t index, | 2079 Object* structure, |
2074 Object* value, | 2080 uint32_t index, |
2075 JSObject* holder, | 2081 Object* value, |
2076 StrictModeFlag strict_mode); | 2082 JSObject* holder, |
| 2083 StrictModeFlag strict_mode); |
2077 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( | 2084 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( |
2078 uint32_t index, | 2085 uint32_t index, |
2079 Object* value, | 2086 Object* value, |
2080 StrictModeFlag strict_mode, | 2087 StrictModeFlag strict_mode, |
2081 bool check_prototype); | 2088 bool check_prototype); |
2082 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( | 2089 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( |
2083 uint32_t index, | 2090 uint32_t index, |
2084 Object* value, | 2091 Object* value, |
2085 StrictModeFlag strict_mode, | 2092 StrictModeFlag strict_mode, |
2086 bool check_prototype); | 2093 bool check_prototype); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 String* name, | 2140 String* name, |
2134 PropertyAttributes attributes); | 2141 PropertyAttributes attributes); |
2135 | 2142 |
2136 void LookupInDescriptor(String* name, LookupResult* result); | 2143 void LookupInDescriptor(String* name, LookupResult* result); |
2137 | 2144 |
2138 // Returns the hidden properties backing store object, currently | 2145 // Returns the hidden properties backing store object, currently |
2139 // a StringDictionary, stored on this object. | 2146 // a StringDictionary, stored on this object. |
2140 // If no hidden properties object has been put on this object, | 2147 // If no hidden properties object has been put on this object, |
2141 // return undefined, unless create_if_absent is true, in which case | 2148 // return undefined, unless create_if_absent is true, in which case |
2142 // a new dictionary is created, added to this object, and returned. | 2149 // a new dictionary is created, added to this object, and returned. |
2143 MaybeObject* GetHiddenPropertiesDictionary(bool create_if_absent); | 2150 MUST_USE_RESULT MaybeObject* GetHiddenPropertiesDictionary( |
| 2151 bool create_if_absent); |
2144 // Updates the existing hidden properties dictionary. | 2152 // Updates the existing hidden properties dictionary. |
2145 MaybeObject* SetHiddenPropertiesDictionary(StringDictionary* dictionary); | 2153 MUST_USE_RESULT MaybeObject* SetHiddenPropertiesDictionary( |
| 2154 StringDictionary* dictionary); |
2146 | 2155 |
2147 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); | 2156 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); |
2148 }; | 2157 }; |
2149 | 2158 |
2150 | 2159 |
2151 // Common superclass for FixedArrays that allow implementations to share | 2160 // Common superclass for FixedArrays that allow implementations to share |
2152 // common accessors and some code paths. | 2161 // common accessors and some code paths. |
2153 class FixedArrayBase: public HeapObject { | 2162 class FixedArrayBase: public HeapObject { |
2154 public: | 2163 public: |
2155 // [length]: length of the array. | 2164 // [length]: length of the array. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2282 | 2291 |
2283 // FixedDoubleArray describes fixed-sized arrays with element type double. | 2292 // FixedDoubleArray describes fixed-sized arrays with element type double. |
2284 class FixedDoubleArray: public FixedArrayBase { | 2293 class FixedDoubleArray: public FixedArrayBase { |
2285 public: | 2294 public: |
2286 inline void Initialize(FixedArray* from); | 2295 inline void Initialize(FixedArray* from); |
2287 inline void Initialize(FixedDoubleArray* from); | 2296 inline void Initialize(FixedDoubleArray* from); |
2288 inline void Initialize(SeededNumberDictionary* from); | 2297 inline void Initialize(SeededNumberDictionary* from); |
2289 | 2298 |
2290 // Setter and getter for elements. | 2299 // Setter and getter for elements. |
2291 inline double get_scalar(int index); | 2300 inline double get_scalar(int index); |
2292 inline MaybeObject* get(int index); | 2301 MUST_USE_RESULT inline MaybeObject* get(int index); |
2293 inline void set(int index, double value); | 2302 inline void set(int index, double value); |
2294 inline void set_the_hole(int index); | 2303 inline void set_the_hole(int index); |
2295 | 2304 |
2296 // Checking for the hole. | 2305 // Checking for the hole. |
2297 inline bool is_the_hole(int index); | 2306 inline bool is_the_hole(int index); |
2298 | 2307 |
2299 // Copy operations | 2308 // Copy operations |
2300 MUST_USE_RESULT inline MaybeObject* Copy(); | 2309 MUST_USE_RESULT inline MaybeObject* Copy(); |
2301 | 2310 |
2302 // Garbage collection support. | 2311 // Garbage collection support. |
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3607 // http://www.whatwg.org/specs/web-apps/current-work/ | 3616 // http://www.whatwg.org/specs/web-apps/current-work/ |
3608 // multipage/the-canvas-element.html#canvaspixelarray | 3617 // multipage/the-canvas-element.html#canvaspixelarray |
3609 // In particular, write access clamps the value written to 0 or 255 if the | 3618 // In particular, write access clamps the value written to 0 or 255 if the |
3610 // value written is outside this range. | 3619 // value written is outside this range. |
3611 class ExternalPixelArray: public ExternalArray { | 3620 class ExternalPixelArray: public ExternalArray { |
3612 public: | 3621 public: |
3613 inline uint8_t* external_pixel_pointer(); | 3622 inline uint8_t* external_pixel_pointer(); |
3614 | 3623 |
3615 // Setter and getter. | 3624 // Setter and getter. |
3616 inline uint8_t get_scalar(int index); | 3625 inline uint8_t get_scalar(int index); |
3617 inline MaybeObject* get(int index); | 3626 MUST_USE_RESULT inline MaybeObject* get(int index); |
3618 inline void set(int index, uint8_t value); | 3627 inline void set(int index, uint8_t value); |
3619 | 3628 |
3620 // This accessor applies the correct conversion from Smi, HeapNumber and | 3629 // This accessor applies the correct conversion from Smi, HeapNumber and |
3621 // undefined and clamps the converted value between 0 and 255. | 3630 // undefined and clamps the converted value between 0 and 255. |
3622 Object* SetValue(uint32_t index, Object* value); | 3631 Object* SetValue(uint32_t index, Object* value); |
3623 | 3632 |
3624 // Casting. | 3633 // Casting. |
3625 static inline ExternalPixelArray* cast(Object* obj); | 3634 static inline ExternalPixelArray* cast(Object* obj); |
3626 | 3635 |
3627 #ifdef OBJECT_PRINT | 3636 #ifdef OBJECT_PRINT |
3628 inline void ExternalPixelArrayPrint() { | 3637 inline void ExternalPixelArrayPrint() { |
3629 ExternalPixelArrayPrint(stdout); | 3638 ExternalPixelArrayPrint(stdout); |
3630 } | 3639 } |
3631 void ExternalPixelArrayPrint(FILE* out); | 3640 void ExternalPixelArrayPrint(FILE* out); |
3632 #endif | 3641 #endif |
3633 #ifdef DEBUG | 3642 #ifdef DEBUG |
3634 void ExternalPixelArrayVerify(); | 3643 void ExternalPixelArrayVerify(); |
3635 #endif // DEBUG | 3644 #endif // DEBUG |
3636 | 3645 |
3637 private: | 3646 private: |
3638 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray); | 3647 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray); |
3639 }; | 3648 }; |
3640 | 3649 |
3641 | 3650 |
3642 class ExternalByteArray: public ExternalArray { | 3651 class ExternalByteArray: public ExternalArray { |
3643 public: | 3652 public: |
3644 // Setter and getter. | 3653 // Setter and getter. |
3645 inline int8_t get_scalar(int index); | 3654 inline int8_t get_scalar(int index); |
3646 inline MaybeObject* get(int index); | 3655 MUST_USE_RESULT inline MaybeObject* get(int index); |
3647 inline void set(int index, int8_t value); | 3656 inline void set(int index, int8_t value); |
3648 | 3657 |
3649 // This accessor applies the correct conversion from Smi, HeapNumber | 3658 // This accessor applies the correct conversion from Smi, HeapNumber |
3650 // and undefined. | 3659 // and undefined. |
3651 MaybeObject* SetValue(uint32_t index, Object* value); | 3660 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); |
3652 | 3661 |
3653 // Casting. | 3662 // Casting. |
3654 static inline ExternalByteArray* cast(Object* obj); | 3663 static inline ExternalByteArray* cast(Object* obj); |
3655 | 3664 |
3656 #ifdef OBJECT_PRINT | 3665 #ifdef OBJECT_PRINT |
3657 inline void ExternalByteArrayPrint() { | 3666 inline void ExternalByteArrayPrint() { |
3658 ExternalByteArrayPrint(stdout); | 3667 ExternalByteArrayPrint(stdout); |
3659 } | 3668 } |
3660 void ExternalByteArrayPrint(FILE* out); | 3669 void ExternalByteArrayPrint(FILE* out); |
3661 #endif | 3670 #endif |
3662 #ifdef DEBUG | 3671 #ifdef DEBUG |
3663 void ExternalByteArrayVerify(); | 3672 void ExternalByteArrayVerify(); |
3664 #endif // DEBUG | 3673 #endif // DEBUG |
3665 | 3674 |
3666 private: | 3675 private: |
3667 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); | 3676 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); |
3668 }; | 3677 }; |
3669 | 3678 |
3670 | 3679 |
3671 class ExternalUnsignedByteArray: public ExternalArray { | 3680 class ExternalUnsignedByteArray: public ExternalArray { |
3672 public: | 3681 public: |
3673 // Setter and getter. | 3682 // Setter and getter. |
3674 inline uint8_t get_scalar(int index); | 3683 inline uint8_t get_scalar(int index); |
3675 inline MaybeObject* get(int index); | 3684 MUST_USE_RESULT inline MaybeObject* get(int index); |
3676 inline void set(int index, uint8_t value); | 3685 inline void set(int index, uint8_t value); |
3677 | 3686 |
3678 // This accessor applies the correct conversion from Smi, HeapNumber | 3687 // This accessor applies the correct conversion from Smi, HeapNumber |
3679 // and undefined. | 3688 // and undefined. |
3680 MaybeObject* SetValue(uint32_t index, Object* value); | 3689 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); |
3681 | 3690 |
3682 // Casting. | 3691 // Casting. |
3683 static inline ExternalUnsignedByteArray* cast(Object* obj); | 3692 static inline ExternalUnsignedByteArray* cast(Object* obj); |
3684 | 3693 |
3685 #ifdef OBJECT_PRINT | 3694 #ifdef OBJECT_PRINT |
3686 inline void ExternalUnsignedByteArrayPrint() { | 3695 inline void ExternalUnsignedByteArrayPrint() { |
3687 ExternalUnsignedByteArrayPrint(stdout); | 3696 ExternalUnsignedByteArrayPrint(stdout); |
3688 } | 3697 } |
3689 void ExternalUnsignedByteArrayPrint(FILE* out); | 3698 void ExternalUnsignedByteArrayPrint(FILE* out); |
3690 #endif | 3699 #endif |
3691 #ifdef DEBUG | 3700 #ifdef DEBUG |
3692 void ExternalUnsignedByteArrayVerify(); | 3701 void ExternalUnsignedByteArrayVerify(); |
3693 #endif // DEBUG | 3702 #endif // DEBUG |
3694 | 3703 |
3695 private: | 3704 private: |
3696 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); | 3705 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); |
3697 }; | 3706 }; |
3698 | 3707 |
3699 | 3708 |
3700 class ExternalShortArray: public ExternalArray { | 3709 class ExternalShortArray: public ExternalArray { |
3701 public: | 3710 public: |
3702 // Setter and getter. | 3711 // Setter and getter. |
3703 inline int16_t get_scalar(int index); | 3712 inline int16_t get_scalar(int index); |
3704 inline MaybeObject* get(int index); | 3713 MUST_USE_RESULT inline MaybeObject* get(int index); |
3705 inline void set(int index, int16_t value); | 3714 inline void set(int index, int16_t value); |
3706 | 3715 |
3707 // This accessor applies the correct conversion from Smi, HeapNumber | 3716 // This accessor applies the correct conversion from Smi, HeapNumber |
3708 // and undefined. | 3717 // and undefined. |
3709 MaybeObject* SetValue(uint32_t index, Object* value); | 3718 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); |
3710 | 3719 |
3711 // Casting. | 3720 // Casting. |
3712 static inline ExternalShortArray* cast(Object* obj); | 3721 static inline ExternalShortArray* cast(Object* obj); |
3713 | 3722 |
3714 #ifdef OBJECT_PRINT | 3723 #ifdef OBJECT_PRINT |
3715 inline void ExternalShortArrayPrint() { | 3724 inline void ExternalShortArrayPrint() { |
3716 ExternalShortArrayPrint(stdout); | 3725 ExternalShortArrayPrint(stdout); |
3717 } | 3726 } |
3718 void ExternalShortArrayPrint(FILE* out); | 3727 void ExternalShortArrayPrint(FILE* out); |
3719 #endif | 3728 #endif |
3720 #ifdef DEBUG | 3729 #ifdef DEBUG |
3721 void ExternalShortArrayVerify(); | 3730 void ExternalShortArrayVerify(); |
3722 #endif // DEBUG | 3731 #endif // DEBUG |
3723 | 3732 |
3724 private: | 3733 private: |
3725 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); | 3734 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); |
3726 }; | 3735 }; |
3727 | 3736 |
3728 | 3737 |
3729 class ExternalUnsignedShortArray: public ExternalArray { | 3738 class ExternalUnsignedShortArray: public ExternalArray { |
3730 public: | 3739 public: |
3731 // Setter and getter. | 3740 // Setter and getter. |
3732 inline uint16_t get_scalar(int index); | 3741 inline uint16_t get_scalar(int index); |
3733 inline MaybeObject* get(int index); | 3742 MUST_USE_RESULT inline MaybeObject* get(int index); |
3734 inline void set(int index, uint16_t value); | 3743 inline void set(int index, uint16_t value); |
3735 | 3744 |
3736 // This accessor applies the correct conversion from Smi, HeapNumber | 3745 // This accessor applies the correct conversion from Smi, HeapNumber |
3737 // and undefined. | 3746 // and undefined. |
3738 MaybeObject* SetValue(uint32_t index, Object* value); | 3747 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); |
3739 | 3748 |
3740 // Casting. | 3749 // Casting. |
3741 static inline ExternalUnsignedShortArray* cast(Object* obj); | 3750 static inline ExternalUnsignedShortArray* cast(Object* obj); |
3742 | 3751 |
3743 #ifdef OBJECT_PRINT | 3752 #ifdef OBJECT_PRINT |
3744 inline void ExternalUnsignedShortArrayPrint() { | 3753 inline void ExternalUnsignedShortArrayPrint() { |
3745 ExternalUnsignedShortArrayPrint(stdout); | 3754 ExternalUnsignedShortArrayPrint(stdout); |
3746 } | 3755 } |
3747 void ExternalUnsignedShortArrayPrint(FILE* out); | 3756 void ExternalUnsignedShortArrayPrint(FILE* out); |
3748 #endif | 3757 #endif |
3749 #ifdef DEBUG | 3758 #ifdef DEBUG |
3750 void ExternalUnsignedShortArrayVerify(); | 3759 void ExternalUnsignedShortArrayVerify(); |
3751 #endif // DEBUG | 3760 #endif // DEBUG |
3752 | 3761 |
3753 private: | 3762 private: |
3754 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); | 3763 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); |
3755 }; | 3764 }; |
3756 | 3765 |
3757 | 3766 |
3758 class ExternalIntArray: public ExternalArray { | 3767 class ExternalIntArray: public ExternalArray { |
3759 public: | 3768 public: |
3760 // Setter and getter. | 3769 // Setter and getter. |
3761 inline int32_t get_scalar(int index); | 3770 inline int32_t get_scalar(int index); |
3762 inline MaybeObject* get(int index); | 3771 MUST_USE_RESULT inline MaybeObject* get(int index); |
3763 inline void set(int index, int32_t value); | 3772 inline void set(int index, int32_t value); |
3764 | 3773 |
3765 // This accessor applies the correct conversion from Smi, HeapNumber | 3774 // This accessor applies the correct conversion from Smi, HeapNumber |
3766 // and undefined. | 3775 // and undefined. |
3767 MaybeObject* SetValue(uint32_t index, Object* value); | 3776 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); |
3768 | 3777 |
3769 // Casting. | 3778 // Casting. |
3770 static inline ExternalIntArray* cast(Object* obj); | 3779 static inline ExternalIntArray* cast(Object* obj); |
3771 | 3780 |
3772 #ifdef OBJECT_PRINT | 3781 #ifdef OBJECT_PRINT |
3773 inline void ExternalIntArrayPrint() { | 3782 inline void ExternalIntArrayPrint() { |
3774 ExternalIntArrayPrint(stdout); | 3783 ExternalIntArrayPrint(stdout); |
3775 } | 3784 } |
3776 void ExternalIntArrayPrint(FILE* out); | 3785 void ExternalIntArrayPrint(FILE* out); |
3777 #endif | 3786 #endif |
3778 #ifdef DEBUG | 3787 #ifdef DEBUG |
3779 void ExternalIntArrayVerify(); | 3788 void ExternalIntArrayVerify(); |
3780 #endif // DEBUG | 3789 #endif // DEBUG |
3781 | 3790 |
3782 private: | 3791 private: |
3783 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); | 3792 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); |
3784 }; | 3793 }; |
3785 | 3794 |
3786 | 3795 |
3787 class ExternalUnsignedIntArray: public ExternalArray { | 3796 class ExternalUnsignedIntArray: public ExternalArray { |
3788 public: | 3797 public: |
3789 // Setter and getter. | 3798 // Setter and getter. |
3790 inline uint32_t get_scalar(int index); | 3799 inline uint32_t get_scalar(int index); |
3791 inline MaybeObject* get(int index); | 3800 MUST_USE_RESULT inline MaybeObject* get(int index); |
3792 inline void set(int index, uint32_t value); | 3801 inline void set(int index, uint32_t value); |
3793 | 3802 |
3794 // This accessor applies the correct conversion from Smi, HeapNumber | 3803 // This accessor applies the correct conversion from Smi, HeapNumber |
3795 // and undefined. | 3804 // and undefined. |
3796 MaybeObject* SetValue(uint32_t index, Object* value); | 3805 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); |
3797 | 3806 |
3798 // Casting. | 3807 // Casting. |
3799 static inline ExternalUnsignedIntArray* cast(Object* obj); | 3808 static inline ExternalUnsignedIntArray* cast(Object* obj); |
3800 | 3809 |
3801 #ifdef OBJECT_PRINT | 3810 #ifdef OBJECT_PRINT |
3802 inline void ExternalUnsignedIntArrayPrint() { | 3811 inline void ExternalUnsignedIntArrayPrint() { |
3803 ExternalUnsignedIntArrayPrint(stdout); | 3812 ExternalUnsignedIntArrayPrint(stdout); |
3804 } | 3813 } |
3805 void ExternalUnsignedIntArrayPrint(FILE* out); | 3814 void ExternalUnsignedIntArrayPrint(FILE* out); |
3806 #endif | 3815 #endif |
3807 #ifdef DEBUG | 3816 #ifdef DEBUG |
3808 void ExternalUnsignedIntArrayVerify(); | 3817 void ExternalUnsignedIntArrayVerify(); |
3809 #endif // DEBUG | 3818 #endif // DEBUG |
3810 | 3819 |
3811 private: | 3820 private: |
3812 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); | 3821 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); |
3813 }; | 3822 }; |
3814 | 3823 |
3815 | 3824 |
3816 class ExternalFloatArray: public ExternalArray { | 3825 class ExternalFloatArray: public ExternalArray { |
3817 public: | 3826 public: |
3818 // Setter and getter. | 3827 // Setter and getter. |
3819 inline float get_scalar(int index); | 3828 inline float get_scalar(int index); |
3820 inline MaybeObject* get(int index); | 3829 MUST_USE_RESULT inline MaybeObject* get(int index); |
3821 inline void set(int index, float value); | 3830 inline void set(int index, float value); |
3822 | 3831 |
3823 // This accessor applies the correct conversion from Smi, HeapNumber | 3832 // This accessor applies the correct conversion from Smi, HeapNumber |
3824 // and undefined. | 3833 // and undefined. |
3825 MaybeObject* SetValue(uint32_t index, Object* value); | 3834 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); |
3826 | 3835 |
3827 // Casting. | 3836 // Casting. |
3828 static inline ExternalFloatArray* cast(Object* obj); | 3837 static inline ExternalFloatArray* cast(Object* obj); |
3829 | 3838 |
3830 #ifdef OBJECT_PRINT | 3839 #ifdef OBJECT_PRINT |
3831 inline void ExternalFloatArrayPrint() { | 3840 inline void ExternalFloatArrayPrint() { |
3832 ExternalFloatArrayPrint(stdout); | 3841 ExternalFloatArrayPrint(stdout); |
3833 } | 3842 } |
3834 void ExternalFloatArrayPrint(FILE* out); | 3843 void ExternalFloatArrayPrint(FILE* out); |
3835 #endif | 3844 #endif |
3836 #ifdef DEBUG | 3845 #ifdef DEBUG |
3837 void ExternalFloatArrayVerify(); | 3846 void ExternalFloatArrayVerify(); |
3838 #endif // DEBUG | 3847 #endif // DEBUG |
3839 | 3848 |
3840 private: | 3849 private: |
3841 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); | 3850 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); |
3842 }; | 3851 }; |
3843 | 3852 |
3844 | 3853 |
3845 class ExternalDoubleArray: public ExternalArray { | 3854 class ExternalDoubleArray: public ExternalArray { |
3846 public: | 3855 public: |
3847 // Setter and getter. | 3856 // Setter and getter. |
3848 inline double get_scalar(int index); | 3857 inline double get_scalar(int index); |
3849 inline MaybeObject* get(int index); | 3858 MUST_USE_RESULT inline MaybeObject* get(int index); |
3850 inline void set(int index, double value); | 3859 inline void set(int index, double value); |
3851 | 3860 |
3852 // This accessor applies the correct conversion from Smi, HeapNumber | 3861 // This accessor applies the correct conversion from Smi, HeapNumber |
3853 // and undefined. | 3862 // and undefined. |
3854 MaybeObject* SetValue(uint32_t index, Object* value); | 3863 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); |
3855 | 3864 |
3856 // Casting. | 3865 // Casting. |
3857 static inline ExternalDoubleArray* cast(Object* obj); | 3866 static inline ExternalDoubleArray* cast(Object* obj); |
3858 | 3867 |
3859 #ifdef OBJECT_PRINT | 3868 #ifdef OBJECT_PRINT |
3860 inline void ExternalDoubleArrayPrint() { | 3869 inline void ExternalDoubleArrayPrint() { |
3861 ExternalDoubleArrayPrint(stdout); | 3870 ExternalDoubleArrayPrint(stdout); |
3862 } | 3871 } |
3863 void ExternalDoubleArrayPrint(FILE* out); | 3872 void ExternalDoubleArrayPrint(FILE* out); |
3864 #endif // OBJECT_PRINT | 3873 #endif // OBJECT_PRINT |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4762 inline void set_visitor_id(int visitor_id); | 4771 inline void set_visitor_id(int visitor_id); |
4763 | 4772 |
4764 typedef void (*TraverseCallback)(Map* map, void* data); | 4773 typedef void (*TraverseCallback)(Map* map, void* data); |
4765 | 4774 |
4766 void TraverseTransitionTree(TraverseCallback callback, void* data); | 4775 void TraverseTransitionTree(TraverseCallback callback, void* data); |
4767 | 4776 |
4768 static const int kMaxCachedPrototypeTransitions = 256; | 4777 static const int kMaxCachedPrototypeTransitions = 256; |
4769 | 4778 |
4770 Object* GetPrototypeTransition(Object* prototype); | 4779 Object* GetPrototypeTransition(Object* prototype); |
4771 | 4780 |
4772 MaybeObject* PutPrototypeTransition(Object* prototype, Map* map); | 4781 MUST_USE_RESULT MaybeObject* PutPrototypeTransition(Object* prototype, |
| 4782 Map* map); |
4773 | 4783 |
4774 static const int kMaxPreAllocatedPropertyFields = 255; | 4784 static const int kMaxPreAllocatedPropertyFields = 255; |
4775 | 4785 |
4776 // Layout description. | 4786 // Layout description. |
4777 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; | 4787 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; |
4778 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; | 4788 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; |
4779 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; | 4789 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; |
4780 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; | 4790 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; |
4781 // Storage for instance descriptors is overloaded to also contain additional | 4791 // Storage for instance descriptors is overloaded to also contain additional |
4782 // map flags when unused (bit_field3). When the map has instance descriptors, | 4792 // map flags when unused (bit_field3). When the map has instance descriptors, |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5654 | 5664 |
5655 inline FixedArray* literals(); | 5665 inline FixedArray* literals(); |
5656 inline void set_literals(FixedArray* literals); | 5666 inline void set_literals(FixedArray* literals); |
5657 | 5667 |
5658 inline FixedArray* function_bindings(); | 5668 inline FixedArray* function_bindings(); |
5659 inline void set_function_bindings(FixedArray* bindings); | 5669 inline void set_function_bindings(FixedArray* bindings); |
5660 | 5670 |
5661 // The initial map for an object created by this constructor. | 5671 // The initial map for an object created by this constructor. |
5662 inline Map* initial_map(); | 5672 inline Map* initial_map(); |
5663 inline void set_initial_map(Map* value); | 5673 inline void set_initial_map(Map* value); |
5664 inline MaybeObject* set_initial_map_and_cache_transitions(Map* value); | 5674 MUST_USE_RESULT inline MaybeObject* set_initial_map_and_cache_transitions( |
| 5675 Map* value); |
5665 inline bool has_initial_map(); | 5676 inline bool has_initial_map(); |
5666 | 5677 |
5667 // Get and set the prototype property on a JSFunction. If the | 5678 // Get and set the prototype property on a JSFunction. If the |
5668 // function has an initial map the prototype is set on the initial | 5679 // function has an initial map the prototype is set on the initial |
5669 // map. Otherwise, the prototype is put in the initial map field | 5680 // map. Otherwise, the prototype is put in the initial map field |
5670 // until an initial map is needed. | 5681 // until an initial map is needed. |
5671 inline bool has_prototype(); | 5682 inline bool has_prototype(); |
5672 inline bool has_instance_prototype(); | 5683 inline bool has_instance_prototype(); |
5673 inline Object* prototype(); | 5684 inline Object* prototype(); |
5674 inline Object* instance_prototype(); | 5685 inline Object* instance_prototype(); |
5675 MaybeObject* SetInstancePrototype(Object* value); | 5686 MUST_USE_RESULT MaybeObject* SetInstancePrototype(Object* value); |
5676 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value); | 5687 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value); |
5677 | 5688 |
5678 // After prototype is removed, it will not be created when accessed, and | 5689 // After prototype is removed, it will not be created when accessed, and |
5679 // [[Construct]] from this function will not be allowed. | 5690 // [[Construct]] from this function will not be allowed. |
5680 Object* RemovePrototype(); | 5691 Object* RemovePrototype(); |
5681 inline bool should_have_prototype(); | 5692 inline bool should_have_prototype(); |
5682 | 5693 |
5683 // Accessor for this function's initial map's [[class]] | 5694 // Accessor for this function's initial map's [[class]] |
5684 // property. This is primarily used by ECMA native functions. This | 5695 // property. This is primarily used by ECMA native functions. This |
5685 // method sets the class_name field of this function's initial map | 5696 // method sets the class_name field of this function's initial map |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6178 class CompilationCacheTable: public HashTable<CompilationCacheShape, | 6189 class CompilationCacheTable: public HashTable<CompilationCacheShape, |
6179 HashTableKey*> { | 6190 HashTableKey*> { |
6180 public: | 6191 public: |
6181 // Find cached value for a string key, otherwise return null. | 6192 // Find cached value for a string key, otherwise return null. |
6182 Object* Lookup(String* src); | 6193 Object* Lookup(String* src); |
6183 Object* LookupEval(String* src, | 6194 Object* LookupEval(String* src, |
6184 Context* context, | 6195 Context* context, |
6185 LanguageMode language_mode, | 6196 LanguageMode language_mode, |
6186 int scope_position); | 6197 int scope_position); |
6187 Object* LookupRegExp(String* source, JSRegExp::Flags flags); | 6198 Object* LookupRegExp(String* source, JSRegExp::Flags flags); |
6188 MaybeObject* Put(String* src, Object* value); | 6199 MUST_USE_RESULT MaybeObject* Put(String* src, Object* value); |
6189 MaybeObject* PutEval(String* src, | 6200 MUST_USE_RESULT MaybeObject* PutEval(String* src, |
6190 Context* context, | 6201 Context* context, |
6191 SharedFunctionInfo* value, | 6202 SharedFunctionInfo* value, |
6192 int scope_position); | 6203 int scope_position); |
6193 MaybeObject* PutRegExp(String* src, JSRegExp::Flags flags, FixedArray* value); | 6204 MUST_USE_RESULT MaybeObject* PutRegExp(String* src, |
| 6205 JSRegExp::Flags flags, |
| 6206 FixedArray* value); |
6194 | 6207 |
6195 // Remove given value from cache. | 6208 // Remove given value from cache. |
6196 void Remove(Object* value); | 6209 void Remove(Object* value); |
6197 | 6210 |
6198 static inline CompilationCacheTable* cast(Object* obj); | 6211 static inline CompilationCacheTable* cast(Object* obj); |
6199 | 6212 |
6200 private: | 6213 private: |
6201 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); | 6214 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); |
6202 }; | 6215 }; |
6203 | 6216 |
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7648 // Initialize the array with the given capacity. The function may | 7661 // Initialize the array with the given capacity. The function may |
7649 // fail due to out-of-memory situations, but only if the requested | 7662 // fail due to out-of-memory situations, but only if the requested |
7650 // capacity is non-zero. | 7663 // capacity is non-zero. |
7651 MUST_USE_RESULT MaybeObject* Initialize(int capacity); | 7664 MUST_USE_RESULT MaybeObject* Initialize(int capacity); |
7652 | 7665 |
7653 // Initializes the array to a certain length. | 7666 // Initializes the array to a certain length. |
7654 inline bool AllowsSetElementsLength(); | 7667 inline bool AllowsSetElementsLength(); |
7655 MUST_USE_RESULT MaybeObject* SetElementsLength(Object* length); | 7668 MUST_USE_RESULT MaybeObject* SetElementsLength(Object* length); |
7656 | 7669 |
7657 // Set the content of the array to the content of storage. | 7670 // Set the content of the array to the content of storage. |
7658 inline MaybeObject* SetContent(FixedArrayBase* storage); | 7671 MUST_USE_RESULT inline MaybeObject* SetContent(FixedArrayBase* storage); |
7659 | 7672 |
7660 // Casting. | 7673 // Casting. |
7661 static inline JSArray* cast(Object* obj); | 7674 static inline JSArray* cast(Object* obj); |
7662 | 7675 |
7663 // Uses handles. Ensures that the fixed array backing the JSArray has at | 7676 // Uses handles. Ensures that the fixed array backing the JSArray has at |
7664 // least the stated size. | 7677 // least the stated size. |
7665 inline void EnsureSize(int minimum_size_of_backing_fixed_array); | 7678 inline void EnsureSize(int minimum_size_of_backing_fixed_array); |
7666 | 7679 |
7667 // Dispatched behavior. | 7680 // Dispatched behavior. |
7668 #ifdef OBJECT_PRINT | 7681 #ifdef OBJECT_PRINT |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8289 } else { | 8302 } else { |
8290 value &= ~(1 << bit_position); | 8303 value &= ~(1 << bit_position); |
8291 } | 8304 } |
8292 return value; | 8305 return value; |
8293 } | 8306 } |
8294 }; | 8307 }; |
8295 | 8308 |
8296 } } // namespace v8::internal | 8309 } } // namespace v8::internal |
8297 | 8310 |
8298 #endif // V8_OBJECTS_H_ | 8311 #endif // V8_OBJECTS_H_ |
OLD | NEW |