OLD | NEW |
---|---|
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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
524 BYTE_ARRAY_TYPE, | 524 BYTE_ARRAY_TYPE, |
525 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE | 525 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
526 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, | 526 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, |
527 EXTERNAL_SHORT_ARRAY_TYPE, | 527 EXTERNAL_SHORT_ARRAY_TYPE, |
528 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, | 528 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, |
529 EXTERNAL_INT_ARRAY_TYPE, | 529 EXTERNAL_INT_ARRAY_TYPE, |
530 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, | 530 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, |
531 EXTERNAL_FLOAT_ARRAY_TYPE, | 531 EXTERNAL_FLOAT_ARRAY_TYPE, |
532 EXTERNAL_DOUBLE_ARRAY_TYPE, | 532 EXTERNAL_DOUBLE_ARRAY_TYPE, |
533 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE | 533 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE |
534 FIXED_DOUBLE_ARRAY_TYPE, | |
534 FILLER_TYPE, // LAST_DATA_TYPE | 535 FILLER_TYPE, // LAST_DATA_TYPE |
535 | 536 |
536 // Structs. | 537 // Structs. |
537 ACCESSOR_INFO_TYPE, | 538 ACCESSOR_INFO_TYPE, |
538 ACCESS_CHECK_INFO_TYPE, | 539 ACCESS_CHECK_INFO_TYPE, |
539 INTERCEPTOR_INFO_TYPE, | 540 INTERCEPTOR_INFO_TYPE, |
540 CALL_HANDLER_INFO_TYPE, | 541 CALL_HANDLER_INFO_TYPE, |
541 FUNCTION_TEMPLATE_INFO_TYPE, | 542 FUNCTION_TEMPLATE_INFO_TYPE, |
542 OBJECT_TEMPLATE_INFO_TYPE, | 543 OBJECT_TEMPLATE_INFO_TYPE, |
543 SIGNATURE_INFO_TYPE, | 544 SIGNATURE_INFO_TYPE, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
722 V(ExternalPixelArray) \ | 723 V(ExternalPixelArray) \ |
723 V(ByteArray) \ | 724 V(ByteArray) \ |
724 V(JSReceiver) \ | 725 V(JSReceiver) \ |
725 V(JSObject) \ | 726 V(JSObject) \ |
726 V(JSContextExtensionObject) \ | 727 V(JSContextExtensionObject) \ |
727 V(Map) \ | 728 V(Map) \ |
728 V(DescriptorArray) \ | 729 V(DescriptorArray) \ |
729 V(DeoptimizationInputData) \ | 730 V(DeoptimizationInputData) \ |
730 V(DeoptimizationOutputData) \ | 731 V(DeoptimizationOutputData) \ |
731 V(FixedArray) \ | 732 V(FixedArray) \ |
733 V(FixedDoubleArray) \ | |
732 V(Context) \ | 734 V(Context) \ |
733 V(CatchContext) \ | 735 V(CatchContext) \ |
734 V(GlobalContext) \ | 736 V(GlobalContext) \ |
735 V(JSFunction) \ | 737 V(JSFunction) \ |
736 V(Code) \ | 738 V(Code) \ |
737 V(Oddball) \ | 739 V(Oddball) \ |
738 V(SharedFunctionInfo) \ | 740 V(SharedFunctionInfo) \ |
739 V(JSValue) \ | 741 V(JSValue) \ |
740 V(JSMessageObject) \ | 742 V(JSMessageObject) \ |
741 V(StringWrapper) \ | 743 V(StringWrapper) \ |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
789 INLINE(bool IsUndefined()); | 791 INLINE(bool IsUndefined()); |
790 INLINE(bool IsNull()); | 792 INLINE(bool IsNull()); |
791 INLINE(bool IsTheHole()); // Shadows MaybeObject's implementation. | 793 INLINE(bool IsTheHole()); // Shadows MaybeObject's implementation. |
792 INLINE(bool IsTrue()); | 794 INLINE(bool IsTrue()); |
793 INLINE(bool IsFalse()); | 795 INLINE(bool IsFalse()); |
794 inline bool IsArgumentsMarker(); | 796 inline bool IsArgumentsMarker(); |
795 | 797 |
796 // Extract the number. | 798 // Extract the number. |
797 inline double Number(); | 799 inline double Number(); |
798 | 800 |
801 // Returns true if the object is of the correct type to be used as a | |
802 // implementation of a JSObject's elements. | |
803 inline bool HasValidElements(); | |
804 | |
799 inline bool HasSpecificClassOf(String* name); | 805 inline bool HasSpecificClassOf(String* name); |
800 | 806 |
801 MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9. | 807 MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9. |
802 Object* ToBoolean(); // ECMA-262 9.2. | 808 Object* ToBoolean(); // ECMA-262 9.2. |
803 | 809 |
804 // Convert to a JSObject if needed. | 810 // Convert to a JSObject if needed. |
805 // global_context is used when creating wrapper object. | 811 // global_context is used when creating wrapper object. |
806 MUST_USE_RESULT MaybeObject* ToObject(Context* global_context); | 812 MUST_USE_RESULT MaybeObject* ToObject(Context* global_context); |
807 | 813 |
808 // Converts this to a Smi if possible. | 814 // Converts this to a Smi if possible. |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1416 enum DeleteMode { | 1422 enum DeleteMode { |
1417 NORMAL_DELETION, | 1423 NORMAL_DELETION, |
1418 STRICT_DELETION, | 1424 STRICT_DELETION, |
1419 FORCE_DELETION | 1425 FORCE_DELETION |
1420 }; | 1426 }; |
1421 | 1427 |
1422 enum ElementsKind { | 1428 enum ElementsKind { |
1423 // The "fast" kind for tagged values. Must be first to make it possible | 1429 // The "fast" kind for tagged values. Must be first to make it possible |
1424 // to efficiently check maps if they have fast elements. | 1430 // to efficiently check maps if they have fast elements. |
1425 FAST_ELEMENTS, | 1431 FAST_ELEMENTS, |
1432 | |
1433 // The "fast" kind for unwrapped, non-tagged double values. | |
1434 FAST_DOUBLE_ELEMENTS, | |
1435 | |
1426 // The "slow" kind. | 1436 // The "slow" kind. |
1427 DICTIONARY_ELEMENTS, | 1437 DICTIONARY_ELEMENTS, |
1428 // The "fast" kind for external arrays | 1438 // The "fast" kind for external arrays |
1429 EXTERNAL_BYTE_ELEMENTS, | 1439 EXTERNAL_BYTE_ELEMENTS, |
1430 EXTERNAL_UNSIGNED_BYTE_ELEMENTS, | 1440 EXTERNAL_UNSIGNED_BYTE_ELEMENTS, |
1431 EXTERNAL_SHORT_ELEMENTS, | 1441 EXTERNAL_SHORT_ELEMENTS, |
1432 EXTERNAL_UNSIGNED_SHORT_ELEMENTS, | 1442 EXTERNAL_UNSIGNED_SHORT_ELEMENTS, |
1433 EXTERNAL_INT_ELEMENTS, | 1443 EXTERNAL_INT_ELEMENTS, |
1434 EXTERNAL_UNSIGNED_INT_ELEMENTS, | 1444 EXTERNAL_UNSIGNED_INT_ELEMENTS, |
1435 EXTERNAL_FLOAT_ELEMENTS, | 1445 EXTERNAL_FLOAT_ELEMENTS, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1467 // arrays). In the latter case the elements array may be shared by a | 1477 // arrays). In the latter case the elements array may be shared by a |
1468 // few objects and so before writing to any element the array must | 1478 // few objects and so before writing to any element the array must |
1469 // be copied. Use EnsureWritableFastElements in this case. | 1479 // be copied. Use EnsureWritableFastElements in this case. |
1470 // | 1480 // |
1471 // In the slow mode elements is either a NumberDictionary or an ExternalArray. | 1481 // In the slow mode elements is either a NumberDictionary or an ExternalArray. |
1472 DECL_ACCESSORS(elements, HeapObject) | 1482 DECL_ACCESSORS(elements, HeapObject) |
1473 inline void initialize_elements(); | 1483 inline void initialize_elements(); |
1474 MUST_USE_RESULT inline MaybeObject* ResetElements(); | 1484 MUST_USE_RESULT inline MaybeObject* ResetElements(); |
1475 inline ElementsKind GetElementsKind(); | 1485 inline ElementsKind GetElementsKind(); |
1476 inline bool HasFastElements(); | 1486 inline bool HasFastElements(); |
1487 inline bool HasFastDoubleElements(); | |
1477 inline bool HasDictionaryElements(); | 1488 inline bool HasDictionaryElements(); |
1478 inline bool HasExternalPixelElements(); | 1489 inline bool HasExternalPixelElements(); |
1479 inline bool HasExternalArrayElements(); | 1490 inline bool HasExternalArrayElements(); |
1480 inline bool HasExternalByteElements(); | 1491 inline bool HasExternalByteElements(); |
1481 inline bool HasExternalUnsignedByteElements(); | 1492 inline bool HasExternalUnsignedByteElements(); |
1482 inline bool HasExternalShortElements(); | 1493 inline bool HasExternalShortElements(); |
1483 inline bool HasExternalUnsignedShortElements(); | 1494 inline bool HasExternalUnsignedShortElements(); |
1484 inline bool HasExternalIntElements(); | 1495 inline bool HasExternalIntElements(); |
1485 inline bool HasExternalUnsignedIntElements(); | 1496 inline bool HasExternalUnsignedIntElements(); |
1486 inline bool HasExternalFloatElements(); | 1497 inline bool HasExternalFloatElements(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1626 bool IsSimpleEnum(); | 1637 bool IsSimpleEnum(); |
1627 | 1638 |
1628 // Do we want to keep the elements in fast case when increasing the | 1639 // Do we want to keep the elements in fast case when increasing the |
1629 // capacity? | 1640 // capacity? |
1630 bool ShouldConvertToSlowElements(int new_capacity); | 1641 bool ShouldConvertToSlowElements(int new_capacity); |
1631 // Returns true if the backing storage for the slow-case elements of | 1642 // Returns true if the backing storage for the slow-case elements of |
1632 // this object takes up nearly as much space as a fast-case backing | 1643 // this object takes up nearly as much space as a fast-case backing |
1633 // storage would. In that case the JSObject should have fast | 1644 // storage would. In that case the JSObject should have fast |
1634 // elements. | 1645 // elements. |
1635 bool ShouldConvertToFastElements(); | 1646 bool ShouldConvertToFastElements(); |
1647 // Returns true if the elements of JSObject contains exclusively values | |
1648 // that can be represented in a FixedDoubleArray. | |
1649 bool ShouldConvertToFastDoubleElements(); | |
1636 | 1650 |
1637 // Tells whether the index'th element is present. | 1651 // Tells whether the index'th element is present. |
1638 inline bool HasElement(uint32_t index); | 1652 inline bool HasElement(uint32_t index); |
1639 bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index); | 1653 bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index); |
1640 | 1654 |
1641 // Computes the new capacity when expanding the elements of a JSObject. | 1655 // Computes the new capacity when expanding the elements of a JSObject. |
1642 static int NewElementsCapacity(int old_capacity) { | 1656 static int NewElementsCapacity(int old_capacity) { |
1643 // (old_capacity + 50%) + 16 | 1657 // (old_capacity + 50%) + 16 |
1644 return old_capacity + (old_capacity >> 1) + 16; | 1658 return old_capacity + (old_capacity >> 1) + 16; |
1645 } | 1659 } |
(...skipping 19 matching lines...) Expand all Loading... | |
1665 LocalElementType HasLocalElement(uint32_t index); | 1679 LocalElementType HasLocalElement(uint32_t index); |
1666 | 1680 |
1667 bool HasElementWithInterceptor(JSReceiver* receiver, uint32_t index); | 1681 bool HasElementWithInterceptor(JSReceiver* receiver, uint32_t index); |
1668 bool HasElementPostInterceptor(JSReceiver* receiver, uint32_t index); | 1682 bool HasElementPostInterceptor(JSReceiver* receiver, uint32_t index); |
1669 | 1683 |
1670 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, | 1684 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, |
1671 Object* value, | 1685 Object* value, |
1672 StrictModeFlag strict_mode, | 1686 StrictModeFlag strict_mode, |
1673 bool check_prototype = true); | 1687 bool check_prototype = true); |
1674 | 1688 |
1689 MUST_USE_RESULT MaybeObject* SetFastDoubleElement( | |
1690 uint32_t index, | |
1691 Object* value, | |
1692 StrictModeFlag strict_mode, | |
1693 bool check_prototype = true); | |
1694 | |
1675 // Set the index'th array element. | 1695 // Set the index'th array element. |
1676 // A Failure object is returned if GC is needed. | 1696 // A Failure object is returned if GC is needed. |
1677 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, | 1697 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, |
1678 Object* value, | 1698 Object* value, |
1679 StrictModeFlag strict_mode, | 1699 StrictModeFlag strict_mode, |
1680 bool check_prototype = true); | 1700 bool check_prototype = true); |
1681 | 1701 |
1682 // Returns the index'th element. | 1702 // Returns the index'th element. |
1683 // The undefined object if index is out of bounds. | 1703 // The undefined object if index is out of bounds. |
1684 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); | 1704 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); |
1685 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); | 1705 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); |
1686 | 1706 |
1687 // Get external element value at index if there is one and undefined | 1707 // Get external element value at index if there is one and undefined |
1688 // otherwise. Can return a failure if allocation of a heap number | 1708 // otherwise. Can return a failure if allocation of a heap number |
1689 // failed. | 1709 // failed. |
1690 MaybeObject* GetExternalElement(uint32_t index); | 1710 MaybeObject* GetExternalElement(uint32_t index); |
1691 | 1711 |
1692 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity, | 1712 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity, |
1693 int length); | 1713 int length); |
1714 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( | |
1715 int capacity, | |
1716 int length); | |
1694 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length); | 1717 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length); |
1695 | 1718 |
1696 // Lookup interceptors are used for handling properties controlled by host | 1719 // Lookup interceptors are used for handling properties controlled by host |
1697 // objects. | 1720 // objects. |
1698 inline bool HasNamedInterceptor(); | 1721 inline bool HasNamedInterceptor(); |
1699 inline bool HasIndexedInterceptor(); | 1722 inline bool HasIndexedInterceptor(); |
1700 | 1723 |
1701 // Support functions for v8 api (needed for correct interceptor behavior). | 1724 // Support functions for v8 api (needed for correct interceptor behavior). |
1702 bool HasRealNamedProperty(String* key); | 1725 bool HasRealNamedProperty(String* key); |
1703 bool HasRealElementProperty(uint32_t index); | 1726 bool HasRealElementProperty(uint32_t index); |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2084 protected: | 2107 protected: |
2085 // Set operation on FixedArray without using write barriers. Can | 2108 // Set operation on FixedArray without using write barriers. Can |
2086 // only be used for storing old space objects or smis. | 2109 // only be used for storing old space objects or smis. |
2087 static inline void fast_set(FixedArray* array, int index, Object* value); | 2110 static inline void fast_set(FixedArray* array, int index, Object* value); |
2088 | 2111 |
2089 private: | 2112 private: |
2090 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); | 2113 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); |
2091 }; | 2114 }; |
2092 | 2115 |
2093 | 2116 |
2117 // FixedDoubleArray describes fixed-sized arrays with element type double | |
Mads Ager (chromium)
2011/06/06 07:58:23
Period at end of comment.
danno
2011/06/08 12:09:43
Done.
| |
2118 class FixedDoubleArray: public HeapObject { | |
2119 public: | |
2120 inline void Initialize(FixedArray* from); | |
2121 inline void Initialize(FixedDoubleArray* from); | |
2122 inline void Initialize(NumberDictionary* from); | |
2123 | |
2124 // [length]: length of the array. | |
2125 inline int length(); | |
2126 inline void set_length(int value); | |
2127 | |
2128 // Setter and getter for elements. | |
2129 inline double get(int index); | |
2130 inline void set(int index, double value); | |
2131 inline void set_the_hole(int index); | |
2132 | |
2133 // Checking for the hole. | |
2134 inline bool is_the_hole(int index); | |
2135 | |
2136 // Garbage collection support. | |
2137 inline static int SizeFor(int length) { | |
2138 return kHeaderSize + length * kDoubleSize; | |
2139 } | |
2140 | |
2141 // The folllwing can't be declared inline as const static | |
Mads Ager (chromium)
2011/06/06 07:58:23
following
danno
2011/06/08 12:09:43
Done.
| |
2142 // because they're 64-bit. | |
2143 static uint64_t kCanonoicalNonHoleNanLower32; | |
Mads Ager (chromium)
2011/06/06 07:58:23
Canonical.
danno
2011/06/08 12:09:43
Done.
| |
2144 static uint64_t kCanonoicalNonHoleNanInt64; | |
Mads Ager (chromium)
2011/06/06 07:58:23
Canonical.
danno
2011/06/08 12:09:43
Done.
| |
2145 static uint64_t kHoleNanInt64; | |
2146 | |
2147 inline static bool is_the_hole_nan(double value) { | |
2148 return BitCast<uint64_t, double>(value) == kHoleNanInt64; | |
2149 } | |
2150 | |
2151 inline static double hole_nan_as_double() { | |
2152 return BitCast<double, uint64_t>(kHoleNanInt64); | |
2153 } | |
2154 | |
2155 inline static double canonical_not_the_hole_nan_as_double() { | |
2156 return BitCast<double, uint64_t>(kCanonoicalNonHoleNanInt64); | |
2157 } | |
2158 | |
2159 // Casting. | |
2160 static inline FixedDoubleArray* cast(Object* obj); | |
2161 | |
2162 // Layout description. | |
2163 // Length is smi tagged when it is stored. | |
Mads Ager (chromium)
2011/06/06 07:58:23
Is it? Didn't we just use INT_ACCESSOR?
You could
danno
2011/06/08 12:09:43
Done.
| |
2164 static const int kLengthOffset = HeapObject::kHeaderSize; | |
2165 static const int kHeaderSize = kLengthOffset + kPointerSize; | |
2166 | |
2167 // Maximal allowed size, in bytes, of a single FixedDoubleArray. | |
2168 // Prevents overflowing size computations, as well as extreme memory | |
2169 // consumption. | |
2170 static const int kMaxSize = 512 * MB; | |
2171 // Maximally allowed length of a FixedArray. | |
2172 static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize; | |
2173 | |
2174 // Dispatched behavior. | |
2175 #ifdef OBJECT_PRINT | |
2176 inline void FixedDoubleArrayPrint() { | |
2177 FixedDoubleArrayPrint(stdout); | |
2178 } | |
2179 void FixedDoubleArrayPrint(FILE* out); | |
2180 #endif | |
2181 | |
2182 private: | |
2183 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); | |
2184 }; | |
2185 | |
2186 | |
2094 // DescriptorArrays are fixed arrays used to hold instance descriptors. | 2187 // DescriptorArrays are fixed arrays used to hold instance descriptors. |
2095 // The format of the these objects is: | 2188 // The format of the these objects is: |
2096 // TODO(1399): It should be possible to make room for bit_field3 in the map | 2189 // TODO(1399): It should be possible to make room for bit_field3 in the map |
2097 // without overloading the instance descriptors field in the map | 2190 // without overloading the instance descriptors field in the map |
2098 // (and storing it in the DescriptorArray when the map has one). | 2191 // (and storing it in the DescriptorArray when the map has one). |
2099 // [0]: storage for bit_field3 for Map owning this object (Smi) | 2192 // [0]: storage for bit_field3 for Map owning this object (Smi) |
2100 // [1]: point to a fixed array with (value, detail) pairs. | 2193 // [1]: point to a fixed array with (value, detail) pairs. |
2101 // [2]: next enumeration index (Smi), or pointer to small fixed array: | 2194 // [2]: next enumeration index (Smi), or pointer to small fixed array: |
2102 // [0]: next enumeration index (Smi) | 2195 // [0]: next enumeration index (Smi) |
2103 // [1]: pointer to fixed array with enum cache | 2196 // [1]: pointer to fixed array with enum cache |
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3805 | 3898 |
3806 inline JSObject::ElementsKind elements_kind() { | 3899 inline JSObject::ElementsKind elements_kind() { |
3807 return static_cast<JSObject::ElementsKind>( | 3900 return static_cast<JSObject::ElementsKind>( |
3808 (bit_field2() & kElementsKindMask) >> kElementsKindShift); | 3901 (bit_field2() & kElementsKindMask) >> kElementsKindShift); |
3809 } | 3902 } |
3810 | 3903 |
3811 inline bool has_fast_elements() { | 3904 inline bool has_fast_elements() { |
3812 return elements_kind() == JSObject::FAST_ELEMENTS; | 3905 return elements_kind() == JSObject::FAST_ELEMENTS; |
3813 } | 3906 } |
3814 | 3907 |
3908 inline bool has_fast_double_elements() { | |
3909 return elements_kind() == JSObject::FAST_DOUBLE_ELEMENTS; | |
3910 } | |
3911 | |
3815 inline bool has_external_array_elements() { | 3912 inline bool has_external_array_elements() { |
3816 JSObject::ElementsKind kind(elements_kind()); | 3913 JSObject::ElementsKind kind(elements_kind()); |
3817 return kind >= JSObject::FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && | 3914 return kind >= JSObject::FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && |
3818 kind <= JSObject::LAST_EXTERNAL_ARRAY_ELEMENTS_KIND; | 3915 kind <= JSObject::LAST_EXTERNAL_ARRAY_ELEMENTS_KIND; |
3819 } | 3916 } |
3820 | 3917 |
3821 // Tells whether the map is attached to SharedFunctionInfo | 3918 // Tells whether the map is attached to SharedFunctionInfo |
3822 // (for inobject slack tracking). | 3919 // (for inobject slack tracking). |
3823 inline void set_attached_to_shared_function_info(bool value); | 3920 inline void set_attached_to_shared_function_info(bool value); |
3824 | 3921 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3877 | 3974 |
3878 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); | 3975 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); |
3879 | 3976 |
3880 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, | 3977 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, |
3881 NormalizedMapSharingMode sharing); | 3978 NormalizedMapSharingMode sharing); |
3882 | 3979 |
3883 // Returns a copy of the map, with all transitions dropped from the | 3980 // Returns a copy of the map, with all transitions dropped from the |
3884 // instance descriptors. | 3981 // instance descriptors. |
3885 MUST_USE_RESULT MaybeObject* CopyDropTransitions(); | 3982 MUST_USE_RESULT MaybeObject* CopyDropTransitions(); |
3886 | 3983 |
3887 // Returns this map if it has the fast elements bit set, otherwise | 3984 // Returns this map if it already has elements that are fast, otherwise |
3888 // returns a copy of the map, with all transitions dropped from the | 3985 // returns a copy of the map, with all transitions dropped from the |
3889 // descriptors and the fast elements bit set. | 3986 // descriptors and the fast elements bit set. |
3890 MUST_USE_RESULT inline MaybeObject* GetFastElementsMap(); | 3987 MUST_USE_RESULT inline MaybeObject* GetFastElementsMap(); |
3891 | 3988 |
3892 // Returns this map if it has the fast elements bit cleared, | 3989 // Returns this map if it already has fast elements that are doubles, |
3893 // otherwise returns a copy of the map, with all transitions dropped | 3990 // otherwise returns a copy of the map, with all transitions dropped from the |
3894 // from the descriptors and the fast elements bit cleared. | 3991 // descriptors and the fast elements bit set. |
Mads Ager (chromium)
2011/06/06 07:58:23
These comments should be updated? The fast element
danno
2011/06/08 12:09:43
Done.
| |
3992 MUST_USE_RESULT inline MaybeObject* GetFastDoubleElementsMap(); | |
3993 | |
3994 // Returns this map if already has dictionary elements, otherwise returns a | |
3995 // copy of the map, with all transitions dropped from the descriptors and the | |
3996 // fast elements bit cleared. | |
3895 MUST_USE_RESULT inline MaybeObject* GetSlowElementsMap(); | 3997 MUST_USE_RESULT inline MaybeObject* GetSlowElementsMap(); |
3896 | 3998 |
3897 // Returns a new map with all transitions dropped from the descriptors and the | 3999 // Returns a new map with all transitions dropped from the descriptors and the |
3898 // external array elements bit set. | 4000 // external array elements bit set. |
3899 MUST_USE_RESULT MaybeObject* GetExternalArrayElementsMap( | 4001 MUST_USE_RESULT MaybeObject* GetExternalArrayElementsMap( |
3900 ExternalArrayType array_type, | 4002 ExternalArrayType array_type, |
3901 bool safe_to_add_transition); | 4003 bool safe_to_add_transition); |
3902 | 4004 |
3903 // Returns the property index for name (only valid for FAST MODE). | 4005 // Returns the property index for name (only valid for FAST MODE). |
3904 int PropertyIndexFor(String* name); | 4006 int PropertyIndexFor(String* name); |
(...skipping 3003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6908 } else { | 7010 } else { |
6909 value &= ~(1 << bit_position); | 7011 value &= ~(1 << bit_position); |
6910 } | 7012 } |
6911 return value; | 7013 return value; |
6912 } | 7014 } |
6913 }; | 7015 }; |
6914 | 7016 |
6915 } } // namespace v8::internal | 7017 } } // namespace v8::internal |
6916 | 7018 |
6917 #endif // V8_OBJECTS_H_ | 7019 #endif // V8_OBJECTS_H_ |
OLD | NEW |