Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: src/objects.h

Issue 2961253002: [objects] Rename macros from DECLARE_ to DECL_ for consistency. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/feedback-vector.h ('k') | src/objects/arguments.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include <memory> 9 #include <memory>
10 10
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 class WeakCell; 959 class WeakCell;
960 class TransitionArray; 960 class TransitionArray;
961 class TemplateList; 961 class TemplateList;
962 template <typename T> 962 template <typename T>
963 class ZoneForwardList; 963 class ZoneForwardList;
964 964
965 // A template-ized version of the IsXXX functions. 965 // A template-ized version of the IsXXX functions.
966 template <class C> inline bool Is(Object* obj); 966 template <class C> inline bool Is(Object* obj);
967 967
968 #ifdef OBJECT_PRINT 968 #ifdef OBJECT_PRINT
969 #define DECLARE_PRINTER(Name) void Name##Print(std::ostream& os); // NOLINT 969 #define DECL_PRINTER(Name) void Name##Print(std::ostream& os); // NOLINT
970 #else 970 #else
971 #define DECLARE_PRINTER(Name) 971 #define DECL_PRINTER(Name)
972 #endif 972 #endif
973 973
974 #define OBJECT_TYPE_LIST(V) \ 974 #define OBJECT_TYPE_LIST(V) \
975 V(Smi) \ 975 V(Smi) \
976 V(LayoutDescriptor) \ 976 V(LayoutDescriptor) \
977 V(HeapObject) \ 977 V(HeapObject) \
978 V(Primitive) \ 978 V(Primitive) \
979 V(Number) 979 V(Number)
980 980
981 #define HEAP_OBJECT_TYPE_LIST(V) \ 981 #define HEAP_OBJECT_TYPE_LIST(V) \
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 } \ 1165 } \
1166 } while (false) 1166 } while (false)
1167 1167
1168 #define MAYBE_RETURN(call, value) \ 1168 #define MAYBE_RETURN(call, value) \
1169 do { \ 1169 do { \
1170 if ((call).IsNothing()) return value; \ 1170 if ((call).IsNothing()) return value; \
1171 } while (false) 1171 } while (false)
1172 1172
1173 #define MAYBE_RETURN_NULL(call) MAYBE_RETURN(call, MaybeHandle<Object>()) 1173 #define MAYBE_RETURN_NULL(call) MAYBE_RETURN(call, MaybeHandle<Object>())
1174 1174
1175 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ 1175 #define DECL_STRUCT_PREDICATE(NAME, Name, name) INLINE(bool Is##Name() const);
1176 INLINE(bool Is##Name() const); 1176 STRUCT_LIST(DECL_STRUCT_PREDICATE)
1177 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) 1177 #undef DECL_STRUCT_PREDICATE
1178 #undef DECLARE_STRUCT_PREDICATE
1179 1178
1180 // ES6, #sec-isarray. NOT to be confused with %_IsArray. 1179 // ES6, #sec-isarray. NOT to be confused with %_IsArray.
1181 INLINE(MUST_USE_RESULT static Maybe<bool> IsArray(Handle<Object> object)); 1180 INLINE(MUST_USE_RESULT static Maybe<bool> IsArray(Handle<Object> object));
1182 1181
1183 INLINE(bool IsNameDictionary() const); 1182 INLINE(bool IsNameDictionary() const);
1184 INLINE(bool IsGlobalDictionary() const); 1183 INLINE(bool IsGlobalDictionary() const);
1185 INLINE(bool IsSeededNumberDictionary() const); 1184 INLINE(bool IsSeededNumberDictionary() const);
1186 INLINE(bool IsOrderedHashSet() const); 1185 INLINE(bool IsOrderedHashSet() const);
1187 INLINE(bool IsOrderedHashMap() const); 1186 INLINE(bool IsOrderedHashMap() const);
1188 INLINE(bool IsSmallOrderedHashTable() const); 1187 INLINE(bool IsSmallOrderedHashTable() const);
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 // Tries to convert an object to an array index. Returns true and sets the 1475 // Tries to convert an object to an array index. Returns true and sets the
1477 // output parameter if it succeeds. Equivalent to ToArrayLength, but does not 1476 // output parameter if it succeeds. Equivalent to ToArrayLength, but does not
1478 // allow kMaxUInt32. 1477 // allow kMaxUInt32.
1479 inline bool ToArrayIndex(uint32_t* index); 1478 inline bool ToArrayIndex(uint32_t* index);
1480 1479
1481 // Returns true if the result of iterating over the object is the same 1480 // Returns true if the result of iterating over the object is the same
1482 // (including observable effects) as simply accessing the properties between 0 1481 // (including observable effects) as simply accessing the properties between 0
1483 // and length. 1482 // and length.
1484 bool IterationHasObservableEffects(); 1483 bool IterationHasObservableEffects();
1485 1484
1486 DECLARE_VERIFIER(Object) 1485 DECL_VERIFIER(Object)
1487 #ifdef VERIFY_HEAP 1486 #ifdef VERIFY_HEAP
1488 // Verify a pointer is a valid object pointer. 1487 // Verify a pointer is a valid object pointer.
1489 static void VerifyPointer(Object* p); 1488 static void VerifyPointer(Object* p);
1490 #endif 1489 #endif
1491 1490
1492 inline void VerifyApiCallResultType(); 1491 inline void VerifyApiCallResultType();
1493 1492
1494 // Prints this object without details. 1493 // Prints this object without details.
1495 void ShortPrint(FILE* out = stdout); 1494 void ShortPrint(FILE* out = stdout);
1496 1495
1497 // Prints this object without details to a message accumulator. 1496 // Prints this object without details to a message accumulator.
1498 void ShortPrint(StringStream* accumulator); 1497 void ShortPrint(StringStream* accumulator);
1499 1498
1500 void ShortPrint(std::ostream& os); // NOLINT 1499 void ShortPrint(std::ostream& os); // NOLINT
1501 1500
1502 DECLARE_CAST(Object) 1501 DECL_CAST(Object)
1503 1502
1504 // Layout description. 1503 // Layout description.
1505 static const int kHeaderSize = 0; // Object does not take up any space. 1504 static const int kHeaderSize = 0; // Object does not take up any space.
1506 1505
1507 #ifdef OBJECT_PRINT 1506 #ifdef OBJECT_PRINT
1508 // For our gdb macros, we should perhaps change these in the future. 1507 // For our gdb macros, we should perhaps change these in the future.
1509 void Print(); 1508 void Print();
1510 1509
1511 // Prints this object with details. 1510 // Prints this object with details.
1512 void Print(std::ostream& os); // NOLINT 1511 void Print(std::ostream& os); // NOLINT
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 return FromInt(static_cast<int>(value)); 1599 return FromInt(static_cast<int>(value));
1601 } 1600 }
1602 1601
1603 // Returns whether value can be represented in a Smi. 1602 // Returns whether value can be represented in a Smi.
1604 static inline bool IsValid(intptr_t value) { 1603 static inline bool IsValid(intptr_t value) {
1605 bool result = Internals::IsValidSmi(value); 1604 bool result = Internals::IsValidSmi(value);
1606 DCHECK_EQ(result, value >= kMinValue && value <= kMaxValue); 1605 DCHECK_EQ(result, value >= kMinValue && value <= kMaxValue);
1607 return result; 1606 return result;
1608 } 1607 }
1609 1608
1610 DECLARE_CAST(Smi) 1609 DECL_CAST(Smi)
1611 1610
1612 // Dispatched behavior. 1611 // Dispatched behavior.
1613 V8_EXPORT_PRIVATE void SmiPrint(std::ostream& os) const; // NOLINT 1612 V8_EXPORT_PRIVATE void SmiPrint(std::ostream& os) const; // NOLINT
1614 DECLARE_VERIFIER(Smi) 1613 DECL_VERIFIER(Smi)
1615 1614
1616 static constexpr Smi* const kZero = nullptr; 1615 static constexpr Smi* const kZero = nullptr;
1617 static const int kMinValue = 1616 static const int kMinValue =
1618 (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1); 1617 (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
1619 static const int kMaxValue = -(kMinValue + 1); 1618 static const int kMaxValue = -(kMinValue + 1);
1620 1619
1621 private: 1620 private:
1622 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi); 1621 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi);
1623 }; 1622 };
1624 1623
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL) 1713 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
1715 #undef IS_TYPE_FUNCTION_DECL 1714 #undef IS_TYPE_FUNCTION_DECL
1716 1715
1717 #define IS_TYPE_FUNCTION_DECL(Type, Value) \ 1716 #define IS_TYPE_FUNCTION_DECL(Type, Value) \
1718 INLINE(bool Is##Type(Isolate* isolate) const); 1717 INLINE(bool Is##Type(Isolate* isolate) const);
1719 ODDBALL_LIST(IS_TYPE_FUNCTION_DECL) 1718 ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
1720 #undef IS_TYPE_FUNCTION_DECL 1719 #undef IS_TYPE_FUNCTION_DECL
1721 1720
1722 INLINE(bool IsNullOrUndefined(Isolate* isolate) const); 1721 INLINE(bool IsNullOrUndefined(Isolate* isolate) const);
1723 1722
1724 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ 1723 #define DECL_STRUCT_PREDICATE(NAME, Name, name) INLINE(bool Is##Name() const);
1725 INLINE(bool Is##Name() const); 1724 STRUCT_LIST(DECL_STRUCT_PREDICATE)
1726 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) 1725 #undef DECL_STRUCT_PREDICATE
1727 #undef DECLARE_STRUCT_PREDICATE
1728 1726
1729 // Converts an address to a HeapObject pointer. 1727 // Converts an address to a HeapObject pointer.
1730 static inline HeapObject* FromAddress(Address address) { 1728 static inline HeapObject* FromAddress(Address address) {
1731 DCHECK_TAG_ALIGNED(address); 1729 DCHECK_TAG_ALIGNED(address);
1732 return reinterpret_cast<HeapObject*>(address + kHeapObjectTag); 1730 return reinterpret_cast<HeapObject*>(address + kHeapObjectTag);
1733 } 1731 }
1734 1732
1735 // Returns the address of this HeapObject. 1733 // Returns the address of this HeapObject.
1736 inline Address address() { 1734 inline Address address() {
1737 return reinterpret_cast<Address>(this) - kHeapObjectTag; 1735 return reinterpret_cast<Address>(this) - kHeapObjectTag;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 // during marking GC. 1778 // during marking GC.
1781 static inline Object** RawField(HeapObject* obj, int offset); 1779 static inline Object** RawField(HeapObject* obj, int offset);
1782 1780
1783 // Adds the |code| object related to |name| to the code cache of this map. If 1781 // Adds the |code| object related to |name| to the code cache of this map. If
1784 // this map is a dictionary map that is shared, the map copied and installed 1782 // this map is a dictionary map that is shared, the map copied and installed
1785 // onto the object. 1783 // onto the object.
1786 static void UpdateMapCodeCache(Handle<HeapObject> object, 1784 static void UpdateMapCodeCache(Handle<HeapObject> object,
1787 Handle<Name> name, 1785 Handle<Name> name,
1788 Handle<Code> code); 1786 Handle<Code> code);
1789 1787
1790 DECLARE_CAST(HeapObject) 1788 DECL_CAST(HeapObject)
1791 1789
1792 // Return the write barrier mode for this. Callers of this function 1790 // Return the write barrier mode for this. Callers of this function
1793 // must be able to present a reference to an DisallowHeapAllocation 1791 // must be able to present a reference to an DisallowHeapAllocation
1794 // object as a sign that they are not going to use this function 1792 // object as a sign that they are not going to use this function
1795 // from code that allocates and thus invalidates the returned write 1793 // from code that allocates and thus invalidates the returned write
1796 // barrier mode. 1794 // barrier mode.
1797 inline WriteBarrierMode GetWriteBarrierMode( 1795 inline WriteBarrierMode GetWriteBarrierMode(
1798 const DisallowHeapAllocation& promise); 1796 const DisallowHeapAllocation& promise);
1799 1797
1800 // Dispatched behavior. 1798 // Dispatched behavior.
1801 void HeapObjectShortPrint(std::ostream& os); // NOLINT 1799 void HeapObjectShortPrint(std::ostream& os); // NOLINT
1802 #ifdef OBJECT_PRINT 1800 #ifdef OBJECT_PRINT
1803 void PrintHeader(std::ostream& os, const char* id); // NOLINT 1801 void PrintHeader(std::ostream& os, const char* id); // NOLINT
1804 #endif 1802 #endif
1805 DECLARE_PRINTER(HeapObject) 1803 DECL_PRINTER(HeapObject)
1806 DECLARE_VERIFIER(HeapObject) 1804 DECL_VERIFIER(HeapObject)
1807 #ifdef VERIFY_HEAP 1805 #ifdef VERIFY_HEAP
1808 inline void VerifyObjectField(int offset); 1806 inline void VerifyObjectField(int offset);
1809 inline void VerifySmiField(int offset); 1807 inline void VerifySmiField(int offset);
1810 1808
1811 // Verify a pointer is a valid HeapObject pointer that points to object 1809 // Verify a pointer is a valid HeapObject pointer that points to object
1812 // areas in the heap. 1810 // areas in the heap.
1813 static void VerifyHeapPointer(Object* p); 1811 static void VerifyHeapPointer(Object* p);
1814 #endif 1812 #endif
1815 1813
1816 inline AllocationAlignment RequiredAlignment(); 1814 inline AllocationAlignment RequiredAlignment();
(...skipping 22 matching lines...) Expand all
1839 // represented in a Smi (small integer) 1837 // represented in a Smi (small integer)
1840 class HeapNumber: public HeapObject { 1838 class HeapNumber: public HeapObject {
1841 public: 1839 public:
1842 // [value]: number value. 1840 // [value]: number value.
1843 inline double value() const; 1841 inline double value() const;
1844 inline void set_value(double value); 1842 inline void set_value(double value);
1845 1843
1846 inline uint64_t value_as_bits() const; 1844 inline uint64_t value_as_bits() const;
1847 inline void set_value_as_bits(uint64_t bits); 1845 inline void set_value_as_bits(uint64_t bits);
1848 1846
1849 DECLARE_CAST(HeapNumber) 1847 DECL_CAST(HeapNumber)
1850 1848
1851 // Dispatched behavior. 1849 // Dispatched behavior.
1852 bool HeapNumberBooleanValue(); 1850 bool HeapNumberBooleanValue();
1853 1851
1854 V8_EXPORT_PRIVATE void HeapNumberPrint(std::ostream& os); // NOLINT 1852 V8_EXPORT_PRIVATE void HeapNumberPrint(std::ostream& os); // NOLINT
1855 DECLARE_VERIFIER(HeapNumber) 1853 DECL_VERIFIER(HeapNumber)
1856 1854
1857 inline int get_exponent(); 1855 inline int get_exponent();
1858 inline int get_sign(); 1856 inline int get_sign();
1859 1857
1860 // Layout description. 1858 // Layout description.
1861 static const int kValueOffset = HeapObject::kHeaderSize; 1859 static const int kValueOffset = HeapObject::kHeaderSize;
1862 // IEEE doubles are two 32 bit words. The first is just mantissa, the second 1860 // IEEE doubles are two 32 bit words. The first is just mantissa, the second
1863 // is a mixture of sign, exponent and mantissa. The offsets of two 32 bit 1861 // is a mixture of sign, exponent and mantissa. The offsets of two 32 bit
1864 // words within double numbers are endian dependent and they are set 1862 // words within double numbers are endian dependent and they are set
1865 // accordingly. 1863 // accordingly.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 // slow case. 1920 // slow case.
1923 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. 1921 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties.
1924 inline void initialize_properties(); 1922 inline void initialize_properties();
1925 inline bool HasFastProperties(); 1923 inline bool HasFastProperties();
1926 // Gets slow properties for non-global objects. 1924 // Gets slow properties for non-global objects.
1927 inline NameDictionary* property_dictionary(); 1925 inline NameDictionary* property_dictionary();
1928 1926
1929 // Deletes an existing named property in a normalized object. 1927 // Deletes an existing named property in a normalized object.
1930 static void DeleteNormalizedProperty(Handle<JSReceiver> object, int entry); 1928 static void DeleteNormalizedProperty(Handle<JSReceiver> object, int entry);
1931 1929
1932 DECLARE_CAST(JSReceiver) 1930 DECL_CAST(JSReceiver)
1933 1931
1934 // ES6 section 7.1.1 ToPrimitive 1932 // ES6 section 7.1.1 ToPrimitive
1935 MUST_USE_RESULT static MaybeHandle<Object> ToPrimitive( 1933 MUST_USE_RESULT static MaybeHandle<Object> ToPrimitive(
1936 Handle<JSReceiver> receiver, 1934 Handle<JSReceiver> receiver,
1937 ToPrimitiveHint hint = ToPrimitiveHint::kDefault); 1935 ToPrimitiveHint hint = ToPrimitiveHint::kDefault);
1938 1936
1939 // ES6 section 7.1.1.1 OrdinaryToPrimitive 1937 // ES6 section 7.1.1.1 OrdinaryToPrimitive
1940 MUST_USE_RESULT static MaybeHandle<Object> OrdinaryToPrimitive( 1938 MUST_USE_RESULT static MaybeHandle<Object> OrdinaryToPrimitive(
1941 Handle<JSReceiver> receiver, OrdinaryToPrimitiveHint hint); 1939 Handle<JSReceiver> receiver, OrdinaryToPrimitiveHint hint);
1942 1940
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 bool ReferencesObject(Object* obj); 2490 bool ReferencesObject(Object* obj);
2493 2491
2494 MUST_USE_RESULT static Maybe<bool> TestIntegrityLevel(Handle<JSObject> object, 2492 MUST_USE_RESULT static Maybe<bool> TestIntegrityLevel(Handle<JSObject> object,
2495 IntegrityLevel lvl); 2493 IntegrityLevel lvl);
2496 2494
2497 MUST_USE_RESULT static Maybe<bool> PreventExtensions( 2495 MUST_USE_RESULT static Maybe<bool> PreventExtensions(
2498 Handle<JSObject> object, ShouldThrow should_throw); 2496 Handle<JSObject> object, ShouldThrow should_throw);
2499 2497
2500 static bool IsExtensible(Handle<JSObject> object); 2498 static bool IsExtensible(Handle<JSObject> object);
2501 2499
2502 DECLARE_CAST(JSObject) 2500 DECL_CAST(JSObject)
2503 2501
2504 // Dispatched behavior. 2502 // Dispatched behavior.
2505 void JSObjectShortPrint(StringStream* accumulator); 2503 void JSObjectShortPrint(StringStream* accumulator);
2506 DECLARE_PRINTER(JSObject) 2504 DECL_PRINTER(JSObject)
2507 DECLARE_VERIFIER(JSObject) 2505 DECL_VERIFIER(JSObject)
2508 #ifdef OBJECT_PRINT 2506 #ifdef OBJECT_PRINT
2509 bool PrintProperties(std::ostream& os); // NOLINT 2507 bool PrintProperties(std::ostream& os); // NOLINT
2510 void PrintElements(std::ostream& os); // NOLINT 2508 void PrintElements(std::ostream& os); // NOLINT
2511 #endif 2509 #endif
2512 #if defined(DEBUG) || defined(OBJECT_PRINT) 2510 #if defined(DEBUG) || defined(OBJECT_PRINT)
2513 void PrintTransitions(std::ostream& os); // NOLINT 2511 void PrintTransitions(std::ostream& os); // NOLINT
2514 #endif 2512 #endif
2515 2513
2516 static void PrintElementsTransition( 2514 static void PrintElementsTransition(
2517 FILE* file, Handle<JSObject> object, 2515 FILE* file, Handle<JSObject> object,
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2709 class FixedArrayBase: public HeapObject { 2707 class FixedArrayBase: public HeapObject {
2710 public: 2708 public:
2711 // [length]: length of the array. 2709 // [length]: length of the array.
2712 inline int length() const; 2710 inline int length() const;
2713 inline void set_length(int value); 2711 inline void set_length(int value);
2714 2712
2715 // Get and set the length using acquire loads and release stores. 2713 // Get and set the length using acquire loads and release stores.
2716 inline int synchronized_length() const; 2714 inline int synchronized_length() const;
2717 inline void synchronized_set_length(int value); 2715 inline void synchronized_set_length(int value);
2718 2716
2719 DECLARE_CAST(FixedArrayBase) 2717 DECL_CAST(FixedArrayBase)
2720 2718
2721 static int GetMaxLengthForNewSpaceAllocation(ElementsKind kind); 2719 static int GetMaxLengthForNewSpaceAllocation(ElementsKind kind);
2722 2720
2723 bool IsCowArray() const; 2721 bool IsCowArray() const;
2724 2722
2725 // Layout description. 2723 // Layout description.
2726 // Length is smi tagged when it is stored. 2724 // Length is smi tagged when it is stored.
2727 static const int kLengthOffset = HeapObject::kHeaderSize; 2725 static const int kLengthOffset = HeapObject::kHeaderSize;
2728 static const int kHeaderSize = kLengthOffset + kPointerSize; 2726 static const int kHeaderSize = kLengthOffset + kPointerSize;
2729 }; 2727 };
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2785 static constexpr int SizeFor(int length) { 2783 static constexpr int SizeFor(int length) {
2786 return kHeaderSize + length * kPointerSize; 2784 return kHeaderSize + length * kPointerSize;
2787 } 2785 }
2788 2786
2789 // Code Generation support. 2787 // Code Generation support.
2790 static constexpr int OffsetOfElementAt(int index) { return SizeFor(index); } 2788 static constexpr int OffsetOfElementAt(int index) { return SizeFor(index); }
2791 2789
2792 // Garbage collection support. 2790 // Garbage collection support.
2793 inline Object** RawFieldOfElementAt(int index); 2791 inline Object** RawFieldOfElementAt(int index);
2794 2792
2795 DECLARE_CAST(FixedArray) 2793 DECL_CAST(FixedArray)
2796 2794
2797 // Maximal allowed size, in bytes, of a single FixedArray. 2795 // Maximal allowed size, in bytes, of a single FixedArray.
2798 // Prevents overflowing size computations, as well as extreme memory 2796 // Prevents overflowing size computations, as well as extreme memory
2799 // consumption. 2797 // consumption.
2800 static const int kMaxSize = 128 * MB * kPointerSize; 2798 static const int kMaxSize = 128 * MB * kPointerSize;
2801 // Maximally allowed length of a FixedArray. 2799 // Maximally allowed length of a FixedArray.
2802 static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize; 2800 static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize;
2803 // Maximally allowed length for regular (non large object space) object. 2801 // Maximally allowed length for regular (non large object space) object.
2804 STATIC_ASSERT(kMaxRegularHeapObjectSize < kMaxSize); 2802 STATIC_ASSERT(kMaxRegularHeapObjectSize < kMaxSize);
2805 static const int kMaxRegularLength = 2803 static const int kMaxRegularLength =
2806 (kMaxRegularHeapObjectSize - kHeaderSize) / kPointerSize; 2804 (kMaxRegularHeapObjectSize - kHeaderSize) / kPointerSize;
2807 2805
2808 // Dispatched behavior. 2806 // Dispatched behavior.
2809 DECLARE_PRINTER(FixedArray) 2807 DECL_PRINTER(FixedArray)
2810 DECLARE_VERIFIER(FixedArray) 2808 DECL_VERIFIER(FixedArray)
2811 #ifdef DEBUG 2809 #ifdef DEBUG
2812 // Checks if two FixedArrays have identical contents. 2810 // Checks if two FixedArrays have identical contents.
2813 bool IsEqualTo(FixedArray* other); 2811 bool IsEqualTo(FixedArray* other);
2814 #endif 2812 #endif
2815 2813
2816 typedef FlexibleBodyDescriptor<kHeaderSize> BodyDescriptor; 2814 typedef FlexibleBodyDescriptor<kHeaderSize> BodyDescriptor;
2817 // No weak fields. 2815 // No weak fields.
2818 typedef BodyDescriptor BodyDescriptorWeak; 2816 typedef BodyDescriptor BodyDescriptorWeak;
2819 2817
2820 protected: 2818 protected:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2852 } 2850 }
2853 2851
2854 // Gives access to raw memory which stores the array's data. 2852 // Gives access to raw memory which stores the array's data.
2855 inline double* data_start(); 2853 inline double* data_start();
2856 2854
2857 inline void FillWithHoles(int from, int to); 2855 inline void FillWithHoles(int from, int to);
2858 2856
2859 // Code Generation support. 2857 // Code Generation support.
2860 static int OffsetOfElementAt(int index) { return SizeFor(index); } 2858 static int OffsetOfElementAt(int index) { return SizeFor(index); }
2861 2859
2862 DECLARE_CAST(FixedDoubleArray) 2860 DECL_CAST(FixedDoubleArray)
2863 2861
2864 // Maximal allowed size, in bytes, of a single FixedDoubleArray. 2862 // Maximal allowed size, in bytes, of a single FixedDoubleArray.
2865 // Prevents overflowing size computations, as well as extreme memory 2863 // Prevents overflowing size computations, as well as extreme memory
2866 // consumption. 2864 // consumption.
2867 static const int kMaxSize = 512 * MB; 2865 static const int kMaxSize = 512 * MB;
2868 // Maximally allowed length of a FixedArray. 2866 // Maximally allowed length of a FixedArray.
2869 static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize; 2867 static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize;
2870 2868
2871 // Dispatched behavior. 2869 // Dispatched behavior.
2872 DECLARE_PRINTER(FixedDoubleArray) 2870 DECL_PRINTER(FixedDoubleArray)
2873 DECLARE_VERIFIER(FixedDoubleArray) 2871 DECL_VERIFIER(FixedDoubleArray)
2874 2872
2875 class BodyDescriptor; 2873 class BodyDescriptor;
2876 // No weak fields. 2874 // No weak fields.
2877 typedef BodyDescriptor BodyDescriptorWeak; 2875 typedef BodyDescriptor BodyDescriptorWeak;
2878 2876
2879 private: 2877 private:
2880 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); 2878 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray);
2881 }; 2879 };
2882 2880
2883 class WeakFixedArray : public FixedArray { 2881 class WeakFixedArray : public FixedArray {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 private: 2916 private:
2919 int index_; 2917 int index_;
2920 WeakFixedArray* list_; 2918 WeakFixedArray* list_;
2921 #ifdef DEBUG 2919 #ifdef DEBUG
2922 int last_used_index_; 2920 int last_used_index_;
2923 DisallowHeapAllocation no_gc_; 2921 DisallowHeapAllocation no_gc_;
2924 #endif // DEBUG 2922 #endif // DEBUG
2925 DISALLOW_COPY_AND_ASSIGN(Iterator); 2923 DISALLOW_COPY_AND_ASSIGN(Iterator);
2926 }; 2924 };
2927 2925
2928 DECLARE_CAST(WeakFixedArray) 2926 DECL_CAST(WeakFixedArray)
2929 2927
2930 private: 2928 private:
2931 static const int kLastUsedIndexIndex = 0; 2929 static const int kLastUsedIndexIndex = 0;
2932 static const int kFirstIndex = 1; 2930 static const int kFirstIndex = 1;
2933 2931
2934 static Handle<WeakFixedArray> Allocate( 2932 static Handle<WeakFixedArray> Allocate(
2935 Isolate* isolate, int size, Handle<WeakFixedArray> initialize_from); 2933 Isolate* isolate, int size, Handle<WeakFixedArray> initialize_from);
2936 2934
2937 static void Set(Handle<WeakFixedArray> array, int index, 2935 static void Set(Handle<WeakFixedArray> array, int index,
2938 Handle<HeapObject> value); 2936 Handle<HeapObject> value);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2983 inline void Set(int index, Object* obj, 2981 inline void Set(int index, Object* obj,
2984 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 2982 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
2985 2983
2986 // Set the element at index to undefined. This does not change the Length(). 2984 // Set the element at index to undefined. This does not change the Length().
2987 inline void Clear(int index, Object* undefined); 2985 inline void Clear(int index, Object* undefined);
2988 2986
2989 // Return a copy of the list of size Length() without the first entry. The 2987 // Return a copy of the list of size Length() without the first entry. The
2990 // number returned by Length() is stored in the first entry. 2988 // number returned by Length() is stored in the first entry.
2991 Handle<FixedArray> Elements() const; 2989 Handle<FixedArray> Elements() const;
2992 bool IsFull(); 2990 bool IsFull();
2993 DECLARE_CAST(ArrayList) 2991 DECL_CAST(ArrayList)
2994 2992
2995 private: 2993 private:
2996 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); 2994 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length);
2997 static const int kLengthIndex = 0; 2995 static const int kLengthIndex = 0;
2998 static const int kFirstIndex = 1; 2996 static const int kFirstIndex = 1;
2999 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); 2997 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList);
3000 }; 2998 };
3001 2999
3002 enum SearchMode { ALL_ENTRIES, VALID_ENTRIES }; 3000 enum SearchMode { ALL_ENTRIES, VALID_ENTRIES };
3003 3001
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3056 // Lookup handler in a table based on return addresses. 3054 // Lookup handler in a table based on return addresses.
3057 int LookupReturn(int pc_offset); 3055 int LookupReturn(int pc_offset);
3058 3056
3059 // Returns the number of entries in the table. 3057 // Returns the number of entries in the table.
3060 inline int NumberOfRangeEntries() const; 3058 inline int NumberOfRangeEntries() const;
3061 3059
3062 // Returns the required length of the underlying fixed array. 3060 // Returns the required length of the underlying fixed array.
3063 static int LengthForRange(int entries) { return entries * kRangeEntrySize; } 3061 static int LengthForRange(int entries) { return entries * kRangeEntrySize; }
3064 static int LengthForReturn(int entries) { return entries * kReturnEntrySize; } 3062 static int LengthForReturn(int entries) { return entries * kReturnEntrySize; }
3065 3063
3066 DECLARE_CAST(HandlerTable) 3064 DECL_CAST(HandlerTable)
3067 3065
3068 #ifdef ENABLE_DISASSEMBLER 3066 #ifdef ENABLE_DISASSEMBLER
3069 void HandlerTableRangePrint(std::ostream& os); // NOLINT 3067 void HandlerTableRangePrint(std::ostream& os); // NOLINT
3070 void HandlerTableReturnPrint(std::ostream& os); // NOLINT 3068 void HandlerTableReturnPrint(std::ostream& os); // NOLINT
3071 #endif 3069 #endif
3072 3070
3073 private: 3071 private:
3074 // Layout description for handler table based on ranges. 3072 // Layout description for handler table based on ranges.
3075 static const int kRangeStartIndex = 0; 3073 static const int kRangeStartIndex = 0;
3076 static const int kRangeEndIndex = 1; 3074 static const int kRangeEndIndex = 1;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3123 } 3121 }
3124 3122
3125 // Returns data start address. 3123 // Returns data start address.
3126 inline Address GetDataStartAddress(); 3124 inline Address GetDataStartAddress();
3127 3125
3128 inline int DataSize() const; 3126 inline int DataSize() const;
3129 3127
3130 // Returns a pointer to the ByteArray object for a given data start address. 3128 // Returns a pointer to the ByteArray object for a given data start address.
3131 static inline ByteArray* FromDataStartAddress(Address address); 3129 static inline ByteArray* FromDataStartAddress(Address address);
3132 3130
3133 DECLARE_CAST(ByteArray) 3131 DECL_CAST(ByteArray)
3134 3132
3135 // Dispatched behavior. 3133 // Dispatched behavior.
3136 inline int ByteArraySize(); 3134 inline int ByteArraySize();
3137 DECLARE_PRINTER(ByteArray) 3135 DECL_PRINTER(ByteArray)
3138 DECLARE_VERIFIER(ByteArray) 3136 DECL_VERIFIER(ByteArray)
3139 3137
3140 // Layout description. 3138 // Layout description.
3141 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); 3139 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
3142 3140
3143 // Maximal memory consumption for a single ByteArray. 3141 // Maximal memory consumption for a single ByteArray.
3144 static const int kMaxSize = 512 * MB; 3142 static const int kMaxSize = 512 * MB;
3145 // Maximal length of a single ByteArray. 3143 // Maximal length of a single ByteArray.
3146 static const int kMaxLength = kMaxSize - kHeaderSize; 3144 static const int kMaxLength = kMaxSize - kHeaderSize;
3147 3145
3148 class BodyDescriptor; 3146 class BodyDescriptor;
(...skipping 18 matching lines...) Expand all
3167 T get(int index) { 3165 T get(int index) {
3168 T result; 3166 T result;
3169 copy_out(index, &result); 3167 copy_out(index, &result);
3170 return result; 3168 return result;
3171 } 3169 }
3172 void set(int index, const T& value) { 3170 void set(int index, const T& value) {
3173 copy_in(index * sizeof(T), reinterpret_cast<const byte*>(&value), 3171 copy_in(index * sizeof(T), reinterpret_cast<const byte*>(&value),
3174 sizeof(T)); 3172 sizeof(T));
3175 } 3173 }
3176 int length() { return ByteArray::length() / sizeof(T); } 3174 int length() { return ByteArray::length() / sizeof(T); }
3177 DECLARE_CAST(PodArray<T>) 3175 DECL_CAST(PodArray<T>)
3178 3176
3179 private: 3177 private:
3180 DISALLOW_IMPLICIT_CONSTRUCTORS(PodArray<T>); 3178 DISALLOW_IMPLICIT_CONSTRUCTORS(PodArray<T>);
3181 }; 3179 };
3182 3180
3183 // BytecodeArray represents a sequence of interpreter bytecodes. 3181 // BytecodeArray represents a sequence of interpreter bytecodes.
3184 class BytecodeArray : public FixedArrayBase { 3182 class BytecodeArray : public FixedArrayBase {
3185 public: 3183 public:
3186 #define DECLARE_BYTECODE_AGE_ENUM(X) k##X##BytecodeAge, 3184 #define DECL_BYTECODE_AGE_ENUM(X) k##X##BytecodeAge,
3187 enum Age { 3185 enum Age {
3188 kNoAgeBytecodeAge = 0, 3186 kNoAgeBytecodeAge = 0,
3189 CODE_AGE_LIST(DECLARE_BYTECODE_AGE_ENUM) kAfterLastBytecodeAge, 3187 CODE_AGE_LIST(DECL_BYTECODE_AGE_ENUM) kAfterLastBytecodeAge,
3190 kFirstBytecodeAge = kNoAgeBytecodeAge, 3188 kFirstBytecodeAge = kNoAgeBytecodeAge,
3191 kLastBytecodeAge = kAfterLastBytecodeAge - 1, 3189 kLastBytecodeAge = kAfterLastBytecodeAge - 1,
3192 kBytecodeAgeCount = kAfterLastBytecodeAge - kFirstBytecodeAge - 1, 3190 kBytecodeAgeCount = kAfterLastBytecodeAge - kFirstBytecodeAge - 1,
3193 kIsOldBytecodeAge = kSexagenarianBytecodeAge 3191 kIsOldBytecodeAge = kSexagenarianBytecodeAge
3194 }; 3192 };
3195 #undef DECLARE_BYTECODE_AGE_ENUM 3193 #undef DECL_BYTECODE_AGE_ENUM
3196 3194
3197 static int SizeFor(int length) { 3195 static int SizeFor(int length) {
3198 return OBJECT_POINTER_ALIGN(kHeaderSize + length); 3196 return OBJECT_POINTER_ALIGN(kHeaderSize + length);
3199 } 3197 }
3200 3198
3201 // Setter and getter 3199 // Setter and getter
3202 inline byte get(int index); 3200 inline byte get(int index);
3203 inline void set(int index, byte value); 3201 inline void set(int index, byte value);
3204 3202
3205 // Returns data start address. 3203 // Returns data start address.
(...skipping 27 matching lines...) Expand all
3233 3231
3234 // Accessors for handler table containing offsets of exception handlers. 3232 // Accessors for handler table containing offsets of exception handlers.
3235 DECL_ACCESSORS(handler_table, FixedArray) 3233 DECL_ACCESSORS(handler_table, FixedArray)
3236 3234
3237 // Accessors for source position table containing mappings between byte code 3235 // Accessors for source position table containing mappings between byte code
3238 // offset and source position or SourcePositionTableWithFrameCache. 3236 // offset and source position or SourcePositionTableWithFrameCache.
3239 DECL_ACCESSORS(source_position_table, Object) 3237 DECL_ACCESSORS(source_position_table, Object)
3240 3238
3241 inline ByteArray* SourcePositionTable(); 3239 inline ByteArray* SourcePositionTable();
3242 3240
3243 DECLARE_CAST(BytecodeArray) 3241 DECL_CAST(BytecodeArray)
3244 3242
3245 // Dispatched behavior. 3243 // Dispatched behavior.
3246 inline int BytecodeArraySize(); 3244 inline int BytecodeArraySize();
3247 3245
3248 inline int instruction_size(); 3246 inline int instruction_size();
3249 3247
3250 // Returns the size of bytecode and its metadata. This includes the size of 3248 // Returns the size of bytecode and its metadata. This includes the size of
3251 // bytecode, constant pool, source position table, and handler table. 3249 // bytecode, constant pool, source position table, and handler table.
3252 inline int SizeIncludingMetadata(); 3250 inline int SizeIncludingMetadata();
3253 3251
3254 int SourcePosition(int offset); 3252 int SourcePosition(int offset);
3255 int SourceStatementPosition(int offset); 3253 int SourceStatementPosition(int offset);
3256 3254
3257 DECLARE_PRINTER(BytecodeArray) 3255 DECL_PRINTER(BytecodeArray)
3258 DECLARE_VERIFIER(BytecodeArray) 3256 DECL_VERIFIER(BytecodeArray)
3259 3257
3260 void Disassemble(std::ostream& os); 3258 void Disassemble(std::ostream& os);
3261 3259
3262 void CopyBytecodesTo(BytecodeArray* to); 3260 void CopyBytecodesTo(BytecodeArray* to);
3263 3261
3264 // Bytecode aging 3262 // Bytecode aging
3265 bool IsOld() const; 3263 bool IsOld() const;
3266 void MakeOlder(); 3264 void MakeOlder();
3267 3265
3268 // Layout description. 3266 // Layout description.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3310 3308
3311 inline int Size(); 3309 inline int Size();
3312 3310
3313 // Accessors for the next field. 3311 // Accessors for the next field.
3314 inline FreeSpace* next(); 3312 inline FreeSpace* next();
3315 inline void set_next(FreeSpace* next); 3313 inline void set_next(FreeSpace* next);
3316 3314
3317 inline static FreeSpace* cast(HeapObject* obj); 3315 inline static FreeSpace* cast(HeapObject* obj);
3318 3316
3319 // Dispatched behavior. 3317 // Dispatched behavior.
3320 DECLARE_PRINTER(FreeSpace) 3318 DECL_PRINTER(FreeSpace)
3321 DECLARE_VERIFIER(FreeSpace) 3319 DECL_VERIFIER(FreeSpace)
3322 3320
3323 // Layout description. 3321 // Layout description.
3324 // Size is smi tagged when it is stored. 3322 // Size is smi tagged when it is stored.
3325 static const int kSizeOffset = HeapObject::kHeaderSize; 3323 static const int kSizeOffset = HeapObject::kHeaderSize;
3326 static const int kNextOffset = POINTER_SIZE_ALIGN(kSizeOffset + kPointerSize); 3324 static const int kNextOffset = POINTER_SIZE_ALIGN(kSizeOffset + kPointerSize);
3327 static const int kSize = kNextOffset + kPointerSize; 3325 static const int kSize = kNextOffset + kPointerSize;
3328 3326
3329 private: 3327 private:
3330 DISALLOW_IMPLICIT_CONSTRUCTORS(FreeSpace); 3328 DISALLOW_IMPLICIT_CONSTRUCTORS(FreeSpace);
3331 }; 3329 };
(...skipping 16 matching lines...) Expand all
3348 public: 3346 public:
3349 // [base_pointer]: Either points to the FixedTypedArrayBase itself or nullptr. 3347 // [base_pointer]: Either points to the FixedTypedArrayBase itself or nullptr.
3350 DECL_ACCESSORS(base_pointer, Object) 3348 DECL_ACCESSORS(base_pointer, Object)
3351 3349
3352 // [external_pointer]: Contains the offset between base_pointer and the start 3350 // [external_pointer]: Contains the offset between base_pointer and the start
3353 // of the data. If the base_pointer is a nullptr, the external_pointer 3351 // of the data. If the base_pointer is a nullptr, the external_pointer
3354 // therefore points to the actual backing store. 3352 // therefore points to the actual backing store.
3355 DECL_ACCESSORS(external_pointer, void) 3353 DECL_ACCESSORS(external_pointer, void)
3356 3354
3357 // Dispatched behavior. 3355 // Dispatched behavior.
3358 DECLARE_CAST(FixedTypedArrayBase) 3356 DECL_CAST(FixedTypedArrayBase)
3359 3357
3360 static const int kBasePointerOffset = FixedArrayBase::kHeaderSize; 3358 static const int kBasePointerOffset = FixedArrayBase::kHeaderSize;
3361 static const int kExternalPointerOffset = kBasePointerOffset + kPointerSize; 3359 static const int kExternalPointerOffset = kBasePointerOffset + kPointerSize;
3362 static const int kHeaderSize = 3360 static const int kHeaderSize =
3363 DOUBLE_POINTER_ALIGN(kExternalPointerOffset + kPointerSize); 3361 DOUBLE_POINTER_ALIGN(kExternalPointerOffset + kPointerSize);
3364 3362
3365 static const int kDataOffset = kHeaderSize; 3363 static const int kDataOffset = kHeaderSize;
3366 3364
3367 static const int kMaxElementSize = 8; 3365 static const int kMaxElementSize = 8;
3368 3366
(...skipping 28 matching lines...) Expand all
3397 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArrayBase); 3395 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArrayBase);
3398 }; 3396 };
3399 3397
3400 3398
3401 template <class Traits> 3399 template <class Traits>
3402 class FixedTypedArray: public FixedTypedArrayBase { 3400 class FixedTypedArray: public FixedTypedArrayBase {
3403 public: 3401 public:
3404 typedef typename Traits::ElementType ElementType; 3402 typedef typename Traits::ElementType ElementType;
3405 static const InstanceType kInstanceType = Traits::kInstanceType; 3403 static const InstanceType kInstanceType = Traits::kInstanceType;
3406 3404
3407 DECLARE_CAST(FixedTypedArray<Traits>) 3405 DECL_CAST(FixedTypedArray<Traits>)
3408 3406
3409 inline ElementType get_scalar(int index); 3407 inline ElementType get_scalar(int index);
3410 static inline Handle<Object> get(FixedTypedArray* array, int index); 3408 static inline Handle<Object> get(FixedTypedArray* array, int index);
3411 inline void set(int index, ElementType value); 3409 inline void set(int index, ElementType value);
3412 3410
3413 static inline ElementType from(int value); 3411 static inline ElementType from(int value);
3414 static inline ElementType from(uint32_t value); 3412 static inline ElementType from(uint32_t value);
3415 static inline ElementType from(double value); 3413 static inline ElementType from(double value);
3416 3414
3417 // This accessor applies the correct conversion from Smi, HeapNumber 3415 // This accessor applies the correct conversion from Smi, HeapNumber
3418 // and undefined. 3416 // and undefined.
3419 inline void SetValue(uint32_t index, Object* value); 3417 inline void SetValue(uint32_t index, Object* value);
3420 3418
3421 DECLARE_PRINTER(FixedTypedArray) 3419 DECL_PRINTER(FixedTypedArray)
3422 DECLARE_VERIFIER(FixedTypedArray) 3420 DECL_VERIFIER(FixedTypedArray)
3423 3421
3424 private: 3422 private:
3425 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray); 3423 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedTypedArray);
3426 }; 3424 };
3427 3425
3428 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size) \ 3426 #define FIXED_TYPED_ARRAY_TRAITS(Type, type, TYPE, elementType, size) \
3429 STATIC_ASSERT(size <= FixedTypedArrayBase::kMaxElementSize); \ 3427 STATIC_ASSERT(size <= FixedTypedArrayBase::kMaxElementSize); \
3430 class Type##ArrayTraits { \ 3428 class Type##ArrayTraits { \
3431 public: /* NOLINT */ \ 3429 public: /* NOLINT */ \
3432 typedef elementType ElementType; \ 3430 typedef elementType ElementType; \
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3464 static const int kFirstDeoptEntryIndex = 9; 3462 static const int kFirstDeoptEntryIndex = 9;
3465 3463
3466 // Offsets of deopt entry elements relative to the start of the entry. 3464 // Offsets of deopt entry elements relative to the start of the entry.
3467 static const int kAstIdRawOffset = 0; 3465 static const int kAstIdRawOffset = 0;
3468 static const int kTranslationIndexOffset = 1; 3466 static const int kTranslationIndexOffset = 1;
3469 static const int kArgumentsStackHeightOffset = 2; 3467 static const int kArgumentsStackHeightOffset = 2;
3470 static const int kPcOffset = 3; 3468 static const int kPcOffset = 3;
3471 static const int kDeoptEntrySize = 4; 3469 static const int kDeoptEntrySize = 4;
3472 3470
3473 // Simple element accessors. 3471 // Simple element accessors.
3474 #define DECLARE_ELEMENT_ACCESSORS(name, type) \ 3472 #define DECL_ELEMENT_ACCESSORS(name, type) \
3475 inline type* name(); \ 3473 inline type* name(); \
3476 inline void Set##name(type* value); 3474 inline void Set##name(type* value);
3477 3475
3478 DECLARE_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray) 3476 DECL_ELEMENT_ACCESSORS(TranslationByteArray, ByteArray)
3479 DECLARE_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi) 3477 DECL_ELEMENT_ACCESSORS(InlinedFunctionCount, Smi)
3480 DECLARE_ELEMENT_ACCESSORS(LiteralArray, FixedArray) 3478 DECL_ELEMENT_ACCESSORS(LiteralArray, FixedArray)
3481 DECLARE_ELEMENT_ACCESSORS(OsrAstId, Smi) 3479 DECL_ELEMENT_ACCESSORS(OsrAstId, Smi)
3482 DECLARE_ELEMENT_ACCESSORS(OsrPcOffset, Smi) 3480 DECL_ELEMENT_ACCESSORS(OsrPcOffset, Smi)
3483 DECLARE_ELEMENT_ACCESSORS(OptimizationId, Smi) 3481 DECL_ELEMENT_ACCESSORS(OptimizationId, Smi)
3484 DECLARE_ELEMENT_ACCESSORS(SharedFunctionInfo, Object) 3482 DECL_ELEMENT_ACCESSORS(SharedFunctionInfo, Object)
3485 DECLARE_ELEMENT_ACCESSORS(WeakCellCache, Object) 3483 DECL_ELEMENT_ACCESSORS(WeakCellCache, Object)
3486 DECLARE_ELEMENT_ACCESSORS(InliningPositions, PodArray<InliningPosition>) 3484 DECL_ELEMENT_ACCESSORS(InliningPositions, PodArray<InliningPosition>)
3487 3485
3488 #undef DECLARE_ELEMENT_ACCESSORS 3486 #undef DECL_ELEMENT_ACCESSORS
3489 3487
3490 // Accessors for elements of the ith deoptimization entry. 3488 // Accessors for elements of the ith deoptimization entry.
3491 #define DECLARE_ENTRY_ACCESSORS(name, type) \ 3489 #define DECL_ENTRY_ACCESSORS(name, type) \
3492 inline type* name(int i); \ 3490 inline type* name(int i); \
3493 inline void Set##name(int i, type* value); 3491 inline void Set##name(int i, type* value);
3494 3492
3495 DECLARE_ENTRY_ACCESSORS(AstIdRaw, Smi) 3493 DECL_ENTRY_ACCESSORS(AstIdRaw, Smi)
3496 DECLARE_ENTRY_ACCESSORS(TranslationIndex, Smi) 3494 DECL_ENTRY_ACCESSORS(TranslationIndex, Smi)
3497 DECLARE_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi) 3495 DECL_ENTRY_ACCESSORS(ArgumentsStackHeight, Smi)
3498 DECLARE_ENTRY_ACCESSORS(Pc, Smi) 3496 DECL_ENTRY_ACCESSORS(Pc, Smi)
3499 3497
3500 #undef DECLARE_ENTRY_ACCESSORS 3498 #undef DECL_ENTRY_ACCESSORS
3501 3499
3502 inline BailoutId AstId(int i); 3500 inline BailoutId AstId(int i);
3503 3501
3504 inline void SetAstId(int i, BailoutId value); 3502 inline void SetAstId(int i, BailoutId value);
3505 3503
3506 inline int DeoptCount(); 3504 inline int DeoptCount();
3507 3505
3508 static const int kNotInlinedIndex = -1; 3506 static const int kNotInlinedIndex = -1;
3509 3507
3510 // Returns the inlined function at the given position in LiteralArray, or the 3508 // Returns the inlined function at the given position in LiteralArray, or the
3511 // outer function if index == kNotInlinedIndex. 3509 // outer function if index == kNotInlinedIndex.
3512 class SharedFunctionInfo* GetInlinedFunction(int index); 3510 class SharedFunctionInfo* GetInlinedFunction(int index);
3513 3511
3514 // Allocates a DeoptimizationInputData. 3512 // Allocates a DeoptimizationInputData.
3515 static Handle<DeoptimizationInputData> New(Isolate* isolate, 3513 static Handle<DeoptimizationInputData> New(Isolate* isolate,
3516 int deopt_entry_count, 3514 int deopt_entry_count,
3517 PretenureFlag pretenure); 3515 PretenureFlag pretenure);
3518 3516
3519 DECLARE_CAST(DeoptimizationInputData) 3517 DECL_CAST(DeoptimizationInputData)
3520 3518
3521 #ifdef ENABLE_DISASSEMBLER 3519 #ifdef ENABLE_DISASSEMBLER
3522 void DeoptimizationInputDataPrint(std::ostream& os); // NOLINT 3520 void DeoptimizationInputDataPrint(std::ostream& os); // NOLINT
3523 #endif 3521 #endif
3524 3522
3525 private: 3523 private:
3526 static int IndexForEntry(int i) { 3524 static int IndexForEntry(int i) {
3527 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize); 3525 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize);
3528 } 3526 }
3529 3527
3530 3528
3531 static int LengthFor(int entry_count) { return IndexForEntry(entry_count); } 3529 static int LengthFor(int entry_count) { return IndexForEntry(entry_count); }
3532 }; 3530 };
3533 3531
3534 class TemplateList : public FixedArray { 3532 class TemplateList : public FixedArray {
3535 public: 3533 public:
3536 static Handle<TemplateList> New(Isolate* isolate, int size); 3534 static Handle<TemplateList> New(Isolate* isolate, int size);
3537 inline int length() const; 3535 inline int length() const;
3538 inline Object* get(int index) const; 3536 inline Object* get(int index) const;
3539 inline void set(int index, Object* value); 3537 inline void set(int index, Object* value);
3540 static Handle<TemplateList> Add(Isolate* isolate, Handle<TemplateList> list, 3538 static Handle<TemplateList> Add(Isolate* isolate, Handle<TemplateList> list,
3541 Handle<Object> value); 3539 Handle<Object> value);
3542 DECLARE_CAST(TemplateList) 3540 DECL_CAST(TemplateList)
3543 private: 3541 private:
3544 static const int kLengthIndex = 0; 3542 static const int kLengthIndex = 0;
3545 static const int kFirstElementIndex = kLengthIndex + 1; 3543 static const int kFirstElementIndex = kLengthIndex + 1;
3546 DISALLOW_IMPLICIT_CONSTRUCTORS(TemplateList); 3544 DISALLOW_IMPLICIT_CONSTRUCTORS(TemplateList);
3547 }; 3545 };
3548 3546
3549 // Code describes objects with on-the-fly generated machine code. 3547 // Code describes objects with on-the-fly generated machine code.
3550 class Code: public HeapObject { 3548 class Code: public HeapObject {
3551 public: 3549 public:
3552 // Opaque data type for encapsulating code flags like kind, inline 3550 // Opaque data type for encapsulating code flags like kind, inline
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
3905 // Returns the object size for a given body (used for allocation). 3903 // Returns the object size for a given body (used for allocation).
3906 static int SizeFor(int body_size) { 3904 static int SizeFor(int body_size) {
3907 DCHECK_SIZE_TAG_ALIGNED(body_size); 3905 DCHECK_SIZE_TAG_ALIGNED(body_size);
3908 return RoundUp(kHeaderSize + body_size, kCodeAlignment); 3906 return RoundUp(kHeaderSize + body_size, kCodeAlignment);
3909 } 3907 }
3910 3908
3911 // Calculate the size of the code object to report for log events. This takes 3909 // Calculate the size of the code object to report for log events. This takes
3912 // the layout of the code object into account. 3910 // the layout of the code object into account.
3913 inline int ExecutableSize(); 3911 inline int ExecutableSize();
3914 3912
3915 DECLARE_CAST(Code) 3913 DECL_CAST(Code)
3916 3914
3917 // Dispatched behavior. 3915 // Dispatched behavior.
3918 inline int CodeSize(); 3916 inline int CodeSize();
3919 3917
3920 DECLARE_PRINTER(Code) 3918 DECL_PRINTER(Code)
3921 DECLARE_VERIFIER(Code) 3919 DECL_VERIFIER(Code)
3922 3920
3923 void ClearInlineCaches(); 3921 void ClearInlineCaches();
3924 3922
3925 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); 3923 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset);
3926 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); 3924 uint32_t TranslateAstIdToPcOffset(BailoutId ast_id);
3927 3925
3928 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, 3926 #define DECL_CODE_AGE_ENUM(X) k##X##CodeAge,
3929 enum Age { 3927 enum Age {
3930 kToBeExecutedOnceCodeAge = -3, 3928 kToBeExecutedOnceCodeAge = -3,
3931 kNotExecutedCodeAge = -2, 3929 kNotExecutedCodeAge = -2,
3932 kExecutedOnceCodeAge = -1, 3930 kExecutedOnceCodeAge = -1,
3933 kNoAgeCodeAge = 0, 3931 kNoAgeCodeAge = 0,
3934 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) 3932 CODE_AGE_LIST(DECL_CODE_AGE_ENUM) kAfterLastCodeAge,
3935 kAfterLastCodeAge,
3936 kFirstCodeAge = kToBeExecutedOnceCodeAge, 3933 kFirstCodeAge = kToBeExecutedOnceCodeAge,
3937 kLastCodeAge = kAfterLastCodeAge - 1, 3934 kLastCodeAge = kAfterLastCodeAge - 1,
3938 kCodeAgeCount = kAfterLastCodeAge - kFirstCodeAge - 1, 3935 kCodeAgeCount = kAfterLastCodeAge - kFirstCodeAge - 1,
3939 kIsOldCodeAge = kSexagenarianCodeAge, 3936 kIsOldCodeAge = kSexagenarianCodeAge,
3940 kPreAgedCodeAge = kIsOldCodeAge - 1 3937 kPreAgedCodeAge = kIsOldCodeAge - 1
3941 }; 3938 };
3942 #undef DECLARE_CODE_AGE_ENUM 3939 #undef DECL_CODE_AGE_ENUM
3943 3940
3944 // Code aging. Indicates how many full GCs this code has survived without 3941 // Code aging. Indicates how many full GCs this code has survived without
3945 // being entered through the prologue. Used to determine when to flush code 3942 // being entered through the prologue. Used to determine when to flush code
3946 // held in the compilation cache. 3943 // held in the compilation cache.
3947 static void MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate); 3944 static void MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate);
3948 static void MarkCodeAsExecuted(byte* sequence, Isolate* isolate); 3945 static void MarkCodeAsExecuted(byte* sequence, Isolate* isolate);
3949 void MakeYoung(Isolate* isolate); 3946 void MakeYoung(Isolate* isolate);
3950 void PreAge(Isolate* isolate); 3947 void PreAge(Isolate* isolate);
3951 void MarkToBeExecutedOnce(Isolate* isolate); 3948 void MarkToBeExecutedOnce(Isolate* isolate);
3952 void MakeOlder(); 3949 void MakeOlder();
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
4158 // Returns true if pc is inside this object's instructions. 4155 // Returns true if pc is inside this object's instructions.
4159 inline bool contains(byte* pc); 4156 inline bool contains(byte* pc);
4160 4157
4161 // Returns the AbstractCode::Kind of the code. 4158 // Returns the AbstractCode::Kind of the code.
4162 inline Kind kind(); 4159 inline Kind kind();
4163 4160
4164 // Calculate the size of the code object to report for log events. This takes 4161 // Calculate the size of the code object to report for log events. This takes
4165 // the layout of the code object into account. 4162 // the layout of the code object into account.
4166 inline int ExecutableSize(); 4163 inline int ExecutableSize();
4167 4164
4168 DECLARE_CAST(AbstractCode) 4165 DECL_CAST(AbstractCode)
4169 inline Code* GetCode(); 4166 inline Code* GetCode();
4170 inline BytecodeArray* GetBytecodeArray(); 4167 inline BytecodeArray* GetBytecodeArray();
4171 4168
4172 // Max loop nesting marker used to postpose OSR. We don't take loop 4169 // Max loop nesting marker used to postpose OSR. We don't take loop
4173 // nesting that is deeper than 5 levels into account. 4170 // nesting that is deeper than 5 levels into account.
4174 static const int kMaxLoopNestingMarker = 6; 4171 static const int kMaxLoopNestingMarker = 6;
4175 STATIC_ASSERT(Code::AllowOSRAtLoopNestingLevelField::kMax >= 4172 STATIC_ASSERT(Code::AllowOSRAtLoopNestingLevelField::kMax >=
4176 kMaxLoopNestingMarker); 4173 kMaxLoopNestingMarker);
4177 }; 4174 };
4178 4175
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
4259 inline DependentCode* next_link(); 4256 inline DependentCode* next_link();
4260 inline void set_next_link(DependentCode* next); 4257 inline void set_next_link(DependentCode* next);
4261 inline int count(); 4258 inline int count();
4262 inline void set_count(int value); 4259 inline void set_count(int value);
4263 inline DependencyGroup group(); 4260 inline DependencyGroup group();
4264 inline void set_group(DependencyGroup group); 4261 inline void set_group(DependencyGroup group);
4265 inline Object* object_at(int i); 4262 inline Object* object_at(int i);
4266 inline void set_object_at(int i, Object* object); 4263 inline void set_object_at(int i, Object* object);
4267 inline void clear_at(int i); 4264 inline void clear_at(int i);
4268 inline void copy(int from, int to); 4265 inline void copy(int from, int to);
4269 DECLARE_CAST(DependentCode) 4266 DECL_CAST(DependentCode)
4270 4267
4271 static const char* DependencyGroupName(DependencyGroup group); 4268 static const char* DependencyGroupName(DependencyGroup group);
4272 static void SetMarkedForDeoptimization(Code* code, DependencyGroup group); 4269 static void SetMarkedForDeoptimization(Code* code, DependencyGroup group);
4273 4270
4274 private: 4271 private:
4275 static Handle<DependentCode> Insert(Handle<DependentCode> entries, 4272 static Handle<DependentCode> Insert(Handle<DependentCode> entries,
4276 DependencyGroup group, 4273 DependencyGroup group,
4277 Handle<Object> object); 4274 Handle<Object> object);
4278 static Handle<DependentCode> New(DependencyGroup group, Handle<Object> object, 4275 static Handle<DependentCode> New(DependencyGroup group, Handle<Object> object,
4279 Handle<DependentCode> next); 4276 Handle<DependentCode> next);
(...skipping 13 matching lines...) Expand all
4293 }; 4290 };
4294 4291
4295 class PrototypeInfo; 4292 class PrototypeInfo;
4296 4293
4297 // An abstract superclass, a marker class really, for simple structure classes. 4294 // An abstract superclass, a marker class really, for simple structure classes.
4298 // It doesn't carry much functionality but allows struct classes to be 4295 // It doesn't carry much functionality but allows struct classes to be
4299 // identified in the type system. 4296 // identified in the type system.
4300 class Struct: public HeapObject { 4297 class Struct: public HeapObject {
4301 public: 4298 public:
4302 inline void InitializeBody(int object_size); 4299 inline void InitializeBody(int object_size);
4303 DECLARE_CAST(Struct) 4300 DECL_CAST(Struct)
4304 }; 4301 };
4305 4302
4306 // A container struct to hold state required for PromiseResolveThenableJob. 4303 // A container struct to hold state required for PromiseResolveThenableJob.
4307 class PromiseResolveThenableJobInfo : public Struct { 4304 class PromiseResolveThenableJobInfo : public Struct {
4308 public: 4305 public:
4309 DECL_ACCESSORS(thenable, JSReceiver) 4306 DECL_ACCESSORS(thenable, JSReceiver)
4310 DECL_ACCESSORS(then, JSReceiver) 4307 DECL_ACCESSORS(then, JSReceiver)
4311 DECL_ACCESSORS(resolve, JSFunction) 4308 DECL_ACCESSORS(resolve, JSFunction)
4312 DECL_ACCESSORS(reject, JSFunction) 4309 DECL_ACCESSORS(reject, JSFunction)
4313 4310
4314 DECL_ACCESSORS(context, Context) 4311 DECL_ACCESSORS(context, Context)
4315 4312
4316 static const int kThenableOffset = Struct::kHeaderSize; 4313 static const int kThenableOffset = Struct::kHeaderSize;
4317 static const int kThenOffset = kThenableOffset + kPointerSize; 4314 static const int kThenOffset = kThenableOffset + kPointerSize;
4318 static const int kResolveOffset = kThenOffset + kPointerSize; 4315 static const int kResolveOffset = kThenOffset + kPointerSize;
4319 static const int kRejectOffset = kResolveOffset + kPointerSize; 4316 static const int kRejectOffset = kResolveOffset + kPointerSize;
4320 static const int kContextOffset = kRejectOffset + kPointerSize; 4317 static const int kContextOffset = kRejectOffset + kPointerSize;
4321 static const int kSize = kContextOffset + kPointerSize; 4318 static const int kSize = kContextOffset + kPointerSize;
4322 4319
4323 DECLARE_CAST(PromiseResolveThenableJobInfo) 4320 DECL_CAST(PromiseResolveThenableJobInfo)
4324 DECLARE_PRINTER(PromiseResolveThenableJobInfo) 4321 DECL_PRINTER(PromiseResolveThenableJobInfo)
4325 DECLARE_VERIFIER(PromiseResolveThenableJobInfo) 4322 DECL_VERIFIER(PromiseResolveThenableJobInfo)
4326 4323
4327 private: 4324 private:
4328 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseResolveThenableJobInfo); 4325 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseResolveThenableJobInfo);
4329 }; 4326 };
4330 4327
4331 class JSPromise; 4328 class JSPromise;
4332 4329
4333 // Struct to hold state required for PromiseReactionJob. 4330 // Struct to hold state required for PromiseReactionJob.
4334 class PromiseReactionJobInfo : public Struct { 4331 class PromiseReactionJobInfo : public Struct {
4335 public: 4332 public:
(...skipping 13 matching lines...) Expand all
4349 static const int kValueOffset = Struct::kHeaderSize; 4346 static const int kValueOffset = Struct::kHeaderSize;
4350 static const int kTasksOffset = kValueOffset + kPointerSize; 4347 static const int kTasksOffset = kValueOffset + kPointerSize;
4351 static const int kDeferredPromiseOffset = kTasksOffset + kPointerSize; 4348 static const int kDeferredPromiseOffset = kTasksOffset + kPointerSize;
4352 static const int kDeferredOnResolveOffset = 4349 static const int kDeferredOnResolveOffset =
4353 kDeferredPromiseOffset + kPointerSize; 4350 kDeferredPromiseOffset + kPointerSize;
4354 static const int kDeferredOnRejectOffset = 4351 static const int kDeferredOnRejectOffset =
4355 kDeferredOnResolveOffset + kPointerSize; 4352 kDeferredOnResolveOffset + kPointerSize;
4356 static const int kContextOffset = kDeferredOnRejectOffset + kPointerSize; 4353 static const int kContextOffset = kDeferredOnRejectOffset + kPointerSize;
4357 static const int kSize = kContextOffset + kPointerSize; 4354 static const int kSize = kContextOffset + kPointerSize;
4358 4355
4359 DECLARE_CAST(PromiseReactionJobInfo) 4356 DECL_CAST(PromiseReactionJobInfo)
4360 DECLARE_PRINTER(PromiseReactionJobInfo) 4357 DECL_PRINTER(PromiseReactionJobInfo)
4361 DECLARE_VERIFIER(PromiseReactionJobInfo) 4358 DECL_VERIFIER(PromiseReactionJobInfo)
4362 4359
4363 private: 4360 private:
4364 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseReactionJobInfo); 4361 DISALLOW_IMPLICIT_CONSTRUCTORS(PromiseReactionJobInfo);
4365 }; 4362 };
4366 4363
4367 class AsyncGeneratorRequest : public Struct { 4364 class AsyncGeneratorRequest : public Struct {
4368 public: 4365 public:
4369 // Holds an AsyncGeneratorRequest, or Undefined. 4366 // Holds an AsyncGeneratorRequest, or Undefined.
4370 DECL_ACCESSORS(next, Object) 4367 DECL_ACCESSORS(next, Object)
4371 DECL_INT_ACCESSORS(resume_mode) 4368 DECL_INT_ACCESSORS(resume_mode)
4372 DECL_ACCESSORS(value, Object) 4369 DECL_ACCESSORS(value, Object)
4373 DECL_ACCESSORS(promise, Object) 4370 DECL_ACCESSORS(promise, Object)
4374 4371
4375 static const int kNextOffset = Struct::kHeaderSize; 4372 static const int kNextOffset = Struct::kHeaderSize;
4376 static const int kResumeModeOffset = kNextOffset + kPointerSize; 4373 static const int kResumeModeOffset = kNextOffset + kPointerSize;
4377 static const int kValueOffset = kResumeModeOffset + kPointerSize; 4374 static const int kValueOffset = kResumeModeOffset + kPointerSize;
4378 static const int kPromiseOffset = kValueOffset + kPointerSize; 4375 static const int kPromiseOffset = kValueOffset + kPointerSize;
4379 static const int kSize = kPromiseOffset + kPointerSize; 4376 static const int kSize = kPromiseOffset + kPointerSize;
4380 4377
4381 DECLARE_CAST(AsyncGeneratorRequest) 4378 DECL_CAST(AsyncGeneratorRequest)
4382 DECLARE_PRINTER(AsyncGeneratorRequest) 4379 DECL_PRINTER(AsyncGeneratorRequest)
4383 DECLARE_VERIFIER(AsyncGeneratorRequest) 4380 DECL_VERIFIER(AsyncGeneratorRequest)
4384 4381
4385 private: 4382 private:
4386 DISALLOW_IMPLICIT_CONSTRUCTORS(AsyncGeneratorRequest); 4383 DISALLOW_IMPLICIT_CONSTRUCTORS(AsyncGeneratorRequest);
4387 }; 4384 };
4388 4385
4389 // Container for metadata stored on each prototype map. 4386 // Container for metadata stored on each prototype map.
4390 class PrototypeInfo : public Struct { 4387 class PrototypeInfo : public Struct {
4391 public: 4388 public:
4392 static const int UNREGISTERED = -1; 4389 static const int UNREGISTERED = -1;
4393 4390
(...skipping 20 matching lines...) Expand all
4414 // and those of all "downstream" prototypes are invalidated; handlers for a 4411 // and those of all "downstream" prototypes are invalidated; handlers for a
4415 // given receiver embed the currently valid cell for that receiver's prototype 4412 // given receiver embed the currently valid cell for that receiver's prototype
4416 // during their compilation and check it on execution. 4413 // during their compilation and check it on execution.
4417 DECL_ACCESSORS(validity_cell, Object) 4414 DECL_ACCESSORS(validity_cell, Object)
4418 // [bit_field] 4415 // [bit_field]
4419 inline int bit_field() const; 4416 inline int bit_field() const;
4420 inline void set_bit_field(int bit_field); 4417 inline void set_bit_field(int bit_field);
4421 4418
4422 DECL_BOOLEAN_ACCESSORS(should_be_fast_map) 4419 DECL_BOOLEAN_ACCESSORS(should_be_fast_map)
4423 4420
4424 DECLARE_CAST(PrototypeInfo) 4421 DECL_CAST(PrototypeInfo)
4425 4422
4426 // Dispatched behavior. 4423 // Dispatched behavior.
4427 DECLARE_PRINTER(PrototypeInfo) 4424 DECL_PRINTER(PrototypeInfo)
4428 DECLARE_VERIFIER(PrototypeInfo) 4425 DECL_VERIFIER(PrototypeInfo)
4429 4426
4430 static const int kWeakCellOffset = HeapObject::kHeaderSize; 4427 static const int kWeakCellOffset = HeapObject::kHeaderSize;
4431 static const int kPrototypeUsersOffset = kWeakCellOffset + kPointerSize; 4428 static const int kPrototypeUsersOffset = kWeakCellOffset + kPointerSize;
4432 static const int kRegistrySlotOffset = kPrototypeUsersOffset + kPointerSize; 4429 static const int kRegistrySlotOffset = kPrototypeUsersOffset + kPointerSize;
4433 static const int kValidityCellOffset = kRegistrySlotOffset + kPointerSize; 4430 static const int kValidityCellOffset = kRegistrySlotOffset + kPointerSize;
4434 static const int kObjectCreateMap = kValidityCellOffset + kPointerSize; 4431 static const int kObjectCreateMap = kValidityCellOffset + kPointerSize;
4435 static const int kBitFieldOffset = kObjectCreateMap + kPointerSize; 4432 static const int kBitFieldOffset = kObjectCreateMap + kPointerSize;
4436 static const int kSize = kBitFieldOffset + kPointerSize; 4433 static const int kSize = kBitFieldOffset + kPointerSize;
4437 4434
4438 // Bit field usage. 4435 // Bit field usage.
4439 static const int kShouldBeFastBit = 0; 4436 static const int kShouldBeFastBit = 0;
4440 4437
4441 private: 4438 private:
4442 DECL_ACCESSORS(object_create_map, Object) 4439 DECL_ACCESSORS(object_create_map, Object)
4443 4440
4444 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo); 4441 DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo);
4445 }; 4442 };
4446 4443
4447 class Tuple2 : public Struct { 4444 class Tuple2 : public Struct {
4448 public: 4445 public:
4449 DECL_ACCESSORS(value1, Object) 4446 DECL_ACCESSORS(value1, Object)
4450 DECL_ACCESSORS(value2, Object) 4447 DECL_ACCESSORS(value2, Object)
4451 4448
4452 DECLARE_CAST(Tuple2) 4449 DECL_CAST(Tuple2)
4453 4450
4454 // Dispatched behavior. 4451 // Dispatched behavior.
4455 DECLARE_PRINTER(Tuple2) 4452 DECL_PRINTER(Tuple2)
4456 DECLARE_VERIFIER(Tuple2) 4453 DECL_VERIFIER(Tuple2)
4457 4454
4458 static const int kValue1Offset = HeapObject::kHeaderSize; 4455 static const int kValue1Offset = HeapObject::kHeaderSize;
4459 static const int kValue2Offset = kValue1Offset + kPointerSize; 4456 static const int kValue2Offset = kValue1Offset + kPointerSize;
4460 static const int kSize = kValue2Offset + kPointerSize; 4457 static const int kSize = kValue2Offset + kPointerSize;
4461 4458
4462 private: 4459 private:
4463 DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple2); 4460 DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple2);
4464 }; 4461 };
4465 4462
4466 class Tuple3 : public Tuple2 { 4463 class Tuple3 : public Tuple2 {
4467 public: 4464 public:
4468 DECL_ACCESSORS(value3, Object) 4465 DECL_ACCESSORS(value3, Object)
4469 4466
4470 DECLARE_CAST(Tuple3) 4467 DECL_CAST(Tuple3)
4471 4468
4472 // Dispatched behavior. 4469 // Dispatched behavior.
4473 DECLARE_PRINTER(Tuple3) 4470 DECL_PRINTER(Tuple3)
4474 DECLARE_VERIFIER(Tuple3) 4471 DECL_VERIFIER(Tuple3)
4475 4472
4476 static const int kValue3Offset = Tuple2::kSize; 4473 static const int kValue3Offset = Tuple2::kSize;
4477 static const int kSize = kValue3Offset + kPointerSize; 4474 static const int kSize = kValue3Offset + kPointerSize;
4478 4475
4479 private: 4476 private:
4480 DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple3); 4477 DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple3);
4481 }; 4478 };
4482 4479
4483 // Pair used to store both a ScopeInfo and an extension object in the extension 4480 // Pair used to store both a ScopeInfo and an extension object in the extension
4484 // slot of a block, catch, or with context. Needed in the rare case where a 4481 // slot of a block, catch, or with context. Needed in the rare case where a
4485 // declaration block scope (a "varblock" as used to desugar parameter 4482 // declaration block scope (a "varblock" as used to desugar parameter
4486 // destructuring) also contains a sloppy direct eval, or for with and catch 4483 // destructuring) also contains a sloppy direct eval, or for with and catch
4487 // scopes. (In no other case both are needed at the same time.) 4484 // scopes. (In no other case both are needed at the same time.)
4488 class ContextExtension : public Struct { 4485 class ContextExtension : public Struct {
4489 public: 4486 public:
4490 // [scope_info]: Scope info. 4487 // [scope_info]: Scope info.
4491 DECL_ACCESSORS(scope_info, ScopeInfo) 4488 DECL_ACCESSORS(scope_info, ScopeInfo)
4492 // [extension]: Extension object. 4489 // [extension]: Extension object.
4493 DECL_ACCESSORS(extension, Object) 4490 DECL_ACCESSORS(extension, Object)
4494 4491
4495 DECLARE_CAST(ContextExtension) 4492 DECL_CAST(ContextExtension)
4496 4493
4497 // Dispatched behavior. 4494 // Dispatched behavior.
4498 DECLARE_PRINTER(ContextExtension) 4495 DECL_PRINTER(ContextExtension)
4499 DECLARE_VERIFIER(ContextExtension) 4496 DECL_VERIFIER(ContextExtension)
4500 4497
4501 static const int kScopeInfoOffset = HeapObject::kHeaderSize; 4498 static const int kScopeInfoOffset = HeapObject::kHeaderSize;
4502 static const int kExtensionOffset = kScopeInfoOffset + kPointerSize; 4499 static const int kExtensionOffset = kScopeInfoOffset + kPointerSize;
4503 static const int kSize = kExtensionOffset + kPointerSize; 4500 static const int kSize = kExtensionOffset + kPointerSize;
4504 4501
4505 private: 4502 private:
4506 DISALLOW_IMPLICIT_CONSTRUCTORS(ContextExtension); 4503 DISALLOW_IMPLICIT_CONSTRUCTORS(ContextExtension);
4507 }; 4504 };
4508 4505
4509 // List of builtin functions we want to identify to improve code 4506 // List of builtin functions we want to identify to improve code
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
4652 V(Atomics, compareExchange, AtomicsCompareExchange) \ 4649 V(Atomics, compareExchange, AtomicsCompareExchange) \
4653 V(Atomics, add, AtomicsAdd) \ 4650 V(Atomics, add, AtomicsAdd) \
4654 V(Atomics, sub, AtomicsSub) \ 4651 V(Atomics, sub, AtomicsSub) \
4655 V(Atomics, and, AtomicsAnd) \ 4652 V(Atomics, and, AtomicsAnd) \
4656 V(Atomics, or, AtomicsOr) \ 4653 V(Atomics, or, AtomicsOr) \
4657 V(Atomics, xor, AtomicsXor) 4654 V(Atomics, xor, AtomicsXor)
4658 4655
4659 enum BuiltinFunctionId { 4656 enum BuiltinFunctionId {
4660 kInvalidBuiltinFunctionId = -1, 4657 kInvalidBuiltinFunctionId = -1,
4661 kArrayCode, 4658 kArrayCode,
4662 #define DECLARE_FUNCTION_ID(ignored1, ignore2, name) \ 4659 #define DECL_FUNCTION_ID(ignored1, ignore2, name) k##name,
4663 k##name, 4660 FUNCTIONS_WITH_ID_LIST(DECL_FUNCTION_ID)
4664 FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID) 4661 ATOMIC_FUNCTIONS_WITH_ID_LIST(DECL_FUNCTION_ID)
4665 ATOMIC_FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID) 4662 #undef DECL_FUNCTION_ID
4666 #undef DECLARE_FUNCTION_ID
4667 // Fake id for a special case of Math.pow. Note, it continues the 4663 // Fake id for a special case of Math.pow. Note, it continues the
4668 // list of math functions. 4664 // list of math functions.
4669 kMathPowHalf, 4665 kMathPowHalf,
4670 // These are manually assigned to special getters during bootstrapping. 4666 // These are manually assigned to special getters during bootstrapping.
4671 kArrayBufferByteLength, 4667 kArrayBufferByteLength,
4672 kArrayEntries, 4668 kArrayEntries,
4673 kArrayKeys, 4669 kArrayKeys,
4674 kArrayValues, 4670 kArrayValues,
4675 kArrayIteratorNext, 4671 kArrayIteratorNext,
4676 kDataViewBuffer, 4672 kDataViewBuffer,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
4731 inline bool is_executing() const; 4727 inline bool is_executing() const;
4732 inline bool is_suspended() const; 4728 inline bool is_suspended() const;
4733 4729
4734 // For suspended generators: the source position at which the generator 4730 // For suspended generators: the source position at which the generator
4735 // is suspended. 4731 // is suspended.
4736 int source_position() const; 4732 int source_position() const;
4737 4733
4738 // [register_file]: Saved interpreter register file. 4734 // [register_file]: Saved interpreter register file.
4739 DECL_ACCESSORS(register_file, FixedArray) 4735 DECL_ACCESSORS(register_file, FixedArray)
4740 4736
4741 DECLARE_CAST(JSGeneratorObject) 4737 DECL_CAST(JSGeneratorObject)
4742 4738
4743 // Dispatched behavior. 4739 // Dispatched behavior.
4744 DECLARE_VERIFIER(JSGeneratorObject) 4740 DECL_VERIFIER(JSGeneratorObject)
4745 4741
4746 // Magic sentinel values for the continuation. 4742 // Magic sentinel values for the continuation.
4747 static const int kGeneratorExecuting = -2; 4743 static const int kGeneratorExecuting = -2;
4748 static const int kGeneratorClosed = -1; 4744 static const int kGeneratorClosed = -1;
4749 4745
4750 // Layout description. 4746 // Layout description.
4751 static const int kFunctionOffset = JSObject::kHeaderSize; 4747 static const int kFunctionOffset = JSObject::kHeaderSize;
4752 static const int kContextOffset = kFunctionOffset + kPointerSize; 4748 static const int kContextOffset = kFunctionOffset + kPointerSize;
4753 static const int kReceiverOffset = kContextOffset + kPointerSize; 4749 static const int kReceiverOffset = kContextOffset + kPointerSize;
4754 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize; 4750 static const int kInputOrDebugPosOffset = kReceiverOffset + kPointerSize;
4755 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize; 4751 static const int kResumeModeOffset = kInputOrDebugPosOffset + kPointerSize;
4756 static const int kContinuationOffset = kResumeModeOffset + kPointerSize; 4752 static const int kContinuationOffset = kResumeModeOffset + kPointerSize;
4757 static const int kRegisterFileOffset = kContinuationOffset + kPointerSize; 4753 static const int kRegisterFileOffset = kContinuationOffset + kPointerSize;
4758 static const int kSize = kRegisterFileOffset + kPointerSize; 4754 static const int kSize = kRegisterFileOffset + kPointerSize;
4759 4755
4760 private: 4756 private:
4761 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); 4757 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject);
4762 }; 4758 };
4763 4759
4764 class JSAsyncGeneratorObject : public JSGeneratorObject { 4760 class JSAsyncGeneratorObject : public JSGeneratorObject {
4765 public: 4761 public:
4766 DECLARE_CAST(JSAsyncGeneratorObject) 4762 DECL_CAST(JSAsyncGeneratorObject)
4767 4763
4768 // Dispatched behavior. 4764 // Dispatched behavior.
4769 DECLARE_VERIFIER(JSAsyncGeneratorObject) 4765 DECL_VERIFIER(JSAsyncGeneratorObject)
4770 4766
4771 // [queue] 4767 // [queue]
4772 // Pointer to the head of a singly linked list of AsyncGeneratorRequest, or 4768 // Pointer to the head of a singly linked list of AsyncGeneratorRequest, or
4773 // undefined. 4769 // undefined.
4774 DECL_ACCESSORS(queue, HeapObject) 4770 DECL_ACCESSORS(queue, HeapObject)
4775 4771
4776 // [await_input_or_debug_pos] 4772 // [await_input_or_debug_pos]
4777 // Holds the value to resume generator with after an Await(), in order to 4773 // Holds the value to resume generator with after an Await(), in order to
4778 // avoid clobbering function.sent. If awaited_promise is not undefined, holds 4774 // avoid clobbering function.sent. If awaited_promise is not undefined, holds
4779 // current bytecode offset for debugging instead. 4775 // current bytecode offset for debugging instead.
(...skipping 12 matching lines...) Expand all
4792 4788
4793 private: 4789 private:
4794 DISALLOW_IMPLICIT_CONSTRUCTORS(JSAsyncGeneratorObject); 4790 DISALLOW_IMPLICIT_CONSTRUCTORS(JSAsyncGeneratorObject);
4795 }; 4791 };
4796 4792
4797 // When importing a module namespace (import * as foo from "bar"), a 4793 // When importing a module namespace (import * as foo from "bar"), a
4798 // JSModuleNamespace object (representing module "bar") is created and bound to 4794 // JSModuleNamespace object (representing module "bar") is created and bound to
4799 // the declared variable (foo). A module can have at most one namespace object. 4795 // the declared variable (foo). A module can have at most one namespace object.
4800 class JSModuleNamespace : public JSObject { 4796 class JSModuleNamespace : public JSObject {
4801 public: 4797 public:
4802 DECLARE_CAST(JSModuleNamespace) 4798 DECL_CAST(JSModuleNamespace)
4803 DECLARE_PRINTER(JSModuleNamespace) 4799 DECL_PRINTER(JSModuleNamespace)
4804 DECLARE_VERIFIER(JSModuleNamespace) 4800 DECL_VERIFIER(JSModuleNamespace)
4805 4801
4806 // The actual module whose namespace is being represented. 4802 // The actual module whose namespace is being represented.
4807 DECL_ACCESSORS(module, Module) 4803 DECL_ACCESSORS(module, Module)
4808 4804
4809 // Retrieve the value exported by [module] under the given [name]. If there is 4805 // Retrieve the value exported by [module] under the given [name]. If there is
4810 // no such export, return Just(undefined). If the export is uninitialized, 4806 // no such export, return Just(undefined). If the export is uninitialized,
4811 // schedule an exception and return Nothing. 4807 // schedule an exception and return Nothing.
4812 MUST_USE_RESULT MaybeHandle<Object> GetExport(Handle<String> name); 4808 MUST_USE_RESULT MaybeHandle<Object> GetExport(Handle<String> name);
4813 4809
4814 // In-object fields. 4810 // In-object fields.
4815 enum { 4811 enum {
4816 kToStringTagFieldIndex, 4812 kToStringTagFieldIndex,
4817 kInObjectFieldCount, 4813 kInObjectFieldCount,
4818 }; 4814 };
4819 4815
4820 static const int kModuleOffset = JSObject::kHeaderSize; 4816 static const int kModuleOffset = JSObject::kHeaderSize;
4821 static const int kHeaderSize = kModuleOffset + kPointerSize; 4817 static const int kHeaderSize = kModuleOffset + kPointerSize;
4822 4818
4823 static const int kSize = kHeaderSize + kPointerSize * kInObjectFieldCount; 4819 static const int kSize = kHeaderSize + kPointerSize * kInObjectFieldCount;
4824 4820
4825 private: 4821 private:
4826 DISALLOW_IMPLICIT_CONSTRUCTORS(JSModuleNamespace); 4822 DISALLOW_IMPLICIT_CONSTRUCTORS(JSModuleNamespace);
4827 }; 4823 };
4828 4824
4829 // A Module object is a mapping from export names to cells 4825 // A Module object is a mapping from export names to cells
4830 // This is still very much in flux. 4826 // This is still very much in flux.
4831 class Module : public Struct { 4827 class Module : public Struct {
4832 public: 4828 public:
4833 DECLARE_CAST(Module) 4829 DECL_CAST(Module)
4834 DECLARE_VERIFIER(Module) 4830 DECL_VERIFIER(Module)
4835 DECLARE_PRINTER(Module) 4831 DECL_PRINTER(Module)
4836 4832
4837 // The code representing this Module, or an abstraction thereof. 4833 // The code representing this Module, or an abstraction thereof.
4838 // This is either a SharedFunctionInfo or a JSFunction or a ModuleInfo 4834 // This is either a SharedFunctionInfo or a JSFunction or a ModuleInfo
4839 // depending on whether the module has been instantiated and evaluated. See 4835 // depending on whether the module has been instantiated and evaluated. See
4840 // Module::ModuleVerify() for the precise invariant. 4836 // Module::ModuleVerify() for the precise invariant.
4841 DECL_ACCESSORS(code, Object) 4837 DECL_ACCESSORS(code, Object)
4842 4838
4843 // Arrays of cells corresponding to regular exports and regular imports. 4839 // Arrays of cells corresponding to regular exports and regular imports.
4844 // A cell's position in the array is determined by the cell index of the 4840 // A cell's position in the array is determined by the cell index of the
4845 // associated module entry (which coincides with the variable index of the 4841 // associated module entry (which coincides with the variable index of the
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
4995 4991
4996 // [bound_arguments]: A list of values whose elements are used as the first 4992 // [bound_arguments]: A list of values whose elements are used as the first
4997 // arguments to any call to the wrapped function. 4993 // arguments to any call to the wrapped function.
4998 DECL_ACCESSORS(bound_arguments, FixedArray) 4994 DECL_ACCESSORS(bound_arguments, FixedArray)
4999 4995
5000 static MaybeHandle<String> GetName(Isolate* isolate, 4996 static MaybeHandle<String> GetName(Isolate* isolate,
5001 Handle<JSBoundFunction> function); 4997 Handle<JSBoundFunction> function);
5002 static MaybeHandle<Context> GetFunctionRealm( 4998 static MaybeHandle<Context> GetFunctionRealm(
5003 Handle<JSBoundFunction> function); 4999 Handle<JSBoundFunction> function);
5004 5000
5005 DECLARE_CAST(JSBoundFunction) 5001 DECL_CAST(JSBoundFunction)
5006 5002
5007 // Dispatched behavior. 5003 // Dispatched behavior.
5008 DECLARE_PRINTER(JSBoundFunction) 5004 DECL_PRINTER(JSBoundFunction)
5009 DECLARE_VERIFIER(JSBoundFunction) 5005 DECL_VERIFIER(JSBoundFunction)
5010 5006
5011 // The bound function's string representation implemented according 5007 // The bound function's string representation implemented according
5012 // to ES6 section 19.2.3.5 Function.prototype.toString ( ). 5008 // to ES6 section 19.2.3.5 Function.prototype.toString ( ).
5013 static Handle<String> ToString(Handle<JSBoundFunction> function); 5009 static Handle<String> ToString(Handle<JSBoundFunction> function);
5014 5010
5015 // Layout description. 5011 // Layout description.
5016 static const int kBoundTargetFunctionOffset = JSObject::kHeaderSize; 5012 static const int kBoundTargetFunctionOffset = JSObject::kHeaderSize;
5017 static const int kBoundThisOffset = kBoundTargetFunctionOffset + kPointerSize; 5013 static const int kBoundThisOffset = kBoundTargetFunctionOffset + kPointerSize;
5018 static const int kBoundArgumentsOffset = kBoundThisOffset + kPointerSize; 5014 static const int kBoundArgumentsOffset = kBoundThisOffset + kPointerSize;
5019 static const int kSize = kBoundArgumentsOffset + kPointerSize; 5015 static const int kSize = kBoundArgumentsOffset + kPointerSize;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
5164 inline bool is_compiled(); 5160 inline bool is_compiled();
5165 5161
5166 // [next_function_link]: Links functions into various lists, e.g. the list 5162 // [next_function_link]: Links functions into various lists, e.g. the list
5167 // of optimized functions hanging off the native_context. Treated weakly 5163 // of optimized functions hanging off the native_context. Treated weakly
5168 // by the garbage collector. 5164 // by the garbage collector.
5169 DECL_ACCESSORS(next_function_link, Object) 5165 DECL_ACCESSORS(next_function_link, Object)
5170 5166
5171 // Prints the name of the function using PrintF. 5167 // Prints the name of the function using PrintF.
5172 void PrintName(FILE* out = stdout); 5168 void PrintName(FILE* out = stdout);
5173 5169
5174 DECLARE_CAST(JSFunction) 5170 DECL_CAST(JSFunction)
5175 5171
5176 // Calculate the instance size and in-object properties count. 5172 // Calculate the instance size and in-object properties count.
5177 static void CalculateInstanceSizeForDerivedClass( 5173 static void CalculateInstanceSizeForDerivedClass(
5178 Handle<JSFunction> function, InstanceType instance_type, 5174 Handle<JSFunction> function, InstanceType instance_type,
5179 int requested_embedder_fields, int* instance_size, 5175 int requested_embedder_fields, int* instance_size,
5180 int* in_object_properties); 5176 int* in_object_properties);
5181 static void CalculateInstanceSizeHelper(InstanceType instance_type, 5177 static void CalculateInstanceSizeHelper(InstanceType instance_type,
5182 int requested_embedder_fields, 5178 int requested_embedder_fields,
5183 int requested_in_object_properties, 5179 int requested_in_object_properties,
5184 int* instance_size, 5180 int* instance_size,
5185 int* in_object_properties); 5181 int* in_object_properties);
5186 enum BodyVisitingPolicy { kIgnoreWeakness, kRespectWeakness }; 5182 enum BodyVisitingPolicy { kIgnoreWeakness, kRespectWeakness };
5187 // Iterates the function object according to the visiting policy. 5183 // Iterates the function object according to the visiting policy.
5188 template <BodyVisitingPolicy> 5184 template <BodyVisitingPolicy>
5189 class BodyDescriptorImpl; 5185 class BodyDescriptorImpl;
5190 5186
5191 typedef BodyDescriptorImpl<kIgnoreWeakness> BodyDescriptor; 5187 typedef BodyDescriptorImpl<kIgnoreWeakness> BodyDescriptor;
5192 typedef BodyDescriptorImpl<kRespectWeakness> BodyDescriptorWeak; 5188 typedef BodyDescriptorImpl<kRespectWeakness> BodyDescriptorWeak;
5193 5189
5194 // Dispatched behavior. 5190 // Dispatched behavior.
5195 DECLARE_PRINTER(JSFunction) 5191 DECL_PRINTER(JSFunction)
5196 DECLARE_VERIFIER(JSFunction) 5192 DECL_VERIFIER(JSFunction)
5197 5193
5198 // The function's name if it is configured, otherwise shared function info 5194 // The function's name if it is configured, otherwise shared function info
5199 // debug name. 5195 // debug name.
5200 static Handle<String> GetName(Handle<JSFunction> function); 5196 static Handle<String> GetName(Handle<JSFunction> function);
5201 5197
5202 // ES6 section 9.2.11 SetFunctionName 5198 // ES6 section 9.2.11 SetFunctionName
5203 // Because of the way this abstract operation is used in the spec, 5199 // Because of the way this abstract operation is used in the spec,
5204 // it should never fail. 5200 // it should never fail.
5205 static void SetName(Handle<JSFunction> function, Handle<Name> name, 5201 static void SetName(Handle<JSFunction> function, Handle<Name> name,
5206 Handle<String> prefix); 5202 Handle<String> prefix);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5242 5238
5243 class JSGlobalProxy : public JSObject { 5239 class JSGlobalProxy : public JSObject {
5244 public: 5240 public:
5245 // [native_context]: the owner native context of this global proxy object. 5241 // [native_context]: the owner native context of this global proxy object.
5246 // It is null value if this object is not used by any context. 5242 // It is null value if this object is not used by any context.
5247 DECL_ACCESSORS(native_context, Object) 5243 DECL_ACCESSORS(native_context, Object)
5248 5244
5249 // [hash]: The hash code property (undefined if not initialized yet). 5245 // [hash]: The hash code property (undefined if not initialized yet).
5250 DECL_ACCESSORS(hash, Object) 5246 DECL_ACCESSORS(hash, Object)
5251 5247
5252 DECLARE_CAST(JSGlobalProxy) 5248 DECL_CAST(JSGlobalProxy)
5253 5249
5254 inline bool IsDetachedFrom(JSGlobalObject* global) const; 5250 inline bool IsDetachedFrom(JSGlobalObject* global) const;
5255 5251
5256 static int SizeWithEmbedderFields(int embedder_field_count); 5252 static int SizeWithEmbedderFields(int embedder_field_count);
5257 5253
5258 // Dispatched behavior. 5254 // Dispatched behavior.
5259 DECLARE_PRINTER(JSGlobalProxy) 5255 DECL_PRINTER(JSGlobalProxy)
5260 DECLARE_VERIFIER(JSGlobalProxy) 5256 DECL_VERIFIER(JSGlobalProxy)
5261 5257
5262 // Layout description. 5258 // Layout description.
5263 static const int kNativeContextOffset = JSObject::kHeaderSize; 5259 static const int kNativeContextOffset = JSObject::kHeaderSize;
5264 static const int kHashOffset = kNativeContextOffset + kPointerSize; 5260 static const int kHashOffset = kNativeContextOffset + kPointerSize;
5265 static const int kSize = kHashOffset + kPointerSize; 5261 static const int kSize = kHashOffset + kPointerSize;
5266 5262
5267 private: 5263 private:
5268 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); 5264 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy);
5269 }; 5265 };
5270 5266
5271 5267
5272 // JavaScript global object. 5268 // JavaScript global object.
5273 class JSGlobalObject : public JSObject { 5269 class JSGlobalObject : public JSObject {
5274 public: 5270 public:
5275 // [native context]: the natives corresponding to this global object. 5271 // [native context]: the natives corresponding to this global object.
5276 DECL_ACCESSORS(native_context, Context) 5272 DECL_ACCESSORS(native_context, Context)
5277 5273
5278 // [global proxy]: the global proxy object of the context 5274 // [global proxy]: the global proxy object of the context
5279 DECL_ACCESSORS(global_proxy, JSObject) 5275 DECL_ACCESSORS(global_proxy, JSObject)
5280 5276
5281 5277
5282 static void InvalidatePropertyCell(Handle<JSGlobalObject> object, 5278 static void InvalidatePropertyCell(Handle<JSGlobalObject> object,
5283 Handle<Name> name); 5279 Handle<Name> name);
5284 // Ensure that the global object has a cell for the given property name. 5280 // Ensure that the global object has a cell for the given property name.
5285 static Handle<PropertyCell> EnsureEmptyPropertyCell( 5281 static Handle<PropertyCell> EnsureEmptyPropertyCell(
5286 Handle<JSGlobalObject> global, Handle<Name> name, 5282 Handle<JSGlobalObject> global, Handle<Name> name,
5287 PropertyCellType cell_type, int* entry_out = nullptr); 5283 PropertyCellType cell_type, int* entry_out = nullptr);
5288 5284
5289 DECLARE_CAST(JSGlobalObject) 5285 DECL_CAST(JSGlobalObject)
5290 5286
5291 inline bool IsDetached(); 5287 inline bool IsDetached();
5292 5288
5293 // Dispatched behavior. 5289 // Dispatched behavior.
5294 DECLARE_PRINTER(JSGlobalObject) 5290 DECL_PRINTER(JSGlobalObject)
5295 DECLARE_VERIFIER(JSGlobalObject) 5291 DECL_VERIFIER(JSGlobalObject)
5296 5292
5297 // Layout description. 5293 // Layout description.
5298 static const int kNativeContextOffset = JSObject::kHeaderSize; 5294 static const int kNativeContextOffset = JSObject::kHeaderSize;
5299 static const int kGlobalProxyOffset = kNativeContextOffset + kPointerSize; 5295 static const int kGlobalProxyOffset = kNativeContextOffset + kPointerSize;
5300 static const int kHeaderSize = kGlobalProxyOffset + kPointerSize; 5296 static const int kHeaderSize = kGlobalProxyOffset + kPointerSize;
5301 static const int kSize = kHeaderSize; 5297 static const int kSize = kHeaderSize;
5302 5298
5303 private: 5299 private:
5304 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject); 5300 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject);
5305 }; 5301 };
5306 5302
5307 5303
5308 // Representation for JS Wrapper objects, String, Number, Boolean, etc. 5304 // Representation for JS Wrapper objects, String, Number, Boolean, etc.
5309 class JSValue: public JSObject { 5305 class JSValue: public JSObject {
5310 public: 5306 public:
5311 // [value]: the object being wrapped. 5307 // [value]: the object being wrapped.
5312 DECL_ACCESSORS(value, Object) 5308 DECL_ACCESSORS(value, Object)
5313 5309
5314 DECLARE_CAST(JSValue) 5310 DECL_CAST(JSValue)
5315 5311
5316 // Dispatched behavior. 5312 // Dispatched behavior.
5317 DECLARE_PRINTER(JSValue) 5313 DECL_PRINTER(JSValue)
5318 DECLARE_VERIFIER(JSValue) 5314 DECL_VERIFIER(JSValue)
5319 5315
5320 // Layout description. 5316 // Layout description.
5321 static const int kValueOffset = JSObject::kHeaderSize; 5317 static const int kValueOffset = JSObject::kHeaderSize;
5322 static const int kSize = kValueOffset + kPointerSize; 5318 static const int kSize = kValueOffset + kPointerSize;
5323 5319
5324 private: 5320 private:
5325 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); 5321 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue);
5326 }; 5322 };
5327 5323
5328 5324
(...skipping 20 matching lines...) Expand all
5349 // [hour]: caches hours. Either undefined, smi, or NaN. 5345 // [hour]: caches hours. Either undefined, smi, or NaN.
5350 DECL_ACCESSORS(hour, Object) 5346 DECL_ACCESSORS(hour, Object)
5351 // [min]: caches minutes. Either undefined, smi, or NaN. 5347 // [min]: caches minutes. Either undefined, smi, or NaN.
5352 DECL_ACCESSORS(min, Object) 5348 DECL_ACCESSORS(min, Object)
5353 // [sec]: caches seconds. Either undefined, smi, or NaN. 5349 // [sec]: caches seconds. Either undefined, smi, or NaN.
5354 DECL_ACCESSORS(sec, Object) 5350 DECL_ACCESSORS(sec, Object)
5355 // [cache stamp]: sample of the date cache stamp at the 5351 // [cache stamp]: sample of the date cache stamp at the
5356 // moment when chached fields were cached. 5352 // moment when chached fields were cached.
5357 DECL_ACCESSORS(cache_stamp, Object) 5353 DECL_ACCESSORS(cache_stamp, Object)
5358 5354
5359 DECLARE_CAST(JSDate) 5355 DECL_CAST(JSDate)
5360 5356
5361 // Returns the time value (UTC) identifying the current time. 5357 // Returns the time value (UTC) identifying the current time.
5362 static double CurrentTimeValue(Isolate* isolate); 5358 static double CurrentTimeValue(Isolate* isolate);
5363 5359
5364 // Returns the date field with the specified index. 5360 // Returns the date field with the specified index.
5365 // See FieldIndex for the list of date fields. 5361 // See FieldIndex for the list of date fields.
5366 static Object* GetField(Object* date, Smi* index); 5362 static Object* GetField(Object* date, Smi* index);
5367 5363
5368 static Handle<Object> SetValue(Handle<JSDate> date, double v); 5364 static Handle<Object> SetValue(Handle<JSDate> date, double v);
5369 5365
5370 void SetValue(Object* value, bool is_value_nan); 5366 void SetValue(Object* value, bool is_value_nan);
5371 5367
5372 // Dispatched behavior. 5368 // Dispatched behavior.
5373 DECLARE_PRINTER(JSDate) 5369 DECL_PRINTER(JSDate)
5374 DECLARE_VERIFIER(JSDate) 5370 DECL_VERIFIER(JSDate)
5375 5371
5376 // The order is important. It must be kept in sync with date macros 5372 // The order is important. It must be kept in sync with date macros
5377 // in macros.py. 5373 // in macros.py.
5378 enum FieldIndex { 5374 enum FieldIndex {
5379 kDateValue, 5375 kDateValue,
5380 kYear, 5376 kYear,
5381 kMonth, 5377 kMonth,
5382 kDay, 5378 kDay,
5383 kWeekday, 5379 kWeekday,
5384 kHour, 5380 kHour,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
5461 // Returns the offset of the given position within the containing line. 5457 // Returns the offset of the given position within the containing line.
5462 int GetColumnNumber() const; 5458 int GetColumnNumber() const;
5463 5459
5464 // Returns the source code line containing the given source 5460 // Returns the source code line containing the given source
5465 // position, or the empty string if the position is invalid. 5461 // position, or the empty string if the position is invalid.
5466 Handle<String> GetSourceLine() const; 5462 Handle<String> GetSourceLine() const;
5467 5463
5468 inline int error_level() const; 5464 inline int error_level() const;
5469 inline void set_error_level(int level); 5465 inline void set_error_level(int level);
5470 5466
5471 DECLARE_CAST(JSMessageObject) 5467 DECL_CAST(JSMessageObject)
5472 5468
5473 // Dispatched behavior. 5469 // Dispatched behavior.
5474 DECLARE_PRINTER(JSMessageObject) 5470 DECL_PRINTER(JSMessageObject)
5475 DECLARE_VERIFIER(JSMessageObject) 5471 DECL_VERIFIER(JSMessageObject)
5476 5472
5477 // Layout description. 5473 // Layout description.
5478 static const int kTypeOffset = JSObject::kHeaderSize; 5474 static const int kTypeOffset = JSObject::kHeaderSize;
5479 static const int kArgumentsOffset = kTypeOffset + kPointerSize; 5475 static const int kArgumentsOffset = kTypeOffset + kPointerSize;
5480 static const int kScriptOffset = kArgumentsOffset + kPointerSize; 5476 static const int kScriptOffset = kArgumentsOffset + kPointerSize;
5481 static const int kStackFramesOffset = kScriptOffset + kPointerSize; 5477 static const int kStackFramesOffset = kScriptOffset + kPointerSize;
5482 static const int kStartPositionOffset = kStackFramesOffset + kPointerSize; 5478 static const int kStartPositionOffset = kStackFramesOffset + kPointerSize;
5483 static const int kEndPositionOffset = kStartPositionOffset + kPointerSize; 5479 static const int kEndPositionOffset = kStartPositionOffset + kPointerSize;
5484 static const int kErrorLevelOffset = kEndPositionOffset + kPointerSize; 5480 static const int kErrorLevelOffset = kEndPositionOffset + kPointerSize;
5485 static const int kSize = kErrorLevelOffset + kPointerSize; 5481 static const int kSize = kErrorLevelOffset + kPointerSize;
5486 5482
5487 typedef FixedBodyDescriptor<HeapObject::kMapOffset, 5483 typedef FixedBodyDescriptor<HeapObject::kMapOffset,
5488 kStackFramesOffset + kPointerSize, 5484 kStackFramesOffset + kPointerSize,
5489 kSize> BodyDescriptor; 5485 kSize> BodyDescriptor;
5490 // No weak fields. 5486 // No weak fields.
5491 typedef BodyDescriptor BodyDescriptorWeak; 5487 typedef BodyDescriptor BodyDescriptorWeak;
5492 }; 5488 };
5493 5489
5494 class JSPromise; 5490 class JSPromise;
5495 5491
5496 // TODO(caitp): Make this a Struct once properties are no longer accessed from 5492 // TODO(caitp): Make this a Struct once properties are no longer accessed from
5497 // JS 5493 // JS
5498 class JSPromiseCapability : public JSObject { 5494 class JSPromiseCapability : public JSObject {
5499 public: 5495 public:
5500 DECLARE_CAST(JSPromiseCapability) 5496 DECL_CAST(JSPromiseCapability)
5501 5497
5502 DECLARE_VERIFIER(JSPromiseCapability) 5498 DECL_VERIFIER(JSPromiseCapability)
5503 5499
5504 DECL_ACCESSORS(promise, Object) 5500 DECL_ACCESSORS(promise, Object)
5505 DECL_ACCESSORS(resolve, Object) 5501 DECL_ACCESSORS(resolve, Object)
5506 DECL_ACCESSORS(reject, Object) 5502 DECL_ACCESSORS(reject, Object)
5507 5503
5508 static const int kPromiseOffset = JSObject::kHeaderSize; 5504 static const int kPromiseOffset = JSObject::kHeaderSize;
5509 static const int kResolveOffset = kPromiseOffset + kPointerSize; 5505 static const int kResolveOffset = kPromiseOffset + kPointerSize;
5510 static const int kRejectOffset = kResolveOffset + kPointerSize; 5506 static const int kRejectOffset = kResolveOffset + kPointerSize;
5511 static const int kSize = kRejectOffset + kPointerSize; 5507 static const int kSize = kRejectOffset + kPointerSize;
5512 5508
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
5549 5545
5550 // [has_handler]: Whether this promise has a reject handler or not. 5546 // [has_handler]: Whether this promise has a reject handler or not.
5551 DECL_BOOLEAN_ACCESSORS(has_handler) 5547 DECL_BOOLEAN_ACCESSORS(has_handler)
5552 5548
5553 // [handled_hint]: Whether this promise will be handled by a catch 5549 // [handled_hint]: Whether this promise will be handled by a catch
5554 // block in an async function. 5550 // block in an async function.
5555 DECL_BOOLEAN_ACCESSORS(handled_hint) 5551 DECL_BOOLEAN_ACCESSORS(handled_hint)
5556 5552
5557 static const char* Status(int status); 5553 static const char* Status(int status);
5558 5554
5559 DECLARE_CAST(JSPromise) 5555 DECL_CAST(JSPromise)
5560 5556
5561 // Dispatched behavior. 5557 // Dispatched behavior.
5562 DECLARE_PRINTER(JSPromise) 5558 DECL_PRINTER(JSPromise)
5563 DECLARE_VERIFIER(JSPromise) 5559 DECL_VERIFIER(JSPromise)
5564 5560
5565 // Layout description. 5561 // Layout description.
5566 static const int kStatusOffset = JSObject::kHeaderSize; 5562 static const int kStatusOffset = JSObject::kHeaderSize;
5567 static const int kResultOffset = kStatusOffset + kPointerSize; 5563 static const int kResultOffset = kStatusOffset + kPointerSize;
5568 static const int kDeferredPromiseOffset = kResultOffset + kPointerSize; 5564 static const int kDeferredPromiseOffset = kResultOffset + kPointerSize;
5569 static const int kDeferredOnResolveOffset = 5565 static const int kDeferredOnResolveOffset =
5570 kDeferredPromiseOffset + kPointerSize; 5566 kDeferredPromiseOffset + kPointerSize;
5571 static const int kDeferredOnRejectOffset = 5567 static const int kDeferredOnRejectOffset =
5572 kDeferredOnResolveOffset + kPointerSize; 5568 kDeferredOnResolveOffset + kPointerSize;
5573 static const int kFulfillReactionsOffset = 5569 static const int kFulfillReactionsOffset =
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
5657 } 5653 }
5658 5654
5659 static int saved_code_index(bool is_latin1) { 5655 static int saved_code_index(bool is_latin1) {
5660 if (is_latin1) { 5656 if (is_latin1) {
5661 return kIrregexpLatin1CodeSavedIndex; 5657 return kIrregexpLatin1CodeSavedIndex;
5662 } else { 5658 } else {
5663 return kIrregexpUC16CodeSavedIndex; 5659 return kIrregexpUC16CodeSavedIndex;
5664 } 5660 }
5665 } 5661 }
5666 5662
5667 DECLARE_CAST(JSRegExp) 5663 DECL_CAST(JSRegExp)
5668 5664
5669 // Dispatched behavior. 5665 // Dispatched behavior.
5670 DECLARE_PRINTER(JSRegExp) 5666 DECL_PRINTER(JSRegExp)
5671 DECLARE_VERIFIER(JSRegExp) 5667 DECL_VERIFIER(JSRegExp)
5672 5668
5673 static const int kDataOffset = JSObject::kHeaderSize; 5669 static const int kDataOffset = JSObject::kHeaderSize;
5674 static const int kSourceOffset = kDataOffset + kPointerSize; 5670 static const int kSourceOffset = kDataOffset + kPointerSize;
5675 static const int kFlagsOffset = kSourceOffset + kPointerSize; 5671 static const int kFlagsOffset = kSourceOffset + kPointerSize;
5676 static const int kSize = kFlagsOffset + kPointerSize; 5672 static const int kSize = kFlagsOffset + kPointerSize;
5677 5673
5678 // Indices in the data array. 5674 // Indices in the data array.
5679 static const int kTagIndex = 0; 5675 static const int kTagIndex = 0;
5680 static const int kSourceIndex = kTagIndex + 1; 5676 static const int kSourceIndex = kTagIndex + 1;
5681 static const int kFlagsIndex = kSourceIndex + 1; 5677 static const int kFlagsIndex = kSourceIndex + 1;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
5745 inline void change_ic_generic_count(int delta); 5741 inline void change_ic_generic_count(int delta);
5746 5742
5747 inline void initialize_storage(); 5743 inline void initialize_storage();
5748 5744
5749 inline void change_own_type_change_checksum(); 5745 inline void change_own_type_change_checksum();
5750 inline int own_type_change_checksum(); 5746 inline int own_type_change_checksum();
5751 5747
5752 inline void set_inlined_type_change_checksum(int checksum); 5748 inline void set_inlined_type_change_checksum(int checksum);
5753 inline bool matches_inlined_type_change_checksum(int checksum); 5749 inline bool matches_inlined_type_change_checksum(int checksum);
5754 5750
5755 DECLARE_CAST(TypeFeedbackInfo) 5751 DECL_CAST(TypeFeedbackInfo)
5756 5752
5757 static const int kStorage1Offset = kValue1Offset; 5753 static const int kStorage1Offset = kValue1Offset;
5758 static const int kStorage2Offset = kValue2Offset; 5754 static const int kStorage2Offset = kValue2Offset;
5759 static const int kStorage3Offset = kValue3Offset; 5755 static const int kStorage3Offset = kValue3Offset;
5760 5756
5761 private: 5757 private:
5762 static const int kTypeChangeChecksumBits = 7; 5758 static const int kTypeChangeChecksumBits = 7;
5763 5759
5764 class ICTotalCountField: public BitField<int, 0, 5760 class ICTotalCountField: public BitField<int, 0,
5765 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT 5761 kSmiValueSize - kTypeChangeChecksumBits> {}; // NOLINT
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
5863 inline bool CanInlineCall(); 5859 inline bool CanInlineCall();
5864 inline void SetDoNotInlineCall(); 5860 inline void SetDoNotInlineCall();
5865 5861
5866 inline bool SitePointsToLiteral(); 5862 inline bool SitePointsToLiteral();
5867 5863
5868 template <AllocationSiteUpdateMode update_or_check = 5864 template <AllocationSiteUpdateMode update_or_check =
5869 AllocationSiteUpdateMode::kUpdate> 5865 AllocationSiteUpdateMode::kUpdate>
5870 static bool DigestTransitionFeedback(Handle<AllocationSite> site, 5866 static bool DigestTransitionFeedback(Handle<AllocationSite> site,
5871 ElementsKind to_kind); 5867 ElementsKind to_kind);
5872 5868
5873 DECLARE_PRINTER(AllocationSite) 5869 DECL_PRINTER(AllocationSite)
5874 DECLARE_VERIFIER(AllocationSite) 5870 DECL_VERIFIER(AllocationSite)
5875 5871
5876 DECLARE_CAST(AllocationSite) 5872 DECL_CAST(AllocationSite)
5877 static inline bool ShouldTrack(ElementsKind boilerplate_elements_kind); 5873 static inline bool ShouldTrack(ElementsKind boilerplate_elements_kind);
5878 static bool ShouldTrack(ElementsKind from, ElementsKind to); 5874 static bool ShouldTrack(ElementsKind from, ElementsKind to);
5879 static inline bool CanTrack(InstanceType type); 5875 static inline bool CanTrack(InstanceType type);
5880 5876
5881 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; 5877 static const int kTransitionInfoOffset = HeapObject::kHeaderSize;
5882 static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize; 5878 static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize;
5883 static const int kPretenureDataOffset = kNestedSiteOffset + kPointerSize; 5879 static const int kPretenureDataOffset = kNestedSiteOffset + kPointerSize;
5884 static const int kPretenureCreateCountOffset = 5880 static const int kPretenureCreateCountOffset =
5885 kPretenureDataOffset + kPointerSize; 5881 kPretenureDataOffset + kPointerSize;
5886 static const int kDependentCodeOffset = 5882 static const int kDependentCodeOffset =
(...skipping 26 matching lines...) Expand all
5913 public: 5909 public:
5914 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; 5910 static const int kAllocationSiteOffset = HeapObject::kHeaderSize;
5915 static const int kSize = kAllocationSiteOffset + kPointerSize; 5911 static const int kSize = kAllocationSiteOffset + kPointerSize;
5916 5912
5917 DECL_ACCESSORS(allocation_site, Object) 5913 DECL_ACCESSORS(allocation_site, Object)
5918 5914
5919 inline bool IsValid(); 5915 inline bool IsValid();
5920 inline AllocationSite* GetAllocationSite(); 5916 inline AllocationSite* GetAllocationSite();
5921 inline Address GetAllocationSiteUnchecked(); 5917 inline Address GetAllocationSiteUnchecked();
5922 5918
5923 DECLARE_PRINTER(AllocationMemento) 5919 DECL_PRINTER(AllocationMemento)
5924 DECLARE_VERIFIER(AllocationMemento) 5920 DECL_VERIFIER(AllocationMemento)
5925 5921
5926 DECLARE_CAST(AllocationMemento) 5922 DECL_CAST(AllocationMemento)
5927 5923
5928 private: 5924 private:
5929 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationMemento); 5925 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationMemento);
5930 }; 5926 };
5931 5927
5932 5928
5933 // Utility superclass for stack-allocated objects that must be updated 5929 // Utility superclass for stack-allocated objects that must be updated
5934 // on gc. It provides two ways for the gc to update instances, either 5930 // on gc. It provides two ways for the gc to update instances, either
5935 // iterating or updating after gc. 5931 // iterating or updating after gc.
5936 class Relocatable BASE_EMBEDDED { 5932 class Relocatable BASE_EMBEDDED {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
5982 5978
5983 // [typeof]: Cached type_of computed at startup. 5979 // [typeof]: Cached type_of computed at startup.
5984 DECL_ACCESSORS(type_of, String) 5980 DECL_ACCESSORS(type_of, String)
5985 5981
5986 inline byte kind() const; 5982 inline byte kind() const;
5987 inline void set_kind(byte kind); 5983 inline void set_kind(byte kind);
5988 5984
5989 // ES6 section 7.1.3 ToNumber for Boolean, Null, Undefined. 5985 // ES6 section 7.1.3 ToNumber for Boolean, Null, Undefined.
5990 MUST_USE_RESULT static inline Handle<Object> ToNumber(Handle<Oddball> input); 5986 MUST_USE_RESULT static inline Handle<Object> ToNumber(Handle<Oddball> input);
5991 5987
5992 DECLARE_CAST(Oddball) 5988 DECL_CAST(Oddball)
5993 5989
5994 // Dispatched behavior. 5990 // Dispatched behavior.
5995 DECLARE_VERIFIER(Oddball) 5991 DECL_VERIFIER(Oddball)
5996 5992
5997 // Initialize the fields. 5993 // Initialize the fields.
5998 static void Initialize(Isolate* isolate, Handle<Oddball> oddball, 5994 static void Initialize(Isolate* isolate, Handle<Oddball> oddball,
5999 const char* to_string, Handle<Object> to_number, 5995 const char* to_string, Handle<Object> to_number,
6000 const char* type_of, byte kind); 5996 const char* type_of, byte kind);
6001 5997
6002 // Layout description. 5998 // Layout description.
6003 static const int kToNumberRawOffset = HeapObject::kHeaderSize; 5999 static const int kToNumberRawOffset = HeapObject::kHeaderSize;
6004 static const int kToStringOffset = kToNumberRawOffset + kDoubleSize; 6000 static const int kToStringOffset = kToNumberRawOffset + kDoubleSize;
6005 static const int kToNumberOffset = kToStringOffset + kPointerSize; 6001 static const int kToNumberOffset = kToStringOffset + kPointerSize;
(...skipping 27 matching lines...) Expand all
6033 private: 6029 private:
6034 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); 6030 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball);
6035 }; 6031 };
6036 6032
6037 6033
6038 class Cell: public HeapObject { 6034 class Cell: public HeapObject {
6039 public: 6035 public:
6040 // [value]: value of the cell. 6036 // [value]: value of the cell.
6041 DECL_ACCESSORS(value, Object) 6037 DECL_ACCESSORS(value, Object)
6042 6038
6043 DECLARE_CAST(Cell) 6039 DECL_CAST(Cell)
6044 6040
6045 static inline Cell* FromValueAddress(Address value) { 6041 static inline Cell* FromValueAddress(Address value) {
6046 Object* result = FromAddress(value - kValueOffset); 6042 Object* result = FromAddress(value - kValueOffset);
6047 return static_cast<Cell*>(result); 6043 return static_cast<Cell*>(result);
6048 } 6044 }
6049 6045
6050 inline Address ValueAddress() { 6046 inline Address ValueAddress() {
6051 return address() + kValueOffset; 6047 return address() + kValueOffset;
6052 } 6048 }
6053 6049
6054 // Dispatched behavior. 6050 // Dispatched behavior.
6055 DECLARE_PRINTER(Cell) 6051 DECL_PRINTER(Cell)
6056 DECLARE_VERIFIER(Cell) 6052 DECL_VERIFIER(Cell)
6057 6053
6058 // Layout description. 6054 // Layout description.
6059 static const int kValueOffset = HeapObject::kHeaderSize; 6055 static const int kValueOffset = HeapObject::kHeaderSize;
6060 static const int kSize = kValueOffset + kPointerSize; 6056 static const int kSize = kValueOffset + kPointerSize;
6061 6057
6062 typedef FixedBodyDescriptor<kValueOffset, 6058 typedef FixedBodyDescriptor<kValueOffset,
6063 kValueOffset + kPointerSize, 6059 kValueOffset + kPointerSize,
6064 kSize> BodyDescriptor; 6060 kSize> BodyDescriptor;
6065 // No weak fields. 6061 // No weak fields.
6066 typedef BodyDescriptor BodyDescriptorWeak; 6062 typedef BodyDescriptor BodyDescriptorWeak;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
6098 static Handle<PropertyCell> PrepareForValue( 6094 static Handle<PropertyCell> PrepareForValue(
6099 Handle<GlobalDictionary> dictionary, int entry, Handle<Object> value, 6095 Handle<GlobalDictionary> dictionary, int entry, Handle<Object> value,
6100 PropertyDetails details); 6096 PropertyDetails details);
6101 6097
6102 static Handle<PropertyCell> InvalidateEntry( 6098 static Handle<PropertyCell> InvalidateEntry(
6103 Handle<GlobalDictionary> dictionary, int entry); 6099 Handle<GlobalDictionary> dictionary, int entry);
6104 6100
6105 static void SetValueWithInvalidation(Handle<PropertyCell> cell, 6101 static void SetValueWithInvalidation(Handle<PropertyCell> cell,
6106 Handle<Object> new_value); 6102 Handle<Object> new_value);
6107 6103
6108 DECLARE_CAST(PropertyCell) 6104 DECL_CAST(PropertyCell)
6109 6105
6110 // Dispatched behavior. 6106 // Dispatched behavior.
6111 DECLARE_PRINTER(PropertyCell) 6107 DECL_PRINTER(PropertyCell)
6112 DECLARE_VERIFIER(PropertyCell) 6108 DECL_VERIFIER(PropertyCell)
6113 6109
6114 // Layout description. 6110 // Layout description.
6115 static const int kDetailsOffset = HeapObject::kHeaderSize; 6111 static const int kDetailsOffset = HeapObject::kHeaderSize;
6116 static const int kNameOffset = kDetailsOffset + kPointerSize; 6112 static const int kNameOffset = kDetailsOffset + kPointerSize;
6117 static const int kValueOffset = kNameOffset + kPointerSize; 6113 static const int kValueOffset = kNameOffset + kPointerSize;
6118 static const int kDependentCodeOffset = kValueOffset + kPointerSize; 6114 static const int kDependentCodeOffset = kValueOffset + kPointerSize;
6119 static const int kSize = kDependentCodeOffset + kPointerSize; 6115 static const int kSize = kDependentCodeOffset + kPointerSize;
6120 6116
6121 typedef FixedBodyDescriptor<kNameOffset, kSize, kSize> BodyDescriptor; 6117 typedef FixedBodyDescriptor<kNameOffset, kSize, kSize> BodyDescriptor;
6122 // No weak fields. 6118 // No weak fields.
(...skipping 15 matching lines...) Expand all
6138 inline void initialize(HeapObject* value); 6134 inline void initialize(HeapObject* value);
6139 6135
6140 inline bool cleared() const; 6136 inline bool cleared() const;
6141 6137
6142 DECL_ACCESSORS(next, Object) 6138 DECL_ACCESSORS(next, Object)
6143 6139
6144 inline void clear_next(Object* the_hole_value); 6140 inline void clear_next(Object* the_hole_value);
6145 6141
6146 inline bool next_cleared(); 6142 inline bool next_cleared();
6147 6143
6148 DECLARE_CAST(WeakCell) 6144 DECL_CAST(WeakCell)
6149 6145
6150 DECLARE_PRINTER(WeakCell) 6146 DECL_PRINTER(WeakCell)
6151 DECLARE_VERIFIER(WeakCell) 6147 DECL_VERIFIER(WeakCell)
6152 6148
6153 // Layout description. 6149 // Layout description.
6154 static const int kValueOffset = HeapObject::kHeaderSize; 6150 static const int kValueOffset = HeapObject::kHeaderSize;
6155 static const int kNextOffset = kValueOffset + kPointerSize; 6151 static const int kNextOffset = kValueOffset + kPointerSize;
6156 static const int kSize = kNextOffset + kPointerSize; 6152 static const int kSize = kNextOffset + kPointerSize;
6157 6153
6158 typedef FixedBodyDescriptor<kValueOffset, kSize, kSize> BodyDescriptor; 6154 typedef FixedBodyDescriptor<kValueOffset, kSize, kSize> BodyDescriptor;
6159 6155
6160 private: 6156 private:
6161 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakCell); 6157 DISALLOW_IMPLICIT_CONSTRUCTORS(WeakCell);
6162 }; 6158 };
6163 6159
6164 6160
6165 // The JSProxy describes EcmaScript Harmony proxies 6161 // The JSProxy describes EcmaScript Harmony proxies
6166 class JSProxy: public JSReceiver { 6162 class JSProxy: public JSReceiver {
6167 public: 6163 public:
6168 MUST_USE_RESULT static MaybeHandle<JSProxy> New(Isolate* isolate, 6164 MUST_USE_RESULT static MaybeHandle<JSProxy> New(Isolate* isolate,
6169 Handle<Object>, 6165 Handle<Object>,
6170 Handle<Object>); 6166 Handle<Object>);
6171 6167
6172 // [handler]: The handler property. 6168 // [handler]: The handler property.
6173 DECL_ACCESSORS(handler, Object) 6169 DECL_ACCESSORS(handler, Object)
6174 // [target]: The target property. 6170 // [target]: The target property.
6175 DECL_ACCESSORS(target, JSReceiver) 6171 DECL_ACCESSORS(target, JSReceiver)
6176 // [hash]: The hash code property (undefined if not initialized yet). 6172 // [hash]: The hash code property (undefined if not initialized yet).
6177 DECL_ACCESSORS(hash, Object) 6173 DECL_ACCESSORS(hash, Object)
6178 6174
6179 static MaybeHandle<Context> GetFunctionRealm(Handle<JSProxy> proxy); 6175 static MaybeHandle<Context> GetFunctionRealm(Handle<JSProxy> proxy);
6180 6176
6181 DECLARE_CAST(JSProxy) 6177 DECL_CAST(JSProxy)
6182 6178
6183 INLINE(bool IsRevoked() const); 6179 INLINE(bool IsRevoked() const);
6184 static void Revoke(Handle<JSProxy> proxy); 6180 static void Revoke(Handle<JSProxy> proxy);
6185 6181
6186 // ES6 9.5.1 6182 // ES6 9.5.1
6187 static MaybeHandle<Object> GetPrototype(Handle<JSProxy> receiver); 6183 static MaybeHandle<Object> GetPrototype(Handle<JSProxy> receiver);
6188 6184
6189 // ES6 9.5.2 6185 // ES6 9.5.2
6190 MUST_USE_RESULT static Maybe<bool> SetPrototype(Handle<JSProxy> proxy, 6186 MUST_USE_RESULT static Maybe<bool> SetPrototype(Handle<JSProxy> proxy,
6191 Handle<Object> value, 6187 Handle<Object> value,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
6234 6230
6235 // ES6 9.5.12 6231 // ES6 9.5.12
6236 MUST_USE_RESULT static Maybe<bool> OwnPropertyKeys( 6232 MUST_USE_RESULT static Maybe<bool> OwnPropertyKeys(
6237 Isolate* isolate, Handle<JSReceiver> receiver, Handle<JSProxy> proxy, 6233 Isolate* isolate, Handle<JSReceiver> receiver, Handle<JSProxy> proxy,
6238 PropertyFilter filter, KeyAccumulator* accumulator); 6234 PropertyFilter filter, KeyAccumulator* accumulator);
6239 6235
6240 MUST_USE_RESULT static Maybe<PropertyAttributes> GetPropertyAttributes( 6236 MUST_USE_RESULT static Maybe<PropertyAttributes> GetPropertyAttributes(
6241 LookupIterator* it); 6237 LookupIterator* it);
6242 6238
6243 // Dispatched behavior. 6239 // Dispatched behavior.
6244 DECLARE_PRINTER(JSProxy) 6240 DECL_PRINTER(JSProxy)
6245 DECLARE_VERIFIER(JSProxy) 6241 DECL_VERIFIER(JSProxy)
6246 6242
6247 static const int kMaxIterationLimit = 100 * 1024; 6243 static const int kMaxIterationLimit = 100 * 1024;
6248 6244
6249 // Layout description. 6245 // Layout description.
6250 static const int kTargetOffset = JSReceiver::kHeaderSize; 6246 static const int kTargetOffset = JSReceiver::kHeaderSize;
6251 static const int kHandlerOffset = kTargetOffset + kPointerSize; 6247 static const int kHandlerOffset = kTargetOffset + kPointerSize;
6252 static const int kHashOffset = kHandlerOffset + kPointerSize; 6248 static const int kHashOffset = kHandlerOffset + kPointerSize;
6253 static const int kSize = kHashOffset + kPointerSize; 6249 static const int kSize = kHashOffset + kPointerSize;
6254 6250
6255 typedef FixedBodyDescriptor<JSReceiver::kPropertiesOffset, kSize, kSize> 6251 typedef FixedBodyDescriptor<JSReceiver::kPropertiesOffset, kSize, kSize>
(...skipping 26 matching lines...) Expand all
6282 private: 6278 private:
6283 DISALLOW_IMPLICIT_CONSTRUCTORS(JSCollection); 6279 DISALLOW_IMPLICIT_CONSTRUCTORS(JSCollection);
6284 }; 6280 };
6285 6281
6286 6282
6287 // The JSSet describes EcmaScript Harmony sets 6283 // The JSSet describes EcmaScript Harmony sets
6288 // TODO(marja): When moving JSSet out of objects.h, move JSSetIterator (from 6284 // TODO(marja): When moving JSSet out of objects.h, move JSSetIterator (from
6289 // objects/hash-table.h) into the same file. 6285 // objects/hash-table.h) into the same file.
6290 class JSSet : public JSCollection { 6286 class JSSet : public JSCollection {
6291 public: 6287 public:
6292 DECLARE_CAST(JSSet) 6288 DECL_CAST(JSSet)
6293 6289
6294 static void Initialize(Handle<JSSet> set, Isolate* isolate); 6290 static void Initialize(Handle<JSSet> set, Isolate* isolate);
6295 static void Clear(Handle<JSSet> set); 6291 static void Clear(Handle<JSSet> set);
6296 6292
6297 // Dispatched behavior. 6293 // Dispatched behavior.
6298 DECLARE_PRINTER(JSSet) 6294 DECL_PRINTER(JSSet)
6299 DECLARE_VERIFIER(JSSet) 6295 DECL_VERIFIER(JSSet)
6300 6296
6301 private: 6297 private:
6302 DISALLOW_IMPLICIT_CONSTRUCTORS(JSSet); 6298 DISALLOW_IMPLICIT_CONSTRUCTORS(JSSet);
6303 }; 6299 };
6304 6300
6305 6301
6306 // The JSMap describes EcmaScript Harmony maps 6302 // The JSMap describes EcmaScript Harmony maps
6307 // TODO(marja): When moving JSMap out of objects.h, move JSMapIterator (from 6303 // TODO(marja): When moving JSMap out of objects.h, move JSMapIterator (from
6308 // objects/hash-table.h) into the same file. 6304 // objects/hash-table.h) into the same file.
6309 class JSMap : public JSCollection { 6305 class JSMap : public JSCollection {
6310 public: 6306 public:
6311 DECLARE_CAST(JSMap) 6307 DECL_CAST(JSMap)
6312 6308
6313 static void Initialize(Handle<JSMap> map, Isolate* isolate); 6309 static void Initialize(Handle<JSMap> map, Isolate* isolate);
6314 static void Clear(Handle<JSMap> map); 6310 static void Clear(Handle<JSMap> map);
6315 6311
6316 // Dispatched behavior. 6312 // Dispatched behavior.
6317 DECLARE_PRINTER(JSMap) 6313 DECL_PRINTER(JSMap)
6318 DECLARE_VERIFIER(JSMap) 6314 DECL_VERIFIER(JSMap)
6319 6315
6320 private: 6316 private:
6321 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap); 6317 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap);
6322 }; 6318 };
6323 6319
6324 class JSArrayIterator : public JSObject { 6320 class JSArrayIterator : public JSObject {
6325 public: 6321 public:
6326 DECLARE_PRINTER(JSArrayIterator) 6322 DECL_PRINTER(JSArrayIterator)
6327 DECLARE_VERIFIER(JSArrayIterator) 6323 DECL_VERIFIER(JSArrayIterator)
6328 6324
6329 DECLARE_CAST(JSArrayIterator) 6325 DECL_CAST(JSArrayIterator)
6330 6326
6331 // [object]: the [[IteratedObject]] inobject property. 6327 // [object]: the [[IteratedObject]] inobject property.
6332 DECL_ACCESSORS(object, Object) 6328 DECL_ACCESSORS(object, Object)
6333 6329
6334 // [index]: The [[ArrayIteratorNextIndex]] inobject property. 6330 // [index]: The [[ArrayIteratorNextIndex]] inobject property.
6335 DECL_ACCESSORS(index, Object) 6331 DECL_ACCESSORS(index, Object)
6336 6332
6337 // [map]: The Map of the [[IteratedObject]] field at the time the iterator is 6333 // [map]: The Map of the [[IteratedObject]] field at the time the iterator is
6338 // allocated. 6334 // allocated.
6339 DECL_ACCESSORS(object_map, Object) 6335 DECL_ACCESSORS(object_map, Object)
(...skipping 11 matching lines...) Expand all
6351 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayIterator); 6347 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayIterator);
6352 }; 6348 };
6353 6349
6354 // The [Async-from-Sync Iterator] object 6350 // The [Async-from-Sync Iterator] object
6355 // (proposal-async-iteration/#sec-async-from-sync-iterator-objects) 6351 // (proposal-async-iteration/#sec-async-from-sync-iterator-objects)
6356 // An object which wraps an ordinary Iterator and converts it to behave 6352 // An object which wraps an ordinary Iterator and converts it to behave
6357 // according to the Async Iterator protocol. 6353 // according to the Async Iterator protocol.
6358 // (See https://tc39.github.io/proposal-async-iteration/#sec-iteration) 6354 // (See https://tc39.github.io/proposal-async-iteration/#sec-iteration)
6359 class JSAsyncFromSyncIterator : public JSObject { 6355 class JSAsyncFromSyncIterator : public JSObject {
6360 public: 6356 public:
6361 DECLARE_CAST(JSAsyncFromSyncIterator) 6357 DECL_CAST(JSAsyncFromSyncIterator)
6362 DECLARE_PRINTER(JSAsyncFromSyncIterator) 6358 DECL_PRINTER(JSAsyncFromSyncIterator)
6363 DECLARE_VERIFIER(JSAsyncFromSyncIterator) 6359 DECL_VERIFIER(JSAsyncFromSyncIterator)
6364 6360
6365 // Async-from-Sync Iterator instances are ordinary objects that inherit 6361 // Async-from-Sync Iterator instances are ordinary objects that inherit
6366 // properties from the %AsyncFromSyncIteratorPrototype% intrinsic object. 6362 // properties from the %AsyncFromSyncIteratorPrototype% intrinsic object.
6367 // Async-from-Sync Iterator instances are initially created with the internal 6363 // Async-from-Sync Iterator instances are initially created with the internal
6368 // slots listed in Table 4. 6364 // slots listed in Table 4.
6369 // (proposal-async-iteration/#table-async-from-sync-iterator-internal-slots) 6365 // (proposal-async-iteration/#table-async-from-sync-iterator-internal-slots)
6370 DECL_ACCESSORS(sync_iterator, JSReceiver) 6366 DECL_ACCESSORS(sync_iterator, JSReceiver)
6371 6367
6372 // Offsets of object fields. 6368 // Offsets of object fields.
6373 static const int kSyncIteratorOffset = JSObject::kHeaderSize; 6369 static const int kSyncIteratorOffset = JSObject::kHeaderSize;
6374 static const int kSize = kSyncIteratorOffset + kPointerSize; 6370 static const int kSize = kSyncIteratorOffset + kPointerSize;
6375 6371
6376 private: 6372 private:
6377 DISALLOW_IMPLICIT_CONSTRUCTORS(JSAsyncFromSyncIterator); 6373 DISALLOW_IMPLICIT_CONSTRUCTORS(JSAsyncFromSyncIterator);
6378 }; 6374 };
6379 6375
6380 class JSStringIterator : public JSObject { 6376 class JSStringIterator : public JSObject {
6381 public: 6377 public:
6382 // Dispatched behavior. 6378 // Dispatched behavior.
6383 DECLARE_PRINTER(JSStringIterator) 6379 DECL_PRINTER(JSStringIterator)
6384 DECLARE_VERIFIER(JSStringIterator) 6380 DECL_VERIFIER(JSStringIterator)
6385 6381
6386 DECLARE_CAST(JSStringIterator) 6382 DECL_CAST(JSStringIterator)
6387 6383
6388 // [string]: the [[IteratedString]] inobject property. 6384 // [string]: the [[IteratedString]] inobject property.
6389 DECL_ACCESSORS(string, String) 6385 DECL_ACCESSORS(string, String)
6390 6386
6391 // [index]: The [[StringIteratorNextIndex]] inobject property. 6387 // [index]: The [[StringIteratorNextIndex]] inobject property.
6392 inline int index() const; 6388 inline int index() const;
6393 inline void set_index(int value); 6389 inline void set_index(int value);
6394 6390
6395 static const int kStringOffset = JSObject::kHeaderSize; 6391 static const int kStringOffset = JSObject::kHeaderSize;
6396 static const int kNextIndexOffset = kStringOffset + kPointerSize; 6392 static const int kNextIndexOffset = kStringOffset + kPointerSize;
6397 static const int kSize = kNextIndexOffset + kPointerSize; 6393 static const int kSize = kNextIndexOffset + kPointerSize;
6398 6394
6399 private: 6395 private:
6400 DISALLOW_IMPLICIT_CONSTRUCTORS(JSStringIterator); 6396 DISALLOW_IMPLICIT_CONSTRUCTORS(JSStringIterator);
6401 }; 6397 };
6402 6398
6403 // Base class for both JSWeakMap and JSWeakSet 6399 // Base class for both JSWeakMap and JSWeakSet
6404 class JSWeakCollection: public JSObject { 6400 class JSWeakCollection: public JSObject {
6405 public: 6401 public:
6406 DECLARE_CAST(JSWeakCollection) 6402 DECL_CAST(JSWeakCollection)
6407 6403
6408 // [table]: the backing hash table mapping keys to values. 6404 // [table]: the backing hash table mapping keys to values.
6409 DECL_ACCESSORS(table, Object) 6405 DECL_ACCESSORS(table, Object)
6410 6406
6411 // [next]: linked list of encountered weak maps during GC. 6407 // [next]: linked list of encountered weak maps during GC.
6412 DECL_ACCESSORS(next, Object) 6408 DECL_ACCESSORS(next, Object)
6413 6409
6414 static void Initialize(Handle<JSWeakCollection> collection, Isolate* isolate); 6410 static void Initialize(Handle<JSWeakCollection> collection, Isolate* isolate);
6415 static void Set(Handle<JSWeakCollection> collection, Handle<Object> key, 6411 static void Set(Handle<JSWeakCollection> collection, Handle<Object> key,
6416 Handle<Object> value, int32_t hash); 6412 Handle<Object> value, int32_t hash);
(...skipping 21 matching lines...) Expand all
6438 typedef BodyDescriptorImpl<kRespectWeakness> BodyDescriptorWeak; 6434 typedef BodyDescriptorImpl<kRespectWeakness> BodyDescriptorWeak;
6439 6435
6440 private: 6436 private:
6441 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakCollection); 6437 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakCollection);
6442 }; 6438 };
6443 6439
6444 6440
6445 // The JSWeakMap describes EcmaScript Harmony weak maps 6441 // The JSWeakMap describes EcmaScript Harmony weak maps
6446 class JSWeakMap: public JSWeakCollection { 6442 class JSWeakMap: public JSWeakCollection {
6447 public: 6443 public:
6448 DECLARE_CAST(JSWeakMap) 6444 DECL_CAST(JSWeakMap)
6449 6445
6450 // Dispatched behavior. 6446 // Dispatched behavior.
6451 DECLARE_PRINTER(JSWeakMap) 6447 DECL_PRINTER(JSWeakMap)
6452 DECLARE_VERIFIER(JSWeakMap) 6448 DECL_VERIFIER(JSWeakMap)
6453 6449
6454 private: 6450 private:
6455 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap); 6451 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap);
6456 }; 6452 };
6457 6453
6458 6454
6459 // The JSWeakSet describes EcmaScript Harmony weak sets 6455 // The JSWeakSet describes EcmaScript Harmony weak sets
6460 class JSWeakSet: public JSWeakCollection { 6456 class JSWeakSet: public JSWeakCollection {
6461 public: 6457 public:
6462 DECLARE_CAST(JSWeakSet) 6458 DECL_CAST(JSWeakSet)
6463 6459
6464 // Dispatched behavior. 6460 // Dispatched behavior.
6465 DECLARE_PRINTER(JSWeakSet) 6461 DECL_PRINTER(JSWeakSet)
6466 DECLARE_VERIFIER(JSWeakSet) 6462 DECL_VERIFIER(JSWeakSet)
6467 6463
6468 private: 6464 private:
6469 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakSet); 6465 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakSet);
6470 }; 6466 };
6471 6467
6472 6468
6473 // Whether a JSArrayBuffer is a SharedArrayBuffer or not. 6469 // Whether a JSArrayBuffer is a SharedArrayBuffer or not.
6474 enum class SharedFlag { kNotShared, kShared }; 6470 enum class SharedFlag { kNotShared, kShared };
6475 6471
6476 6472
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
6510 inline void set_is_shared(bool value); 6506 inline void set_is_shared(bool value);
6511 6507
6512 inline bool has_guard_region() const; 6508 inline bool has_guard_region() const;
6513 inline void set_has_guard_region(bool value); 6509 inline void set_has_guard_region(bool value);
6514 6510
6515 // TODO(gdeepti): This flag is introduced to disable asm.js optimizations in 6511 // TODO(gdeepti): This flag is introduced to disable asm.js optimizations in
6516 // js-typer-lowering.cc, remove when the asm.js case is fixed. 6512 // js-typer-lowering.cc, remove when the asm.js case is fixed.
6517 inline bool is_wasm_buffer(); 6513 inline bool is_wasm_buffer();
6518 inline void set_is_wasm_buffer(bool value); 6514 inline void set_is_wasm_buffer(bool value);
6519 6515
6520 DECLARE_CAST(JSArrayBuffer) 6516 DECL_CAST(JSArrayBuffer)
6521 6517
6522 void Neuter(); 6518 void Neuter();
6523 6519
6524 inline ArrayBuffer::Allocator::AllocationMode allocation_mode() const; 6520 inline ArrayBuffer::Allocator::AllocationMode allocation_mode() const;
6525 6521
6526 void FreeBackingStore(); 6522 void FreeBackingStore();
6527 6523
6528 V8_EXPORT_PRIVATE static void Setup( 6524 V8_EXPORT_PRIVATE static void Setup(
6529 Handle<JSArrayBuffer> array_buffer, Isolate* isolate, bool is_external, 6525 Handle<JSArrayBuffer> array_buffer, Isolate* isolate, bool is_external,
6530 void* data, size_t allocated_length, 6526 void* data, size_t allocated_length,
6531 SharedFlag shared = SharedFlag::kNotShared); 6527 SharedFlag shared = SharedFlag::kNotShared);
6532 6528
6533 V8_EXPORT_PRIVATE static void Setup( 6529 V8_EXPORT_PRIVATE static void Setup(
6534 Handle<JSArrayBuffer> array_buffer, Isolate* isolate, bool is_external, 6530 Handle<JSArrayBuffer> array_buffer, Isolate* isolate, bool is_external,
6535 void* allocation_base, size_t allocation_length, void* data, 6531 void* allocation_base, size_t allocation_length, void* data,
6536 size_t byte_length, SharedFlag shared = SharedFlag::kNotShared); 6532 size_t byte_length, SharedFlag shared = SharedFlag::kNotShared);
6537 6533
6538 // Returns false if array buffer contents could not be allocated. 6534 // Returns false if array buffer contents could not be allocated.
6539 // In this case, |array_buffer| will not be set up. 6535 // In this case, |array_buffer| will not be set up.
6540 static bool SetupAllocatingData( 6536 static bool SetupAllocatingData(
6541 Handle<JSArrayBuffer> array_buffer, Isolate* isolate, 6537 Handle<JSArrayBuffer> array_buffer, Isolate* isolate,
6542 size_t allocated_length, bool initialize = true, 6538 size_t allocated_length, bool initialize = true,
6543 SharedFlag shared = SharedFlag::kNotShared) WARN_UNUSED_RESULT; 6539 SharedFlag shared = SharedFlag::kNotShared) WARN_UNUSED_RESULT;
6544 6540
6545 // Dispatched behavior. 6541 // Dispatched behavior.
6546 DECLARE_PRINTER(JSArrayBuffer) 6542 DECL_PRINTER(JSArrayBuffer)
6547 DECLARE_VERIFIER(JSArrayBuffer) 6543 DECL_VERIFIER(JSArrayBuffer)
6548 6544
6549 static const int kByteLengthOffset = JSObject::kHeaderSize; 6545 static const int kByteLengthOffset = JSObject::kHeaderSize;
6550 // The rest of the fields are not JSObjects, so they are not iterated over in 6546 // The rest of the fields are not JSObjects, so they are not iterated over in
6551 // objects-body-descriptors-inl.h. 6547 // objects-body-descriptors-inl.h.
6552 static const int kBackingStoreOffset = kByteLengthOffset + kPointerSize; 6548 static const int kBackingStoreOffset = kByteLengthOffset + kPointerSize;
6553 static const int kAllocationBaseOffset = kBackingStoreOffset + kPointerSize; 6549 static const int kAllocationBaseOffset = kBackingStoreOffset + kPointerSize;
6554 static const int kAllocationLengthOffset = 6550 static const int kAllocationLengthOffset =
6555 kAllocationBaseOffset + kPointerSize; 6551 kAllocationBaseOffset + kPointerSize;
6556 static const int kBitFieldSlot = kAllocationLengthOffset + kSizetSize; 6552 static const int kBitFieldSlot = kAllocationLengthOffset + kSizetSize;
6557 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT 6553 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT
(...skipping 28 matching lines...) Expand all
6586 public: 6582 public:
6587 // [buffer]: ArrayBuffer that this typed array views. 6583 // [buffer]: ArrayBuffer that this typed array views.
6588 DECL_ACCESSORS(buffer, Object) 6584 DECL_ACCESSORS(buffer, Object)
6589 6585
6590 // [byte_offset]: offset of typed array in bytes. 6586 // [byte_offset]: offset of typed array in bytes.
6591 DECL_ACCESSORS(byte_offset, Object) 6587 DECL_ACCESSORS(byte_offset, Object)
6592 6588
6593 // [byte_length]: length of typed array in bytes. 6589 // [byte_length]: length of typed array in bytes.
6594 DECL_ACCESSORS(byte_length, Object) 6590 DECL_ACCESSORS(byte_length, Object)
6595 6591
6596 DECLARE_CAST(JSArrayBufferView) 6592 DECL_CAST(JSArrayBufferView)
6597 6593
6598 DECLARE_VERIFIER(JSArrayBufferView) 6594 DECL_VERIFIER(JSArrayBufferView)
6599 6595
6600 inline bool WasNeutered() const; 6596 inline bool WasNeutered() const;
6601 6597
6602 static const int kBufferOffset = JSObject::kHeaderSize; 6598 static const int kBufferOffset = JSObject::kHeaderSize;
6603 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; 6599 static const int kByteOffsetOffset = kBufferOffset + kPointerSize;
6604 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize; 6600 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize;
6605 static const int kViewSize = kByteLengthOffset + kPointerSize; 6601 static const int kViewSize = kByteLengthOffset + kPointerSize;
6606 6602
6607 private: 6603 private:
6608 #ifdef VERIFY_HEAP 6604 #ifdef VERIFY_HEAP
6609 DECL_ACCESSORS(raw_byte_offset, Object) 6605 DECL_ACCESSORS(raw_byte_offset, Object)
6610 DECL_ACCESSORS(raw_byte_length, Object) 6606 DECL_ACCESSORS(raw_byte_length, Object)
6611 #endif 6607 #endif
6612 6608
6613 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView); 6609 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView);
6614 }; 6610 };
6615 6611
6616 6612
6617 class JSTypedArray: public JSArrayBufferView { 6613 class JSTypedArray: public JSArrayBufferView {
6618 public: 6614 public:
6619 // [length]: length of typed array in elements. 6615 // [length]: length of typed array in elements.
6620 DECL_ACCESSORS(length, Object) 6616 DECL_ACCESSORS(length, Object)
6621 inline uint32_t length_value() const; 6617 inline uint32_t length_value() const;
6622 6618
6623 // ES6 9.4.5.3 6619 // ES6 9.4.5.3
6624 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty( 6620 MUST_USE_RESULT static Maybe<bool> DefineOwnProperty(
6625 Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key, 6621 Isolate* isolate, Handle<JSTypedArray> o, Handle<Object> key,
6626 PropertyDescriptor* desc, ShouldThrow should_throw); 6622 PropertyDescriptor* desc, ShouldThrow should_throw);
6627 6623
6628 DECLARE_CAST(JSTypedArray) 6624 DECL_CAST(JSTypedArray)
6629 6625
6630 ExternalArrayType type(); 6626 ExternalArrayType type();
6631 V8_EXPORT_PRIVATE size_t element_size(); 6627 V8_EXPORT_PRIVATE size_t element_size();
6632 6628
6633 Handle<JSArrayBuffer> GetBuffer(); 6629 Handle<JSArrayBuffer> GetBuffer();
6634 6630
6635 static inline MaybeHandle<JSTypedArray> Validate(Isolate* isolate, 6631 static inline MaybeHandle<JSTypedArray> Validate(Isolate* isolate,
6636 Handle<Object> receiver, 6632 Handle<Object> receiver,
6637 const char* method_name); 6633 const char* method_name);
6638 // ES7 section 22.2.4.6 Create ( constructor, argumentList ) 6634 // ES7 section 22.2.4.6 Create ( constructor, argumentList )
6639 static MaybeHandle<JSTypedArray> Create(Isolate* isolate, 6635 static MaybeHandle<JSTypedArray> Create(Isolate* isolate,
6640 Handle<Object> default_ctor, int argc, 6636 Handle<Object> default_ctor, int argc,
6641 Handle<Object>* argv, 6637 Handle<Object>* argv,
6642 const char* method_name); 6638 const char* method_name);
6643 // ES7 section 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList ) 6639 // ES7 section 22.2.4.7 TypedArraySpeciesCreate ( exemplar, argumentList )
6644 static MaybeHandle<JSTypedArray> SpeciesCreate(Isolate* isolate, 6640 static MaybeHandle<JSTypedArray> SpeciesCreate(Isolate* isolate,
6645 Handle<JSTypedArray> exemplar, 6641 Handle<JSTypedArray> exemplar,
6646 int argc, Handle<Object>* argv, 6642 int argc, Handle<Object>* argv,
6647 const char* method_name); 6643 const char* method_name);
6648 6644
6649 // Dispatched behavior. 6645 // Dispatched behavior.
6650 DECLARE_PRINTER(JSTypedArray) 6646 DECL_PRINTER(JSTypedArray)
6651 DECLARE_VERIFIER(JSTypedArray) 6647 DECL_VERIFIER(JSTypedArray)
6652 6648
6653 static const int kLengthOffset = kViewSize + kPointerSize; 6649 static const int kLengthOffset = kViewSize + kPointerSize;
6654 static const int kSize = kLengthOffset + kPointerSize; 6650 static const int kSize = kLengthOffset + kPointerSize;
6655 6651
6656 static const int kSizeWithEmbedderFields = 6652 static const int kSizeWithEmbedderFields =
6657 kSize + v8::ArrayBufferView::kEmbedderFieldCount * kPointerSize; 6653 kSize + v8::ArrayBufferView::kEmbedderFieldCount * kPointerSize;
6658 6654
6659 private: 6655 private:
6660 static Handle<JSArrayBuffer> MaterializeArrayBuffer( 6656 static Handle<JSArrayBuffer> MaterializeArrayBuffer(
6661 Handle<JSTypedArray> typed_array); 6657 Handle<JSTypedArray> typed_array);
6662 #ifdef VERIFY_HEAP 6658 #ifdef VERIFY_HEAP
6663 DECL_ACCESSORS(raw_length, Object) 6659 DECL_ACCESSORS(raw_length, Object)
6664 #endif 6660 #endif
6665 6661
6666 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); 6662 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray);
6667 }; 6663 };
6668 6664
6669 6665
6670 class JSDataView: public JSArrayBufferView { 6666 class JSDataView: public JSArrayBufferView {
6671 public: 6667 public:
6672 DECLARE_CAST(JSDataView) 6668 DECL_CAST(JSDataView)
6673 6669
6674 // Dispatched behavior. 6670 // Dispatched behavior.
6675 DECLARE_PRINTER(JSDataView) 6671 DECL_PRINTER(JSDataView)
6676 DECLARE_VERIFIER(JSDataView) 6672 DECL_VERIFIER(JSDataView)
6677 6673
6678 static const int kSize = kViewSize; 6674 static const int kSize = kViewSize;
6679 6675
6680 static const int kSizeWithEmbedderFields = 6676 static const int kSizeWithEmbedderFields =
6681 kSize + v8::ArrayBufferView::kEmbedderFieldCount * kPointerSize; 6677 kSize + v8::ArrayBufferView::kEmbedderFieldCount * kPointerSize;
6682 6678
6683 private: 6679 private:
6684 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView); 6680 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView);
6685 }; 6681 };
6686 6682
6687 6683
6688 // Foreign describes objects pointing from JavaScript to C structures. 6684 // Foreign describes objects pointing from JavaScript to C structures.
6689 class Foreign: public HeapObject { 6685 class Foreign: public HeapObject {
6690 public: 6686 public:
6691 // [address]: field containing the address. 6687 // [address]: field containing the address.
6692 inline Address foreign_address(); 6688 inline Address foreign_address();
6693 inline void set_foreign_address(Address value); 6689 inline void set_foreign_address(Address value);
6694 6690
6695 DECLARE_CAST(Foreign) 6691 DECL_CAST(Foreign)
6696 6692
6697 // Dispatched behavior. 6693 // Dispatched behavior.
6698 DECLARE_PRINTER(Foreign) 6694 DECL_PRINTER(Foreign)
6699 DECLARE_VERIFIER(Foreign) 6695 DECL_VERIFIER(Foreign)
6700 6696
6701 // Layout description. 6697 // Layout description.
6702 6698
6703 static const int kForeignAddressOffset = HeapObject::kHeaderSize; 6699 static const int kForeignAddressOffset = HeapObject::kHeaderSize;
6704 static const int kSize = kForeignAddressOffset + kPointerSize; 6700 static const int kSize = kForeignAddressOffset + kPointerSize;
6705 6701
6706 STATIC_ASSERT(kForeignAddressOffset == Internals::kForeignAddressOffset); 6702 STATIC_ASSERT(kForeignAddressOffset == Internals::kForeignAddressOffset);
6707 6703
6708 class BodyDescriptor; 6704 class BodyDescriptor;
6709 // No weak fields. 6705 // No weak fields.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
6762 Handle<JSArray> a, 6758 Handle<JSArray> a,
6763 PropertyDescriptor* desc, 6759 PropertyDescriptor* desc,
6764 ShouldThrow should_throw); 6760 ShouldThrow should_throw);
6765 6761
6766 // Checks whether the Array has the current realm's Array.prototype as its 6762 // Checks whether the Array has the current realm's Array.prototype as its
6767 // prototype. This function is best-effort and only gives a conservative 6763 // prototype. This function is best-effort and only gives a conservative
6768 // approximation, erring on the side of false, in particular with respect 6764 // approximation, erring on the side of false, in particular with respect
6769 // to Proxies and objects with a hidden prototype. 6765 // to Proxies and objects with a hidden prototype.
6770 inline bool HasArrayPrototype(Isolate* isolate); 6766 inline bool HasArrayPrototype(Isolate* isolate);
6771 6767
6772 DECLARE_CAST(JSArray) 6768 DECL_CAST(JSArray)
6773 6769
6774 // Dispatched behavior. 6770 // Dispatched behavior.
6775 DECLARE_PRINTER(JSArray) 6771 DECL_PRINTER(JSArray)
6776 DECLARE_VERIFIER(JSArray) 6772 DECL_VERIFIER(JSArray)
6777 6773
6778 // Number of element slots to pre-allocate for an empty array. 6774 // Number of element slots to pre-allocate for an empty array.
6779 static const int kPreallocatedArrayElements = 4; 6775 static const int kPreallocatedArrayElements = 4;
6780 6776
6781 // Layout description. 6777 // Layout description.
6782 static const int kLengthOffset = JSObject::kHeaderSize; 6778 static const int kLengthOffset = JSObject::kHeaderSize;
6783 static const int kSize = kLengthOffset + kPointerSize; 6779 static const int kSize = kLengthOffset + kPointerSize;
6784 6780
6785 // Max. number of elements being copied in Array builtins. 6781 // Max. number of elements being copied in Array builtins.
6786 static const int kMaxCopyElements = 100; 6782 static const int kMaxCopyElements = 100;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
6839 // This either points at the same as above, or a trampoline in case we are 6835 // This either points at the same as above, or a trampoline in case we are
6840 // running with the simulator. Use these entries from generated code. 6836 // running with the simulator. Use these entries from generated code.
6841 DECL_ACCESSORS(js_getter, Object) 6837 DECL_ACCESSORS(js_getter, Object)
6842 DECL_ACCESSORS(data, Object) 6838 DECL_ACCESSORS(data, Object)
6843 6839
6844 static Address redirect(Isolate* isolate, Address address, 6840 static Address redirect(Isolate* isolate, Address address,
6845 AccessorComponent component); 6841 AccessorComponent component);
6846 Address redirected_getter() const; 6842 Address redirected_getter() const;
6847 6843
6848 // Dispatched behavior. 6844 // Dispatched behavior.
6849 DECLARE_PRINTER(AccessorInfo) 6845 DECL_PRINTER(AccessorInfo)
6850 6846
6851 inline bool all_can_read(); 6847 inline bool all_can_read();
6852 inline void set_all_can_read(bool value); 6848 inline void set_all_can_read(bool value);
6853 6849
6854 inline bool all_can_write(); 6850 inline bool all_can_write();
6855 inline void set_all_can_write(bool value); 6851 inline void set_all_can_write(bool value);
6856 6852
6857 inline bool is_special_data_property(); 6853 inline bool is_special_data_property();
6858 inline void set_is_special_data_property(bool value); 6854 inline void set_is_special_data_property(bool value);
6859 6855
6860 inline bool replace_on_access(); 6856 inline bool replace_on_access();
6861 inline void set_replace_on_access(bool value); 6857 inline void set_replace_on_access(bool value);
6862 6858
6863 inline bool is_sloppy(); 6859 inline bool is_sloppy();
6864 inline void set_is_sloppy(bool value); 6860 inline void set_is_sloppy(bool value);
6865 6861
6866 inline PropertyAttributes property_attributes(); 6862 inline PropertyAttributes property_attributes();
6867 inline void set_property_attributes(PropertyAttributes attributes); 6863 inline void set_property_attributes(PropertyAttributes attributes);
6868 6864
6869 // Checks whether the given receiver is compatible with this accessor. 6865 // Checks whether the given receiver is compatible with this accessor.
6870 static bool IsCompatibleReceiverMap(Isolate* isolate, 6866 static bool IsCompatibleReceiverMap(Isolate* isolate,
6871 Handle<AccessorInfo> info, 6867 Handle<AccessorInfo> info,
6872 Handle<Map> map); 6868 Handle<Map> map);
6873 inline bool IsCompatibleReceiver(Object* receiver); 6869 inline bool IsCompatibleReceiver(Object* receiver);
6874 6870
6875 DECLARE_CAST(AccessorInfo) 6871 DECL_CAST(AccessorInfo)
6876 6872
6877 // Dispatched behavior. 6873 // Dispatched behavior.
6878 DECLARE_VERIFIER(AccessorInfo) 6874 DECL_VERIFIER(AccessorInfo)
6879 6875
6880 // Append all descriptors to the array that are not already there. 6876 // Append all descriptors to the array that are not already there.
6881 // Return number added. 6877 // Return number added.
6882 static int AppendUnique(Handle<Object> descriptors, 6878 static int AppendUnique(Handle<Object> descriptors,
6883 Handle<FixedArray> array, 6879 Handle<FixedArray> array,
6884 int valid_descriptors); 6880 int valid_descriptors);
6885 6881
6886 static const int kNameOffset = HeapObject::kHeaderSize; 6882 static const int kNameOffset = HeapObject::kHeaderSize;
6887 static const int kFlagOffset = kNameOffset + kPointerSize; 6883 static const int kFlagOffset = kNameOffset + kPointerSize;
6888 static const int kExpectedReceiverTypeOffset = kFlagOffset + kPointerSize; 6884 static const int kExpectedReceiverTypeOffset = kFlagOffset + kPointerSize;
(...skipping 23 matching lines...) Expand all
6912 // accessor can either be 6908 // accessor can either be
6913 // * a pointer to a JavaScript function or proxy: a real accessor 6909 // * a pointer to a JavaScript function or proxy: a real accessor
6914 // * undefined: considered an accessor by the spec, too, strangely enough 6910 // * undefined: considered an accessor by the spec, too, strangely enough
6915 // * the hole: an accessor which has not been set 6911 // * the hole: an accessor which has not been set
6916 // * a pointer to a map: a transition used to ensure map sharing 6912 // * a pointer to a map: a transition used to ensure map sharing
6917 class AccessorPair: public Struct { 6913 class AccessorPair: public Struct {
6918 public: 6914 public:
6919 DECL_ACCESSORS(getter, Object) 6915 DECL_ACCESSORS(getter, Object)
6920 DECL_ACCESSORS(setter, Object) 6916 DECL_ACCESSORS(setter, Object)
6921 6917
6922 DECLARE_CAST(AccessorPair) 6918 DECL_CAST(AccessorPair)
6923 6919
6924 static Handle<AccessorPair> Copy(Handle<AccessorPair> pair); 6920 static Handle<AccessorPair> Copy(Handle<AccessorPair> pair);
6925 6921
6926 inline Object* get(AccessorComponent component); 6922 inline Object* get(AccessorComponent component);
6927 inline void set(AccessorComponent component, Object* value); 6923 inline void set(AccessorComponent component, Object* value);
6928 6924
6929 // Note: Returns undefined instead in case of a hole. 6925 // Note: Returns undefined instead in case of a hole.
6930 static Handle<Object> GetComponent(Handle<AccessorPair> accessor_pair, 6926 static Handle<Object> GetComponent(Handle<AccessorPair> accessor_pair,
6931 AccessorComponent component); 6927 AccessorComponent component);
6932 6928
6933 // Set both components, skipping arguments which are a JavaScript null. 6929 // Set both components, skipping arguments which are a JavaScript null.
6934 inline void SetComponents(Object* getter, Object* setter); 6930 inline void SetComponents(Object* getter, Object* setter);
6935 6931
6936 inline bool Equals(AccessorPair* pair); 6932 inline bool Equals(AccessorPair* pair);
6937 inline bool Equals(Object* getter_value, Object* setter_value); 6933 inline bool Equals(Object* getter_value, Object* setter_value);
6938 6934
6939 inline bool ContainsAccessor(); 6935 inline bool ContainsAccessor();
6940 6936
6941 // Dispatched behavior. 6937 // Dispatched behavior.
6942 DECLARE_PRINTER(AccessorPair) 6938 DECL_PRINTER(AccessorPair)
6943 DECLARE_VERIFIER(AccessorPair) 6939 DECL_VERIFIER(AccessorPair)
6944 6940
6945 static const int kGetterOffset = HeapObject::kHeaderSize; 6941 static const int kGetterOffset = HeapObject::kHeaderSize;
6946 static const int kSetterOffset = kGetterOffset + kPointerSize; 6942 static const int kSetterOffset = kGetterOffset + kPointerSize;
6947 static const int kSize = kSetterOffset + kPointerSize; 6943 static const int kSize = kSetterOffset + kPointerSize;
6948 6944
6949 private: 6945 private:
6950 // Strangely enough, in addition to functions and harmony proxies, the spec 6946 // Strangely enough, in addition to functions and harmony proxies, the spec
6951 // requires us to consider undefined as a kind of accessor, too: 6947 // requires us to consider undefined as a kind of accessor, too:
6952 // var obj = {}; 6948 // var obj = {};
6953 // Object.defineProperty(obj, "foo", {get: undefined}); 6949 // Object.defineProperty(obj, "foo", {get: undefined});
6954 // assertTrue("foo" in obj); 6950 // assertTrue("foo" in obj);
6955 inline bool IsJSAccessor(Object* obj); 6951 inline bool IsJSAccessor(Object* obj);
6956 6952
6957 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorPair); 6953 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorPair);
6958 }; 6954 };
6959 6955
6960 6956
6961 class AccessCheckInfo: public Struct { 6957 class AccessCheckInfo: public Struct {
6962 public: 6958 public:
6963 DECL_ACCESSORS(callback, Object) 6959 DECL_ACCESSORS(callback, Object)
6964 DECL_ACCESSORS(named_interceptor, Object) 6960 DECL_ACCESSORS(named_interceptor, Object)
6965 DECL_ACCESSORS(indexed_interceptor, Object) 6961 DECL_ACCESSORS(indexed_interceptor, Object)
6966 DECL_ACCESSORS(data, Object) 6962 DECL_ACCESSORS(data, Object)
6967 6963
6968 DECLARE_CAST(AccessCheckInfo) 6964 DECL_CAST(AccessCheckInfo)
6969 6965
6970 // Dispatched behavior. 6966 // Dispatched behavior.
6971 DECLARE_PRINTER(AccessCheckInfo) 6967 DECL_PRINTER(AccessCheckInfo)
6972 DECLARE_VERIFIER(AccessCheckInfo) 6968 DECL_VERIFIER(AccessCheckInfo)
6973 6969
6974 static AccessCheckInfo* Get(Isolate* isolate, Handle<JSObject> receiver); 6970 static AccessCheckInfo* Get(Isolate* isolate, Handle<JSObject> receiver);
6975 6971
6976 static const int kCallbackOffset = HeapObject::kHeaderSize; 6972 static const int kCallbackOffset = HeapObject::kHeaderSize;
6977 static const int kNamedInterceptorOffset = kCallbackOffset + kPointerSize; 6973 static const int kNamedInterceptorOffset = kCallbackOffset + kPointerSize;
6978 static const int kIndexedInterceptorOffset = 6974 static const int kIndexedInterceptorOffset =
6979 kNamedInterceptorOffset + kPointerSize; 6975 kNamedInterceptorOffset + kPointerSize;
6980 static const int kDataOffset = kIndexedInterceptorOffset + kPointerSize; 6976 static const int kDataOffset = kIndexedInterceptorOffset + kPointerSize;
6981 static const int kSize = kDataOffset + kPointerSize; 6977 static const int kSize = kDataOffset + kPointerSize;
6982 6978
(...skipping 12 matching lines...) Expand all
6995 DECL_ACCESSORS(enumerator, Object) 6991 DECL_ACCESSORS(enumerator, Object)
6996 DECL_ACCESSORS(definer, Object) 6992 DECL_ACCESSORS(definer, Object)
6997 DECL_ACCESSORS(data, Object) 6993 DECL_ACCESSORS(data, Object)
6998 DECL_BOOLEAN_ACCESSORS(can_intercept_symbols) 6994 DECL_BOOLEAN_ACCESSORS(can_intercept_symbols)
6999 DECL_BOOLEAN_ACCESSORS(all_can_read) 6995 DECL_BOOLEAN_ACCESSORS(all_can_read)
7000 DECL_BOOLEAN_ACCESSORS(non_masking) 6996 DECL_BOOLEAN_ACCESSORS(non_masking)
7001 6997
7002 inline int flags() const; 6998 inline int flags() const;
7003 inline void set_flags(int flags); 6999 inline void set_flags(int flags);
7004 7000
7005 DECLARE_CAST(InterceptorInfo) 7001 DECL_CAST(InterceptorInfo)
7006 7002
7007 // Dispatched behavior. 7003 // Dispatched behavior.
7008 DECLARE_PRINTER(InterceptorInfo) 7004 DECL_PRINTER(InterceptorInfo)
7009 DECLARE_VERIFIER(InterceptorInfo) 7005 DECL_VERIFIER(InterceptorInfo)
7010 7006
7011 static const int kGetterOffset = HeapObject::kHeaderSize; 7007 static const int kGetterOffset = HeapObject::kHeaderSize;
7012 static const int kSetterOffset = kGetterOffset + kPointerSize; 7008 static const int kSetterOffset = kGetterOffset + kPointerSize;
7013 static const int kQueryOffset = kSetterOffset + kPointerSize; 7009 static const int kQueryOffset = kSetterOffset + kPointerSize;
7014 static const int kDescriptorOffset = kQueryOffset + kPointerSize; 7010 static const int kDescriptorOffset = kQueryOffset + kPointerSize;
7015 static const int kDeleterOffset = kDescriptorOffset + kPointerSize; 7011 static const int kDeleterOffset = kDescriptorOffset + kPointerSize;
7016 static const int kEnumeratorOffset = kDeleterOffset + kPointerSize; 7012 static const int kEnumeratorOffset = kDeleterOffset + kPointerSize;
7017 static const int kDefinerOffset = kEnumeratorOffset + kPointerSize; 7013 static const int kDefinerOffset = kEnumeratorOffset + kPointerSize;
7018 static const int kDataOffset = kDefinerOffset + kPointerSize; 7014 static const int kDataOffset = kDefinerOffset + kPointerSize;
7019 static const int kFlagsOffset = kDataOffset + kPointerSize; 7015 static const int kFlagsOffset = kDataOffset + kPointerSize;
7020 static const int kSize = kFlagsOffset + kPointerSize; 7016 static const int kSize = kFlagsOffset + kPointerSize;
7021 7017
7022 static const int kCanInterceptSymbolsBit = 0; 7018 static const int kCanInterceptSymbolsBit = 0;
7023 static const int kAllCanReadBit = 1; 7019 static const int kAllCanReadBit = 1;
7024 static const int kNonMasking = 2; 7020 static const int kNonMasking = 2;
7025 7021
7026 private: 7022 private:
7027 DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo); 7023 DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo);
7028 }; 7024 };
7029 7025
7030 class CallHandlerInfo : public Tuple2 { 7026 class CallHandlerInfo : public Tuple2 {
7031 public: 7027 public:
7032 DECL_ACCESSORS(callback, Object) 7028 DECL_ACCESSORS(callback, Object)
7033 DECL_ACCESSORS(data, Object) 7029 DECL_ACCESSORS(data, Object)
7034 7030
7035 DECLARE_CAST(CallHandlerInfo) 7031 DECL_CAST(CallHandlerInfo)
7036 7032
7037 static const int kCallbackOffset = kValue1Offset; 7033 static const int kCallbackOffset = kValue1Offset;
7038 static const int kDataOffset = kValue2Offset; 7034 static const int kDataOffset = kValue2Offset;
7039 7035
7040 private: 7036 private:
7041 DISALLOW_IMPLICIT_CONSTRUCTORS(CallHandlerInfo); 7037 DISALLOW_IMPLICIT_CONSTRUCTORS(CallHandlerInfo);
7042 }; 7038 };
7043 7039
7044 7040
7045 class TemplateInfo: public Struct { 7041 class TemplateInfo: public Struct {
7046 public: 7042 public:
7047 DECL_ACCESSORS(tag, Object) 7043 DECL_ACCESSORS(tag, Object)
7048 DECL_ACCESSORS(serial_number, Object) 7044 DECL_ACCESSORS(serial_number, Object)
7049 DECL_INT_ACCESSORS(number_of_properties) 7045 DECL_INT_ACCESSORS(number_of_properties)
7050 DECL_ACCESSORS(property_list, Object) 7046 DECL_ACCESSORS(property_list, Object)
7051 DECL_ACCESSORS(property_accessors, Object) 7047 DECL_ACCESSORS(property_accessors, Object)
7052 7048
7053 DECLARE_VERIFIER(TemplateInfo) 7049 DECL_VERIFIER(TemplateInfo)
7054 7050
7055 DECLARE_CAST(TemplateInfo) 7051 DECL_CAST(TemplateInfo)
7056 7052
7057 static const int kTagOffset = HeapObject::kHeaderSize; 7053 static const int kTagOffset = HeapObject::kHeaderSize;
7058 static const int kSerialNumberOffset = kTagOffset + kPointerSize; 7054 static const int kSerialNumberOffset = kTagOffset + kPointerSize;
7059 static const int kNumberOfProperties = kSerialNumberOffset + kPointerSize; 7055 static const int kNumberOfProperties = kSerialNumberOffset + kPointerSize;
7060 static const int kPropertyListOffset = kNumberOfProperties + kPointerSize; 7056 static const int kPropertyListOffset = kNumberOfProperties + kPointerSize;
7061 static const int kPropertyAccessorsOffset = 7057 static const int kPropertyAccessorsOffset =
7062 kPropertyListOffset + kPointerSize; 7058 kPropertyListOffset + kPointerSize;
7063 static const int kHeaderSize = kPropertyAccessorsOffset + kPointerSize; 7059 static const int kHeaderSize = kPropertyAccessorsOffset + kPointerSize;
7064 7060
7065 static const int kFastTemplateInstantiationsCacheSize = 1 * KB; 7061 static const int kFastTemplateInstantiationsCacheSize = 1 * KB;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
7100 // If the bit is set, object instances created by this function 7096 // If the bit is set, object instances created by this function
7101 // requires access check. 7097 // requires access check.
7102 DECL_BOOLEAN_ACCESSORS(needs_access_check) 7098 DECL_BOOLEAN_ACCESSORS(needs_access_check)
7103 DECL_BOOLEAN_ACCESSORS(read_only_prototype) 7099 DECL_BOOLEAN_ACCESSORS(read_only_prototype)
7104 DECL_BOOLEAN_ACCESSORS(remove_prototype) 7100 DECL_BOOLEAN_ACCESSORS(remove_prototype)
7105 DECL_BOOLEAN_ACCESSORS(do_not_cache) 7101 DECL_BOOLEAN_ACCESSORS(do_not_cache)
7106 DECL_BOOLEAN_ACCESSORS(accept_any_receiver) 7102 DECL_BOOLEAN_ACCESSORS(accept_any_receiver)
7107 7103
7108 DECL_ACCESSORS(cached_property_name, Object) 7104 DECL_ACCESSORS(cached_property_name, Object)
7109 7105
7110 DECLARE_CAST(FunctionTemplateInfo) 7106 DECL_CAST(FunctionTemplateInfo)
7111 7107
7112 // Dispatched behavior. 7108 // Dispatched behavior.
7113 DECLARE_PRINTER(FunctionTemplateInfo) 7109 DECL_PRINTER(FunctionTemplateInfo)
7114 DECLARE_VERIFIER(FunctionTemplateInfo) 7110 DECL_VERIFIER(FunctionTemplateInfo)
7115 7111
7116 static const int kInvalidSerialNumber = 0; 7112 static const int kInvalidSerialNumber = 0;
7117 7113
7118 static const int kCallCodeOffset = TemplateInfo::kHeaderSize; 7114 static const int kCallCodeOffset = TemplateInfo::kHeaderSize;
7119 static const int kPrototypeTemplateOffset = 7115 static const int kPrototypeTemplateOffset =
7120 kCallCodeOffset + kPointerSize; 7116 kCallCodeOffset + kPointerSize;
7121 static const int kPrototypeProviderTemplateOffset = 7117 static const int kPrototypeProviderTemplateOffset =
7122 kPrototypeTemplateOffset + kPointerSize; 7118 kPrototypeTemplateOffset + kPointerSize;
7123 static const int kParentTemplateOffset = 7119 static const int kParentTemplateOffset =
7124 kPrototypeProviderTemplateOffset + kPointerSize; 7120 kPrototypeProviderTemplateOffset + kPointerSize;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
7167 }; 7163 };
7168 7164
7169 7165
7170 class ObjectTemplateInfo: public TemplateInfo { 7166 class ObjectTemplateInfo: public TemplateInfo {
7171 public: 7167 public:
7172 DECL_ACCESSORS(constructor, Object) 7168 DECL_ACCESSORS(constructor, Object)
7173 DECL_ACCESSORS(data, Object) 7169 DECL_ACCESSORS(data, Object)
7174 DECL_INT_ACCESSORS(embedder_field_count) 7170 DECL_INT_ACCESSORS(embedder_field_count)
7175 DECL_BOOLEAN_ACCESSORS(immutable_proto) 7171 DECL_BOOLEAN_ACCESSORS(immutable_proto)
7176 7172
7177 DECLARE_CAST(ObjectTemplateInfo) 7173 DECL_CAST(ObjectTemplateInfo)
7178 7174
7179 // Dispatched behavior. 7175 // Dispatched behavior.
7180 DECLARE_PRINTER(ObjectTemplateInfo) 7176 DECL_PRINTER(ObjectTemplateInfo)
7181 DECLARE_VERIFIER(ObjectTemplateInfo) 7177 DECL_VERIFIER(ObjectTemplateInfo)
7182 7178
7183 static const int kConstructorOffset = TemplateInfo::kHeaderSize; 7179 static const int kConstructorOffset = TemplateInfo::kHeaderSize;
7184 // LSB is for immutable_proto, higher bits for embedder_field_count 7180 // LSB is for immutable_proto, higher bits for embedder_field_count
7185 static const int kDataOffset = kConstructorOffset + kPointerSize; 7181 static const int kDataOffset = kConstructorOffset + kPointerSize;
7186 static const int kSize = kDataOffset + kPointerSize; 7182 static const int kSize = kDataOffset + kPointerSize;
7187 7183
7188 // Starting from given object template's constructor walk up the inheritance 7184 // Starting from given object template's constructor walk up the inheritance
7189 // chain till a function template that has an instance template is found. 7185 // chain till a function template that has an instance template is found.
7190 inline ObjectTemplateInfo* GetParent(Isolate* isolate); 7186 inline ObjectTemplateInfo* GetParent(Isolate* isolate);
7191 7187
(...skipping 10 matching lines...) Expand all
7202 DECL_INT_ACCESSORS(script_id) 7198 DECL_INT_ACCESSORS(script_id)
7203 DECL_ACCESSORS(script_name, Object) 7199 DECL_ACCESSORS(script_name, Object)
7204 DECL_ACCESSORS(script_name_or_source_url, Object) 7200 DECL_ACCESSORS(script_name_or_source_url, Object)
7205 DECL_ACCESSORS(function_name, Object) 7201 DECL_ACCESSORS(function_name, Object)
7206 DECL_BOOLEAN_ACCESSORS(is_eval) 7202 DECL_BOOLEAN_ACCESSORS(is_eval)
7207 DECL_BOOLEAN_ACCESSORS(is_constructor) 7203 DECL_BOOLEAN_ACCESSORS(is_constructor)
7208 DECL_BOOLEAN_ACCESSORS(is_wasm) 7204 DECL_BOOLEAN_ACCESSORS(is_wasm)
7209 DECL_INT_ACCESSORS(flag) 7205 DECL_INT_ACCESSORS(flag)
7210 DECL_INT_ACCESSORS(id) 7206 DECL_INT_ACCESSORS(id)
7211 7207
7212 DECLARE_CAST(StackFrameInfo) 7208 DECL_CAST(StackFrameInfo)
7213 7209
7214 // Dispatched behavior. 7210 // Dispatched behavior.
7215 DECLARE_PRINTER(StackFrameInfo) 7211 DECL_PRINTER(StackFrameInfo)
7216 DECLARE_VERIFIER(StackFrameInfo) 7212 DECL_VERIFIER(StackFrameInfo)
7217 7213
7218 static const int kLineNumberIndex = Struct::kHeaderSize; 7214 static const int kLineNumberIndex = Struct::kHeaderSize;
7219 static const int kColumnNumberIndex = kLineNumberIndex + kPointerSize; 7215 static const int kColumnNumberIndex = kLineNumberIndex + kPointerSize;
7220 static const int kScriptIdIndex = kColumnNumberIndex + kPointerSize; 7216 static const int kScriptIdIndex = kColumnNumberIndex + kPointerSize;
7221 static const int kScriptNameIndex = kScriptIdIndex + kPointerSize; 7217 static const int kScriptNameIndex = kScriptIdIndex + kPointerSize;
7222 static const int kScriptNameOrSourceUrlIndex = 7218 static const int kScriptNameOrSourceUrlIndex =
7223 kScriptNameIndex + kPointerSize; 7219 kScriptNameIndex + kPointerSize;
7224 static const int kFunctionNameIndex = 7220 static const int kFunctionNameIndex =
7225 kScriptNameOrSourceUrlIndex + kPointerSize; 7221 kScriptNameOrSourceUrlIndex + kPointerSize;
7226 static const int kFlagIndex = kFunctionNameIndex + kPointerSize; 7222 static const int kFlagIndex = kFunctionNameIndex + kPointerSize;
7227 static const int kIdIndex = kFlagIndex + kPointerSize; 7223 static const int kIdIndex = kFlagIndex + kPointerSize;
7228 static const int kSize = kIdIndex + kPointerSize; 7224 static const int kSize = kIdIndex + kPointerSize;
7229 7225
7230 private: 7226 private:
7231 // Bit position in the flag, from least significant bit position. 7227 // Bit position in the flag, from least significant bit position.
7232 static const int kIsEvalBit = 0; 7228 static const int kIsEvalBit = 0;
7233 static const int kIsConstructorBit = 1; 7229 static const int kIsConstructorBit = 1;
7234 static const int kIsWasmBit = 2; 7230 static const int kIsWasmBit = 2;
7235 7231
7236 DISALLOW_IMPLICIT_CONSTRUCTORS(StackFrameInfo); 7232 DISALLOW_IMPLICIT_CONSTRUCTORS(StackFrameInfo);
7237 }; 7233 };
7238 7234
7239 class SourcePositionTableWithFrameCache : public Tuple2 { 7235 class SourcePositionTableWithFrameCache : public Tuple2 {
7240 public: 7236 public:
7241 DECL_ACCESSORS(source_position_table, ByteArray) 7237 DECL_ACCESSORS(source_position_table, ByteArray)
7242 DECL_ACCESSORS(stack_frame_cache, UnseededNumberDictionary) 7238 DECL_ACCESSORS(stack_frame_cache, UnseededNumberDictionary)
7243 7239
7244 DECLARE_CAST(SourcePositionTableWithFrameCache) 7240 DECL_CAST(SourcePositionTableWithFrameCache)
7245 7241
7246 static const int kSourcePositionTableIndex = Struct::kHeaderSize; 7242 static const int kSourcePositionTableIndex = Struct::kHeaderSize;
7247 static const int kStackFrameCacheIndex = 7243 static const int kStackFrameCacheIndex =
7248 kSourcePositionTableIndex + kPointerSize; 7244 kSourcePositionTableIndex + kPointerSize;
7249 static const int kSize = kStackFrameCacheIndex + kPointerSize; 7245 static const int kSize = kStackFrameCacheIndex + kPointerSize;
7250 7246
7251 private: 7247 private:
7252 DISALLOW_IMPLICIT_CONSTRUCTORS(SourcePositionTableWithFrameCache); 7248 DISALLOW_IMPLICIT_CONSTRUCTORS(SourcePositionTableWithFrameCache);
7253 }; 7249 };
7254 7250
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
7327 } 7323 }
7328 }; 7324 };
7329 7325
7330 7326
7331 } // NOLINT, false-positive due to second-order macros. 7327 } // NOLINT, false-positive due to second-order macros.
7332 } // NOLINT, false-positive due to second-order macros. 7328 } // NOLINT, false-positive due to second-order macros.
7333 7329
7334 #include "src/objects/object-macros-undef.h" 7330 #include "src/objects/object-macros-undef.h"
7335 7331
7336 #endif // V8_OBJECTS_H_ 7332 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/feedback-vector.h ('k') | src/objects/arguments.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698