| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ | 
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ | 
| 7 | 7 | 
| 8 #include <iosfwd> | 8 #include <iosfwd> | 
| 9 | 9 | 
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" | 
| (...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1768 }; | 1768 }; | 
| 1769 | 1769 | 
| 1770 | 1770 | 
| 1771 // Indicator for one component of an AccessorPair. | 1771 // Indicator for one component of an AccessorPair. | 
| 1772 enum AccessorComponent { | 1772 enum AccessorComponent { | 
| 1773   ACCESSOR_GETTER, | 1773   ACCESSOR_GETTER, | 
| 1774   ACCESSOR_SETTER | 1774   ACCESSOR_SETTER | 
| 1775 }; | 1775 }; | 
| 1776 | 1776 | 
| 1777 | 1777 | 
|  | 1778 enum KeyFilter { SKIP_SYMBOLS, INCLUDE_SYMBOLS }; | 
|  | 1779 | 
|  | 1780 | 
| 1778 // JSReceiver includes types on which properties can be defined, i.e., | 1781 // JSReceiver includes types on which properties can be defined, i.e., | 
| 1779 // JSObject and JSProxy. | 1782 // JSObject and JSProxy. | 
| 1780 class JSReceiver: public HeapObject { | 1783 class JSReceiver: public HeapObject { | 
| 1781  public: | 1784  public: | 
| 1782   DECLARE_CAST(JSReceiver) | 1785   DECLARE_CAST(JSReceiver) | 
| 1783 | 1786 | 
| 1784   // ES6 section 7.1.1 ToPrimitive | 1787   // ES6 section 7.1.1 ToPrimitive | 
| 1785   MUST_USE_RESULT static MaybeHandle<Object> ToPrimitive( | 1788   MUST_USE_RESULT static MaybeHandle<Object> ToPrimitive( | 
| 1786       Handle<JSReceiver> receiver, | 1789       Handle<JSReceiver> receiver, | 
| 1787       ToPrimitiveHint hint = ToPrimitiveHint::kDefault); | 1790       ToPrimitiveHint hint = ToPrimitiveHint::kDefault); | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1847   // Retrieves a permanent object identity hash code. May create and store a | 1850   // Retrieves a permanent object identity hash code. May create and store a | 
| 1848   // hash code if needed and none exists. | 1851   // hash code if needed and none exists. | 
| 1849   inline static Handle<Smi> GetOrCreateIdentityHash( | 1852   inline static Handle<Smi> GetOrCreateIdentityHash( | 
| 1850       Handle<JSReceiver> object); | 1853       Handle<JSReceiver> object); | 
| 1851 | 1854 | 
| 1852   enum KeyCollectionType { OWN_ONLY, INCLUDE_PROTOS }; | 1855   enum KeyCollectionType { OWN_ONLY, INCLUDE_PROTOS }; | 
| 1853 | 1856 | 
| 1854   // Computes the enumerable keys for a JSObject. Used for implementing | 1857   // Computes the enumerable keys for a JSObject. Used for implementing | 
| 1855   // "for (n in object) { }". | 1858   // "for (n in object) { }". | 
| 1856   MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( | 1859   MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( | 
| 1857       Handle<JSReceiver> object, | 1860       Handle<JSReceiver> object, KeyCollectionType type, | 
| 1858       KeyCollectionType type); | 1861       KeyFilter filter = SKIP_SYMBOLS); | 
| 1859 | 1862 | 
| 1860  private: | 1863  private: | 
| 1861   DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 1864   DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 
| 1862 }; | 1865 }; | 
| 1863 | 1866 | 
| 1864 | 1867 | 
| 1865 // The JSObject describes real heap allocated JavaScript objects with | 1868 // The JSObject describes real heap allocated JavaScript objects with | 
| 1866 // properties. | 1869 // properties. | 
| 1867 // Note that the map of JSObject changes during execution to enable inline | 1870 // Note that the map of JSObject changes during execution to enable inline | 
| 1868 // caching. | 1871 // caching. | 
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2512   inline bool ContainsOnlySmisOrHoles(); | 2515   inline bool ContainsOnlySmisOrHoles(); | 
| 2513 | 2516 | 
| 2514   // Gives access to raw memory which stores the array's data. | 2517   // Gives access to raw memory which stores the array's data. | 
| 2515   inline Object** data_start(); | 2518   inline Object** data_start(); | 
| 2516 | 2519 | 
| 2517   inline void FillWithHoles(int from, int to); | 2520   inline void FillWithHoles(int from, int to); | 
| 2518 | 2521 | 
| 2519   // Shrink length and insert filler objects. | 2522   // Shrink length and insert filler objects. | 
| 2520   void Shrink(int length); | 2523   void Shrink(int length); | 
| 2521 | 2524 | 
| 2522   enum KeyFilter { ALL_KEYS, NON_SYMBOL_KEYS }; |  | 
| 2523 |  | 
| 2524   // Copy a sub array from the receiver to dest. | 2525   // Copy a sub array from the receiver to dest. | 
| 2525   void CopyTo(int pos, FixedArray* dest, int dest_pos, int len); | 2526   void CopyTo(int pos, FixedArray* dest, int dest_pos, int len); | 
| 2526 | 2527 | 
| 2527   // Garbage collection support. | 2528   // Garbage collection support. | 
| 2528   static int SizeFor(int length) { return kHeaderSize + length * kPointerSize; } | 2529   static int SizeFor(int length) { return kHeaderSize + length * kPointerSize; } | 
| 2529 | 2530 | 
| 2530   // Code Generation support. | 2531   // Code Generation support. | 
| 2531   static int OffsetOfElementAt(int index) { return SizeFor(index); } | 2532   static int OffsetOfElementAt(int index) { return SizeFor(index); } | 
| 2532 | 2533 | 
| 2533   // Garbage collection support. | 2534   // Garbage collection support. | 
| (...skipping 8066 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 10600     return value; | 10601     return value; | 
| 10601   } | 10602   } | 
| 10602 }; | 10603 }; | 
| 10603 | 10604 | 
| 10604 | 10605 | 
| 10605 class KeyAccumulator final BASE_EMBEDDED { | 10606 class KeyAccumulator final BASE_EMBEDDED { | 
| 10606  public: | 10607  public: | 
| 10607   explicit KeyAccumulator(Isolate* isolate) : isolate_(isolate), length_(0) {} | 10608   explicit KeyAccumulator(Isolate* isolate) : isolate_(isolate), length_(0) {} | 
| 10608 | 10609 | 
| 10609   void AddKey(Handle<Object> key, int check_limit); | 10610   void AddKey(Handle<Object> key, int check_limit); | 
| 10610   void AddKeys(Handle<FixedArray> array, FixedArray::KeyFilter filter); | 10611   void AddKeys(Handle<FixedArray> array, KeyFilter filter); | 
| 10611   void AddKeys(Handle<JSObject> array, FixedArray::KeyFilter filter); | 10612   void AddKeys(Handle<JSObject> array, KeyFilter filter); | 
| 10612   void PrepareForComparisons(int count); | 10613   void PrepareForComparisons(int count); | 
| 10613   Handle<FixedArray> GetKeys(); | 10614   Handle<FixedArray> GetKeys(); | 
| 10614 | 10615 | 
| 10615   int GetLength() { return length_; } | 10616   int GetLength() { return length_; } | 
| 10616 | 10617 | 
| 10617  private: | 10618  private: | 
| 10618   void EnsureCapacity(int capacity); | 10619   void EnsureCapacity(int capacity); | 
| 10619   void Grow(); | 10620   void Grow(); | 
| 10620 | 10621 | 
| 10621   Isolate* isolate_; | 10622   Isolate* isolate_; | 
| 10622   Handle<FixedArray> keys_; | 10623   Handle<FixedArray> keys_; | 
| 10623   Handle<OrderedHashSet> set_; | 10624   Handle<OrderedHashSet> set_; | 
| 10624   int length_; | 10625   int length_; | 
| 10625   DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); | 10626   DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); | 
| 10626 }; | 10627 }; | 
| 10627 | 10628 | 
| 10628 }  // NOLINT, false-positive due to second-order macros. | 10629 }  // NOLINT, false-positive due to second-order macros. | 
| 10629 }  // NOLINT, false-positive due to second-order macros. | 10630 }  // NOLINT, false-positive due to second-order macros. | 
| 10630 | 10631 | 
| 10631 #endif  // V8_OBJECTS_H_ | 10632 #endif  // V8_OBJECTS_H_ | 
| OLD | NEW | 
|---|