| 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 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1466   inline bool HasExternalShortElements(); | 1466   inline bool HasExternalShortElements(); | 
| 1467   inline bool HasExternalUnsignedShortElements(); | 1467   inline bool HasExternalUnsignedShortElements(); | 
| 1468   inline bool HasExternalIntElements(); | 1468   inline bool HasExternalIntElements(); | 
| 1469   inline bool HasExternalUnsignedIntElements(); | 1469   inline bool HasExternalUnsignedIntElements(); | 
| 1470   inline bool HasExternalFloatElements(); | 1470   inline bool HasExternalFloatElements(); | 
| 1471   inline bool HasExternalDoubleElements(); | 1471   inline bool HasExternalDoubleElements(); | 
| 1472   bool HasFastArgumentsElements(); | 1472   bool HasFastArgumentsElements(); | 
| 1473   bool HasDictionaryArgumentsElements(); | 1473   bool HasDictionaryArgumentsElements(); | 
| 1474   inline NumberDictionary* element_dictionary();  // Gets slow elements. | 1474   inline NumberDictionary* element_dictionary();  // Gets slow elements. | 
| 1475 | 1475 | 
|  | 1476   inline void set_map_and_elements( | 
|  | 1477       Map* map, | 
|  | 1478       FixedArrayBase* value, | 
|  | 1479       WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 
|  | 1480 | 
| 1476   // Requires: HasFastElements(). | 1481   // Requires: HasFastElements(). | 
| 1477   MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); | 1482   MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); | 
| 1478 | 1483 | 
| 1479   // Collects elements starting at index 0. | 1484   // Collects elements starting at index 0. | 
| 1480   // Undefined values are placed after non-undefined values. | 1485   // Undefined values are placed after non-undefined values. | 
| 1481   // Returns the number of non-undefined values. | 1486   // Returns the number of non-undefined values. | 
| 1482   MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); | 1487   MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); | 
| 1483   // As PrepareElementsForSort, but only on objects where elements is | 1488   // As PrepareElementsForSort, but only on objects where elements is | 
| 1484   // a dictionary, and it will stay a dictionary. | 1489   // a dictionary, and it will stay a dictionary. | 
| 1485   MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); | 1490   MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); | 
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1637 | 1642 | 
| 1638   // Do we want to keep the elements in fast case when increasing the | 1643   // Do we want to keep the elements in fast case when increasing the | 
| 1639   // capacity? | 1644   // capacity? | 
| 1640   bool ShouldConvertToSlowElements(int new_capacity); | 1645   bool ShouldConvertToSlowElements(int new_capacity); | 
| 1641   // Returns true if the backing storage for the slow-case elements of | 1646   // Returns true if the backing storage for the slow-case elements of | 
| 1642   // this object takes up nearly as much space as a fast-case backing | 1647   // this object takes up nearly as much space as a fast-case backing | 
| 1643   // storage would.  In that case the JSObject should have fast | 1648   // storage would.  In that case the JSObject should have fast | 
| 1644   // elements. | 1649   // elements. | 
| 1645   bool ShouldConvertToFastElements(); | 1650   bool ShouldConvertToFastElements(); | 
| 1646   // Returns true if the elements of JSObject contains only values that can be | 1651   // Returns true if the elements of JSObject contains only values that can be | 
| 1647   // represented in a FixedDoubleArray. | 1652   // represented in a FixedDoubleArray and has at least one value that can only | 
| 1648   bool CanConvertToFastDoubleElements(); | 1653   // be represented as a double and not a Smi. | 
|  | 1654   bool ShouldConvertToFastDoubleElements(bool* has_smi_only_elements); | 
| 1649 | 1655 | 
| 1650   // Tells whether the index'th element is present. | 1656   // Tells whether the index'th element is present. | 
| 1651   bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index); | 1657   bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index); | 
| 1652 | 1658 | 
| 1653   // Computes the new capacity when expanding the elements of a JSObject. | 1659   // Computes the new capacity when expanding the elements of a JSObject. | 
| 1654   static int NewElementsCapacity(int old_capacity) { | 1660   static int NewElementsCapacity(int old_capacity) { | 
| 1655     // (old_capacity + 50%) + 16 | 1661     // (old_capacity + 50%) + 16 | 
| 1656     return old_capacity + (old_capacity >> 1) + 16; | 1662     return old_capacity + (old_capacity >> 1) + 16; | 
| 1657   } | 1663   } | 
| 1658 | 1664 | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1701                                           Object* value, | 1707                                           Object* value, | 
| 1702                                           StrictModeFlag strict_mode, | 1708                                           StrictModeFlag strict_mode, | 
| 1703                                           bool check_prototype); | 1709                                           bool check_prototype); | 
| 1704 | 1710 | 
| 1705   // Returns the index'th element. | 1711   // Returns the index'th element. | 
| 1706   // The undefined object if index is out of bounds. | 1712   // The undefined object if index is out of bounds. | 
| 1707   MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); | 1713   MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); | 
| 1708 | 1714 | 
| 1709   enum SetFastElementsCapacityMode { | 1715   enum SetFastElementsCapacityMode { | 
| 1710     kAllowSmiOnlyElements, | 1716     kAllowSmiOnlyElements, | 
|  | 1717     kForceSmiOnlyElements, | 
| 1711     kDontAllowSmiOnlyElements | 1718     kDontAllowSmiOnlyElements | 
| 1712   }; | 1719   }; | 
| 1713 | 1720 | 
| 1714   // Replace the elements' backing store with fast elements of the given | 1721   // Replace the elements' backing store with fast elements of the given | 
| 1715   // capacity.  Update the length for JSArrays.  Returns the new backing | 1722   // capacity.  Update the length for JSArrays.  Returns the new backing | 
| 1716   // store. | 1723   // store. | 
| 1717   MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength( | 1724   MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength( | 
| 1718       int capacity, | 1725       int capacity, | 
| 1719       int length, | 1726       int length, | 
| 1720       SetFastElementsCapacityMode set_capacity_mode); | 1727       SetFastElementsCapacityMode set_capacity_mode); | 
| (...skipping 6280 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 8001     } else { | 8008     } else { | 
| 8002       value &= ~(1 << bit_position); | 8009       value &= ~(1 << bit_position); | 
| 8003     } | 8010     } | 
| 8004     return value; | 8011     return value; | 
| 8005   } | 8012   } | 
| 8006 }; | 8013 }; | 
| 8007 | 8014 | 
| 8008 } }  // namespace v8::internal | 8015 } }  // namespace v8::internal | 
| 8009 | 8016 | 
| 8010 #endif  // V8_OBJECTS_H_ | 8017 #endif  // V8_OBJECTS_H_ | 
| OLD | NEW | 
|---|