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

Side by Side Diff: src/objects.h

Issue 23143007: Revert "Use V8_FINAL and V8_OVERRIDE in various places, fixing bugs revealed by them." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/mips/lithium-mips.h ('k') | src/objects.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // - JSDate 79 // - JSDate
80 // - JSMessageObject 80 // - JSMessageObject
81 // - JSProxy 81 // - JSProxy
82 // - JSFunctionProxy 82 // - JSFunctionProxy
83 // - FixedArrayBase 83 // - FixedArrayBase
84 // - ByteArray 84 // - ByteArray
85 // - FixedArray 85 // - FixedArray
86 // - DescriptorArray 86 // - DescriptorArray
87 // - HashTable 87 // - HashTable
88 // - Dictionary 88 // - Dictionary
89 // - NameDictionary
90 // - SeededNumberDictionary
91 // - UnseededNumberDictionary
92 // - ObjectHashSet
93 // - ObjectHashTable
94 // - StringTable 89 // - StringTable
95 // - CompilationCacheTable 90 // - CompilationCacheTable
96 // - CodeCacheHashTable 91 // - CodeCacheHashTable
97 // - MapCache 92 // - MapCache
98 // - Context 93 // - Context
99 // - JSFunctionResultCache 94 // - JSFunctionResultCache
100 // - ScopeInfo 95 // - ScopeInfo
101 // - TransitionArray 96 // - TransitionArray
102 // - FixedDoubleArray 97 // - FixedDoubleArray
103 // - ExternalArray 98 // - ExternalArray
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 DISALLOW_IMPLICIT_CONSTRUCTORS(Object); 1529 DISALLOW_IMPLICIT_CONSTRUCTORS(Object);
1535 }; 1530 };
1536 1531
1537 1532
1538 // Smi represents integer Numbers that can be stored in 31 bits. 1533 // Smi represents integer Numbers that can be stored in 31 bits.
1539 // Smis are immediate which means they are NOT allocated in the heap. 1534 // Smis are immediate which means they are NOT allocated in the heap.
1540 // The this pointer has the following format: [31 bit signed int] 0 1535 // The this pointer has the following format: [31 bit signed int] 0
1541 // For long smis it has the following format: 1536 // For long smis it has the following format:
1542 // [32 bit signed int] [31 bits zero padding] 0 1537 // [32 bit signed int] [31 bits zero padding] 0
1543 // Smi stands for small integer. 1538 // Smi stands for small integer.
1544 class Smi V8_FINAL : public Object { 1539 class Smi: public Object {
1545 public: 1540 public:
1546 // Returns the integer value. 1541 // Returns the integer value.
1547 inline int value(); 1542 inline int value();
1548 1543
1549 // Convert a value to a Smi object. 1544 // Convert a value to a Smi object.
1550 static inline Smi* FromInt(int value); 1545 static inline Smi* FromInt(int value);
1551 1546
1552 static inline Smi* FromIntptr(intptr_t value); 1547 static inline Smi* FromIntptr(intptr_t value);
1553 1548
1554 // Returns whether value can be represented in a Smi. 1549 // Returns whether value can be represented in a Smi.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 // 1590 //
1596 // The next three bits, 4-6, are an allocation space tag 'sss'. The 1591 // The next three bits, 4-6, are an allocation space tag 'sss'. The
1597 // allocation space tag is 000 for all failure types except 1592 // allocation space tag is 000 for all failure types except
1598 // RETRY_AFTER_GC. For RETRY_AFTER_GC, the possible values are the 1593 // RETRY_AFTER_GC. For RETRY_AFTER_GC, the possible values are the
1599 // allocation spaces (the encoding is found in globals.h). 1594 // allocation spaces (the encoding is found in globals.h).
1600 1595
1601 // Failure type tag info. 1596 // Failure type tag info.
1602 const int kFailureTypeTagSize = 2; 1597 const int kFailureTypeTagSize = 2;
1603 const int kFailureTypeTagMask = (1 << kFailureTypeTagSize) - 1; 1598 const int kFailureTypeTagMask = (1 << kFailureTypeTagSize) - 1;
1604 1599
1605 class Failure V8_FINAL : public MaybeObject { 1600 class Failure: public MaybeObject {
1606 public: 1601 public:
1607 // RuntimeStubs assumes EXCEPTION = 1 in the compiler-generated code. 1602 // RuntimeStubs assumes EXCEPTION = 1 in the compiler-generated code.
1608 enum Type { 1603 enum Type {
1609 RETRY_AFTER_GC = 0, 1604 RETRY_AFTER_GC = 0,
1610 EXCEPTION = 1, // Returning this marker tells the real exception 1605 EXCEPTION = 1, // Returning this marker tells the real exception
1611 // is in Isolate::pending_exception. 1606 // is in Isolate::pending_exception.
1612 INTERNAL_ERROR = 2, 1607 INTERNAL_ERROR = 2,
1613 OUT_OF_MEMORY_EXCEPTION = 3 1608 OUT_OF_MEMORY_EXCEPTION = 3
1614 }; 1609 };
1615 1610
(...skipping 29 matching lines...) Expand all
1645 static inline Failure* Construct(Type type, intptr_t value = 0); 1640 static inline Failure* Construct(Type type, intptr_t value = 0);
1646 1641
1647 DISALLOW_IMPLICIT_CONSTRUCTORS(Failure); 1642 DISALLOW_IMPLICIT_CONSTRUCTORS(Failure);
1648 }; 1643 };
1649 1644
1650 1645
1651 // Heap objects typically have a map pointer in their first word. However, 1646 // Heap objects typically have a map pointer in their first word. However,
1652 // during GC other data (e.g. mark bits, forwarding addresses) is sometimes 1647 // during GC other data (e.g. mark bits, forwarding addresses) is sometimes
1653 // encoded in the first word. The class MapWord is an abstraction of the 1648 // encoded in the first word. The class MapWord is an abstraction of the
1654 // value in a heap object's first word. 1649 // value in a heap object's first word.
1655 class MapWord V8_FINAL BASE_EMBEDDED { 1650 class MapWord BASE_EMBEDDED {
1656 public: 1651 public:
1657 // Normal state: the map word contains a map pointer. 1652 // Normal state: the map word contains a map pointer.
1658 1653
1659 // Create a map word from a map pointer. 1654 // Create a map word from a map pointer.
1660 static inline MapWord FromMap(Map* map); 1655 static inline MapWord FromMap(Map* map);
1661 1656
1662 // View this map word as a map pointer. 1657 // View this map word as a map pointer.
1663 inline Map* ToMap(); 1658 inline Map* ToMap();
1664 1659
1665 1660
(...skipping 24 matching lines...) Expand all
1690 friend class HeapObject; 1685 friend class HeapObject;
1691 1686
1692 explicit MapWord(uintptr_t value) : value_(value) {} 1687 explicit MapWord(uintptr_t value) : value_(value) {}
1693 1688
1694 uintptr_t value_; 1689 uintptr_t value_;
1695 }; 1690 };
1696 1691
1697 1692
1698 // HeapObject is the superclass for all classes describing heap allocated 1693 // HeapObject is the superclass for all classes describing heap allocated
1699 // objects. 1694 // objects.
1700 class HeapObject : public Object { 1695 class HeapObject: public Object {
1701 public: 1696 public:
1702 // [map]: Contains a map which contains the object's reflective 1697 // [map]: Contains a map which contains the object's reflective
1703 // information. 1698 // information.
1704 inline Map* map(); 1699 inline Map* map();
1705 inline void set_map(Map* value); 1700 inline void set_map(Map* value);
1706 // The no-write-barrier version. This is OK if the object is white and in 1701 // The no-write-barrier version. This is OK if the object is white and in
1707 // new space, or if the value is an immortal immutable object, like the maps 1702 // new space, or if the value is an immortal immutable object, like the maps
1708 // of primitive (non-JS) objects like strings, heap numbers etc. 1703 // of primitive (non-JS) objects like strings, heap numbers etc.
1709 inline void set_map_no_write_barrier(Map* value); 1704 inline void set_map_no_write_barrier(Map* value);
1710 1705
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 template<typename StaticVisitor> 1829 template<typename StaticVisitor>
1835 static inline void IterateBody(HeapObject* obj, int object_size) { 1830 static inline void IterateBody(HeapObject* obj, int object_size) {
1836 StaticVisitor::VisitPointers(HeapObject::RawField(obj, start_offset), 1831 StaticVisitor::VisitPointers(HeapObject::RawField(obj, start_offset),
1837 HeapObject::RawField(obj, object_size)); 1832 HeapObject::RawField(obj, object_size));
1838 } 1833 }
1839 }; 1834 };
1840 1835
1841 1836
1842 // The HeapNumber class describes heap allocated numbers that cannot be 1837 // The HeapNumber class describes heap allocated numbers that cannot be
1843 // represented in a Smi (small integer) 1838 // represented in a Smi (small integer)
1844 class HeapNumber V8_FINAL : public HeapObject { 1839 class HeapNumber: public HeapObject {
1845 public: 1840 public:
1846 // [value]: number value. 1841 // [value]: number value.
1847 inline double value(); 1842 inline double value();
1848 inline void set_value(double value); 1843 inline void set_value(double value);
1849 1844
1850 // Casting. 1845 // Casting.
1851 static inline HeapNumber* cast(Object* obj); 1846 static inline HeapNumber* cast(Object* obj);
1852 1847
1853 // Dispatched behavior. 1848 // Dispatched behavior.
1854 bool HeapNumberBooleanValue(); 1849 bool HeapNumberBooleanValue();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 1904
1910 // Indicator for one component of an AccessorPair. 1905 // Indicator for one component of an AccessorPair.
1911 enum AccessorComponent { 1906 enum AccessorComponent {
1912 ACCESSOR_GETTER, 1907 ACCESSOR_GETTER,
1913 ACCESSOR_SETTER 1908 ACCESSOR_SETTER
1914 }; 1909 };
1915 1910
1916 1911
1917 // JSReceiver includes types on which properties can be defined, i.e., 1912 // JSReceiver includes types on which properties can be defined, i.e.,
1918 // JSObject and JSProxy. 1913 // JSObject and JSProxy.
1919 class JSReceiver : public HeapObject { 1914 class JSReceiver: public HeapObject {
1920 public: 1915 public:
1921 enum DeleteMode { 1916 enum DeleteMode {
1922 NORMAL_DELETION, 1917 NORMAL_DELETION,
1923 STRICT_DELETION, 1918 STRICT_DELETION,
1924 FORCE_DELETION 1919 FORCE_DELETION
1925 }; 1920 };
1926 1921
1927 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas 1922 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas
1928 // a keyed store is of the form a[expression] = foo. 1923 // a keyed store is of the form a[expression] = foo.
1929 enum StoreFromKeyed { 1924 enum StoreFromKeyed {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 Name* name, 2037 Name* name,
2043 bool continue_search); 2038 bool continue_search);
2044 2039
2045 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); 2040 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver);
2046 }; 2041 };
2047 2042
2048 // The JSObject describes real heap allocated JavaScript objects with 2043 // The JSObject describes real heap allocated JavaScript objects with
2049 // properties. 2044 // properties.
2050 // Note that the map of JSObject changes during execution to enable inline 2045 // Note that the map of JSObject changes during execution to enable inline
2051 // caching. 2046 // caching.
2052 class JSObject : public JSReceiver { 2047 class JSObject: public JSReceiver {
2053 public: 2048 public:
2054 // [properties]: Backing storage for properties. 2049 // [properties]: Backing storage for properties.
2055 // properties is a FixedArray in the fast case and a Dictionary in the 2050 // properties is a FixedArray in the fast case and a Dictionary in the
2056 // slow case. 2051 // slow case.
2057 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. 2052 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties.
2058 inline void initialize_properties(); 2053 inline void initialize_properties();
2059 inline bool HasFastProperties(); 2054 inline bool HasFastProperties();
2060 inline NameDictionary* property_dictionary(); // Gets slow properties. 2055 inline NameDictionary* property_dictionary(); // Gets slow properties.
2061 2056
2062 // [elements]: The elements (properties with names that are integers). 2057 // [elements]: The elements (properties with names that are integers).
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 #endif 2669 #endif
2675 2670
2676 void PrintElementsTransition( 2671 void PrintElementsTransition(
2677 FILE* file, ElementsKind from_kind, FixedArrayBase* from_elements, 2672 FILE* file, ElementsKind from_kind, FixedArrayBase* from_elements,
2678 ElementsKind to_kind, FixedArrayBase* to_elements); 2673 ElementsKind to_kind, FixedArrayBase* to_elements);
2679 2674
2680 void PrintInstanceMigration(FILE* file, Map* original_map, Map* new_map); 2675 void PrintInstanceMigration(FILE* file, Map* original_map, Map* new_map);
2681 2676
2682 #ifdef DEBUG 2677 #ifdef DEBUG
2683 // Structure for collecting spill information about JSObjects. 2678 // Structure for collecting spill information about JSObjects.
2684 class SpillInformation V8_FINAL { 2679 class SpillInformation {
2685 public: 2680 public:
2686 void Clear(); 2681 void Clear();
2687 void Print(); 2682 void Print();
2688 int number_of_objects_; 2683 int number_of_objects_;
2689 int number_of_objects_with_fast_properties_; 2684 int number_of_objects_with_fast_properties_;
2690 int number_of_objects_with_fast_elements_; 2685 int number_of_objects_with_fast_elements_;
2691 int number_of_fast_used_fields_; 2686 int number_of_fast_used_fields_;
2692 int number_of_fast_unused_fields_; 2687 int number_of_fast_unused_fields_;
2693 int number_of_slow_used_properties_; 2688 int number_of_slow_used_properties_;
2694 int number_of_slow_unused_properties_; 2689 int number_of_slow_unused_properties_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 // to the same object requires fewer allocations and copies. 2730 // to the same object requires fewer allocations and copies.
2736 static const int kFieldsAdded = 3; 2731 static const int kFieldsAdded = 3;
2737 2732
2738 // Layout description. 2733 // Layout description.
2739 static const int kPropertiesOffset = HeapObject::kHeaderSize; 2734 static const int kPropertiesOffset = HeapObject::kHeaderSize;
2740 static const int kElementsOffset = kPropertiesOffset + kPointerSize; 2735 static const int kElementsOffset = kPropertiesOffset + kPointerSize;
2741 static const int kHeaderSize = kElementsOffset + kPointerSize; 2736 static const int kHeaderSize = kElementsOffset + kPointerSize;
2742 2737
2743 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize); 2738 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize);
2744 2739
2745 class BodyDescriptor V8_FINAL 2740 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> {
2746 : public FlexibleBodyDescriptor<kPropertiesOffset> {
2747 public: 2741 public:
2748 static inline int SizeOf(Map* map, HeapObject* object); 2742 static inline int SizeOf(Map* map, HeapObject* object);
2749 }; 2743 };
2750 2744
2751 // Enqueue change record for Object.observe. May cause GC. 2745 // Enqueue change record for Object.observe. May cause GC.
2752 static void EnqueueChangeRecord(Handle<JSObject> object, 2746 static void EnqueueChangeRecord(Handle<JSObject> object,
2753 const char* type, 2747 const char* type,
2754 Handle<Name> name, 2748 Handle<Name> name,
2755 Handle<Object> old_value); 2749 Handle<Object> old_value);
2756 2750
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2880 // the inline-stored identity hash. 2874 // the inline-stored identity hash.
2881 MUST_USE_RESULT MaybeObject* SetHiddenPropertiesHashTable( 2875 MUST_USE_RESULT MaybeObject* SetHiddenPropertiesHashTable(
2882 Object* value); 2876 Object* value);
2883 2877
2884 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); 2878 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject);
2885 }; 2879 };
2886 2880
2887 2881
2888 // Common superclass for FixedArrays that allow implementations to share 2882 // Common superclass for FixedArrays that allow implementations to share
2889 // common accessors and some code paths. 2883 // common accessors and some code paths.
2890 class FixedArrayBase : public HeapObject { 2884 class FixedArrayBase: public HeapObject {
2891 public: 2885 public:
2892 // [length]: length of the array. 2886 // [length]: length of the array.
2893 inline int length(); 2887 inline int length();
2894 inline void set_length(int value); 2888 inline void set_length(int value);
2895 2889
2896 inline static FixedArrayBase* cast(Object* object); 2890 inline static FixedArrayBase* cast(Object* object);
2897 2891
2898 // Layout description. 2892 // Layout description.
2899 // Length is smi tagged when it is stored. 2893 // Length is smi tagged when it is stored.
2900 static const int kLengthOffset = HeapObject::kHeaderSize; 2894 static const int kLengthOffset = HeapObject::kHeaderSize;
2901 static const int kHeaderSize = kLengthOffset + kPointerSize; 2895 static const int kHeaderSize = kLengthOffset + kPointerSize;
2902 }; 2896 };
2903 2897
2904 2898
2905 class FixedDoubleArray; 2899 class FixedDoubleArray;
2906 class IncrementalMarking; 2900 class IncrementalMarking;
2907 2901
2908 2902
2909 // FixedArray describes fixed-sized arrays with element type Object*. 2903 // FixedArray describes fixed-sized arrays with element type Object*.
2910 class FixedArray : public FixedArrayBase { 2904 class FixedArray: public FixedArrayBase {
2911 public: 2905 public:
2912 // Setter and getter for elements. 2906 // Setter and getter for elements.
2913 inline Object* get(int index); 2907 inline Object* get(int index);
2914 // Setter that uses write barrier. 2908 // Setter that uses write barrier.
2915 inline void set(int index, Object* value); 2909 inline void set(int index, Object* value);
2916 inline bool is_the_hole(int index); 2910 inline bool is_the_hole(int index);
2917 2911
2918 // Setter that doesn't need write barrier. 2912 // Setter that doesn't need write barrier.
2919 inline void set(int index, Smi* value); 2913 inline void set(int index, Smi* value);
2920 // Setter with explicit barrier mode. 2914 // Setter with explicit barrier mode.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2975 // Swap two elements in a pair of arrays. If this array and the 2969 // Swap two elements in a pair of arrays. If this array and the
2976 // numbers array are the same object, the elements are only swapped 2970 // numbers array are the same object, the elements are only swapped
2977 // once. 2971 // once.
2978 void SwapPairs(FixedArray* numbers, int i, int j); 2972 void SwapPairs(FixedArray* numbers, int i, int j);
2979 2973
2980 // Sort prefix of this array and the numbers array as pairs wrt. the 2974 // Sort prefix of this array and the numbers array as pairs wrt. the
2981 // numbers. If the numbers array and the this array are the same 2975 // numbers. If the numbers array and the this array are the same
2982 // object, the prefix of this array is sorted. 2976 // object, the prefix of this array is sorted.
2983 void SortPairs(FixedArray* numbers, uint32_t len); 2977 void SortPairs(FixedArray* numbers, uint32_t len);
2984 2978
2985 class BodyDescriptor V8_FINAL : public FlexibleBodyDescriptor<kHeaderSize> { 2979 class BodyDescriptor : public FlexibleBodyDescriptor<kHeaderSize> {
2986 public: 2980 public:
2987 static inline int SizeOf(Map* map, HeapObject* object) { 2981 static inline int SizeOf(Map* map, HeapObject* object) {
2988 return SizeFor(reinterpret_cast<FixedArray*>(object)->length()); 2982 return SizeFor(reinterpret_cast<FixedArray*>(object)->length());
2989 } 2983 }
2990 }; 2984 };
2991 2985
2992 protected: 2986 protected:
2993 // Set operation on FixedArray without using write barriers. Can 2987 // Set operation on FixedArray without using write barriers. Can
2994 // only be used for storing old space objects or smis. 2988 // only be used for storing old space objects or smis.
2995 static inline void NoWriteBarrierSet(FixedArray* array, 2989 static inline void NoWriteBarrierSet(FixedArray* array,
2996 int index, 2990 int index,
2997 Object* value); 2991 Object* value);
2998 2992
2999 // Set operation on FixedArray without incremental write barrier. Can 2993 // Set operation on FixedArray without incremental write barrier. Can
3000 // only be used if the object is guaranteed to be white (whiteness witness 2994 // only be used if the object is guaranteed to be white (whiteness witness
3001 // is present). 2995 // is present).
3002 static inline void NoIncrementalWriteBarrierSet(FixedArray* array, 2996 static inline void NoIncrementalWriteBarrierSet(FixedArray* array,
3003 int index, 2997 int index,
3004 Object* value); 2998 Object* value);
3005 2999
3006 private: 3000 private:
3007 STATIC_CHECK(kHeaderSize == Internals::kFixedArrayHeaderSize); 3001 STATIC_CHECK(kHeaderSize == Internals::kFixedArrayHeaderSize);
3008 3002
3009 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); 3003 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray);
3010 }; 3004 };
3011 3005
3012 3006
3013 // FixedDoubleArray describes fixed-sized arrays with element type double. 3007 // FixedDoubleArray describes fixed-sized arrays with element type double.
3014 class FixedDoubleArray V8_FINAL : public FixedArrayBase { 3008 class FixedDoubleArray: public FixedArrayBase {
3015 public: 3009 public:
3016 // Setter and getter for elements. 3010 // Setter and getter for elements.
3017 inline double get_scalar(int index); 3011 inline double get_scalar(int index);
3018 inline int64_t get_representation(int index); 3012 inline int64_t get_representation(int index);
3019 MUST_USE_RESULT inline MaybeObject* get(int index); 3013 MUST_USE_RESULT inline MaybeObject* get(int index);
3020 inline void set(int index, double value); 3014 inline void set(int index, double value);
3021 inline void set_the_hole(int index); 3015 inline void set_the_hole(int index);
3022 3016
3023 // Checking for the hole. 3017 // Checking for the hole.
3024 inline bool is_the_hole(int index); 3018 inline bool is_the_hole(int index);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 3055
3062 3056
3063 // DescriptorArrays are fixed arrays used to hold instance descriptors. 3057 // DescriptorArrays are fixed arrays used to hold instance descriptors.
3064 // The format of the these objects is: 3058 // The format of the these objects is:
3065 // [0]: Number of descriptors 3059 // [0]: Number of descriptors
3066 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: 3060 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array:
3067 // [0]: pointer to fixed array with enum cache 3061 // [0]: pointer to fixed array with enum cache
3068 // [1]: either Smi(0) or pointer to fixed array with indices 3062 // [1]: either Smi(0) or pointer to fixed array with indices
3069 // [2]: first key 3063 // [2]: first key
3070 // [2 + number of descriptors * kDescriptorSize]: start of slack 3064 // [2 + number of descriptors * kDescriptorSize]: start of slack
3071 class DescriptorArray V8_FINAL : public FixedArray { 3065 class DescriptorArray: public FixedArray {
3072 public: 3066 public:
3073 // WhitenessWitness is used to prove that a descriptor array is white 3067 // WhitenessWitness is used to prove that a descriptor array is white
3074 // (unmarked), so incremental write barriers can be skipped because the 3068 // (unmarked), so incremental write barriers can be skipped because the
3075 // marking invariant cannot be broken and slots pointing into evacuation 3069 // marking invariant cannot be broken and slots pointing into evacuation
3076 // candidates will be discovered when the object is scanned. A witness is 3070 // candidates will be discovered when the object is scanned. A witness is
3077 // always stack-allocated right after creating an array. By allocating a 3071 // always stack-allocated right after creating an array. By allocating a
3078 // witness, incremental marking is globally disabled. The witness is then 3072 // witness, incremental marking is globally disabled. The witness is then
3079 // passed along wherever needed to statically prove that the array is known to 3073 // passed along wherever needed to statically prove that the array is known to
3080 // be white. 3074 // be white.
3081 class WhitenessWitness V8_FINAL { 3075 class WhitenessWitness {
3082 public: 3076 public:
3083 inline explicit WhitenessWitness(FixedArray* array); 3077 inline explicit WhitenessWitness(FixedArray* array);
3084 inline ~WhitenessWitness(); 3078 inline ~WhitenessWitness();
3085 3079
3086 private: 3080 private:
3087 IncrementalMarking* marking_; 3081 IncrementalMarking* marking_;
3088 }; 3082 };
3089 3083
3090 // Returns true for both shared empty_descriptor_array and for smis, which the 3084 // Returns true for both shared empty_descriptor_array and for smis, which the
3091 // map uses to encode additional bit fields when the descriptor array is not 3085 // map uses to encode additional bit fields when the descriptor array is not
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
3279 static const int kMaxNumberOfDescriptors = 1024 + 512; 3273 static const int kMaxNumberOfDescriptors = 1024 + 512;
3280 3274
3281 // Returns the fixed array length required to hold number_of_descriptors 3275 // Returns the fixed array length required to hold number_of_descriptors
3282 // descriptors. 3276 // descriptors.
3283 static int LengthFor(int number_of_descriptors) { 3277 static int LengthFor(int number_of_descriptors) {
3284 return ToKeyIndex(number_of_descriptors); 3278 return ToKeyIndex(number_of_descriptors);
3285 } 3279 }
3286 3280
3287 private: 3281 private:
3288 // An entry in a DescriptorArray, represented as an (array, index) pair. 3282 // An entry in a DescriptorArray, represented as an (array, index) pair.
3289 class Entry V8_FINAL { 3283 class Entry {
3290 public: 3284 public:
3291 inline explicit Entry(DescriptorArray* descs, int index) : 3285 inline explicit Entry(DescriptorArray* descs, int index) :
3292 descs_(descs), index_(index) { } 3286 descs_(descs), index_(index) { }
3293 3287
3294 inline PropertyType type() { return descs_->GetType(index_); } 3288 inline PropertyType type() { return descs_->GetType(index_); }
3295 inline Object* GetCallbackObject() { return descs_->GetValue(index_); } 3289 inline Object* GetCallbackObject() { return descs_->GetValue(index_); }
3296 3290
3297 private: 3291 private:
3298 DescriptorArray* descs_; 3292 DescriptorArray* descs_;
3299 int index_; 3293 int index_;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 return Hash(key); 3372 return Hash(key);
3379 } 3373 }
3380 static uint32_t HashForObject(Key key, Object* object) { return 0; } 3374 static uint32_t HashForObject(Key key, Object* object) { return 0; }
3381 static uint32_t SeededHashForObject(Key key, uint32_t seed, Object* object) { 3375 static uint32_t SeededHashForObject(Key key, uint32_t seed, Object* object) {
3382 ASSERT(UsesSeed); 3376 ASSERT(UsesSeed);
3383 return HashForObject(key, object); 3377 return HashForObject(key, object);
3384 } 3378 }
3385 }; 3379 };
3386 3380
3387 template<typename Shape, typename Key> 3381 template<typename Shape, typename Key>
3388 class HashTable : public FixedArray { 3382 class HashTable: public FixedArray {
3389 public: 3383 public:
3390 enum MinimumCapacity { 3384 enum MinimumCapacity {
3391 USE_DEFAULT_MINIMUM_CAPACITY, 3385 USE_DEFAULT_MINIMUM_CAPACITY,
3392 USE_CUSTOM_MINIMUM_CAPACITY 3386 USE_CUSTOM_MINIMUM_CAPACITY
3393 }; 3387 };
3394 3388
3395 // Wrapper methods 3389 // Wrapper methods
3396 inline uint32_t Hash(Key key) { 3390 inline uint32_t Hash(Key key) {
3397 if (Shape::UsesSeed) { 3391 if (Shape::UsesSeed) {
3398 return Shape::SeededHash(key, 3392 return Shape::SeededHash(key,
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3565 // Returns the hash value for object. 3559 // Returns the hash value for object.
3566 virtual uint32_t HashForObject(Object* key) = 0; 3560 virtual uint32_t HashForObject(Object* key) = 0;
3567 // Returns the key object for storing into the hash table. 3561 // Returns the key object for storing into the hash table.
3568 // If allocations fails a failure object is returned. 3562 // If allocations fails a failure object is returned.
3569 MUST_USE_RESULT virtual MaybeObject* AsObject(Heap* heap) = 0; 3563 MUST_USE_RESULT virtual MaybeObject* AsObject(Heap* heap) = 0;
3570 // Required. 3564 // Required.
3571 virtual ~HashTableKey() {} 3565 virtual ~HashTableKey() {}
3572 }; 3566 };
3573 3567
3574 3568
3575 class StringTableShape V8_FINAL : public BaseShape<HashTableKey*> { 3569 class StringTableShape : public BaseShape<HashTableKey*> {
3576 public: 3570 public:
3577 static inline bool IsMatch(HashTableKey* key, Object* value) { 3571 static inline bool IsMatch(HashTableKey* key, Object* value) {
3578 return key->IsMatch(value); 3572 return key->IsMatch(value);
3579 } 3573 }
3580 static inline uint32_t Hash(HashTableKey* key) { 3574 static inline uint32_t Hash(HashTableKey* key) {
3581 return key->Hash(); 3575 return key->Hash();
3582 } 3576 }
3583 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { 3577 static inline uint32_t HashForObject(HashTableKey* key, Object* object) {
3584 return key->HashForObject(object); 3578 return key->HashForObject(object);
3585 } 3579 }
3586 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, 3580 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
3587 HashTableKey* key) { 3581 HashTableKey* key) {
3588 return key->AsObject(heap); 3582 return key->AsObject(heap);
3589 } 3583 }
3590 3584
3591 static const int kPrefixSize = 0; 3585 static const int kPrefixSize = 0;
3592 static const int kEntrySize = 1; 3586 static const int kEntrySize = 1;
3593 }; 3587 };
3594 3588
3595 class SeqOneByteString; 3589 class SeqOneByteString;
3596 3590
3597 // StringTable. 3591 // StringTable.
3598 // 3592 //
3599 // No special elements in the prefix and the element size is 1 3593 // No special elements in the prefix and the element size is 1
3600 // because only the string itself (the key) needs to be stored. 3594 // because only the string itself (the key) needs to be stored.
3601 class StringTable V8_FINAL : public HashTable<StringTableShape, HashTableKey*> { 3595 class StringTable: public HashTable<StringTableShape, HashTableKey*> {
3602 public: 3596 public:
3603 // Find string in the string table. If it is not there yet, it is 3597 // Find string in the string table. If it is not there yet, it is
3604 // added. The return value is the string table which might have 3598 // added. The return value is the string table which might have
3605 // been enlarged. If the return value is not a failure, the string 3599 // been enlarged. If the return value is not a failure, the string
3606 // pointer *s is set to the string found. 3600 // pointer *s is set to the string found.
3607 MUST_USE_RESULT MaybeObject* LookupUtf8String( 3601 MUST_USE_RESULT MaybeObject* LookupUtf8String(
3608 Vector<const char> str, 3602 Vector<const char> str,
3609 Object** s); 3603 Object** s);
3610 MUST_USE_RESULT MaybeObject* LookupOneByteString( 3604 MUST_USE_RESULT MaybeObject* LookupOneByteString(
3611 Vector<const uint8_t> str, 3605 Vector<const uint8_t> str,
(...skipping 19 matching lines...) Expand all
3631 3625
3632 private: 3626 private:
3633 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s); 3627 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s);
3634 3628
3635 template <bool seq_ascii> friend class JsonParser; 3629 template <bool seq_ascii> friend class JsonParser;
3636 3630
3637 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable); 3631 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable);
3638 }; 3632 };
3639 3633
3640 3634
3641 class MapCacheShape V8_FINAL : public BaseShape<HashTableKey*> { 3635 class MapCacheShape : public BaseShape<HashTableKey*> {
3642 public: 3636 public:
3643 static inline bool IsMatch(HashTableKey* key, Object* value) { 3637 static inline bool IsMatch(HashTableKey* key, Object* value) {
3644 return key->IsMatch(value); 3638 return key->IsMatch(value);
3645 } 3639 }
3646 static inline uint32_t Hash(HashTableKey* key) { 3640 static inline uint32_t Hash(HashTableKey* key) {
3647 return key->Hash(); 3641 return key->Hash();
3648 } 3642 }
3649 3643
3650 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { 3644 static inline uint32_t HashForObject(HashTableKey* key, Object* object) {
3651 return key->HashForObject(object); 3645 return key->HashForObject(object);
3652 } 3646 }
3653 3647
3654 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, 3648 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
3655 HashTableKey* key) { 3649 HashTableKey* key) {
3656 return key->AsObject(heap); 3650 return key->AsObject(heap);
3657 } 3651 }
3658 3652
3659 static const int kPrefixSize = 0; 3653 static const int kPrefixSize = 0;
3660 static const int kEntrySize = 2; 3654 static const int kEntrySize = 2;
3661 }; 3655 };
3662 3656
3663 3657
3664 // MapCache. 3658 // MapCache.
3665 // 3659 //
3666 // Maps keys that are a fixed array of unique names to a map. 3660 // Maps keys that are a fixed array of unique names to a map.
3667 // Used for canonicalize maps for object literals. 3661 // Used for canonicalize maps for object literals.
3668 class MapCache V8_FINAL : public HashTable<MapCacheShape, HashTableKey*> { 3662 class MapCache: public HashTable<MapCacheShape, HashTableKey*> {
3669 public: 3663 public:
3670 // Find cached value for a name key, otherwise return null. 3664 // Find cached value for a name key, otherwise return null.
3671 Object* Lookup(FixedArray* key); 3665 Object* Lookup(FixedArray* key);
3672 MUST_USE_RESULT MaybeObject* Put(FixedArray* key, Map* value); 3666 MUST_USE_RESULT MaybeObject* Put(FixedArray* key, Map* value);
3673 static inline MapCache* cast(Object* obj); 3667 static inline MapCache* cast(Object* obj);
3674 3668
3675 private: 3669 private:
3676 DISALLOW_IMPLICIT_CONSTRUCTORS(MapCache); 3670 DISALLOW_IMPLICIT_CONSTRUCTORS(MapCache);
3677 }; 3671 };
3678 3672
3679 3673
3680 template <typename Shape, typename Key> 3674 template <typename Shape, typename Key>
3681 class Dictionary : public HashTable<Shape, Key> { 3675 class Dictionary: public HashTable<Shape, Key> {
3682 public: 3676 public:
3683 static inline Dictionary<Shape, Key>* cast(Object* obj) { 3677 static inline Dictionary<Shape, Key>* cast(Object* obj) {
3684 return reinterpret_cast<Dictionary<Shape, Key>*>(obj); 3678 return reinterpret_cast<Dictionary<Shape, Key>*>(obj);
3685 } 3679 }
3686 3680
3687 // Returns the value at entry. 3681 // Returns the value at entry.
3688 Object* ValueAt(int entry) { 3682 Object* ValueAt(int entry) {
3689 return this->get(HashTable<Shape, Key>::EntryToIndex(entry) + 1); 3683 return this->get(HashTable<Shape, Key>::EntryToIndex(entry) + 1);
3690 } 3684 }
3691 3685
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
3785 uint32_t hash); 3779 uint32_t hash);
3786 3780
3787 // Generate new enumeration indices to avoid enumeration index overflow. 3781 // Generate new enumeration indices to avoid enumeration index overflow.
3788 MUST_USE_RESULT MaybeObject* GenerateNewEnumerationIndices(); 3782 MUST_USE_RESULT MaybeObject* GenerateNewEnumerationIndices();
3789 static const int kMaxNumberKeyIndex = 3783 static const int kMaxNumberKeyIndex =
3790 HashTable<Shape, Key>::kPrefixStartIndex; 3784 HashTable<Shape, Key>::kPrefixStartIndex;
3791 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; 3785 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1;
3792 }; 3786 };
3793 3787
3794 3788
3795 class NameDictionaryShape V8_FINAL : public BaseShape<Name*> { 3789 class NameDictionaryShape : public BaseShape<Name*> {
3796 public: 3790 public:
3797 static inline bool IsMatch(Name* key, Object* other); 3791 static inline bool IsMatch(Name* key, Object* other);
3798 static inline uint32_t Hash(Name* key); 3792 static inline uint32_t Hash(Name* key);
3799 static inline uint32_t HashForObject(Name* key, Object* object); 3793 static inline uint32_t HashForObject(Name* key, Object* object);
3800 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, 3794 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
3801 Name* key); 3795 Name* key);
3802 static const int kPrefixSize = 2; 3796 static const int kPrefixSize = 2;
3803 static const int kEntrySize = 3; 3797 static const int kEntrySize = 3;
3804 static const bool kIsEnumerable = true; 3798 static const bool kIsEnumerable = true;
3805 }; 3799 };
3806 3800
3807 3801
3808 class NameDictionary V8_FINAL : public Dictionary<NameDictionaryShape, Name*> { 3802 class NameDictionary: public Dictionary<NameDictionaryShape, Name*> {
3809 public: 3803 public:
3810 static inline NameDictionary* cast(Object* obj) { 3804 static inline NameDictionary* cast(Object* obj) {
3811 ASSERT(obj->IsDictionary()); 3805 ASSERT(obj->IsDictionary());
3812 return reinterpret_cast<NameDictionary*>(obj); 3806 return reinterpret_cast<NameDictionary*>(obj);
3813 } 3807 }
3814 3808
3815 // Copies enumerable keys to preallocated fixed array. 3809 // Copies enumerable keys to preallocated fixed array.
3816 FixedArray* CopyEnumKeysTo(FixedArray* storage); 3810 FixedArray* CopyEnumKeysTo(FixedArray* storage);
3817 static void DoGenerateNewEnumerationIndices( 3811 static void DoGenerateNewEnumerationIndices(
3818 Handle<NameDictionary> dictionary); 3812 Handle<NameDictionary> dictionary);
(...skipping 12 matching lines...) Expand all
3831 class NumberDictionaryShape : public BaseShape<uint32_t> { 3825 class NumberDictionaryShape : public BaseShape<uint32_t> {
3832 public: 3826 public:
3833 static inline bool IsMatch(uint32_t key, Object* other); 3827 static inline bool IsMatch(uint32_t key, Object* other);
3834 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, 3828 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
3835 uint32_t key); 3829 uint32_t key);
3836 static const int kEntrySize = 3; 3830 static const int kEntrySize = 3;
3837 static const bool kIsEnumerable = false; 3831 static const bool kIsEnumerable = false;
3838 }; 3832 };
3839 3833
3840 3834
3841 class SeededNumberDictionaryShape V8_FINAL : public NumberDictionaryShape { 3835 class SeededNumberDictionaryShape : public NumberDictionaryShape {
3842 public: 3836 public:
3843 static const bool UsesSeed = true; 3837 static const bool UsesSeed = true;
3844 static const int kPrefixSize = 2; 3838 static const int kPrefixSize = 2;
3845 3839
3846 static inline uint32_t SeededHash(uint32_t key, uint32_t seed); 3840 static inline uint32_t SeededHash(uint32_t key, uint32_t seed);
3847 static inline uint32_t SeededHashForObject(uint32_t key, 3841 static inline uint32_t SeededHashForObject(uint32_t key,
3848 uint32_t seed, 3842 uint32_t seed,
3849 Object* object); 3843 Object* object);
3850 }; 3844 };
3851 3845
3852 3846
3853 class UnseededNumberDictionaryShape V8_FINAL : public NumberDictionaryShape { 3847 class UnseededNumberDictionaryShape : public NumberDictionaryShape {
3854 public: 3848 public:
3855 static const int kPrefixSize = 0; 3849 static const int kPrefixSize = 0;
3856 3850
3857 static inline uint32_t Hash(uint32_t key); 3851 static inline uint32_t Hash(uint32_t key);
3858 static inline uint32_t HashForObject(uint32_t key, Object* object); 3852 static inline uint32_t HashForObject(uint32_t key, Object* object);
3859 }; 3853 };
3860 3854
3861 3855
3862 class SeededNumberDictionary V8_FINAL 3856 class SeededNumberDictionary
3863 : public Dictionary<SeededNumberDictionaryShape, uint32_t> { 3857 : public Dictionary<SeededNumberDictionaryShape, uint32_t> {
3864 public: 3858 public:
3865 static SeededNumberDictionary* cast(Object* obj) { 3859 static SeededNumberDictionary* cast(Object* obj) {
3866 ASSERT(obj->IsDictionary()); 3860 ASSERT(obj->IsDictionary());
3867 return reinterpret_cast<SeededNumberDictionary*>(obj); 3861 return reinterpret_cast<SeededNumberDictionary*>(obj);
3868 } 3862 }
3869 3863
3870 // Type specific at put (default NONE attributes is used when adding). 3864 // Type specific at put (default NONE attributes is used when adding).
3871 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value); 3865 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value);
3872 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, 3866 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key,
(...skipping 27 matching lines...) Expand all
3900 // requires_slow_elements returns false. 3894 // requires_slow_elements returns false.
3901 inline uint32_t max_number_key(); 3895 inline uint32_t max_number_key();
3902 3896
3903 // Bit masks. 3897 // Bit masks.
3904 static const int kRequiresSlowElementsMask = 1; 3898 static const int kRequiresSlowElementsMask = 1;
3905 static const int kRequiresSlowElementsTagSize = 1; 3899 static const int kRequiresSlowElementsTagSize = 1;
3906 static const uint32_t kRequiresSlowElementsLimit = (1 << 29) - 1; 3900 static const uint32_t kRequiresSlowElementsLimit = (1 << 29) - 1;
3907 }; 3901 };
3908 3902
3909 3903
3910 class UnseededNumberDictionary V8_FINAL 3904 class UnseededNumberDictionary
3911 : public Dictionary<UnseededNumberDictionaryShape, uint32_t> { 3905 : public Dictionary<UnseededNumberDictionaryShape, uint32_t> {
3912 public: 3906 public:
3913 static UnseededNumberDictionary* cast(Object* obj) { 3907 static UnseededNumberDictionary* cast(Object* obj) {
3914 ASSERT(obj->IsDictionary()); 3908 ASSERT(obj->IsDictionary());
3915 return reinterpret_cast<UnseededNumberDictionary*>(obj); 3909 return reinterpret_cast<UnseededNumberDictionary*>(obj);
3916 } 3910 }
3917 3911
3918 // Type specific at put (default NONE attributes is used when adding). 3912 // Type specific at put (default NONE attributes is used when adding).
3919 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value); 3913 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value);
3920 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, Object* value); 3914 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, Object* value);
3921 3915
3922 // Set an existing entry or add a new one if needed. 3916 // Set an existing entry or add a new one if needed.
3923 // Return the updated dictionary. 3917 // Return the updated dictionary.
3924 MUST_USE_RESULT static Handle<UnseededNumberDictionary> Set( 3918 MUST_USE_RESULT static Handle<UnseededNumberDictionary> Set(
3925 Handle<UnseededNumberDictionary> dictionary, 3919 Handle<UnseededNumberDictionary> dictionary,
3926 uint32_t index, 3920 uint32_t index,
3927 Handle<Object> value); 3921 Handle<Object> value);
3928 3922
3929 MUST_USE_RESULT MaybeObject* Set(uint32_t key, Object* value); 3923 MUST_USE_RESULT MaybeObject* Set(uint32_t key, Object* value);
3930 }; 3924 };
3931 3925
3932 3926
3933 template <int entrysize> 3927 template <int entrysize>
3934 class ObjectHashTableShape V8_FINAL : public BaseShape<Object*> { 3928 class ObjectHashTableShape : public BaseShape<Object*> {
3935 public: 3929 public:
3936 static inline bool IsMatch(Object* key, Object* other); 3930 static inline bool IsMatch(Object* key, Object* other);
3937 static inline uint32_t Hash(Object* key); 3931 static inline uint32_t Hash(Object* key);
3938 static inline uint32_t HashForObject(Object* key, Object* object); 3932 static inline uint32_t HashForObject(Object* key, Object* object);
3939 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap, 3933 MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
3940 Object* key); 3934 Object* key);
3941 static const int kPrefixSize = 0; 3935 static const int kPrefixSize = 0;
3942 static const int kEntrySize = entrysize; 3936 static const int kEntrySize = entrysize;
3943 }; 3937 };
3944 3938
3945 3939
3946 // ObjectHashSet holds keys that are arbitrary objects by using the identity 3940 // ObjectHashSet holds keys that are arbitrary objects by using the identity
3947 // hash of the key for hashing purposes. 3941 // hash of the key for hashing purposes.
3948 class ObjectHashSet V8_FINAL 3942 class ObjectHashSet: public HashTable<ObjectHashTableShape<1>, Object*> {
3949 : public HashTable<ObjectHashTableShape<1>, Object*> {
3950 public: 3943 public:
3951 static inline ObjectHashSet* cast(Object* obj) { 3944 static inline ObjectHashSet* cast(Object* obj) {
3952 ASSERT(obj->IsHashTable()); 3945 ASSERT(obj->IsHashTable());
3953 return reinterpret_cast<ObjectHashSet*>(obj); 3946 return reinterpret_cast<ObjectHashSet*>(obj);
3954 } 3947 }
3955 3948
3956 // Looks up whether the given key is part of this hash set. 3949 // Looks up whether the given key is part of this hash set.
3957 bool Contains(Object* key); 3950 bool Contains(Object* key);
3958 3951
3959 // Adds the given key to this hash set. 3952 // Adds the given key to this hash set.
3960 MUST_USE_RESULT MaybeObject* Add(Object* key); 3953 MUST_USE_RESULT MaybeObject* Add(Object* key);
3961 3954
3962 // Removes the given key from this hash set. 3955 // Removes the given key from this hash set.
3963 MUST_USE_RESULT MaybeObject* Remove(Object* key); 3956 MUST_USE_RESULT MaybeObject* Remove(Object* key);
3964 }; 3957 };
3965 3958
3966 3959
3967 // ObjectHashTable maps keys that are arbitrary objects to object values by 3960 // ObjectHashTable maps keys that are arbitrary objects to object values by
3968 // using the identity hash of the key for hashing purposes. 3961 // using the identity hash of the key for hashing purposes.
3969 class ObjectHashTable V8_FINAL 3962 class ObjectHashTable: public HashTable<ObjectHashTableShape<2>, Object*> {
3970 : public HashTable<ObjectHashTableShape<2>, Object*> {
3971 public: 3963 public:
3972 static inline ObjectHashTable* cast(Object* obj) { 3964 static inline ObjectHashTable* cast(Object* obj) {
3973 ASSERT(obj->IsHashTable()); 3965 ASSERT(obj->IsHashTable());
3974 return reinterpret_cast<ObjectHashTable*>(obj); 3966 return reinterpret_cast<ObjectHashTable*>(obj);
3975 } 3967 }
3976 3968
3977 // Looks up the value associated with the given key. The hole value is 3969 // Looks up the value associated with the given key. The hole value is
3978 // returned in case the key is not present. 3970 // returned in case the key is not present.
3979 Object* Lookup(Object* key); 3971 Object* Lookup(Object* key);
3980 3972
(...skipping 14 matching lines...) Expand all
3995 }; 3987 };
3996 3988
3997 3989
3998 // JSFunctionResultCache caches results of some JSFunction invocation. 3990 // JSFunctionResultCache caches results of some JSFunction invocation.
3999 // It is a fixed array with fixed structure: 3991 // It is a fixed array with fixed structure:
4000 // [0]: factory function 3992 // [0]: factory function
4001 // [1]: finger index 3993 // [1]: finger index
4002 // [2]: current cache size 3994 // [2]: current cache size
4003 // [3]: dummy field. 3995 // [3]: dummy field.
4004 // The rest of array are key/value pairs. 3996 // The rest of array are key/value pairs.
4005 class JSFunctionResultCache V8_FINAL : public FixedArray { 3997 class JSFunctionResultCache: public FixedArray {
4006 public: 3998 public:
4007 static const int kFactoryIndex = 0; 3999 static const int kFactoryIndex = 0;
4008 static const int kFingerIndex = kFactoryIndex + 1; 4000 static const int kFingerIndex = kFactoryIndex + 1;
4009 static const int kCacheSizeIndex = kFingerIndex + 1; 4001 static const int kCacheSizeIndex = kFingerIndex + 1;
4010 static const int kDummyIndex = kCacheSizeIndex + 1; 4002 static const int kDummyIndex = kCacheSizeIndex + 1;
4011 static const int kEntriesIndex = kDummyIndex + 1; 4003 static const int kEntriesIndex = kDummyIndex + 1;
4012 4004
4013 static const int kEntrySize = 2; // key + value 4005 static const int kEntrySize = 2; // key + value
4014 4006
4015 static const int kFactoryOffset = kHeaderSize; 4007 static const int kFactoryOffset = kHeaderSize;
(...skipping 15 matching lines...) Expand all
4031 }; 4023 };
4032 4024
4033 4025
4034 // ScopeInfo represents information about different scopes of a source 4026 // ScopeInfo represents information about different scopes of a source
4035 // program and the allocation of the scope's variables. Scope information 4027 // program and the allocation of the scope's variables. Scope information
4036 // is stored in a compressed form in ScopeInfo objects and is used 4028 // is stored in a compressed form in ScopeInfo objects and is used
4037 // at runtime (stack dumps, deoptimization, etc.). 4029 // at runtime (stack dumps, deoptimization, etc.).
4038 4030
4039 // This object provides quick access to scope info details for runtime 4031 // This object provides quick access to scope info details for runtime
4040 // routines. 4032 // routines.
4041 class ScopeInfo V8_FINAL : public FixedArray { 4033 class ScopeInfo : public FixedArray {
4042 public: 4034 public:
4043 static inline ScopeInfo* cast(Object* object); 4035 static inline ScopeInfo* cast(Object* object);
4044 4036
4045 // Return the type of this scope. 4037 // Return the type of this scope.
4046 ScopeType scope_type(); 4038 ScopeType scope_type();
4047 4039
4048 // Does this scope call eval? 4040 // Does this scope call eval?
4049 bool CallsEval(); 4041 bool CallsEval();
4050 4042
4051 // Return the language mode of this scope. 4043 // Return the language mode of this scope.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
4235 // BitFields representing the encoded information for context locals in the 4227 // BitFields representing the encoded information for context locals in the
4236 // ContextLocalInfoEntries part. 4228 // ContextLocalInfoEntries part.
4237 class ContextLocalMode: public BitField<VariableMode, 0, 3> {}; 4229 class ContextLocalMode: public BitField<VariableMode, 0, 3> {};
4238 class ContextLocalInitFlag: public BitField<InitializationFlag, 3, 1> {}; 4230 class ContextLocalInitFlag: public BitField<InitializationFlag, 3, 1> {};
4239 }; 4231 };
4240 4232
4241 4233
4242 // The cache for maps used by normalized (dictionary mode) objects. 4234 // The cache for maps used by normalized (dictionary mode) objects.
4243 // Such maps do not have property descriptors, so a typical program 4235 // Such maps do not have property descriptors, so a typical program
4244 // needs very limited number of distinct normalized maps. 4236 // needs very limited number of distinct normalized maps.
4245 class NormalizedMapCache V8_FINAL : public FixedArray { 4237 class NormalizedMapCache: public FixedArray {
4246 public: 4238 public:
4247 static const int kEntries = 64; 4239 static const int kEntries = 64;
4248 4240
4249 MUST_USE_RESULT MaybeObject* Get(JSObject* object, 4241 MUST_USE_RESULT MaybeObject* Get(JSObject* object,
4250 PropertyNormalizationMode mode); 4242 PropertyNormalizationMode mode);
4251 4243
4252 void Clear(); 4244 void Clear();
4253 4245
4254 // Casting 4246 // Casting
4255 static inline NormalizedMapCache* cast(Object* obj); 4247 static inline NormalizedMapCache* cast(Object* obj);
4256 4248
4257 DECLARE_VERIFIER(NormalizedMapCache) 4249 DECLARE_VERIFIER(NormalizedMapCache)
4258 }; 4250 };
4259 4251
4260 4252
4261 // ByteArray represents fixed sized byte arrays. Used for the relocation info 4253 // ByteArray represents fixed sized byte arrays. Used for the relocation info
4262 // that is attached to code objects. 4254 // that is attached to code objects.
4263 class ByteArray V8_FINAL : public FixedArrayBase { 4255 class ByteArray: public FixedArrayBase {
4264 public: 4256 public:
4265 inline int Size() { return RoundUp(length() + kHeaderSize, kPointerSize); } 4257 inline int Size() { return RoundUp(length() + kHeaderSize, kPointerSize); }
4266 4258
4267 // Setter and getter. 4259 // Setter and getter.
4268 inline byte get(int index); 4260 inline byte get(int index);
4269 inline void set(int index, byte value); 4261 inline void set(int index, byte value);
4270 4262
4271 // Treat contents as an int array. 4263 // Treat contents as an int array.
4272 inline int get_int(int index); 4264 inline int get_int(int index);
4273 4265
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4308 // Maximal length of a single ByteArray. 4300 // Maximal length of a single ByteArray.
4309 static const int kMaxLength = kMaxSize - kHeaderSize; 4301 static const int kMaxLength = kMaxSize - kHeaderSize;
4310 4302
4311 private: 4303 private:
4312 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); 4304 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray);
4313 }; 4305 };
4314 4306
4315 4307
4316 // FreeSpace represents fixed sized areas of the heap that are not currently in 4308 // FreeSpace represents fixed sized areas of the heap that are not currently in
4317 // use. Used by the heap and GC. 4309 // use. Used by the heap and GC.
4318 class FreeSpace V8_FINAL : public HeapObject { 4310 class FreeSpace: public HeapObject {
4319 public: 4311 public:
4320 // [size]: size of the free space including the header. 4312 // [size]: size of the free space including the header.
4321 inline int size(); 4313 inline int size();
4322 inline void set_size(int value); 4314 inline void set_size(int value);
4323 4315
4324 inline int Size() { return size(); } 4316 inline int Size() { return size(); }
4325 4317
4326 // Casting. 4318 // Casting.
4327 static inline FreeSpace* cast(Object* obj); 4319 static inline FreeSpace* cast(Object* obj);
4328 4320
(...skipping 17 matching lines...) Expand all
4346 // which live outside the JavaScript heap. Its subclasses are used to 4338 // which live outside the JavaScript heap. Its subclasses are used to
4347 // implement the CanvasArray types being defined in the WebGL 4339 // implement the CanvasArray types being defined in the WebGL
4348 // specification. As of this writing the first public draft is not yet 4340 // specification. As of this writing the first public draft is not yet
4349 // available, but Khronos members can access the draft at: 4341 // available, but Khronos members can access the draft at:
4350 // https://cvs.khronos.org/svn/repos/3dweb/trunk/doc/spec/WebGL-spec.html 4342 // https://cvs.khronos.org/svn/repos/3dweb/trunk/doc/spec/WebGL-spec.html
4351 // 4343 //
4352 // The semantics of these arrays differ from CanvasPixelArray. 4344 // The semantics of these arrays differ from CanvasPixelArray.
4353 // Out-of-range values passed to the setter are converted via a C 4345 // Out-of-range values passed to the setter are converted via a C
4354 // cast, not clamping. Out-of-range indices cause exceptions to be 4346 // cast, not clamping. Out-of-range indices cause exceptions to be
4355 // raised rather than being silently ignored. 4347 // raised rather than being silently ignored.
4356 class ExternalArray : public FixedArrayBase { 4348 class ExternalArray: public FixedArrayBase {
4357 public: 4349 public:
4358 inline bool is_the_hole(int index) { return false; } 4350 inline bool is_the_hole(int index) { return false; }
4359 4351
4360 // [external_pointer]: The pointer to the external memory area backing this 4352 // [external_pointer]: The pointer to the external memory area backing this
4361 // external array. 4353 // external array.
4362 DECL_ACCESSORS(external_pointer, void) // Pointer to the data store. 4354 DECL_ACCESSORS(external_pointer, void) // Pointer to the data store.
4363 4355
4364 // Casting. 4356 // Casting.
4365 static inline ExternalArray* cast(Object* obj); 4357 static inline ExternalArray* cast(Object* obj);
4366 4358
(...skipping 12 matching lines...) Expand all
4379 4371
4380 4372
4381 // A ExternalPixelArray represents a fixed-size byte array with special 4373 // A ExternalPixelArray represents a fixed-size byte array with special
4382 // semantics used for implementing the CanvasPixelArray object. Please see the 4374 // semantics used for implementing the CanvasPixelArray object. Please see the
4383 // specification at: 4375 // specification at:
4384 4376
4385 // http://www.whatwg.org/specs/web-apps/current-work/ 4377 // http://www.whatwg.org/specs/web-apps/current-work/
4386 // multipage/the-canvas-element.html#canvaspixelarray 4378 // multipage/the-canvas-element.html#canvaspixelarray
4387 // In particular, write access clamps the value written to 0 or 255 if the 4379 // In particular, write access clamps the value written to 0 or 255 if the
4388 // value written is outside this range. 4380 // value written is outside this range.
4389 class ExternalPixelArray V8_FINAL : public ExternalArray { 4381 class ExternalPixelArray: public ExternalArray {
4390 public: 4382 public:
4391 inline uint8_t* external_pixel_pointer(); 4383 inline uint8_t* external_pixel_pointer();
4392 4384
4393 // Setter and getter. 4385 // Setter and getter.
4394 inline uint8_t get_scalar(int index); 4386 inline uint8_t get_scalar(int index);
4395 MUST_USE_RESULT inline MaybeObject* get(int index); 4387 MUST_USE_RESULT inline MaybeObject* get(int index);
4396 inline void set(int index, uint8_t value); 4388 inline void set(int index, uint8_t value);
4397 4389
4398 // This accessor applies the correct conversion from Smi, HeapNumber and 4390 // This accessor applies the correct conversion from Smi, HeapNumber and
4399 // undefined and clamps the converted value between 0 and 255. 4391 // undefined and clamps the converted value between 0 and 255.
4400 Object* SetValue(uint32_t index, Object* value); 4392 Object* SetValue(uint32_t index, Object* value);
4401 4393
4402 // Casting. 4394 // Casting.
4403 static inline ExternalPixelArray* cast(Object* obj); 4395 static inline ExternalPixelArray* cast(Object* obj);
4404 4396
4405 // Dispatched behavior. 4397 // Dispatched behavior.
4406 DECLARE_PRINTER(ExternalPixelArray) 4398 DECLARE_PRINTER(ExternalPixelArray)
4407 DECLARE_VERIFIER(ExternalPixelArray) 4399 DECLARE_VERIFIER(ExternalPixelArray)
4408 4400
4409 private: 4401 private:
4410 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray); 4402 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray);
4411 }; 4403 };
4412 4404
4413 4405
4414 class ExternalByteArray V8_FINAL : public ExternalArray { 4406 class ExternalByteArray: public ExternalArray {
4415 public: 4407 public:
4416 // Setter and getter. 4408 // Setter and getter.
4417 inline int8_t get_scalar(int index); 4409 inline int8_t get_scalar(int index);
4418 MUST_USE_RESULT inline MaybeObject* get(int index); 4410 MUST_USE_RESULT inline MaybeObject* get(int index);
4419 inline void set(int index, int8_t value); 4411 inline void set(int index, int8_t value);
4420 4412
4421 // This accessor applies the correct conversion from Smi, HeapNumber 4413 // This accessor applies the correct conversion from Smi, HeapNumber
4422 // and undefined. 4414 // and undefined.
4423 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4415 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4424 4416
4425 // Casting. 4417 // Casting.
4426 static inline ExternalByteArray* cast(Object* obj); 4418 static inline ExternalByteArray* cast(Object* obj);
4427 4419
4428 // Dispatched behavior. 4420 // Dispatched behavior.
4429 DECLARE_PRINTER(ExternalByteArray) 4421 DECLARE_PRINTER(ExternalByteArray)
4430 DECLARE_VERIFIER(ExternalByteArray) 4422 DECLARE_VERIFIER(ExternalByteArray)
4431 4423
4432 private: 4424 private:
4433 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); 4425 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray);
4434 }; 4426 };
4435 4427
4436 4428
4437 class ExternalUnsignedByteArray V8_FINAL : public ExternalArray { 4429 class ExternalUnsignedByteArray: public ExternalArray {
4438 public: 4430 public:
4439 // Setter and getter. 4431 // Setter and getter.
4440 inline uint8_t get_scalar(int index); 4432 inline uint8_t get_scalar(int index);
4441 MUST_USE_RESULT inline MaybeObject* get(int index); 4433 MUST_USE_RESULT inline MaybeObject* get(int index);
4442 inline void set(int index, uint8_t value); 4434 inline void set(int index, uint8_t value);
4443 4435
4444 // This accessor applies the correct conversion from Smi, HeapNumber 4436 // This accessor applies the correct conversion from Smi, HeapNumber
4445 // and undefined. 4437 // and undefined.
4446 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4438 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4447 4439
4448 // Casting. 4440 // Casting.
4449 static inline ExternalUnsignedByteArray* cast(Object* obj); 4441 static inline ExternalUnsignedByteArray* cast(Object* obj);
4450 4442
4451 // Dispatched behavior. 4443 // Dispatched behavior.
4452 DECLARE_PRINTER(ExternalUnsignedByteArray) 4444 DECLARE_PRINTER(ExternalUnsignedByteArray)
4453 DECLARE_VERIFIER(ExternalUnsignedByteArray) 4445 DECLARE_VERIFIER(ExternalUnsignedByteArray)
4454 4446
4455 private: 4447 private:
4456 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); 4448 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray);
4457 }; 4449 };
4458 4450
4459 4451
4460 class ExternalShortArray V8_FINAL : public ExternalArray { 4452 class ExternalShortArray: public ExternalArray {
4461 public: 4453 public:
4462 // Setter and getter. 4454 // Setter and getter.
4463 inline int16_t get_scalar(int index); 4455 inline int16_t get_scalar(int index);
4464 MUST_USE_RESULT inline MaybeObject* get(int index); 4456 MUST_USE_RESULT inline MaybeObject* get(int index);
4465 inline void set(int index, int16_t value); 4457 inline void set(int index, int16_t value);
4466 4458
4467 // This accessor applies the correct conversion from Smi, HeapNumber 4459 // This accessor applies the correct conversion from Smi, HeapNumber
4468 // and undefined. 4460 // and undefined.
4469 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4461 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4470 4462
4471 // Casting. 4463 // Casting.
4472 static inline ExternalShortArray* cast(Object* obj); 4464 static inline ExternalShortArray* cast(Object* obj);
4473 4465
4474 // Dispatched behavior. 4466 // Dispatched behavior.
4475 DECLARE_PRINTER(ExternalShortArray) 4467 DECLARE_PRINTER(ExternalShortArray)
4476 DECLARE_VERIFIER(ExternalShortArray) 4468 DECLARE_VERIFIER(ExternalShortArray)
4477 4469
4478 private: 4470 private:
4479 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); 4471 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray);
4480 }; 4472 };
4481 4473
4482 4474
4483 class ExternalUnsignedShortArray V8_FINAL : public ExternalArray { 4475 class ExternalUnsignedShortArray: public ExternalArray {
4484 public: 4476 public:
4485 // Setter and getter. 4477 // Setter and getter.
4486 inline uint16_t get_scalar(int index); 4478 inline uint16_t get_scalar(int index);
4487 MUST_USE_RESULT inline MaybeObject* get(int index); 4479 MUST_USE_RESULT inline MaybeObject* get(int index);
4488 inline void set(int index, uint16_t value); 4480 inline void set(int index, uint16_t value);
4489 4481
4490 // This accessor applies the correct conversion from Smi, HeapNumber 4482 // This accessor applies the correct conversion from Smi, HeapNumber
4491 // and undefined. 4483 // and undefined.
4492 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4484 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4493 4485
4494 // Casting. 4486 // Casting.
4495 static inline ExternalUnsignedShortArray* cast(Object* obj); 4487 static inline ExternalUnsignedShortArray* cast(Object* obj);
4496 4488
4497 // Dispatched behavior. 4489 // Dispatched behavior.
4498 DECLARE_PRINTER(ExternalUnsignedShortArray) 4490 DECLARE_PRINTER(ExternalUnsignedShortArray)
4499 DECLARE_VERIFIER(ExternalUnsignedShortArray) 4491 DECLARE_VERIFIER(ExternalUnsignedShortArray)
4500 4492
4501 private: 4493 private:
4502 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); 4494 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray);
4503 }; 4495 };
4504 4496
4505 4497
4506 class ExternalIntArray V8_FINAL : public ExternalArray { 4498 class ExternalIntArray: public ExternalArray {
4507 public: 4499 public:
4508 // Setter and getter. 4500 // Setter and getter.
4509 inline int32_t get_scalar(int index); 4501 inline int32_t get_scalar(int index);
4510 MUST_USE_RESULT inline MaybeObject* get(int index); 4502 MUST_USE_RESULT inline MaybeObject* get(int index);
4511 inline void set(int index, int32_t value); 4503 inline void set(int index, int32_t value);
4512 4504
4513 // This accessor applies the correct conversion from Smi, HeapNumber 4505 // This accessor applies the correct conversion from Smi, HeapNumber
4514 // and undefined. 4506 // and undefined.
4515 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4507 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4516 4508
4517 // Casting. 4509 // Casting.
4518 static inline ExternalIntArray* cast(Object* obj); 4510 static inline ExternalIntArray* cast(Object* obj);
4519 4511
4520 // Dispatched behavior. 4512 // Dispatched behavior.
4521 DECLARE_PRINTER(ExternalIntArray) 4513 DECLARE_PRINTER(ExternalIntArray)
4522 DECLARE_VERIFIER(ExternalIntArray) 4514 DECLARE_VERIFIER(ExternalIntArray)
4523 4515
4524 private: 4516 private:
4525 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); 4517 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray);
4526 }; 4518 };
4527 4519
4528 4520
4529 class ExternalUnsignedIntArray V8_FINAL : public ExternalArray { 4521 class ExternalUnsignedIntArray: public ExternalArray {
4530 public: 4522 public:
4531 // Setter and getter. 4523 // Setter and getter.
4532 inline uint32_t get_scalar(int index); 4524 inline uint32_t get_scalar(int index);
4533 MUST_USE_RESULT inline MaybeObject* get(int index); 4525 MUST_USE_RESULT inline MaybeObject* get(int index);
4534 inline void set(int index, uint32_t value); 4526 inline void set(int index, uint32_t value);
4535 4527
4536 // This accessor applies the correct conversion from Smi, HeapNumber 4528 // This accessor applies the correct conversion from Smi, HeapNumber
4537 // and undefined. 4529 // and undefined.
4538 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4530 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4539 4531
4540 // Casting. 4532 // Casting.
4541 static inline ExternalUnsignedIntArray* cast(Object* obj); 4533 static inline ExternalUnsignedIntArray* cast(Object* obj);
4542 4534
4543 // Dispatched behavior. 4535 // Dispatched behavior.
4544 DECLARE_PRINTER(ExternalUnsignedIntArray) 4536 DECLARE_PRINTER(ExternalUnsignedIntArray)
4545 DECLARE_VERIFIER(ExternalUnsignedIntArray) 4537 DECLARE_VERIFIER(ExternalUnsignedIntArray)
4546 4538
4547 private: 4539 private:
4548 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); 4540 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray);
4549 }; 4541 };
4550 4542
4551 4543
4552 class ExternalFloatArray V8_FINAL : public ExternalArray { 4544 class ExternalFloatArray: public ExternalArray {
4553 public: 4545 public:
4554 // Setter and getter. 4546 // Setter and getter.
4555 inline float get_scalar(int index); 4547 inline float get_scalar(int index);
4556 MUST_USE_RESULT inline MaybeObject* get(int index); 4548 MUST_USE_RESULT inline MaybeObject* get(int index);
4557 inline void set(int index, float value); 4549 inline void set(int index, float value);
4558 4550
4559 // This accessor applies the correct conversion from Smi, HeapNumber 4551 // This accessor applies the correct conversion from Smi, HeapNumber
4560 // and undefined. 4552 // and undefined.
4561 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4553 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4562 4554
4563 // Casting. 4555 // Casting.
4564 static inline ExternalFloatArray* cast(Object* obj); 4556 static inline ExternalFloatArray* cast(Object* obj);
4565 4557
4566 // Dispatched behavior. 4558 // Dispatched behavior.
4567 DECLARE_PRINTER(ExternalFloatArray) 4559 DECLARE_PRINTER(ExternalFloatArray)
4568 DECLARE_VERIFIER(ExternalFloatArray) 4560 DECLARE_VERIFIER(ExternalFloatArray)
4569 4561
4570 private: 4562 private:
4571 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); 4563 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray);
4572 }; 4564 };
4573 4565
4574 4566
4575 class ExternalDoubleArray V8_FINAL : public ExternalArray { 4567 class ExternalDoubleArray: public ExternalArray {
4576 public: 4568 public:
4577 // Setter and getter. 4569 // Setter and getter.
4578 inline double get_scalar(int index); 4570 inline double get_scalar(int index);
4579 MUST_USE_RESULT inline MaybeObject* get(int index); 4571 MUST_USE_RESULT inline MaybeObject* get(int index);
4580 inline void set(int index, double value); 4572 inline void set(int index, double value);
4581 4573
4582 // This accessor applies the correct conversion from Smi, HeapNumber 4574 // This accessor applies the correct conversion from Smi, HeapNumber
4583 // and undefined. 4575 // and undefined.
4584 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4576 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4585 4577
4586 // Casting. 4578 // Casting.
4587 static inline ExternalDoubleArray* cast(Object* obj); 4579 static inline ExternalDoubleArray* cast(Object* obj);
4588 4580
4589 // Dispatched behavior. 4581 // Dispatched behavior.
4590 DECLARE_PRINTER(ExternalDoubleArray) 4582 DECLARE_PRINTER(ExternalDoubleArray)
4591 DECLARE_VERIFIER(ExternalDoubleArray) 4583 DECLARE_VERIFIER(ExternalDoubleArray)
4592 4584
4593 private: 4585 private:
4594 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalDoubleArray); 4586 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalDoubleArray);
4595 }; 4587 };
4596 4588
4597 4589
4598 // DeoptimizationInputData is a fixed array used to hold the deoptimization 4590 // DeoptimizationInputData is a fixed array used to hold the deoptimization
4599 // data for code generated by the Hydrogen/Lithium compiler. It also 4591 // data for code generated by the Hydrogen/Lithium compiler. It also
4600 // contains information about functions that were inlined. If N different 4592 // contains information about functions that were inlined. If N different
4601 // functions were inlined then first N elements of the literal array will 4593 // functions were inlined then first N elements of the literal array will
4602 // contain these functions. 4594 // contain these functions.
4603 // 4595 //
4604 // It can be empty. 4596 // It can be empty.
4605 class DeoptimizationInputData V8_FINAL : public FixedArray { 4597 class DeoptimizationInputData: public FixedArray {
4606 public: 4598 public:
4607 // Layout description. Indices in the array. 4599 // Layout description. Indices in the array.
4608 static const int kTranslationByteArrayIndex = 0; 4600 static const int kTranslationByteArrayIndex = 0;
4609 static const int kInlinedFunctionCountIndex = 1; 4601 static const int kInlinedFunctionCountIndex = 1;
4610 static const int kLiteralArrayIndex = 2; 4602 static const int kLiteralArrayIndex = 2;
4611 static const int kOsrAstIdIndex = 3; 4603 static const int kOsrAstIdIndex = 3;
4612 static const int kOsrPcOffsetIndex = 4; 4604 static const int kOsrPcOffsetIndex = 4;
4613 static const int kFirstDeoptEntryIndex = 5; 4605 static const int kFirstDeoptEntryIndex = 5;
4614 4606
4615 // Offsets of deopt entry elements relative to the start of the entry. 4607 // Offsets of deopt entry elements relative to the start of the entry.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
4684 return IndexForEntry(entry_count); 4676 return IndexForEntry(entry_count);
4685 } 4677 }
4686 }; 4678 };
4687 4679
4688 4680
4689 // DeoptimizationOutputData is a fixed array used to hold the deoptimization 4681 // DeoptimizationOutputData is a fixed array used to hold the deoptimization
4690 // data for code generated by the full compiler. 4682 // data for code generated by the full compiler.
4691 // The format of the these objects is 4683 // The format of the these objects is
4692 // [i * 2]: Ast ID for ith deoptimization. 4684 // [i * 2]: Ast ID for ith deoptimization.
4693 // [i * 2 + 1]: PC and state of ith deoptimization 4685 // [i * 2 + 1]: PC and state of ith deoptimization
4694 class DeoptimizationOutputData V8_FINAL : public FixedArray { 4686 class DeoptimizationOutputData: public FixedArray {
4695 public: 4687 public:
4696 int DeoptPoints() { return length() / 2; } 4688 int DeoptPoints() { return length() / 2; }
4697 4689
4698 BailoutId AstId(int index) { 4690 BailoutId AstId(int index) {
4699 return BailoutId(Smi::cast(get(index * 2))->value()); 4691 return BailoutId(Smi::cast(get(index * 2))->value());
4700 } 4692 }
4701 4693
4702 void SetAstId(int index, BailoutId id) { 4694 void SetAstId(int index, BailoutId id) {
4703 set(index * 2, Smi::FromInt(id.ToInt())); 4695 set(index * 2, Smi::FromInt(id.ToInt()));
4704 } 4696 }
(...skipping 20 matching lines...) Expand all
4725 4717
4726 // Forward declaration. 4718 // Forward declaration.
4727 class Cell; 4719 class Cell;
4728 class PropertyCell; 4720 class PropertyCell;
4729 4721
4730 // TypeFeedbackCells is a fixed array used to hold the association between 4722 // TypeFeedbackCells is a fixed array used to hold the association between
4731 // cache cells and AST ids for code generated by the full compiler. 4723 // cache cells and AST ids for code generated by the full compiler.
4732 // The format of the these objects is 4724 // The format of the these objects is
4733 // [i * 2]: Global property cell of ith cache cell. 4725 // [i * 2]: Global property cell of ith cache cell.
4734 // [i * 2 + 1]: Ast ID for ith cache cell. 4726 // [i * 2 + 1]: Ast ID for ith cache cell.
4735 class TypeFeedbackCells V8_FINAL : public FixedArray { 4727 class TypeFeedbackCells: public FixedArray {
4736 public: 4728 public:
4737 int CellCount() { return length() / 2; } 4729 int CellCount() { return length() / 2; }
4738 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; } 4730 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; }
4739 4731
4740 // Accessors for AST ids associated with cache values. 4732 // Accessors for AST ids associated with cache values.
4741 inline TypeFeedbackId AstId(int index); 4733 inline TypeFeedbackId AstId(int index);
4742 inline void SetAstId(int index, TypeFeedbackId id); 4734 inline void SetAstId(int index, TypeFeedbackId id);
4743 4735
4744 // Accessors for global property cells holding the cache values. 4736 // Accessors for global property cells holding the cache values.
4745 inline Cell* GetCell(int index); 4737 inline Cell* GetCell(int index);
(...skipping 20 matching lines...) Expand all
4766 static const int kForInFastCaseMarker = 0; 4758 static const int kForInFastCaseMarker = 0;
4767 static const int kForInSlowCaseMarker = 1; 4759 static const int kForInSlowCaseMarker = 1;
4768 }; 4760 };
4769 4761
4770 4762
4771 // Forward declaration. 4763 // Forward declaration.
4772 class SafepointEntry; 4764 class SafepointEntry;
4773 class TypeFeedbackInfo; 4765 class TypeFeedbackInfo;
4774 4766
4775 // Code describes objects with on-the-fly generated machine code. 4767 // Code describes objects with on-the-fly generated machine code.
4776 class Code V8_FINAL : public HeapObject { 4768 class Code: public HeapObject {
4777 public: 4769 public:
4778 // Opaque data type for encapsulating code flags like kind, inline 4770 // Opaque data type for encapsulating code flags like kind, inline
4779 // cache state, and arguments count. 4771 // cache state, and arguments count.
4780 typedef uint32_t Flags; 4772 typedef uint32_t Flags;
4781 4773
4782 #define NON_IC_KIND_LIST(V) \ 4774 #define NON_IC_KIND_LIST(V) \
4783 V(FUNCTION) \ 4775 V(FUNCTION) \
4784 V(OPTIMIZED_FUNCTION) \ 4776 V(OPTIMIZED_FUNCTION) \
4785 V(STUB) \ 4777 V(STUB) \
4786 V(BUILTIN) \ 4778 V(BUILTIN) \
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
5337 // The first n elements are Smis, each of them specifies the number of codes 5329 // The first n elements are Smis, each of them specifies the number of codes
5338 // in the corresponding group. The subsequent elements contain grouped code 5330 // in the corresponding group. The subsequent elements contain grouped code
5339 // objects. The suffix of the array can be filled with the undefined value if 5331 // objects. The suffix of the array can be filled with the undefined value if
5340 // the number of codes is less than the length of the array. The order of the 5332 // the number of codes is less than the length of the array. The order of the
5341 // code objects within a group is not preserved. 5333 // code objects within a group is not preserved.
5342 // 5334 //
5343 // All code indexes used in the class are counted starting from the first 5335 // All code indexes used in the class are counted starting from the first
5344 // code object of the first group. In other words, code index 0 corresponds 5336 // code object of the first group. In other words, code index 0 corresponds
5345 // to array index n = kCodesStartIndex. 5337 // to array index n = kCodesStartIndex.
5346 5338
5347 class DependentCode V8_FINAL : public FixedArray { 5339 class DependentCode: public FixedArray {
5348 public: 5340 public:
5349 enum DependencyGroup { 5341 enum DependencyGroup {
5350 // Group of code that weakly embed this map and depend on being 5342 // Group of code that weakly embed this map and depend on being
5351 // deoptimized when the map is garbage collected. 5343 // deoptimized when the map is garbage collected.
5352 kWeaklyEmbeddedGroup, 5344 kWeaklyEmbeddedGroup,
5353 // Group of code that embed a transition to this map, and depend on being 5345 // Group of code that embed a transition to this map, and depend on being
5354 // deoptimized when the transition is replaced by a new version. 5346 // deoptimized when the transition is replaced by a new version.
5355 kTransitionGroup, 5347 kTransitionGroup,
5356 // Group of code that omit run-time prototype checks for prototypes 5348 // Group of code that omit run-time prototype checks for prototypes
5357 // described by this map. The group is deoptimized whenever an object 5349 // described by this map. The group is deoptimized whenever an object
5358 // described by this map changes shape (and transitions to a new map), 5350 // described by this map changes shape (and transitions to a new map),
5359 // possibly invalidating the assumptions embedded in the code. 5351 // possibly invalidating the assumptions embedded in the code.
5360 kPrototypeCheckGroup, 5352 kPrototypeCheckGroup,
5361 // Group of code that depends on elements not being added to objects with 5353 // Group of code that depends on elements not being added to objects with
5362 // this map. 5354 // this map.
5363 kElementsCantBeAddedGroup, 5355 kElementsCantBeAddedGroup,
5364 // Group of code that depends on global property values in property cells 5356 // Group of code that depends on global property values in property cells
5365 // not being changed. 5357 // not being changed.
5366 kPropertyCellChangedGroup, 5358 kPropertyCellChangedGroup,
5367 kGroupCount = kPropertyCellChangedGroup + 1 5359 kGroupCount = kPropertyCellChangedGroup + 1
5368 }; 5360 };
5369 5361
5370 // Array for holding the index of the first code object of each group. 5362 // Array for holding the index of the first code object of each group.
5371 // The last element stores the total number of code objects. 5363 // The last element stores the total number of code objects.
5372 class GroupStartIndexes V8_FINAL { 5364 class GroupStartIndexes {
5373 public: 5365 public:
5374 explicit GroupStartIndexes(DependentCode* entries); 5366 explicit GroupStartIndexes(DependentCode* entries);
5375 void Recompute(DependentCode* entries); 5367 void Recompute(DependentCode* entries);
5376 int at(int i) { return start_indexes_[i]; } 5368 int at(int i) { return start_indexes_[i]; }
5377 int number_of_entries() { return start_indexes_[kGroupCount]; } 5369 int number_of_entries() { return start_indexes_[kGroupCount]; }
5378 private: 5370 private:
5379 int start_indexes_[kGroupCount + 1]; 5371 int start_indexes_[kGroupCount + 1];
5380 }; 5372 };
5381 5373
5382 bool Contains(DependencyGroup group, Code* code); 5374 bool Contains(DependencyGroup group, Code* code);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5414 // code objects of the subsequent groups. 5406 // code objects of the subsequent groups.
5415 inline void ExtendGroup(DependencyGroup group); 5407 inline void ExtendGroup(DependencyGroup group);
5416 static const int kCodesStartIndex = kGroupCount; 5408 static const int kCodesStartIndex = kGroupCount;
5417 }; 5409 };
5418 5410
5419 5411
5420 // All heap objects have a Map that describes their structure. 5412 // All heap objects have a Map that describes their structure.
5421 // A Map contains information about: 5413 // A Map contains information about:
5422 // - Size information about the object 5414 // - Size information about the object
5423 // - How to iterate over an object (for garbage collection) 5415 // - How to iterate over an object (for garbage collection)
5424 class Map : public HeapObject { 5416 class Map: public HeapObject {
5425 public: 5417 public:
5426 // Instance size. 5418 // Instance size.
5427 // Size in bytes or kVariableSizeSentinel if instances do not have 5419 // Size in bytes or kVariableSizeSentinel if instances do not have
5428 // a fixed size. 5420 // a fixed size.
5429 inline int instance_size(); 5421 inline int instance_size();
5430 inline void set_instance_size(int value); 5422 inline void set_instance_size(int value);
5431 5423
5432 // Count of properties allocated in the object. 5424 // Count of properties allocated in the object.
5433 inline int inobject_properties(); 5425 inline int inobject_properties();
5434 inline void set_inobject_properties(int value); 5426 inline void set_inobject_properties(int value);
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
6068 // It doesn't carry much functionality but allows struct classes to be 6060 // It doesn't carry much functionality but allows struct classes to be
6069 // identified in the type system. 6061 // identified in the type system.
6070 class Struct: public HeapObject { 6062 class Struct: public HeapObject {
6071 public: 6063 public:
6072 inline void InitializeBody(int object_size); 6064 inline void InitializeBody(int object_size);
6073 static inline Struct* cast(Object* that); 6065 static inline Struct* cast(Object* that);
6074 }; 6066 };
6075 6067
6076 6068
6077 // A simple one-element struct, useful where smis need to be boxed. 6069 // A simple one-element struct, useful where smis need to be boxed.
6078 class Box V8_FINAL : public Struct { 6070 class Box : public Struct {
6079 public: 6071 public:
6080 // [value]: the boxed contents. 6072 // [value]: the boxed contents.
6081 DECL_ACCESSORS(value, Object) 6073 DECL_ACCESSORS(value, Object)
6082 6074
6083 static inline Box* cast(Object* obj); 6075 static inline Box* cast(Object* obj);
6084 6076
6085 // Dispatched behavior. 6077 // Dispatched behavior.
6086 DECLARE_PRINTER(Box) 6078 DECLARE_PRINTER(Box)
6087 DECLARE_VERIFIER(Box) 6079 DECLARE_VERIFIER(Box)
6088 6080
6089 static const int kValueOffset = HeapObject::kHeaderSize; 6081 static const int kValueOffset = HeapObject::kHeaderSize;
6090 static const int kSize = kValueOffset + kPointerSize; 6082 static const int kSize = kValueOffset + kPointerSize;
6091 6083
6092 private: 6084 private:
6093 DISALLOW_IMPLICIT_CONSTRUCTORS(Box); 6085 DISALLOW_IMPLICIT_CONSTRUCTORS(Box);
6094 }; 6086 };
6095 6087
6096 6088
6097 // Script describes a script which has been added to the VM. 6089 // Script describes a script which has been added to the VM.
6098 class Script V8_FINAL : public Struct { 6090 class Script: public Struct {
6099 public: 6091 public:
6100 // Script types. 6092 // Script types.
6101 enum Type { 6093 enum Type {
6102 TYPE_NATIVE = 0, 6094 TYPE_NATIVE = 0,
6103 TYPE_EXTENSION = 1, 6095 TYPE_EXTENSION = 1,
6104 TYPE_NORMAL = 2 6096 TYPE_NORMAL = 2
6105 }; 6097 };
6106 6098
6107 // Script compilation types. 6099 // Script compilation types.
6108 enum CompilationType { 6100 enum CompilationType {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
6257 #undef DECLARE_FUNCTION_ID 6249 #undef DECLARE_FUNCTION_ID
6258 // Fake id for a special case of Math.pow. Note, it continues the 6250 // Fake id for a special case of Math.pow. Note, it continues the
6259 // list of math functions. 6251 // list of math functions.
6260 kMathPowHalf, 6252 kMathPowHalf,
6261 kFirstMathFunctionId = kMathFloor 6253 kFirstMathFunctionId = kMathFloor
6262 }; 6254 };
6263 6255
6264 6256
6265 // SharedFunctionInfo describes the JSFunction information that can be 6257 // SharedFunctionInfo describes the JSFunction information that can be
6266 // shared by multiple instances of the function. 6258 // shared by multiple instances of the function.
6267 class SharedFunctionInfo V8_FINAL : public HeapObject { 6259 class SharedFunctionInfo: public HeapObject {
6268 public: 6260 public:
6269 // [name]: Function name. 6261 // [name]: Function name.
6270 DECL_ACCESSORS(name, Object) 6262 DECL_ACCESSORS(name, Object)
6271 6263
6272 // [code]: Function code. 6264 // [code]: Function code.
6273 DECL_ACCESSORS(code, Code) 6265 DECL_ACCESSORS(code, Code)
6274 inline void ReplaceCode(Code* code); 6266 inline void ReplaceCode(Code* code);
6275 6267
6276 // [optimized_code_map]: Map from native context to optimized code 6268 // [optimized_code_map]: Map from native context to optimized code
6277 // and a shared literals array or Smi(0) if none. 6269 // and a shared literals array or Smi(0) if none.
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
6836 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte); 6828 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte);
6837 #else 6829 #else
6838 #error Unknown byte ordering 6830 #error Unknown byte ordering
6839 #endif 6831 #endif
6840 6832
6841 private: 6833 private:
6842 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); 6834 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo);
6843 }; 6835 };
6844 6836
6845 6837
6846 class JSGeneratorObject V8_FINAL : public JSObject { 6838 class JSGeneratorObject: public JSObject {
6847 public: 6839 public:
6848 // [function]: The function corresponding to this generator object. 6840 // [function]: The function corresponding to this generator object.
6849 DECL_ACCESSORS(function, JSFunction) 6841 DECL_ACCESSORS(function, JSFunction)
6850 6842
6851 // [context]: The context of the suspended computation. 6843 // [context]: The context of the suspended computation.
6852 DECL_ACCESSORS(context, Context) 6844 DECL_ACCESSORS(context, Context)
6853 6845
6854 // [receiver]: The receiver of the suspended computation. 6846 // [receiver]: The receiver of the suspended computation.
6855 DECL_ACCESSORS(receiver, Object) 6847 DECL_ACCESSORS(receiver, Object)
6856 6848
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
6904 static const int kResultDonePropertyOffset = 6896 static const int kResultDonePropertyOffset =
6905 kResultValuePropertyOffset + kPointerSize; 6897 kResultValuePropertyOffset + kPointerSize;
6906 static const int kResultSize = kResultDonePropertyOffset + kPointerSize; 6898 static const int kResultSize = kResultDonePropertyOffset + kPointerSize;
6907 6899
6908 private: 6900 private:
6909 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject); 6901 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGeneratorObject);
6910 }; 6902 };
6911 6903
6912 6904
6913 // Representation for module instance objects. 6905 // Representation for module instance objects.
6914 class JSModule V8_FINAL : public JSObject { 6906 class JSModule: public JSObject {
6915 public: 6907 public:
6916 // [context]: the context holding the module's locals, or undefined if none. 6908 // [context]: the context holding the module's locals, or undefined if none.
6917 DECL_ACCESSORS(context, Object) 6909 DECL_ACCESSORS(context, Object)
6918 6910
6919 // [scope_info]: Scope info. 6911 // [scope_info]: Scope info.
6920 DECL_ACCESSORS(scope_info, ScopeInfo) 6912 DECL_ACCESSORS(scope_info, ScopeInfo)
6921 6913
6922 // Casting. 6914 // Casting.
6923 static inline JSModule* cast(Object* obj); 6915 static inline JSModule* cast(Object* obj);
6924 6916
6925 // Dispatched behavior. 6917 // Dispatched behavior.
6926 DECLARE_PRINTER(JSModule) 6918 DECLARE_PRINTER(JSModule)
6927 DECLARE_VERIFIER(JSModule) 6919 DECLARE_VERIFIER(JSModule)
6928 6920
6929 // Layout description. 6921 // Layout description.
6930 static const int kContextOffset = JSObject::kHeaderSize; 6922 static const int kContextOffset = JSObject::kHeaderSize;
6931 static const int kScopeInfoOffset = kContextOffset + kPointerSize; 6923 static const int kScopeInfoOffset = kContextOffset + kPointerSize;
6932 static const int kSize = kScopeInfoOffset + kPointerSize; 6924 static const int kSize = kScopeInfoOffset + kPointerSize;
6933 6925
6934 private: 6926 private:
6935 DISALLOW_IMPLICIT_CONSTRUCTORS(JSModule); 6927 DISALLOW_IMPLICIT_CONSTRUCTORS(JSModule);
6936 }; 6928 };
6937 6929
6938 6930
6939 // JSFunction describes JavaScript functions. 6931 // JSFunction describes JavaScript functions.
6940 class JSFunction V8_FINAL : public JSObject { 6932 class JSFunction: public JSObject {
6941 public: 6933 public:
6942 // [prototype_or_initial_map]: 6934 // [prototype_or_initial_map]:
6943 DECL_ACCESSORS(prototype_or_initial_map, Object) 6935 DECL_ACCESSORS(prototype_or_initial_map, Object)
6944 6936
6945 // [shared]: The information about the function that 6937 // [shared]: The information about the function that
6946 // can be shared by instances. 6938 // can be shared by instances.
6947 DECL_ACCESSORS(shared, SharedFunctionInfo) 6939 DECL_ACCESSORS(shared, SharedFunctionInfo)
6948 6940
6949 // [context]: The context for this function. 6941 // [context]: The context for this function.
6950 inline Context* context(); 6942 inline Context* context();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
7117 7109
7118 7110
7119 // JSGlobalProxy's prototype must be a JSGlobalObject or null, 7111 // JSGlobalProxy's prototype must be a JSGlobalObject or null,
7120 // and the prototype is hidden. JSGlobalProxy always delegates 7112 // and the prototype is hidden. JSGlobalProxy always delegates
7121 // property accesses to its prototype if the prototype is not null. 7113 // property accesses to its prototype if the prototype is not null.
7122 // 7114 //
7123 // A JSGlobalProxy can be reinitialized which will preserve its identity. 7115 // A JSGlobalProxy can be reinitialized which will preserve its identity.
7124 // 7116 //
7125 // Accessing a JSGlobalProxy requires security check. 7117 // Accessing a JSGlobalProxy requires security check.
7126 7118
7127 class JSGlobalProxy V8_FINAL : public JSObject { 7119 class JSGlobalProxy : public JSObject {
7128 public: 7120 public:
7129 // [native_context]: the owner native context of this global proxy object. 7121 // [native_context]: the owner native context of this global proxy object.
7130 // It is null value if this object is not used by any context. 7122 // It is null value if this object is not used by any context.
7131 DECL_ACCESSORS(native_context, Object) 7123 DECL_ACCESSORS(native_context, Object)
7132 7124
7133 // Casting. 7125 // Casting.
7134 static inline JSGlobalProxy* cast(Object* obj); 7126 static inline JSGlobalProxy* cast(Object* obj);
7135 7127
7136 // Dispatched behavior. 7128 // Dispatched behavior.
7137 DECLARE_PRINTER(JSGlobalProxy) 7129 DECLARE_PRINTER(JSGlobalProxy)
7138 DECLARE_VERIFIER(JSGlobalProxy) 7130 DECLARE_VERIFIER(JSGlobalProxy)
7139 7131
7140 // Layout description. 7132 // Layout description.
7141 static const int kNativeContextOffset = JSObject::kHeaderSize; 7133 static const int kNativeContextOffset = JSObject::kHeaderSize;
7142 static const int kSize = kNativeContextOffset + kPointerSize; 7134 static const int kSize = kNativeContextOffset + kPointerSize;
7143 7135
7144 private: 7136 private:
7145 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); 7137 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy);
7146 }; 7138 };
7147 7139
7148 7140
7149 // Forward declaration. 7141 // Forward declaration.
7150 class JSBuiltinsObject; 7142 class JSBuiltinsObject;
7151 7143
7152 // Common super class for JavaScript global objects and the special 7144 // Common super class for JavaScript global objects and the special
7153 // builtins global objects. 7145 // builtins global objects.
7154 class GlobalObject : public JSObject { 7146 class GlobalObject: public JSObject {
7155 public: 7147 public:
7156 // [builtins]: the object holding the runtime routines written in JS. 7148 // [builtins]: the object holding the runtime routines written in JS.
7157 DECL_ACCESSORS(builtins, JSBuiltinsObject) 7149 DECL_ACCESSORS(builtins, JSBuiltinsObject)
7158 7150
7159 // [native context]: the natives corresponding to this global object. 7151 // [native context]: the natives corresponding to this global object.
7160 DECL_ACCESSORS(native_context, Context) 7152 DECL_ACCESSORS(native_context, Context)
7161 7153
7162 // [global context]: the most recent (i.e. innermost) global context. 7154 // [global context]: the most recent (i.e. innermost) global context.
7163 DECL_ACCESSORS(global_context, Context) 7155 DECL_ACCESSORS(global_context, Context)
7164 7156
(...skipping 25 matching lines...) Expand all
7190 static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize; 7182 static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize;
7191 static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize; 7183 static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize;
7192 static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize; 7184 static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize;
7193 7185
7194 private: 7186 private:
7195 DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalObject); 7187 DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalObject);
7196 }; 7188 };
7197 7189
7198 7190
7199 // JavaScript global object. 7191 // JavaScript global object.
7200 class JSGlobalObject V8_FINAL : public GlobalObject { 7192 class JSGlobalObject: public GlobalObject {
7201 public: 7193 public:
7202 // Casting. 7194 // Casting.
7203 static inline JSGlobalObject* cast(Object* obj); 7195 static inline JSGlobalObject* cast(Object* obj);
7204 7196
7205 // Dispatched behavior. 7197 // Dispatched behavior.
7206 DECLARE_PRINTER(JSGlobalObject) 7198 DECLARE_PRINTER(JSGlobalObject)
7207 DECLARE_VERIFIER(JSGlobalObject) 7199 DECLARE_VERIFIER(JSGlobalObject)
7208 7200
7209 // Layout description. 7201 // Layout description.
7210 static const int kSize = GlobalObject::kHeaderSize; 7202 static const int kSize = GlobalObject::kHeaderSize;
7211 7203
7212 private: 7204 private:
7213 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject); 7205 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject);
7214 }; 7206 };
7215 7207
7216 7208
7217 // Builtins global object which holds the runtime routines written in 7209 // Builtins global object which holds the runtime routines written in
7218 // JavaScript. 7210 // JavaScript.
7219 class JSBuiltinsObject V8_FINAL : public GlobalObject { 7211 class JSBuiltinsObject: public GlobalObject {
7220 public: 7212 public:
7221 // Accessors for the runtime routines written in JavaScript. 7213 // Accessors for the runtime routines written in JavaScript.
7222 inline Object* javascript_builtin(Builtins::JavaScript id); 7214 inline Object* javascript_builtin(Builtins::JavaScript id);
7223 inline void set_javascript_builtin(Builtins::JavaScript id, Object* value); 7215 inline void set_javascript_builtin(Builtins::JavaScript id, Object* value);
7224 7216
7225 // Accessors for code of the runtime routines written in JavaScript. 7217 // Accessors for code of the runtime routines written in JavaScript.
7226 inline Code* javascript_builtin_code(Builtins::JavaScript id); 7218 inline Code* javascript_builtin_code(Builtins::JavaScript id);
7227 inline void set_javascript_builtin_code(Builtins::JavaScript id, Code* value); 7219 inline void set_javascript_builtin_code(Builtins::JavaScript id, Code* value);
7228 7220
7229 // Casting. 7221 // Casting.
(...skipping 20 matching lines...) Expand all
7250 static int OffsetOfCodeWithId(Builtins::JavaScript id) { 7242 static int OffsetOfCodeWithId(Builtins::JavaScript id) {
7251 return kJSBuiltinsCodeOffset + id * kPointerSize; 7243 return kJSBuiltinsCodeOffset + id * kPointerSize;
7252 } 7244 }
7253 7245
7254 private: 7246 private:
7255 DISALLOW_IMPLICIT_CONSTRUCTORS(JSBuiltinsObject); 7247 DISALLOW_IMPLICIT_CONSTRUCTORS(JSBuiltinsObject);
7256 }; 7248 };
7257 7249
7258 7250
7259 // Representation for JS Wrapper objects, String, Number, Boolean, etc. 7251 // Representation for JS Wrapper objects, String, Number, Boolean, etc.
7260 class JSValue V8_FINAL : public JSObject { 7252 class JSValue: public JSObject {
7261 public: 7253 public:
7262 // [value]: the object being wrapped. 7254 // [value]: the object being wrapped.
7263 DECL_ACCESSORS(value, Object) 7255 DECL_ACCESSORS(value, Object)
7264 7256
7265 // Casting. 7257 // Casting.
7266 static inline JSValue* cast(Object* obj); 7258 static inline JSValue* cast(Object* obj);
7267 7259
7268 // Dispatched behavior. 7260 // Dispatched behavior.
7269 DECLARE_PRINTER(JSValue) 7261 DECLARE_PRINTER(JSValue)
7270 DECLARE_VERIFIER(JSValue) 7262 DECLARE_VERIFIER(JSValue)
7271 7263
7272 // Layout description. 7264 // Layout description.
7273 static const int kValueOffset = JSObject::kHeaderSize; 7265 static const int kValueOffset = JSObject::kHeaderSize;
7274 static const int kSize = kValueOffset + kPointerSize; 7266 static const int kSize = kValueOffset + kPointerSize;
7275 7267
7276 private: 7268 private:
7277 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); 7269 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue);
7278 }; 7270 };
7279 7271
7280 7272
7281 class DateCache; 7273 class DateCache;
7282 7274
7283 // Representation for JS date objects. 7275 // Representation for JS date objects.
7284 class JSDate V8_FINAL : public JSObject { 7276 class JSDate: public JSObject {
7285 public: 7277 public:
7286 // If one component is NaN, all of them are, indicating a NaN time value. 7278 // If one component is NaN, all of them are, indicating a NaN time value.
7287 // [value]: the time value. 7279 // [value]: the time value.
7288 DECL_ACCESSORS(value, Object) 7280 DECL_ACCESSORS(value, Object)
7289 // [year]: caches year. Either undefined, smi, or NaN. 7281 // [year]: caches year. Either undefined, smi, or NaN.
7290 DECL_ACCESSORS(year, Object) 7282 DECL_ACCESSORS(year, Object)
7291 // [month]: caches month. Either undefined, smi, or NaN. 7283 // [month]: caches month. Either undefined, smi, or NaN.
7292 DECL_ACCESSORS(month, Object) 7284 DECL_ACCESSORS(month, Object)
7293 // [day]: caches day. Either undefined, smi, or NaN. 7285 // [day]: caches day. Either undefined, smi, or NaN.
7294 DECL_ACCESSORS(day, Object) 7286 DECL_ACCESSORS(day, Object)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
7371 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDate); 7363 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDate);
7372 }; 7364 };
7373 7365
7374 7366
7375 // Representation of message objects used for error reporting through 7367 // Representation of message objects used for error reporting through
7376 // the API. The messages are formatted in JavaScript so this object is 7368 // the API. The messages are formatted in JavaScript so this object is
7377 // a real JavaScript object. The information used for formatting the 7369 // a real JavaScript object. The information used for formatting the
7378 // error messages are not directly accessible from JavaScript to 7370 // error messages are not directly accessible from JavaScript to
7379 // prevent leaking information to user code called during error 7371 // prevent leaking information to user code called during error
7380 // formatting. 7372 // formatting.
7381 class JSMessageObject V8_FINAL : public JSObject { 7373 class JSMessageObject: public JSObject {
7382 public: 7374 public:
7383 // [type]: the type of error message. 7375 // [type]: the type of error message.
7384 DECL_ACCESSORS(type, String) 7376 DECL_ACCESSORS(type, String)
7385 7377
7386 // [arguments]: the arguments for formatting the error message. 7378 // [arguments]: the arguments for formatting the error message.
7387 DECL_ACCESSORS(arguments, JSArray) 7379 DECL_ACCESSORS(arguments, JSArray)
7388 7380
7389 // [script]: the script from which the error message originated. 7381 // [script]: the script from which the error message originated.
7390 DECL_ACCESSORS(script, Object) 7382 DECL_ACCESSORS(script, Object)
7391 7383
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
7435 // - reference to the original flag string 7427 // - reference to the original flag string
7436 // If it is an atom regexp 7428 // If it is an atom regexp
7437 // - a reference to a literal string to search for 7429 // - a reference to a literal string to search for
7438 // If it is an irregexp regexp: 7430 // If it is an irregexp regexp:
7439 // - a reference to code for ASCII inputs (bytecode or compiled), or a smi 7431 // - a reference to code for ASCII inputs (bytecode or compiled), or a smi
7440 // used for tracking the last usage (used for code flushing). 7432 // used for tracking the last usage (used for code flushing).
7441 // - a reference to code for UC16 inputs (bytecode or compiled), or a smi 7433 // - a reference to code for UC16 inputs (bytecode or compiled), or a smi
7442 // used for tracking the last usage (used for code flushing).. 7434 // used for tracking the last usage (used for code flushing)..
7443 // - max number of registers used by irregexp implementations. 7435 // - max number of registers used by irregexp implementations.
7444 // - number of capture registers (output values) of the regexp. 7436 // - number of capture registers (output values) of the regexp.
7445 class JSRegExp V8_FINAL : public JSObject { 7437 class JSRegExp: public JSObject {
7446 public: 7438 public:
7447 // Meaning of Type: 7439 // Meaning of Type:
7448 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. 7440 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet.
7449 // ATOM: A simple string to match against using an indexOf operation. 7441 // ATOM: A simple string to match against using an indexOf operation.
7450 // IRREGEXP: Compiled with Irregexp. 7442 // IRREGEXP: Compiled with Irregexp.
7451 // IRREGEXP_NATIVE: Compiled to native code with Irregexp. 7443 // IRREGEXP_NATIVE: Compiled to native code with Irregexp.
7452 enum Type { NOT_COMPILED, ATOM, IRREGEXP }; 7444 enum Type { NOT_COMPILED, ATOM, IRREGEXP };
7453 enum Flag { NONE = 0, GLOBAL = 1, IGNORE_CASE = 2, MULTILINE = 4 }; 7445 enum Flag { NONE = 0, GLOBAL = 1, IGNORE_CASE = 2, MULTILINE = 4 };
7454 7446
7455 class Flags { 7447 class Flags {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
7558 // object is in the saved code field. 7550 // object is in the saved code field.
7559 static const int kCompilationErrorValue = -2; 7551 static const int kCompilationErrorValue = -2;
7560 7552
7561 // When we store the sweep generation at which we moved the code from the 7553 // When we store the sweep generation at which we moved the code from the
7562 // code index to the saved code index we mask it of to be in the [0:255] 7554 // code index to the saved code index we mask it of to be in the [0:255]
7563 // range. 7555 // range.
7564 static const int kCodeAgeMask = 0xff; 7556 static const int kCodeAgeMask = 0xff;
7565 }; 7557 };
7566 7558
7567 7559
7568 class CompilationCacheShape V8_FINAL : public BaseShape<HashTableKey*> { 7560 class CompilationCacheShape : public BaseShape<HashTableKey*> {
7569 public: 7561 public:
7570 static inline bool IsMatch(HashTableKey* key, Object* value) { 7562 static inline bool IsMatch(HashTableKey* key, Object* value) {
7571 return key->IsMatch(value); 7563 return key->IsMatch(value);
7572 } 7564 }
7573 7565
7574 static inline uint32_t Hash(HashTableKey* key) { 7566 static inline uint32_t Hash(HashTableKey* key) {
7575 return key->Hash(); 7567 return key->Hash();
7576 } 7568 }
7577 7569
7578 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { 7570 static inline uint32_t HashForObject(HashTableKey* key, Object* object) {
7579 return key->HashForObject(object); 7571 return key->HashForObject(object);
7580 } 7572 }
7581 7573
7582 MUST_USE_RESULT static MaybeObject* AsObject(Heap* heap, 7574 MUST_USE_RESULT static MaybeObject* AsObject(Heap* heap,
7583 HashTableKey* key) { 7575 HashTableKey* key) {
7584 return key->AsObject(heap); 7576 return key->AsObject(heap);
7585 } 7577 }
7586 7578
7587 static const int kPrefixSize = 0; 7579 static const int kPrefixSize = 0;
7588 static const int kEntrySize = 2; 7580 static const int kEntrySize = 2;
7589 }; 7581 };
7590 7582
7591 7583
7592 class CompilationCacheTable V8_FINAL : public HashTable<CompilationCacheShape, 7584 class CompilationCacheTable: public HashTable<CompilationCacheShape,
7593 HashTableKey*> { 7585 HashTableKey*> {
7594 public: 7586 public:
7595 // Find cached value for a string key, otherwise return null. 7587 // Find cached value for a string key, otherwise return null.
7596 Object* Lookup(String* src, Context* context); 7588 Object* Lookup(String* src, Context* context);
7597 Object* LookupEval(String* src, 7589 Object* LookupEval(String* src,
7598 Context* context, 7590 Context* context,
7599 LanguageMode language_mode, 7591 LanguageMode language_mode,
7600 int scope_position); 7592 int scope_position);
7601 Object* LookupRegExp(String* source, JSRegExp::Flags flags); 7593 Object* LookupRegExp(String* source, JSRegExp::Flags flags);
7602 MUST_USE_RESULT MaybeObject* Put(String* src, 7594 MUST_USE_RESULT MaybeObject* Put(String* src,
7603 Context* context, 7595 Context* context,
7604 Object* value); 7596 Object* value);
7605 MUST_USE_RESULT MaybeObject* PutEval(String* src, 7597 MUST_USE_RESULT MaybeObject* PutEval(String* src,
7606 Context* context, 7598 Context* context,
7607 SharedFunctionInfo* value, 7599 SharedFunctionInfo* value,
7608 int scope_position); 7600 int scope_position);
7609 MUST_USE_RESULT MaybeObject* PutRegExp(String* src, 7601 MUST_USE_RESULT MaybeObject* PutRegExp(String* src,
7610 JSRegExp::Flags flags, 7602 JSRegExp::Flags flags,
7611 FixedArray* value); 7603 FixedArray* value);
7612 7604
7613 // Remove given value from cache. 7605 // Remove given value from cache.
7614 void Remove(Object* value); 7606 void Remove(Object* value);
7615 7607
7616 static inline CompilationCacheTable* cast(Object* obj); 7608 static inline CompilationCacheTable* cast(Object* obj);
7617 7609
7618 private: 7610 private:
7619 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); 7611 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable);
7620 }; 7612 };
7621 7613
7622 7614
7623 class CodeCache V8_FINAL : public Struct { 7615 class CodeCache: public Struct {
7624 public: 7616 public:
7625 DECL_ACCESSORS(default_cache, FixedArray) 7617 DECL_ACCESSORS(default_cache, FixedArray)
7626 DECL_ACCESSORS(normal_type_cache, Object) 7618 DECL_ACCESSORS(normal_type_cache, Object)
7627 7619
7628 // Add the code object to the cache. 7620 // Add the code object to the cache.
7629 MUST_USE_RESULT MaybeObject* Update(Name* name, Code* code); 7621 MUST_USE_RESULT MaybeObject* Update(Name* name, Code* code);
7630 7622
7631 // Lookup code object in the cache. Returns code object if found and undefined 7623 // Lookup code object in the cache. Returns code object if found and undefined
7632 // if not. 7624 // if not.
7633 Object* Lookup(Name* name, Code::Flags flags); 7625 Object* Lookup(Name* name, Code::Flags flags);
(...skipping 27 matching lines...) Expand all
7661 // Code cache layout of the default cache. Elements are alternating name and 7653 // Code cache layout of the default cache. Elements are alternating name and
7662 // code objects for non normal load/store/call IC's. 7654 // code objects for non normal load/store/call IC's.
7663 static const int kCodeCacheEntrySize = 2; 7655 static const int kCodeCacheEntrySize = 2;
7664 static const int kCodeCacheEntryNameOffset = 0; 7656 static const int kCodeCacheEntryNameOffset = 0;
7665 static const int kCodeCacheEntryCodeOffset = 1; 7657 static const int kCodeCacheEntryCodeOffset = 1;
7666 7658
7667 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCache); 7659 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCache);
7668 }; 7660 };
7669 7661
7670 7662
7671 class CodeCacheHashTableShape V8_FINAL : public BaseShape<HashTableKey*> { 7663 class CodeCacheHashTableShape : public BaseShape<HashTableKey*> {
7672 public: 7664 public:
7673 static inline bool IsMatch(HashTableKey* key, Object* value) { 7665 static inline bool IsMatch(HashTableKey* key, Object* value) {
7674 return key->IsMatch(value); 7666 return key->IsMatch(value);
7675 } 7667 }
7676 7668
7677 static inline uint32_t Hash(HashTableKey* key) { 7669 static inline uint32_t Hash(HashTableKey* key) {
7678 return key->Hash(); 7670 return key->Hash();
7679 } 7671 }
7680 7672
7681 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { 7673 static inline uint32_t HashForObject(HashTableKey* key, Object* object) {
7682 return key->HashForObject(object); 7674 return key->HashForObject(object);
7683 } 7675 }
7684 7676
7685 MUST_USE_RESULT static MaybeObject* AsObject(Heap* heap, 7677 MUST_USE_RESULT static MaybeObject* AsObject(Heap* heap,
7686 HashTableKey* key) { 7678 HashTableKey* key) {
7687 return key->AsObject(heap); 7679 return key->AsObject(heap);
7688 } 7680 }
7689 7681
7690 static const int kPrefixSize = 0; 7682 static const int kPrefixSize = 0;
7691 static const int kEntrySize = 2; 7683 static const int kEntrySize = 2;
7692 }; 7684 };
7693 7685
7694 7686
7695 class CodeCacheHashTable V8_FINAL : public HashTable<CodeCacheHashTableShape, 7687 class CodeCacheHashTable: public HashTable<CodeCacheHashTableShape,
7696 HashTableKey*> { 7688 HashTableKey*> {
7697 public: 7689 public:
7698 Object* Lookup(Name* name, Code::Flags flags); 7690 Object* Lookup(Name* name, Code::Flags flags);
7699 MUST_USE_RESULT MaybeObject* Put(Name* name, Code* code); 7691 MUST_USE_RESULT MaybeObject* Put(Name* name, Code* code);
7700 7692
7701 int GetIndex(Name* name, Code::Flags flags); 7693 int GetIndex(Name* name, Code::Flags flags);
7702 void RemoveByIndex(int index); 7694 void RemoveByIndex(int index);
7703 7695
7704 static inline CodeCacheHashTable* cast(Object* obj); 7696 static inline CodeCacheHashTable* cast(Object* obj);
7705 7697
7706 // Initial size of the fixed array backing the hash table. 7698 // Initial size of the fixed array backing the hash table.
7707 static const int kInitialSize = 64; 7699 static const int kInitialSize = 64;
7708 7700
7709 private: 7701 private:
7710 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); 7702 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable);
7711 }; 7703 };
7712 7704
7713 7705
7714 class PolymorphicCodeCache V8_FINAL : public Struct { 7706 class PolymorphicCodeCache: public Struct {
7715 public: 7707 public:
7716 DECL_ACCESSORS(cache, Object) 7708 DECL_ACCESSORS(cache, Object)
7717 7709
7718 static void Update(Handle<PolymorphicCodeCache> cache, 7710 static void Update(Handle<PolymorphicCodeCache> cache,
7719 MapHandleList* maps, 7711 MapHandleList* maps,
7720 Code::Flags flags, 7712 Code::Flags flags,
7721 Handle<Code> code); 7713 Handle<Code> code);
7722 7714
7723 MUST_USE_RESULT MaybeObject* Update(MapHandleList* maps, 7715 MUST_USE_RESULT MaybeObject* Update(MapHandleList* maps,
7724 Code::Flags flags, 7716 Code::Flags flags,
7725 Code* code); 7717 Code* code);
7726 7718
7727 // Returns an undefined value if the entry is not found. 7719 // Returns an undefined value if the entry is not found.
7728 Handle<Object> Lookup(MapHandleList* maps, Code::Flags flags); 7720 Handle<Object> Lookup(MapHandleList* maps, Code::Flags flags);
7729 7721
7730 static inline PolymorphicCodeCache* cast(Object* obj); 7722 static inline PolymorphicCodeCache* cast(Object* obj);
7731 7723
7732 // Dispatched behavior. 7724 // Dispatched behavior.
7733 DECLARE_PRINTER(PolymorphicCodeCache) 7725 DECLARE_PRINTER(PolymorphicCodeCache)
7734 DECLARE_VERIFIER(PolymorphicCodeCache) 7726 DECLARE_VERIFIER(PolymorphicCodeCache)
7735 7727
7736 static const int kCacheOffset = HeapObject::kHeaderSize; 7728 static const int kCacheOffset = HeapObject::kHeaderSize;
7737 static const int kSize = kCacheOffset + kPointerSize; 7729 static const int kSize = kCacheOffset + kPointerSize;
7738 7730
7739 private: 7731 private:
7740 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCache); 7732 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCache);
7741 }; 7733 };
7742 7734
7743 7735
7744 class PolymorphicCodeCacheHashTable V8_FINAL 7736 class PolymorphicCodeCacheHashTable
7745 : public HashTable<CodeCacheHashTableShape, HashTableKey*> { 7737 : public HashTable<CodeCacheHashTableShape, HashTableKey*> {
7746 public: 7738 public:
7747 Object* Lookup(MapHandleList* maps, int code_kind); 7739 Object* Lookup(MapHandleList* maps, int code_kind);
7748 7740
7749 MUST_USE_RESULT MaybeObject* Put(MapHandleList* maps, 7741 MUST_USE_RESULT MaybeObject* Put(MapHandleList* maps,
7750 int code_kind, 7742 int code_kind,
7751 Code* code); 7743 Code* code);
7752 7744
7753 static inline PolymorphicCodeCacheHashTable* cast(Object* obj); 7745 static inline PolymorphicCodeCacheHashTable* cast(Object* obj);
7754 7746
7755 static const int kInitialSize = 64; 7747 static const int kInitialSize = 64;
7756 private: 7748 private:
7757 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable); 7749 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable);
7758 }; 7750 };
7759 7751
7760 7752
7761 class TypeFeedbackInfo V8_FINAL : public Struct { 7753 class TypeFeedbackInfo: public Struct {
7762 public: 7754 public:
7763 inline int ic_total_count(); 7755 inline int ic_total_count();
7764 inline void set_ic_total_count(int count); 7756 inline void set_ic_total_count(int count);
7765 7757
7766 inline int ic_with_type_info_count(); 7758 inline int ic_with_type_info_count();
7767 inline void change_ic_with_type_info_count(int count); 7759 inline void change_ic_with_type_info_count(int count);
7768 7760
7769 inline void initialize_storage(); 7761 inline void initialize_storage();
7770 7762
7771 inline void change_own_type_change_checksum(); 7763 inline void change_own_type_change_checksum();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
7805 }; 7797 };
7806 7798
7807 7799
7808 enum AllocationSiteMode { 7800 enum AllocationSiteMode {
7809 DONT_TRACK_ALLOCATION_SITE, 7801 DONT_TRACK_ALLOCATION_SITE,
7810 TRACK_ALLOCATION_SITE, 7802 TRACK_ALLOCATION_SITE,
7811 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE 7803 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE
7812 }; 7804 };
7813 7805
7814 7806
7815 class AllocationSite V8_FINAL : public Struct { 7807 class AllocationSite: public Struct {
7816 public: 7808 public:
7817 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; 7809 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
7818 7810
7819 DECL_ACCESSORS(transition_info, Object) 7811 DECL_ACCESSORS(transition_info, Object)
7820 DECL_ACCESSORS(weak_next, Object) 7812 DECL_ACCESSORS(weak_next, Object)
7821 7813
7822 void Initialize() { 7814 void Initialize() {
7823 SetElementsKind(GetInitialFastElementsKind()); 7815 SetElementsKind(GetInitialFastElementsKind());
7824 } 7816 }
7825 7817
(...skipping 27 matching lines...) Expand all
7853 7845
7854 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, 7846 typedef FixedBodyDescriptor<HeapObject::kHeaderSize,
7855 kTransitionInfoOffset + kPointerSize, 7847 kTransitionInfoOffset + kPointerSize,
7856 kSize> BodyDescriptor; 7848 kSize> BodyDescriptor;
7857 7849
7858 private: 7850 private:
7859 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); 7851 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite);
7860 }; 7852 };
7861 7853
7862 7854
7863 class AllocationMemento V8_FINAL : public Struct { 7855 class AllocationMemento: public Struct {
7864 public: 7856 public:
7865 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; 7857 static const int kAllocationSiteOffset = HeapObject::kHeaderSize;
7866 static const int kSize = kAllocationSiteOffset + kPointerSize; 7858 static const int kSize = kAllocationSiteOffset + kPointerSize;
7867 7859
7868 DECL_ACCESSORS(allocation_site, Object) 7860 DECL_ACCESSORS(allocation_site, Object)
7869 7861
7870 bool IsValid() { return allocation_site()->IsAllocationSite(); } 7862 bool IsValid() { return allocation_site()->IsAllocationSite(); }
7871 AllocationSite* GetAllocationSite() { 7863 AllocationSite* GetAllocationSite() {
7872 ASSERT(IsValid()); 7864 ASSERT(IsValid());
7873 return AllocationSite::cast(allocation_site()); 7865 return AllocationSite::cast(allocation_site());
(...skipping 12 matching lines...) Expand all
7886 7878
7887 7879
7888 // Representation of a slow alias as part of a non-strict arguments objects. 7880 // Representation of a slow alias as part of a non-strict arguments objects.
7889 // For fast aliases (if HasNonStrictArgumentsElements()): 7881 // For fast aliases (if HasNonStrictArgumentsElements()):
7890 // - the parameter map contains an index into the context 7882 // - the parameter map contains an index into the context
7891 // - all attributes of the element have default values 7883 // - all attributes of the element have default values
7892 // For slow aliases (if HasDictionaryArgumentsElements()): 7884 // For slow aliases (if HasDictionaryArgumentsElements()):
7893 // - the parameter map contains no fast alias mapping (i.e. the hole) 7885 // - the parameter map contains no fast alias mapping (i.e. the hole)
7894 // - this struct (in the slow backing store) contains an index into the context 7886 // - this struct (in the slow backing store) contains an index into the context
7895 // - all attributes are available as part if the property details 7887 // - all attributes are available as part if the property details
7896 class AliasedArgumentsEntry V8_FINAL : public Struct { 7888 class AliasedArgumentsEntry: public Struct {
7897 public: 7889 public:
7898 inline int aliased_context_slot(); 7890 inline int aliased_context_slot();
7899 inline void set_aliased_context_slot(int count); 7891 inline void set_aliased_context_slot(int count);
7900 7892
7901 static inline AliasedArgumentsEntry* cast(Object* obj); 7893 static inline AliasedArgumentsEntry* cast(Object* obj);
7902 7894
7903 // Dispatched behavior. 7895 // Dispatched behavior.
7904 DECLARE_PRINTER(AliasedArgumentsEntry) 7896 DECLARE_PRINTER(AliasedArgumentsEntry)
7905 DECLARE_VERIFIER(AliasedArgumentsEntry) 7897 DECLARE_VERIFIER(AliasedArgumentsEntry)
7906 7898
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
7974 // few bits of information is moderately expensive, involving two memory 7966 // few bits of information is moderately expensive, involving two memory
7975 // loads where the second is dependent on the first. To improve efficiency 7967 // loads where the second is dependent on the first. To improve efficiency
7976 // the shape of the string is given its own class so that it can be retrieved 7968 // the shape of the string is given its own class so that it can be retrieved
7977 // once and used for several string operations. A StringShape is small enough 7969 // once and used for several string operations. A StringShape is small enough
7978 // to be passed by value and is immutable, but be aware that flattening a 7970 // to be passed by value and is immutable, but be aware that flattening a
7979 // string can potentially alter its shape. Also be aware that a GC caused by 7971 // string can potentially alter its shape. Also be aware that a GC caused by
7980 // something else can alter the shape of a string due to ConsString 7972 // something else can alter the shape of a string due to ConsString
7981 // shortcutting. Keeping these restrictions in mind has proven to be error- 7973 // shortcutting. Keeping these restrictions in mind has proven to be error-
7982 // prone and so we no longer put StringShapes in variables unless there is a 7974 // prone and so we no longer put StringShapes in variables unless there is a
7983 // concrete performance benefit at that particular point in the code. 7975 // concrete performance benefit at that particular point in the code.
7984 class StringShape V8_FINAL BASE_EMBEDDED { 7976 class StringShape BASE_EMBEDDED {
7985 public: 7977 public:
7986 inline explicit StringShape(String* s); 7978 inline explicit StringShape(String* s);
7987 inline explicit StringShape(Map* s); 7979 inline explicit StringShape(Map* s);
7988 inline explicit StringShape(InstanceType t); 7980 inline explicit StringShape(InstanceType t);
7989 inline bool IsSequential(); 7981 inline bool IsSequential();
7990 inline bool IsExternal(); 7982 inline bool IsExternal();
7991 inline bool IsCons(); 7983 inline bool IsCons();
7992 inline bool IsSliced(); 7984 inline bool IsSliced();
7993 inline bool IsIndirect(); 7985 inline bool IsIndirect();
7994 inline bool IsExternalAscii(); 7986 inline bool IsExternalAscii();
(...skipping 19 matching lines...) Expand all
8014 inline void set_valid() { valid_ = true; } 8006 inline void set_valid() { valid_ = true; }
8015 bool valid_; 8007 bool valid_;
8016 #else 8008 #else
8017 inline void set_valid() { } 8009 inline void set_valid() { }
8018 #endif 8010 #endif
8019 }; 8011 };
8020 8012
8021 8013
8022 // The Name abstract class captures anything that can be used as a property 8014 // The Name abstract class captures anything that can be used as a property
8023 // name, i.e., strings and symbols. All names store a hash value. 8015 // name, i.e., strings and symbols. All names store a hash value.
8024 class Name : public HeapObject { 8016 class Name: public HeapObject {
8025 public: 8017 public:
8026 // Get and set the hash field of the name. 8018 // Get and set the hash field of the name.
8027 inline uint32_t hash_field(); 8019 inline uint32_t hash_field();
8028 inline void set_hash_field(uint32_t value); 8020 inline void set_hash_field(uint32_t value);
8029 8021
8030 // Tells whether the hash code has been computed. 8022 // Tells whether the hash code has been computed.
8031 inline bool HasHashCode(); 8023 inline bool HasHashCode();
8032 8024
8033 // Returns a hash value used for the property table 8025 // Returns a hash value used for the property table
8034 inline uint32_t Hash(); 8026 inline uint32_t Hash();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
8099 8091
8100 protected: 8092 protected:
8101 static inline bool IsHashFieldComputed(uint32_t field); 8093 static inline bool IsHashFieldComputed(uint32_t field);
8102 8094
8103 private: 8095 private:
8104 DISALLOW_IMPLICIT_CONSTRUCTORS(Name); 8096 DISALLOW_IMPLICIT_CONSTRUCTORS(Name);
8105 }; 8097 };
8106 8098
8107 8099
8108 // ES6 symbols. 8100 // ES6 symbols.
8109 class Symbol V8_FINAL : public Name { 8101 class Symbol: public Name {
8110 public: 8102 public:
8111 // [name]: the print name of a symbol, or undefined if none. 8103 // [name]: the print name of a symbol, or undefined if none.
8112 DECL_ACCESSORS(name, Object) 8104 DECL_ACCESSORS(name, Object)
8113 8105
8114 // Casting. 8106 // Casting.
8115 static inline Symbol* cast(Object* obj); 8107 static inline Symbol* cast(Object* obj);
8116 8108
8117 // Dispatched behavior. 8109 // Dispatched behavior.
8118 DECLARE_PRINTER(Symbol) 8110 DECLARE_PRINTER(Symbol)
8119 DECLARE_VERIFIER(Symbol) 8111 DECLARE_VERIFIER(Symbol)
(...skipping 13 matching lines...) Expand all
8133 class ConsString; 8125 class ConsString;
8134 8126
8135 // The String abstract class captures JavaScript string values: 8127 // The String abstract class captures JavaScript string values:
8136 // 8128 //
8137 // Ecma-262: 8129 // Ecma-262:
8138 // 4.3.16 String Value 8130 // 4.3.16 String Value
8139 // A string value is a member of the type String and is a finite 8131 // A string value is a member of the type String and is a finite
8140 // ordered sequence of zero or more 16-bit unsigned integer values. 8132 // ordered sequence of zero or more 16-bit unsigned integer values.
8141 // 8133 //
8142 // All string values have a length field. 8134 // All string values have a length field.
8143 class String : public Name { 8135 class String: public Name {
8144 public: 8136 public:
8145 enum Encoding { ONE_BYTE_ENCODING, TWO_BYTE_ENCODING }; 8137 enum Encoding { ONE_BYTE_ENCODING, TWO_BYTE_ENCODING };
8146 8138
8147 // Representation of the flat content of a String. 8139 // Representation of the flat content of a String.
8148 // A non-flat string doesn't have flat content. 8140 // A non-flat string doesn't have flat content.
8149 // A flat string has content that's encoded as a sequence of either 8141 // A flat string has content that's encoded as a sequence of either
8150 // ASCII chars or two-byte UC16. 8142 // ASCII chars or two-byte UC16.
8151 // Returned by String::GetFlatContent(). 8143 // Returned by String::GetFlatContent().
8152 class FlatContent { 8144 class FlatContent {
8153 public: 8145 public:
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
8448 bool SlowAsArrayIndex(uint32_t* index); 8440 bool SlowAsArrayIndex(uint32_t* index);
8449 8441
8450 // Compute and set the hash code. 8442 // Compute and set the hash code.
8451 uint32_t ComputeAndSetHash(); 8443 uint32_t ComputeAndSetHash();
8452 8444
8453 DISALLOW_IMPLICIT_CONSTRUCTORS(String); 8445 DISALLOW_IMPLICIT_CONSTRUCTORS(String);
8454 }; 8446 };
8455 8447
8456 8448
8457 // The SeqString abstract class captures sequential string values. 8449 // The SeqString abstract class captures sequential string values.
8458 class SeqString : public String { 8450 class SeqString: public String {
8459 public: 8451 public:
8460 // Casting. 8452 // Casting.
8461 static inline SeqString* cast(Object* obj); 8453 static inline SeqString* cast(Object* obj);
8462 8454
8463 // Layout description. 8455 // Layout description.
8464 static const int kHeaderSize = String::kSize; 8456 static const int kHeaderSize = String::kSize;
8465 8457
8466 // Truncate the string in-place if possible and return the result. 8458 // Truncate the string in-place if possible and return the result.
8467 // In case of new_length == 0, the empty string is returned without 8459 // In case of new_length == 0, the empty string is returned without
8468 // truncating the original string. 8460 // truncating the original string.
8469 MUST_USE_RESULT static Handle<String> Truncate(Handle<SeqString> string, 8461 MUST_USE_RESULT static Handle<String> Truncate(Handle<SeqString> string,
8470 int new_length); 8462 int new_length);
8471 private: 8463 private:
8472 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString); 8464 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString);
8473 }; 8465 };
8474 8466
8475 8467
8476 // The AsciiString class captures sequential ASCII string objects. 8468 // The AsciiString class captures sequential ASCII string objects.
8477 // Each character in the AsciiString is an ASCII character. 8469 // Each character in the AsciiString is an ASCII character.
8478 class SeqOneByteString V8_FINAL : public SeqString { 8470 class SeqOneByteString: public SeqString {
8479 public: 8471 public:
8480 static const bool kHasAsciiEncoding = true; 8472 static const bool kHasAsciiEncoding = true;
8481 8473
8482 // Dispatched behavior. 8474 // Dispatched behavior.
8483 inline uint16_t SeqOneByteStringGet(int index); 8475 inline uint16_t SeqOneByteStringGet(int index);
8484 inline void SeqOneByteStringSet(int index, uint16_t value); 8476 inline void SeqOneByteStringSet(int index, uint16_t value);
8485 8477
8486 // Get the address of the characters in this string. 8478 // Get the address of the characters in this string.
8487 inline Address GetCharsAddress(); 8479 inline Address GetCharsAddress();
8488 8480
(...skipping 18 matching lines...) Expand all
8507 // Q.v. String::kMaxLength which is the maximal size of concatenated strings. 8499 // Q.v. String::kMaxLength which is the maximal size of concatenated strings.
8508 static const int kMaxLength = (kMaxSize - kHeaderSize); 8500 static const int kMaxLength = (kMaxSize - kHeaderSize);
8509 8501
8510 private: 8502 private:
8511 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqOneByteString); 8503 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqOneByteString);
8512 }; 8504 };
8513 8505
8514 8506
8515 // The TwoByteString class captures sequential unicode string objects. 8507 // The TwoByteString class captures sequential unicode string objects.
8516 // Each character in the TwoByteString is a two-byte uint16_t. 8508 // Each character in the TwoByteString is a two-byte uint16_t.
8517 class SeqTwoByteString V8_FINAL : public SeqString { 8509 class SeqTwoByteString: public SeqString {
8518 public: 8510 public:
8519 static const bool kHasAsciiEncoding = false; 8511 static const bool kHasAsciiEncoding = false;
8520 8512
8521 // Dispatched behavior. 8513 // Dispatched behavior.
8522 inline uint16_t SeqTwoByteStringGet(int index); 8514 inline uint16_t SeqTwoByteStringGet(int index);
8523 inline void SeqTwoByteStringSet(int index, uint16_t value); 8515 inline void SeqTwoByteStringSet(int index, uint16_t value);
8524 8516
8525 // Get the address of the characters in this string. 8517 // Get the address of the characters in this string.
8526 inline Address GetCharsAddress(); 8518 inline Address GetCharsAddress();
8527 8519
(...skipping 27 matching lines...) Expand all
8555 8547
8556 8548
8557 // The ConsString class describes string values built by using the 8549 // The ConsString class describes string values built by using the
8558 // addition operator on strings. A ConsString is a pair where the 8550 // addition operator on strings. A ConsString is a pair where the
8559 // first and second components are pointers to other string values. 8551 // first and second components are pointers to other string values.
8560 // One or both components of a ConsString can be pointers to other 8552 // One or both components of a ConsString can be pointers to other
8561 // ConsStrings, creating a binary tree of ConsStrings where the leaves 8553 // ConsStrings, creating a binary tree of ConsStrings where the leaves
8562 // are non-ConsString string values. The string value represented by 8554 // are non-ConsString string values. The string value represented by
8563 // a ConsString can be obtained by concatenating the leaf string 8555 // a ConsString can be obtained by concatenating the leaf string
8564 // values in a left-to-right depth-first traversal of the tree. 8556 // values in a left-to-right depth-first traversal of the tree.
8565 class ConsString V8_FINAL : public String { 8557 class ConsString: public String {
8566 public: 8558 public:
8567 // First string of the cons cell. 8559 // First string of the cons cell.
8568 inline String* first(); 8560 inline String* first();
8569 // Doesn't check that the result is a string, even in debug mode. This is 8561 // Doesn't check that the result is a string, even in debug mode. This is
8570 // useful during GC where the mark bits confuse the checks. 8562 // useful during GC where the mark bits confuse the checks.
8571 inline Object* unchecked_first(); 8563 inline Object* unchecked_first();
8572 inline void set_first(String* first, 8564 inline void set_first(String* first,
8573 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 8565 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
8574 8566
8575 // Second string of the cons cell. 8567 // Second string of the cons cell.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
8609 // a substring. A Sliced String is described as a pointer to the parent, 8601 // a substring. A Sliced String is described as a pointer to the parent,
8610 // the offset from the start of the parent string and the length. Using 8602 // the offset from the start of the parent string and the length. Using
8611 // a Sliced String therefore requires unpacking of the parent string and 8603 // a Sliced String therefore requires unpacking of the parent string and
8612 // adding the offset to the start address. A substring of a Sliced String 8604 // adding the offset to the start address. A substring of a Sliced String
8613 // are not nested since the double indirection is simplified when creating 8605 // are not nested since the double indirection is simplified when creating
8614 // such a substring. 8606 // such a substring.
8615 // Currently missing features are: 8607 // Currently missing features are:
8616 // - handling externalized parent strings 8608 // - handling externalized parent strings
8617 // - external strings as parent 8609 // - external strings as parent
8618 // - truncating sliced string to enable otherwise unneeded parent to be GC'ed. 8610 // - truncating sliced string to enable otherwise unneeded parent to be GC'ed.
8619 class SlicedString V8_FINAL : public String { 8611 class SlicedString: public String {
8620 public: 8612 public:
8621 inline String* parent(); 8613 inline String* parent();
8622 inline void set_parent(String* parent, 8614 inline void set_parent(String* parent,
8623 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 8615 WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
8624 inline int offset(); 8616 inline int offset();
8625 inline void set_offset(int offset); 8617 inline void set_offset(int offset);
8626 8618
8627 // Dispatched behavior. 8619 // Dispatched behavior.
8628 uint16_t SlicedStringGet(int index); 8620 uint16_t SlicedStringGet(int index);
8629 8621
(...skipping 21 matching lines...) Expand all
8651 8643
8652 // The ExternalString class describes string values that are backed by 8644 // The ExternalString class describes string values that are backed by
8653 // a string resource that lies outside the V8 heap. ExternalStrings 8645 // a string resource that lies outside the V8 heap. ExternalStrings
8654 // consist of the length field common to all strings, a pointer to the 8646 // consist of the length field common to all strings, a pointer to the
8655 // external resource. It is important to ensure (externally) that the 8647 // external resource. It is important to ensure (externally) that the
8656 // resource is not deallocated while the ExternalString is live in the 8648 // resource is not deallocated while the ExternalString is live in the
8657 // V8 heap. 8649 // V8 heap.
8658 // 8650 //
8659 // The API expects that all ExternalStrings are created through the 8651 // The API expects that all ExternalStrings are created through the
8660 // API. Therefore, ExternalStrings should not be used internally. 8652 // API. Therefore, ExternalStrings should not be used internally.
8661 class ExternalString : public String { 8653 class ExternalString: public String {
8662 public: 8654 public:
8663 // Casting 8655 // Casting
8664 static inline ExternalString* cast(Object* obj); 8656 static inline ExternalString* cast(Object* obj);
8665 8657
8666 // Layout description. 8658 // Layout description.
8667 static const int kResourceOffset = POINTER_SIZE_ALIGN(String::kSize); 8659 static const int kResourceOffset = POINTER_SIZE_ALIGN(String::kSize);
8668 static const int kShortSize = kResourceOffset + kPointerSize; 8660 static const int kShortSize = kResourceOffset + kPointerSize;
8669 static const int kResourceDataOffset = kResourceOffset + kPointerSize; 8661 static const int kResourceDataOffset = kResourceOffset + kPointerSize;
8670 static const int kSize = kResourceDataOffset + kPointerSize; 8662 static const int kSize = kResourceDataOffset + kPointerSize;
8671 8663
8672 static const int kMaxShortLength = 8664 static const int kMaxShortLength =
8673 (kShortSize - SeqString::kHeaderSize) / kCharSize; 8665 (kShortSize - SeqString::kHeaderSize) / kCharSize;
8674 8666
8675 // Return whether external string is short (data pointer is not cached). 8667 // Return whether external string is short (data pointer is not cached).
8676 inline bool is_short(); 8668 inline bool is_short();
8677 8669
8678 STATIC_CHECK(kResourceOffset == Internals::kStringResourceOffset); 8670 STATIC_CHECK(kResourceOffset == Internals::kStringResourceOffset);
8679 8671
8680 private: 8672 private:
8681 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString); 8673 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString);
8682 }; 8674 };
8683 8675
8684 8676
8685 // The ExternalAsciiString class is an external string backed by an 8677 // The ExternalAsciiString class is an external string backed by an
8686 // ASCII string. 8678 // ASCII string.
8687 class ExternalAsciiString V8_FINAL : public ExternalString { 8679 class ExternalAsciiString: public ExternalString {
8688 public: 8680 public:
8689 static const bool kHasAsciiEncoding = true; 8681 static const bool kHasAsciiEncoding = true;
8690 8682
8691 typedef v8::String::ExternalAsciiStringResource Resource; 8683 typedef v8::String::ExternalAsciiStringResource Resource;
8692 8684
8693 // The underlying resource. 8685 // The underlying resource.
8694 inline const Resource* resource(); 8686 inline const Resource* resource();
8695 inline void set_resource(const Resource* buffer); 8687 inline void set_resource(const Resource* buffer);
8696 8688
8697 // Update the pointer cache to the external character array. 8689 // Update the pointer cache to the external character array.
(...skipping 16 matching lines...) Expand all
8714 template<typename StaticVisitor> 8706 template<typename StaticVisitor>
8715 inline void ExternalAsciiStringIterateBody(); 8707 inline void ExternalAsciiStringIterateBody();
8716 8708
8717 private: 8709 private:
8718 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString); 8710 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString);
8719 }; 8711 };
8720 8712
8721 8713
8722 // The ExternalTwoByteString class is an external string backed by a UTF-16 8714 // The ExternalTwoByteString class is an external string backed by a UTF-16
8723 // encoded string. 8715 // encoded string.
8724 class ExternalTwoByteString V8_FINAL : public ExternalString { 8716 class ExternalTwoByteString: public ExternalString {
8725 public: 8717 public:
8726 static const bool kHasAsciiEncoding = false; 8718 static const bool kHasAsciiEncoding = false;
8727 8719
8728 typedef v8::String::ExternalStringResource Resource; 8720 typedef v8::String::ExternalStringResource Resource;
8729 8721
8730 // The underlying string resource. 8722 // The underlying string resource.
8731 inline const Resource* resource(); 8723 inline const Resource* resource();
8732 inline void set_resource(const Resource* buffer); 8724 inline void set_resource(const Resource* buffer);
8733 8725
8734 // Update the pointer cache to the external character array. 8726 // Update the pointer cache to the external character array.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
8778 static char* Iterate(ObjectVisitor* v, char* t); 8770 static char* Iterate(ObjectVisitor* v, char* t);
8779 private: 8771 private:
8780 Isolate* isolate_; 8772 Isolate* isolate_;
8781 Relocatable* prev_; 8773 Relocatable* prev_;
8782 }; 8774 };
8783 8775
8784 8776
8785 // A flat string reader provides random access to the contents of a 8777 // A flat string reader provides random access to the contents of a
8786 // string independent of the character width of the string. The handle 8778 // string independent of the character width of the string. The handle
8787 // must be valid as long as the reader is being used. 8779 // must be valid as long as the reader is being used.
8788 class FlatStringReader V8_FINAL : public Relocatable { 8780 class FlatStringReader : public Relocatable {
8789 public: 8781 public:
8790 FlatStringReader(Isolate* isolate, Handle<String> str); 8782 FlatStringReader(Isolate* isolate, Handle<String> str);
8791 FlatStringReader(Isolate* isolate, Vector<const char> input); 8783 FlatStringReader(Isolate* isolate, Vector<const char> input);
8792 void PostGarbageCollection(); 8784 void PostGarbageCollection();
8793 inline uc32 Get(int index); 8785 inline uc32 Get(int index);
8794 int length() { return length_; } 8786 int length() { return length_; }
8795 private: 8787 private:
8796 String** str_; 8788 String** str_;
8797 bool is_ascii_; 8789 bool is_ascii_;
8798 int length_; 8790 int length_;
8799 const void* start_; 8791 const void* start_;
8800 }; 8792 };
8801 8793
8802 8794
8803 // A ConsStringOp that returns null. 8795 // A ConsStringOp that returns null.
8804 // Useful when the operation to apply on a ConsString 8796 // Useful when the operation to apply on a ConsString
8805 // requires an expensive data structure. 8797 // requires an expensive data structure.
8806 class ConsStringNullOp V8_FINAL { 8798 class ConsStringNullOp {
8807 public: 8799 public:
8808 inline ConsStringNullOp() {} 8800 inline ConsStringNullOp() {}
8809 static inline String* Operate(String*, unsigned*, int32_t*, unsigned*); 8801 static inline String* Operate(String*, unsigned*, int32_t*, unsigned*);
8810 private: 8802 private:
8811 DISALLOW_COPY_AND_ASSIGN(ConsStringNullOp); 8803 DISALLOW_COPY_AND_ASSIGN(ConsStringNullOp);
8812 }; 8804 };
8813 8805
8814 8806
8815 // This maintains an off-stack representation of the stack frames required 8807 // This maintains an off-stack representation of the stack frames required
8816 // to traverse a ConsString, allowing an entirely iterative and restartable 8808 // to traverse a ConsString, allowing an entirely iterative and restartable
8817 // traversal of the entire string 8809 // traversal of the entire string
8818 // Note: this class is not GC-safe. 8810 // Note: this class is not GC-safe.
8819 class ConsStringIteratorOp V8_FINAL { 8811 class ConsStringIteratorOp {
8820 public: 8812 public:
8821 inline ConsStringIteratorOp() {} 8813 inline ConsStringIteratorOp() {}
8822 String* Operate(String* string, 8814 String* Operate(String* string,
8823 unsigned* offset_out, 8815 unsigned* offset_out,
8824 int32_t* type_out, 8816 int32_t* type_out,
8825 unsigned* length_out); 8817 unsigned* length_out);
8826 inline String* ContinueOperation(int32_t* type_out, unsigned* length_out); 8818 inline String* ContinueOperation(int32_t* type_out, unsigned* length_out);
8827 inline void Reset(); 8819 inline void Reset();
8828 inline bool HasMore(); 8820 inline bool HasMore();
8829 8821
(...skipping 19 matching lines...) Expand all
8849 // Stack must always contain only frames for which right traversal 8841 // Stack must always contain only frames for which right traversal
8850 // has not yet been performed. 8842 // has not yet been performed.
8851 ConsString* frames_[kStackSize]; 8843 ConsString* frames_[kStackSize];
8852 unsigned consumed_; 8844 unsigned consumed_;
8853 ConsString* root_; 8845 ConsString* root_;
8854 DISALLOW_COPY_AND_ASSIGN(ConsStringIteratorOp); 8846 DISALLOW_COPY_AND_ASSIGN(ConsStringIteratorOp);
8855 }; 8847 };
8856 8848
8857 8849
8858 // Note: this class is not GC-safe. 8850 // Note: this class is not GC-safe.
8859 class StringCharacterStream V8_FINAL { 8851 class StringCharacterStream {
8860 public: 8852 public:
8861 inline StringCharacterStream(String* string, 8853 inline StringCharacterStream(String* string,
8862 ConsStringIteratorOp* op, 8854 ConsStringIteratorOp* op,
8863 unsigned offset = 0); 8855 unsigned offset = 0);
8864 inline uint16_t GetNext(); 8856 inline uint16_t GetNext();
8865 inline bool HasMore(); 8857 inline bool HasMore();
8866 inline void Reset(String* string, unsigned offset = 0); 8858 inline void Reset(String* string, unsigned offset = 0);
8867 inline void VisitOneByteString(const uint8_t* chars, unsigned length); 8859 inline void VisitOneByteString(const uint8_t* chars, unsigned length);
8868 inline void VisitTwoByteString(const uint16_t* chars, unsigned length); 8860 inline void VisitTwoByteString(const uint16_t* chars, unsigned length);
8869 8861
8870 private: 8862 private:
8871 bool is_one_byte_; 8863 bool is_one_byte_;
8872 union { 8864 union {
8873 const uint8_t* buffer8_; 8865 const uint8_t* buffer8_;
8874 const uint16_t* buffer16_; 8866 const uint16_t* buffer16_;
8875 }; 8867 };
8876 const uint8_t* end_; 8868 const uint8_t* end_;
8877 ConsStringIteratorOp* op_; 8869 ConsStringIteratorOp* op_;
8878 DISALLOW_COPY_AND_ASSIGN(StringCharacterStream); 8870 DISALLOW_COPY_AND_ASSIGN(StringCharacterStream);
8879 }; 8871 };
8880 8872
8881 8873
8882 template <typename T> 8874 template <typename T>
8883 class VectorIterator V8_FINAL { 8875 class VectorIterator {
8884 public: 8876 public:
8885 VectorIterator(T* d, int l) : data_(Vector<const T>(d, l)), index_(0) { } 8877 VectorIterator(T* d, int l) : data_(Vector<const T>(d, l)), index_(0) { }
8886 explicit VectorIterator(Vector<const T> data) : data_(data), index_(0) { } 8878 explicit VectorIterator(Vector<const T> data) : data_(data), index_(0) { }
8887 T GetNext() { return data_[index_++]; } 8879 T GetNext() { return data_[index_++]; }
8888 bool has_more() { return index_ < data_.length(); } 8880 bool has_more() { return index_ < data_.length(); }
8889 private: 8881 private:
8890 Vector<const T> data_; 8882 Vector<const T> data_;
8891 int index_; 8883 int index_;
8892 }; 8884 };
8893 8885
8894 8886
8895 // The Oddball describes objects null, undefined, true, and false. 8887 // The Oddball describes objects null, undefined, true, and false.
8896 class Oddball V8_FINAL : public HeapObject { 8888 class Oddball: public HeapObject {
8897 public: 8889 public:
8898 // [to_string]: Cached to_string computed at startup. 8890 // [to_string]: Cached to_string computed at startup.
8899 DECL_ACCESSORS(to_string, String) 8891 DECL_ACCESSORS(to_string, String)
8900 8892
8901 // [to_number]: Cached to_number computed at startup. 8893 // [to_number]: Cached to_number computed at startup.
8902 DECL_ACCESSORS(to_number, Object) 8894 DECL_ACCESSORS(to_number, Object)
8903 8895
8904 inline byte kind(); 8896 inline byte kind();
8905 inline void set_kind(byte kind); 8897 inline void set_kind(byte kind);
8906 8898
(...skipping 30 matching lines...) Expand all
8937 8929
8938 STATIC_CHECK(kKindOffset == Internals::kOddballKindOffset); 8930 STATIC_CHECK(kKindOffset == Internals::kOddballKindOffset);
8939 STATIC_CHECK(kNull == Internals::kNullOddballKind); 8931 STATIC_CHECK(kNull == Internals::kNullOddballKind);
8940 STATIC_CHECK(kUndefined == Internals::kUndefinedOddballKind); 8932 STATIC_CHECK(kUndefined == Internals::kUndefinedOddballKind);
8941 8933
8942 private: 8934 private:
8943 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); 8935 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball);
8944 }; 8936 };
8945 8937
8946 8938
8947 class Cell : public HeapObject { 8939 class Cell: public HeapObject {
8948 public: 8940 public:
8949 // [value]: value of the global property. 8941 // [value]: value of the global property.
8950 DECL_ACCESSORS(value, Object) 8942 DECL_ACCESSORS(value, Object)
8951 8943
8952 // Casting. 8944 // Casting.
8953 static inline Cell* cast(Object* obj); 8945 static inline Cell* cast(Object* obj);
8954 8946
8955 static inline Cell* FromValueAddress(Address value) { 8947 static inline Cell* FromValueAddress(Address value) {
8956 Object* result = FromAddress(value - kValueOffset); 8948 Object* result = FromAddress(value - kValueOffset);
8957 ASSERT(result->IsCell() || result->IsPropertyCell()); 8949 ASSERT(result->IsCell() || result->IsPropertyCell());
(...skipping 14 matching lines...) Expand all
8972 8964
8973 typedef FixedBodyDescriptor<kValueOffset, 8965 typedef FixedBodyDescriptor<kValueOffset,
8974 kValueOffset + kPointerSize, 8966 kValueOffset + kPointerSize,
8975 kSize> BodyDescriptor; 8967 kSize> BodyDescriptor;
8976 8968
8977 private: 8969 private:
8978 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell); 8970 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell);
8979 }; 8971 };
8980 8972
8981 8973
8982 class PropertyCell V8_FINAL : public Cell { 8974 class PropertyCell: public Cell {
8983 public: 8975 public:
8984 // [type]: type of the global property. 8976 // [type]: type of the global property.
8985 Type* type(); 8977 Type* type();
8986 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 8978 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
8987 8979
8988 // [dependent_code]: dependent code that depends on the type of the global 8980 // [dependent_code]: dependent code that depends on the type of the global
8989 // property. 8981 // property.
8990 DECL_ACCESSORS(dependent_code, DependentCode) 8982 DECL_ACCESSORS(dependent_code, DependentCode)
8991 8983
8992 // Sets the value of the cell and updates the type field to be the union 8984 // Sets the value of the cell and updates the type field to be the union
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
9027 static Type* UpdateType(Handle<PropertyCell> cell, 9019 static Type* UpdateType(Handle<PropertyCell> cell,
9028 Handle<Object> value); 9020 Handle<Object> value);
9029 9021
9030 private: 9022 private:
9031 DECL_ACCESSORS(type_raw, Object) 9023 DECL_ACCESSORS(type_raw, Object)
9032 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); 9024 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell);
9033 }; 9025 };
9034 9026
9035 9027
9036 // The JSProxy describes EcmaScript Harmony proxies 9028 // The JSProxy describes EcmaScript Harmony proxies
9037 class JSProxy : public JSReceiver { 9029 class JSProxy: public JSReceiver {
9038 public: 9030 public:
9039 // [handler]: The handler property. 9031 // [handler]: The handler property.
9040 DECL_ACCESSORS(handler, Object) 9032 DECL_ACCESSORS(handler, Object)
9041 9033
9042 // [hash]: The hash code property (undefined if not initialized yet). 9034 // [hash]: The hash code property (undefined if not initialized yet).
9043 DECL_ACCESSORS(hash, Object) 9035 DECL_ACCESSORS(hash, Object)
9044 9036
9045 // Casting. 9037 // Casting.
9046 static inline JSProxy* cast(Object* obj); 9038 static inline JSProxy* cast(Object* obj);
9047 9039
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
9128 Handle<Name> name, 9120 Handle<Name> name,
9129 DeleteMode mode); 9121 DeleteMode mode);
9130 static Handle<Object> DeleteElementWithHandler(Handle<JSProxy> object, 9122 static Handle<Object> DeleteElementWithHandler(Handle<JSProxy> object,
9131 uint32_t index, 9123 uint32_t index,
9132 DeleteMode mode); 9124 DeleteMode mode);
9133 9125
9134 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); 9126 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy);
9135 }; 9127 };
9136 9128
9137 9129
9138 class JSFunctionProxy V8_FINAL : public JSProxy { 9130 class JSFunctionProxy: public JSProxy {
9139 public: 9131 public:
9140 // [call_trap]: The call trap. 9132 // [call_trap]: The call trap.
9141 DECL_ACCESSORS(call_trap, Object) 9133 DECL_ACCESSORS(call_trap, Object)
9142 9134
9143 // [construct_trap]: The construct trap. 9135 // [construct_trap]: The construct trap.
9144 DECL_ACCESSORS(construct_trap, Object) 9136 DECL_ACCESSORS(construct_trap, Object)
9145 9137
9146 // Casting. 9138 // Casting.
9147 static inline JSFunctionProxy* cast(Object* obj); 9139 static inline JSFunctionProxy* cast(Object* obj);
9148 9140
(...skipping 13 matching lines...) Expand all
9162 typedef FixedBodyDescriptor<kHandlerOffset, 9154 typedef FixedBodyDescriptor<kHandlerOffset,
9163 kConstructTrapOffset + kPointerSize, 9155 kConstructTrapOffset + kPointerSize,
9164 kSize> BodyDescriptor; 9156 kSize> BodyDescriptor;
9165 9157
9166 private: 9158 private:
9167 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy); 9159 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy);
9168 }; 9160 };
9169 9161
9170 9162
9171 // The JSSet describes EcmaScript Harmony sets 9163 // The JSSet describes EcmaScript Harmony sets
9172 class JSSet V8_FINAL : public JSObject { 9164 class JSSet: public JSObject {
9173 public: 9165 public:
9174 // [set]: the backing hash set containing keys. 9166 // [set]: the backing hash set containing keys.
9175 DECL_ACCESSORS(table, Object) 9167 DECL_ACCESSORS(table, Object)
9176 9168
9177 // Casting. 9169 // Casting.
9178 static inline JSSet* cast(Object* obj); 9170 static inline JSSet* cast(Object* obj);
9179 9171
9180 // Dispatched behavior. 9172 // Dispatched behavior.
9181 DECLARE_PRINTER(JSSet) 9173 DECLARE_PRINTER(JSSet)
9182 DECLARE_VERIFIER(JSSet) 9174 DECLARE_VERIFIER(JSSet)
9183 9175
9184 static const int kTableOffset = JSObject::kHeaderSize; 9176 static const int kTableOffset = JSObject::kHeaderSize;
9185 static const int kSize = kTableOffset + kPointerSize; 9177 static const int kSize = kTableOffset + kPointerSize;
9186 9178
9187 private: 9179 private:
9188 DISALLOW_IMPLICIT_CONSTRUCTORS(JSSet); 9180 DISALLOW_IMPLICIT_CONSTRUCTORS(JSSet);
9189 }; 9181 };
9190 9182
9191 9183
9192 // The JSMap describes EcmaScript Harmony maps 9184 // The JSMap describes EcmaScript Harmony maps
9193 class JSMap V8_FINAL : public JSObject { 9185 class JSMap: public JSObject {
9194 public: 9186 public:
9195 // [table]: the backing hash table mapping keys to values. 9187 // [table]: the backing hash table mapping keys to values.
9196 DECL_ACCESSORS(table, Object) 9188 DECL_ACCESSORS(table, Object)
9197 9189
9198 // Casting. 9190 // Casting.
9199 static inline JSMap* cast(Object* obj); 9191 static inline JSMap* cast(Object* obj);
9200 9192
9201 // Dispatched behavior. 9193 // Dispatched behavior.
9202 DECLARE_PRINTER(JSMap) 9194 DECLARE_PRINTER(JSMap)
9203 DECLARE_VERIFIER(JSMap) 9195 DECLARE_VERIFIER(JSMap)
9204 9196
9205 static const int kTableOffset = JSObject::kHeaderSize; 9197 static const int kTableOffset = JSObject::kHeaderSize;
9206 static const int kSize = kTableOffset + kPointerSize; 9198 static const int kSize = kTableOffset + kPointerSize;
9207 9199
9208 private: 9200 private:
9209 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap); 9201 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap);
9210 }; 9202 };
9211 9203
9212 9204
9213 // Base class for both JSWeakMap and JSWeakSet 9205 // Base class for both JSWeakMap and JSWeakSet
9214 class JSWeakCollection : public JSObject { 9206 class JSWeakCollection: public JSObject {
9215 public: 9207 public:
9216 // [table]: the backing hash table mapping keys to values. 9208 // [table]: the backing hash table mapping keys to values.
9217 DECL_ACCESSORS(table, Object) 9209 DECL_ACCESSORS(table, Object)
9218 9210
9219 // [next]: linked list of encountered weak maps during GC. 9211 // [next]: linked list of encountered weak maps during GC.
9220 DECL_ACCESSORS(next, Object) 9212 DECL_ACCESSORS(next, Object)
9221 9213
9222 static const int kTableOffset = JSObject::kHeaderSize; 9214 static const int kTableOffset = JSObject::kHeaderSize;
9223 static const int kNextOffset = kTableOffset + kPointerSize; 9215 static const int kNextOffset = kTableOffset + kPointerSize;
9224 static const int kSize = kNextOffset + kPointerSize; 9216 static const int kSize = kNextOffset + kPointerSize;
9225 9217
9226 private: 9218 private:
9227 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakCollection); 9219 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakCollection);
9228 }; 9220 };
9229 9221
9230 9222
9231 // The JSWeakMap describes EcmaScript Harmony weak maps 9223 // The JSWeakMap describes EcmaScript Harmony weak maps
9232 class JSWeakMap V8_FINAL : public JSWeakCollection { 9224 class JSWeakMap: public JSWeakCollection {
9233 public: 9225 public:
9234 // Casting. 9226 // Casting.
9235 static inline JSWeakMap* cast(Object* obj); 9227 static inline JSWeakMap* cast(Object* obj);
9236 9228
9237 // Dispatched behavior. 9229 // Dispatched behavior.
9238 DECLARE_PRINTER(JSWeakMap) 9230 DECLARE_PRINTER(JSWeakMap)
9239 DECLARE_VERIFIER(JSWeakMap) 9231 DECLARE_VERIFIER(JSWeakMap)
9240 9232
9241 private: 9233 private:
9242 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap); 9234 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap);
9243 }; 9235 };
9244 9236
9245 9237
9246 // The JSWeakSet describes EcmaScript Harmony weak sets 9238 // The JSWeakSet describes EcmaScript Harmony weak sets
9247 class JSWeakSet V8_FINAL : public JSWeakCollection { 9239 class JSWeakSet: public JSWeakCollection {
9248 public: 9240 public:
9249 // Casting. 9241 // Casting.
9250 static inline JSWeakSet* cast(Object* obj); 9242 static inline JSWeakSet* cast(Object* obj);
9251 9243
9252 // Dispatched behavior. 9244 // Dispatched behavior.
9253 DECLARE_PRINTER(JSWeakSet) 9245 DECLARE_PRINTER(JSWeakSet)
9254 DECLARE_VERIFIER(JSWeakSet) 9246 DECLARE_VERIFIER(JSWeakSet)
9255 9247
9256 private: 9248 private:
9257 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakSet); 9249 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakSet);
9258 }; 9250 };
9259 9251
9260 9252
9261 class JSArrayBuffer : public JSObject { 9253 class JSArrayBuffer: public JSObject {
9262 public: 9254 public:
9263 // [backing_store]: backing memory for this array 9255 // [backing_store]: backing memory for this array
9264 DECL_ACCESSORS(backing_store, void) 9256 DECL_ACCESSORS(backing_store, void)
9265 9257
9266 // [byte_length]: length in bytes 9258 // [byte_length]: length in bytes
9267 DECL_ACCESSORS(byte_length, Object) 9259 DECL_ACCESSORS(byte_length, Object)
9268 9260
9269 // [flags] 9261 // [flags]
9270 DECL_ACCESSORS(flag, Smi) 9262 DECL_ACCESSORS(flag, Smi)
9271 9263
(...skipping 27 matching lines...) Expand all
9299 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; 9291 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize;
9300 9292
9301 private: 9293 private:
9302 // Bit position in a flag 9294 // Bit position in a flag
9303 static const int kIsExternalBit = 0; 9295 static const int kIsExternalBit = 0;
9304 9296
9305 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); 9297 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer);
9306 }; 9298 };
9307 9299
9308 9300
9309 class JSArrayBufferView : public JSObject { 9301 class JSArrayBufferView: public JSObject {
9310 public: 9302 public:
9311 // [buffer]: ArrayBuffer that this typed array views. 9303 // [buffer]: ArrayBuffer that this typed array views.
9312 DECL_ACCESSORS(buffer, Object) 9304 DECL_ACCESSORS(buffer, Object)
9313 9305
9314 // [byte_length]: offset of typed array in bytes. 9306 // [byte_length]: offset of typed array in bytes.
9315 DECL_ACCESSORS(byte_offset, Object) 9307 DECL_ACCESSORS(byte_offset, Object)
9316 9308
9317 // [byte_length]: length of typed array in bytes. 9309 // [byte_length]: length of typed array in bytes.
9318 DECL_ACCESSORS(byte_length, Object) 9310 DECL_ACCESSORS(byte_length, Object)
9319 9311
(...skipping 12 matching lines...) Expand all
9332 static const int kViewSize = kWeakNextOffset + kPointerSize; 9324 static const int kViewSize = kWeakNextOffset + kPointerSize;
9333 9325
9334 protected: 9326 protected:
9335 void NeuterView(); 9327 void NeuterView();
9336 9328
9337 private: 9329 private:
9338 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView); 9330 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView);
9339 }; 9331 };
9340 9332
9341 9333
9342 class JSTypedArray V8_FINAL : public JSArrayBufferView { 9334 class JSTypedArray: public JSArrayBufferView {
9343 public: 9335 public:
9344 // [length]: length of typed array in elements. 9336 // [length]: length of typed array in elements.
9345 DECL_ACCESSORS(length, Object) 9337 DECL_ACCESSORS(length, Object)
9346 9338
9347 // Neutering. Only neuters this typed array. 9339 // Neutering. Only neuters this typed array.
9348 void Neuter(); 9340 void Neuter();
9349 9341
9350 // Casting. 9342 // Casting.
9351 static inline JSTypedArray* cast(Object* obj); 9343 static inline JSTypedArray* cast(Object* obj);
9352 9344
9353 ExternalArrayType type(); 9345 ExternalArrayType type();
9354 size_t element_size(); 9346 size_t element_size();
9355 9347
9356 // Dispatched behavior. 9348 // Dispatched behavior.
9357 DECLARE_PRINTER(JSTypedArray) 9349 DECLARE_PRINTER(JSTypedArray)
9358 DECLARE_VERIFIER(JSTypedArray) 9350 DECLARE_VERIFIER(JSTypedArray)
9359 9351
9360 static const int kLengthOffset = kViewSize + kPointerSize; 9352 static const int kLengthOffset = kViewSize + kPointerSize;
9361 static const int kSize = kLengthOffset + kPointerSize; 9353 static const int kSize = kLengthOffset + kPointerSize;
9362 9354
9363 static const int kSizeWithInternalFields = 9355 static const int kSizeWithInternalFields =
9364 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; 9356 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize;
9365 9357
9366 private: 9358 private:
9367 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); 9359 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray);
9368 }; 9360 };
9369 9361
9370 9362
9371 class JSDataView V8_FINAL : public JSArrayBufferView { 9363 class JSDataView: public JSArrayBufferView {
9372 public: 9364 public:
9373 // Only neuters this DataView 9365 // Only neuters this DataView
9374 void Neuter(); 9366 void Neuter();
9375 9367
9376 // Casting. 9368 // Casting.
9377 static inline JSDataView* cast(Object* obj); 9369 static inline JSDataView* cast(Object* obj);
9378 9370
9379 // Dispatched behavior. 9371 // Dispatched behavior.
9380 DECLARE_PRINTER(JSDataView) 9372 DECLARE_PRINTER(JSDataView)
9381 DECLARE_VERIFIER(JSDataView) 9373 DECLARE_VERIFIER(JSDataView)
9382 9374
9383 static const int kSize = kViewSize; 9375 static const int kSize = kViewSize;
9384 9376
9385 static const int kSizeWithInternalFields = 9377 static const int kSizeWithInternalFields =
9386 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; 9378 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize;
9387 9379
9388 private: 9380 private:
9389 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView); 9381 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView);
9390 }; 9382 };
9391 9383
9392 9384
9393 // Foreign describes objects pointing from JavaScript to C structures. 9385 // Foreign describes objects pointing from JavaScript to C structures.
9394 // Since they cannot contain references to JS HeapObjects they can be 9386 // Since they cannot contain references to JS HeapObjects they can be
9395 // placed in old_data_space. 9387 // placed in old_data_space.
9396 class Foreign V8_FINAL : public HeapObject { 9388 class Foreign: public HeapObject {
9397 public: 9389 public:
9398 // [address]: field containing the address. 9390 // [address]: field containing the address.
9399 inline Address foreign_address(); 9391 inline Address foreign_address();
9400 inline void set_foreign_address(Address value); 9392 inline void set_foreign_address(Address value);
9401 9393
9402 // Casting. 9394 // Casting.
9403 static inline Foreign* cast(Object* obj); 9395 static inline Foreign* cast(Object* obj);
9404 9396
9405 // Dispatched behavior. 9397 // Dispatched behavior.
9406 inline void ForeignIterateBody(ObjectVisitor* v); 9398 inline void ForeignIterateBody(ObjectVisitor* v);
(...skipping 15 matching lines...) Expand all
9422 private: 9414 private:
9423 DISALLOW_IMPLICIT_CONSTRUCTORS(Foreign); 9415 DISALLOW_IMPLICIT_CONSTRUCTORS(Foreign);
9424 }; 9416 };
9425 9417
9426 9418
9427 // The JSArray describes JavaScript Arrays 9419 // The JSArray describes JavaScript Arrays
9428 // Such an array can be in one of two modes: 9420 // Such an array can be in one of two modes:
9429 // - fast, backing storage is a FixedArray and length <= elements.length(); 9421 // - fast, backing storage is a FixedArray and length <= elements.length();
9430 // Please note: push and pop can be used to grow and shrink the array. 9422 // Please note: push and pop can be used to grow and shrink the array.
9431 // - slow, backing storage is a HashTable with numbers as keys. 9423 // - slow, backing storage is a HashTable with numbers as keys.
9432 class JSArray : public JSObject { 9424 class JSArray: public JSObject {
9433 public: 9425 public:
9434 // [length]: The length property. 9426 // [length]: The length property.
9435 DECL_ACCESSORS(length, Object) 9427 DECL_ACCESSORS(length, Object)
9436 9428
9437 // Overload the length setter to skip write barrier when the length 9429 // Overload the length setter to skip write barrier when the length
9438 // is set to a smi. This matches the set function on FixedArray. 9430 // is set to a smi. This matches the set function on FixedArray.
9439 inline void set_length(Smi* length); 9431 inline void set_length(Smi* length);
9440 9432
9441 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index, 9433 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index,
9442 Object* value); 9434 Object* value);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
9484 Handle<Object> CacheInitialJSArrayMaps(Handle<Context> native_context, 9476 Handle<Object> CacheInitialJSArrayMaps(Handle<Context> native_context,
9485 Handle<Map> initial_map); 9477 Handle<Map> initial_map);
9486 9478
9487 9479
9488 // JSRegExpResult is just a JSArray with a specific initial map. 9480 // JSRegExpResult is just a JSArray with a specific initial map.
9489 // This initial map adds in-object properties for "index" and "input" 9481 // This initial map adds in-object properties for "index" and "input"
9490 // properties, as assigned by RegExp.prototype.exec, which allows 9482 // properties, as assigned by RegExp.prototype.exec, which allows
9491 // faster creation of RegExp exec results. 9483 // faster creation of RegExp exec results.
9492 // This class just holds constants used when creating the result. 9484 // This class just holds constants used when creating the result.
9493 // After creation the result must be treated as a JSArray in all regards. 9485 // After creation the result must be treated as a JSArray in all regards.
9494 class JSRegExpResult V8_FINAL : public JSArray { 9486 class JSRegExpResult: public JSArray {
9495 public: 9487 public:
9496 // Offsets of object fields. 9488 // Offsets of object fields.
9497 static const int kIndexOffset = JSArray::kSize; 9489 static const int kIndexOffset = JSArray::kSize;
9498 static const int kInputOffset = kIndexOffset + kPointerSize; 9490 static const int kInputOffset = kIndexOffset + kPointerSize;
9499 static const int kSize = kInputOffset + kPointerSize; 9491 static const int kSize = kInputOffset + kPointerSize;
9500 // Indices of in-object properties. 9492 // Indices of in-object properties.
9501 static const int kIndexIndex = 0; 9493 static const int kIndexIndex = 0;
9502 static const int kInputIndex = 1; 9494 static const int kInputIndex = 1;
9503 private: 9495 private:
9504 DISALLOW_IMPLICIT_CONSTRUCTORS(JSRegExpResult); 9496 DISALLOW_IMPLICIT_CONSTRUCTORS(JSRegExpResult);
9505 }; 9497 };
9506 9498
9507 9499
9508 class AccessorInfo : public Struct { 9500 class AccessorInfo: public Struct {
9509 public: 9501 public:
9510 DECL_ACCESSORS(name, Object) 9502 DECL_ACCESSORS(name, Object)
9511 DECL_ACCESSORS(flag, Smi) 9503 DECL_ACCESSORS(flag, Smi)
9512 DECL_ACCESSORS(expected_receiver_type, Object) 9504 DECL_ACCESSORS(expected_receiver_type, Object)
9513 9505
9514 inline bool all_can_read(); 9506 inline bool all_can_read();
9515 inline void set_all_can_read(bool value); 9507 inline void set_all_can_read(bool value);
9516 9508
9517 inline bool all_can_write(); 9509 inline bool all_can_write();
9518 inline void set_all_can_write(bool value); 9510 inline void set_all_can_write(bool value);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
9595 struct PrimitiveValueDescriptor primitive_value_descriptor; 9587 struct PrimitiveValueDescriptor primitive_value_descriptor;
9596 struct ObjectDerefenceDescriptor object_dereference_descriptor; 9588 struct ObjectDerefenceDescriptor object_dereference_descriptor;
9597 struct PointerShiftDescriptor pointer_shift_descriptor; 9589 struct PointerShiftDescriptor pointer_shift_descriptor;
9598 }; 9590 };
9599 }; 9591 };
9600 9592
9601 9593
9602 class DeclaredAccessorDescriptor; 9594 class DeclaredAccessorDescriptor;
9603 9595
9604 9596
9605 class DeclaredAccessorDescriptorIterator V8_FINAL { 9597 class DeclaredAccessorDescriptorIterator {
9606 public: 9598 public:
9607 explicit DeclaredAccessorDescriptorIterator( 9599 explicit DeclaredAccessorDescriptorIterator(
9608 DeclaredAccessorDescriptor* descriptor); 9600 DeclaredAccessorDescriptor* descriptor);
9609 const DeclaredAccessorDescriptorData* Next(); 9601 const DeclaredAccessorDescriptorData* Next();
9610 bool Complete() const { return length_ == offset_; } 9602 bool Complete() const { return length_ == offset_; }
9611 private: 9603 private:
9612 uint8_t* array_; 9604 uint8_t* array_;
9613 const int length_; 9605 const int length_;
9614 int offset_; 9606 int offset_;
9615 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptorIterator); 9607 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptorIterator);
9616 }; 9608 };
9617 9609
9618 9610
9619 class DeclaredAccessorDescriptor V8_FINAL : public Struct { 9611 class DeclaredAccessorDescriptor: public Struct {
9620 public: 9612 public:
9621 DECL_ACCESSORS(serialized_data, ByteArray) 9613 DECL_ACCESSORS(serialized_data, ByteArray)
9622 9614
9623 static inline DeclaredAccessorDescriptor* cast(Object* obj); 9615 static inline DeclaredAccessorDescriptor* cast(Object* obj);
9624 9616
9625 static Handle<DeclaredAccessorDescriptor> Create( 9617 static Handle<DeclaredAccessorDescriptor> Create(
9626 Isolate* isolate, 9618 Isolate* isolate,
9627 const DeclaredAccessorDescriptorData& data, 9619 const DeclaredAccessorDescriptorData& data,
9628 Handle<DeclaredAccessorDescriptor> previous); 9620 Handle<DeclaredAccessorDescriptor> previous);
9629 9621
9630 // Dispatched behavior. 9622 // Dispatched behavior.
9631 DECLARE_PRINTER(DeclaredAccessorDescriptor) 9623 DECLARE_PRINTER(DeclaredAccessorDescriptor)
9632 DECLARE_VERIFIER(DeclaredAccessorDescriptor) 9624 DECLARE_VERIFIER(DeclaredAccessorDescriptor)
9633 9625
9634 static const int kSerializedDataOffset = HeapObject::kHeaderSize; 9626 static const int kSerializedDataOffset = HeapObject::kHeaderSize;
9635 static const int kSize = kSerializedDataOffset + kPointerSize; 9627 static const int kSize = kSerializedDataOffset + kPointerSize;
9636 9628
9637 private: 9629 private:
9638 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptor); 9630 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorDescriptor);
9639 }; 9631 };
9640 9632
9641 9633
9642 class DeclaredAccessorInfo V8_FINAL : public AccessorInfo { 9634 class DeclaredAccessorInfo: public AccessorInfo {
9643 public: 9635 public:
9644 DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor) 9636 DECL_ACCESSORS(descriptor, DeclaredAccessorDescriptor)
9645 9637
9646 static inline DeclaredAccessorInfo* cast(Object* obj); 9638 static inline DeclaredAccessorInfo* cast(Object* obj);
9647 9639
9648 // Dispatched behavior. 9640 // Dispatched behavior.
9649 DECLARE_PRINTER(DeclaredAccessorInfo) 9641 DECLARE_PRINTER(DeclaredAccessorInfo)
9650 DECLARE_VERIFIER(DeclaredAccessorInfo) 9642 DECLARE_VERIFIER(DeclaredAccessorInfo)
9651 9643
9652 static const int kDescriptorOffset = AccessorInfo::kSize; 9644 static const int kDescriptorOffset = AccessorInfo::kSize;
9653 static const int kSize = kDescriptorOffset + kPointerSize; 9645 static const int kSize = kDescriptorOffset + kPointerSize;
9654 9646
9655 private: 9647 private:
9656 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorInfo); 9648 DISALLOW_IMPLICIT_CONSTRUCTORS(DeclaredAccessorInfo);
9657 }; 9649 };
9658 9650
9659 9651
9660 // An accessor must have a getter, but can have no setter. 9652 // An accessor must have a getter, but can have no setter.
9661 // 9653 //
9662 // When setting a property, V8 searches accessors in prototypes. 9654 // When setting a property, V8 searches accessors in prototypes.
9663 // If an accessor was found and it does not have a setter, 9655 // If an accessor was found and it does not have a setter,
9664 // the request is ignored. 9656 // the request is ignored.
9665 // 9657 //
9666 // If the accessor in the prototype has the READ_ONLY property attribute, then 9658 // If the accessor in the prototype has the READ_ONLY property attribute, then
9667 // a new value is added to the local object when the property is set. 9659 // a new value is added to the local object when the property is set.
9668 // This shadows the accessor in the prototype. 9660 // This shadows the accessor in the prototype.
9669 class ExecutableAccessorInfo V8_FINAL : public AccessorInfo { 9661 class ExecutableAccessorInfo: public AccessorInfo {
9670 public: 9662 public:
9671 DECL_ACCESSORS(getter, Object) 9663 DECL_ACCESSORS(getter, Object)
9672 DECL_ACCESSORS(setter, Object) 9664 DECL_ACCESSORS(setter, Object)
9673 DECL_ACCESSORS(data, Object) 9665 DECL_ACCESSORS(data, Object)
9674 9666
9675 static inline ExecutableAccessorInfo* cast(Object* obj); 9667 static inline ExecutableAccessorInfo* cast(Object* obj);
9676 9668
9677 // Dispatched behavior. 9669 // Dispatched behavior.
9678 DECLARE_PRINTER(ExecutableAccessorInfo) 9670 DECLARE_PRINTER(ExecutableAccessorInfo)
9679 DECLARE_VERIFIER(ExecutableAccessorInfo) 9671 DECLARE_VERIFIER(ExecutableAccessorInfo)
9680 9672
9681 static const int kGetterOffset = AccessorInfo::kSize; 9673 static const int kGetterOffset = AccessorInfo::kSize;
9682 static const int kSetterOffset = kGetterOffset + kPointerSize; 9674 static const int kSetterOffset = kGetterOffset + kPointerSize;
9683 static const int kDataOffset = kSetterOffset + kPointerSize; 9675 static const int kDataOffset = kSetterOffset + kPointerSize;
9684 static const int kSize = kDataOffset + kPointerSize; 9676 static const int kSize = kDataOffset + kPointerSize;
9685 9677
9686 private: 9678 private:
9687 DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo); 9679 DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo);
9688 }; 9680 };
9689 9681
9690 9682
9691 // Support for JavaScript accessors: A pair of a getter and a setter. Each 9683 // Support for JavaScript accessors: A pair of a getter and a setter. Each
9692 // accessor can either be 9684 // accessor can either be
9693 // * a pointer to a JavaScript function or proxy: a real accessor 9685 // * a pointer to a JavaScript function or proxy: a real accessor
9694 // * undefined: considered an accessor by the spec, too, strangely enough 9686 // * undefined: considered an accessor by the spec, too, strangely enough
9695 // * the hole: an accessor which has not been set 9687 // * the hole: an accessor which has not been set
9696 // * a pointer to a map: a transition used to ensure map sharing 9688 // * a pointer to a map: a transition used to ensure map sharing
9697 class AccessorPair V8_FINAL : public Struct { 9689 class AccessorPair: public Struct {
9698 public: 9690 public:
9699 DECL_ACCESSORS(getter, Object) 9691 DECL_ACCESSORS(getter, Object)
9700 DECL_ACCESSORS(setter, Object) 9692 DECL_ACCESSORS(setter, Object)
9701 9693
9702 static inline AccessorPair* cast(Object* obj); 9694 static inline AccessorPair* cast(Object* obj);
9703 9695
9704 static Handle<AccessorPair> Copy(Handle<AccessorPair> pair); 9696 static Handle<AccessorPair> Copy(Handle<AccessorPair> pair);
9705 9697
9706 Object* get(AccessorComponent component) { 9698 Object* get(AccessorComponent component) {
9707 return component == ACCESSOR_GETTER ? getter() : setter(); 9699 return component == ACCESSOR_GETTER ? getter() : setter();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
9743 // Object.defineProperty(obj, "foo", {get: undefined}); 9735 // Object.defineProperty(obj, "foo", {get: undefined});
9744 // assertTrue("foo" in obj); 9736 // assertTrue("foo" in obj);
9745 bool IsJSAccessor(Object* obj) { 9737 bool IsJSAccessor(Object* obj) {
9746 return obj->IsSpecFunction() || obj->IsUndefined(); 9738 return obj->IsSpecFunction() || obj->IsUndefined();
9747 } 9739 }
9748 9740
9749 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorPair); 9741 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorPair);
9750 }; 9742 };
9751 9743
9752 9744
9753 class AccessCheckInfo V8_FINAL : public Struct { 9745 class AccessCheckInfo: public Struct {
9754 public: 9746 public:
9755 DECL_ACCESSORS(named_callback, Object) 9747 DECL_ACCESSORS(named_callback, Object)
9756 DECL_ACCESSORS(indexed_callback, Object) 9748 DECL_ACCESSORS(indexed_callback, Object)
9757 DECL_ACCESSORS(data, Object) 9749 DECL_ACCESSORS(data, Object)
9758 9750
9759 static inline AccessCheckInfo* cast(Object* obj); 9751 static inline AccessCheckInfo* cast(Object* obj);
9760 9752
9761 // Dispatched behavior. 9753 // Dispatched behavior.
9762 DECLARE_PRINTER(AccessCheckInfo) 9754 DECLARE_PRINTER(AccessCheckInfo)
9763 DECLARE_VERIFIER(AccessCheckInfo) 9755 DECLARE_VERIFIER(AccessCheckInfo)
9764 9756
9765 static const int kNamedCallbackOffset = HeapObject::kHeaderSize; 9757 static const int kNamedCallbackOffset = HeapObject::kHeaderSize;
9766 static const int kIndexedCallbackOffset = kNamedCallbackOffset + kPointerSize; 9758 static const int kIndexedCallbackOffset = kNamedCallbackOffset + kPointerSize;
9767 static const int kDataOffset = kIndexedCallbackOffset + kPointerSize; 9759 static const int kDataOffset = kIndexedCallbackOffset + kPointerSize;
9768 static const int kSize = kDataOffset + kPointerSize; 9760 static const int kSize = kDataOffset + kPointerSize;
9769 9761
9770 private: 9762 private:
9771 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessCheckInfo); 9763 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessCheckInfo);
9772 }; 9764 };
9773 9765
9774 9766
9775 class InterceptorInfo V8_FINAL : public Struct { 9767 class InterceptorInfo: public Struct {
9776 public: 9768 public:
9777 DECL_ACCESSORS(getter, Object) 9769 DECL_ACCESSORS(getter, Object)
9778 DECL_ACCESSORS(setter, Object) 9770 DECL_ACCESSORS(setter, Object)
9779 DECL_ACCESSORS(query, Object) 9771 DECL_ACCESSORS(query, Object)
9780 DECL_ACCESSORS(deleter, Object) 9772 DECL_ACCESSORS(deleter, Object)
9781 DECL_ACCESSORS(enumerator, Object) 9773 DECL_ACCESSORS(enumerator, Object)
9782 DECL_ACCESSORS(data, Object) 9774 DECL_ACCESSORS(data, Object)
9783 9775
9784 static inline InterceptorInfo* cast(Object* obj); 9776 static inline InterceptorInfo* cast(Object* obj);
9785 9777
9786 // Dispatched behavior. 9778 // Dispatched behavior.
9787 DECLARE_PRINTER(InterceptorInfo) 9779 DECLARE_PRINTER(InterceptorInfo)
9788 DECLARE_VERIFIER(InterceptorInfo) 9780 DECLARE_VERIFIER(InterceptorInfo)
9789 9781
9790 static const int kGetterOffset = HeapObject::kHeaderSize; 9782 static const int kGetterOffset = HeapObject::kHeaderSize;
9791 static const int kSetterOffset = kGetterOffset + kPointerSize; 9783 static const int kSetterOffset = kGetterOffset + kPointerSize;
9792 static const int kQueryOffset = kSetterOffset + kPointerSize; 9784 static const int kQueryOffset = kSetterOffset + kPointerSize;
9793 static const int kDeleterOffset = kQueryOffset + kPointerSize; 9785 static const int kDeleterOffset = kQueryOffset + kPointerSize;
9794 static const int kEnumeratorOffset = kDeleterOffset + kPointerSize; 9786 static const int kEnumeratorOffset = kDeleterOffset + kPointerSize;
9795 static const int kDataOffset = kEnumeratorOffset + kPointerSize; 9787 static const int kDataOffset = kEnumeratorOffset + kPointerSize;
9796 static const int kSize = kDataOffset + kPointerSize; 9788 static const int kSize = kDataOffset + kPointerSize;
9797 9789
9798 private: 9790 private:
9799 DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo); 9791 DISALLOW_IMPLICIT_CONSTRUCTORS(InterceptorInfo);
9800 }; 9792 };
9801 9793
9802 9794
9803 class CallHandlerInfo V8_FINAL : public Struct { 9795 class CallHandlerInfo: public Struct {
9804 public: 9796 public:
9805 DECL_ACCESSORS(callback, Object) 9797 DECL_ACCESSORS(callback, Object)
9806 DECL_ACCESSORS(data, Object) 9798 DECL_ACCESSORS(data, Object)
9807 9799
9808 static inline CallHandlerInfo* cast(Object* obj); 9800 static inline CallHandlerInfo* cast(Object* obj);
9809 9801
9810 // Dispatched behavior. 9802 // Dispatched behavior.
9811 DECLARE_PRINTER(CallHandlerInfo) 9803 DECLARE_PRINTER(CallHandlerInfo)
9812 DECLARE_VERIFIER(CallHandlerInfo) 9804 DECLARE_VERIFIER(CallHandlerInfo)
9813 9805
(...skipping 15 matching lines...) Expand all
9829 9821
9830 static const int kTagOffset = HeapObject::kHeaderSize; 9822 static const int kTagOffset = HeapObject::kHeaderSize;
9831 static const int kPropertyListOffset = kTagOffset + kPointerSize; 9823 static const int kPropertyListOffset = kTagOffset + kPointerSize;
9832 static const int kHeaderSize = kPropertyListOffset + kPointerSize; 9824 static const int kHeaderSize = kPropertyListOffset + kPointerSize;
9833 9825
9834 private: 9826 private:
9835 DISALLOW_IMPLICIT_CONSTRUCTORS(TemplateInfo); 9827 DISALLOW_IMPLICIT_CONSTRUCTORS(TemplateInfo);
9836 }; 9828 };
9837 9829
9838 9830
9839 class FunctionTemplateInfo V8_FINAL : public TemplateInfo { 9831 class FunctionTemplateInfo: public TemplateInfo {
9840 public: 9832 public:
9841 DECL_ACCESSORS(serial_number, Object) 9833 DECL_ACCESSORS(serial_number, Object)
9842 DECL_ACCESSORS(call_code, Object) 9834 DECL_ACCESSORS(call_code, Object)
9843 DECL_ACCESSORS(property_accessors, Object) 9835 DECL_ACCESSORS(property_accessors, Object)
9844 DECL_ACCESSORS(prototype_template, Object) 9836 DECL_ACCESSORS(prototype_template, Object)
9845 DECL_ACCESSORS(parent_template, Object) 9837 DECL_ACCESSORS(parent_template, Object)
9846 DECL_ACCESSORS(named_property_handler, Object) 9838 DECL_ACCESSORS(named_property_handler, Object)
9847 DECL_ACCESSORS(indexed_property_handler, Object) 9839 DECL_ACCESSORS(indexed_property_handler, Object)
9848 DECL_ACCESSORS(instance_template, Object) 9840 DECL_ACCESSORS(instance_template, Object)
9849 DECL_ACCESSORS(class_name, Object) 9841 DECL_ACCESSORS(class_name, Object)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
9895 // Bit position in the flag, from least significant bit position. 9887 // Bit position in the flag, from least significant bit position.
9896 static const int kHiddenPrototypeBit = 0; 9888 static const int kHiddenPrototypeBit = 0;
9897 static const int kUndetectableBit = 1; 9889 static const int kUndetectableBit = 1;
9898 static const int kNeedsAccessCheckBit = 2; 9890 static const int kNeedsAccessCheckBit = 2;
9899 static const int kReadOnlyPrototypeBit = 3; 9891 static const int kReadOnlyPrototypeBit = 3;
9900 9892
9901 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo); 9893 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo);
9902 }; 9894 };
9903 9895
9904 9896
9905 class ObjectTemplateInfo V8_FINAL : public TemplateInfo { 9897 class ObjectTemplateInfo: public TemplateInfo {
9906 public: 9898 public:
9907 DECL_ACCESSORS(constructor, Object) 9899 DECL_ACCESSORS(constructor, Object)
9908 DECL_ACCESSORS(internal_field_count, Object) 9900 DECL_ACCESSORS(internal_field_count, Object)
9909 9901
9910 static inline ObjectTemplateInfo* cast(Object* obj); 9902 static inline ObjectTemplateInfo* cast(Object* obj);
9911 9903
9912 // Dispatched behavior. 9904 // Dispatched behavior.
9913 DECLARE_PRINTER(ObjectTemplateInfo) 9905 DECLARE_PRINTER(ObjectTemplateInfo)
9914 DECLARE_VERIFIER(ObjectTemplateInfo) 9906 DECLARE_VERIFIER(ObjectTemplateInfo)
9915 9907
9916 static const int kConstructorOffset = TemplateInfo::kHeaderSize; 9908 static const int kConstructorOffset = TemplateInfo::kHeaderSize;
9917 static const int kInternalFieldCountOffset = 9909 static const int kInternalFieldCountOffset =
9918 kConstructorOffset + kPointerSize; 9910 kConstructorOffset + kPointerSize;
9919 static const int kSize = kInternalFieldCountOffset + kPointerSize; 9911 static const int kSize = kInternalFieldCountOffset + kPointerSize;
9920 }; 9912 };
9921 9913
9922 9914
9923 class SignatureInfo V8_FINAL : public Struct { 9915 class SignatureInfo: public Struct {
9924 public: 9916 public:
9925 DECL_ACCESSORS(receiver, Object) 9917 DECL_ACCESSORS(receiver, Object)
9926 DECL_ACCESSORS(args, Object) 9918 DECL_ACCESSORS(args, Object)
9927 9919
9928 static inline SignatureInfo* cast(Object* obj); 9920 static inline SignatureInfo* cast(Object* obj);
9929 9921
9930 // Dispatched behavior. 9922 // Dispatched behavior.
9931 DECLARE_PRINTER(SignatureInfo) 9923 DECLARE_PRINTER(SignatureInfo)
9932 DECLARE_VERIFIER(SignatureInfo) 9924 DECLARE_VERIFIER(SignatureInfo)
9933 9925
9934 static const int kReceiverOffset = Struct::kHeaderSize; 9926 static const int kReceiverOffset = Struct::kHeaderSize;
9935 static const int kArgsOffset = kReceiverOffset + kPointerSize; 9927 static const int kArgsOffset = kReceiverOffset + kPointerSize;
9936 static const int kSize = kArgsOffset + kPointerSize; 9928 static const int kSize = kArgsOffset + kPointerSize;
9937 9929
9938 private: 9930 private:
9939 DISALLOW_IMPLICIT_CONSTRUCTORS(SignatureInfo); 9931 DISALLOW_IMPLICIT_CONSTRUCTORS(SignatureInfo);
9940 }; 9932 };
9941 9933
9942 9934
9943 class TypeSwitchInfo V8_FINAL : public Struct { 9935 class TypeSwitchInfo: public Struct {
9944 public: 9936 public:
9945 DECL_ACCESSORS(types, Object) 9937 DECL_ACCESSORS(types, Object)
9946 9938
9947 static inline TypeSwitchInfo* cast(Object* obj); 9939 static inline TypeSwitchInfo* cast(Object* obj);
9948 9940
9949 // Dispatched behavior. 9941 // Dispatched behavior.
9950 DECLARE_PRINTER(TypeSwitchInfo) 9942 DECLARE_PRINTER(TypeSwitchInfo)
9951 DECLARE_VERIFIER(TypeSwitchInfo) 9943 DECLARE_VERIFIER(TypeSwitchInfo)
9952 9944
9953 static const int kTypesOffset = Struct::kHeaderSize; 9945 static const int kTypesOffset = Struct::kHeaderSize;
9954 static const int kSize = kTypesOffset + kPointerSize; 9946 static const int kSize = kTypesOffset + kPointerSize;
9955 }; 9947 };
9956 9948
9957 9949
9958 #ifdef ENABLE_DEBUGGER_SUPPORT 9950 #ifdef ENABLE_DEBUGGER_SUPPORT
9959 // The DebugInfo class holds additional information for a function being 9951 // The DebugInfo class holds additional information for a function being
9960 // debugged. 9952 // debugged.
9961 class DebugInfo V8_FINAL : public Struct { 9953 class DebugInfo: public Struct {
9962 public: 9954 public:
9963 // The shared function info for the source being debugged. 9955 // The shared function info for the source being debugged.
9964 DECL_ACCESSORS(shared, SharedFunctionInfo) 9956 DECL_ACCESSORS(shared, SharedFunctionInfo)
9965 // Code object for the original code. 9957 // Code object for the original code.
9966 DECL_ACCESSORS(original_code, Code) 9958 DECL_ACCESSORS(original_code, Code)
9967 // Code object for the patched code. This code object is the code object 9959 // Code object for the patched code. This code object is the code object
9968 // currently active for the function. 9960 // currently active for the function.
9969 DECL_ACCESSORS(code, Code) 9961 DECL_ACCESSORS(code, Code)
9970 // Fixed array holding status information for each active break point. 9962 // Fixed array holding status information for each active break point.
9971 DECL_ACCESSORS(break_points, FixedArray) 9963 DECL_ACCESSORS(break_points, FixedArray)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
10011 // Lookup the index in the break_points array for a code position. 10003 // Lookup the index in the break_points array for a code position.
10012 int GetBreakPointInfoIndex(int code_position); 10004 int GetBreakPointInfoIndex(int code_position);
10013 10005
10014 DISALLOW_IMPLICIT_CONSTRUCTORS(DebugInfo); 10006 DISALLOW_IMPLICIT_CONSTRUCTORS(DebugInfo);
10015 }; 10007 };
10016 10008
10017 10009
10018 // The BreakPointInfo class holds information for break points set in a 10010 // The BreakPointInfo class holds information for break points set in a
10019 // function. The DebugInfo object holds a BreakPointInfo object for each code 10011 // function. The DebugInfo object holds a BreakPointInfo object for each code
10020 // position with one or more break points. 10012 // position with one or more break points.
10021 class BreakPointInfo V8_FINAL : public Struct { 10013 class BreakPointInfo: public Struct {
10022 public: 10014 public:
10023 // The position in the code for the break point. 10015 // The position in the code for the break point.
10024 DECL_ACCESSORS(code_position, Smi) 10016 DECL_ACCESSORS(code_position, Smi)
10025 // The position in the source for the break position. 10017 // The position in the source for the break position.
10026 DECL_ACCESSORS(source_position, Smi) 10018 DECL_ACCESSORS(source_position, Smi)
10027 // The position in the source for the last statement before this break 10019 // The position in the source for the last statement before this break
10028 // position. 10020 // position.
10029 DECL_ACCESSORS(statement_position, Smi) 10021 DECL_ACCESSORS(statement_position, Smi)
10030 // List of related JavaScript break points. 10022 // List of related JavaScript break points.
10031 DECL_ACCESSORS(break_point_objects, Object) 10023 DECL_ACCESSORS(break_point_objects, Object)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
10076 V(kRelocatable, "relocatable", "(Relocatable)") \ 10068 V(kRelocatable, "relocatable", "(Relocatable)") \
10077 V(kDebug, "debug", "(Debugger)") \ 10069 V(kDebug, "debug", "(Debugger)") \
10078 V(kCompilationCache, "compilationcache", "(Compilation cache)") \ 10070 V(kCompilationCache, "compilationcache", "(Compilation cache)") \
10079 V(kHandleScope, "handlescope", "(Handle scope)") \ 10071 V(kHandleScope, "handlescope", "(Handle scope)") \
10080 V(kBuiltins, "builtins", "(Builtins)") \ 10072 V(kBuiltins, "builtins", "(Builtins)") \
10081 V(kGlobalHandles, "globalhandles", "(Global handles)") \ 10073 V(kGlobalHandles, "globalhandles", "(Global handles)") \
10082 V(kEternalHandles, "eternalhandles", "(Eternal handles)") \ 10074 V(kEternalHandles, "eternalhandles", "(Eternal handles)") \
10083 V(kThreadManager, "threadmanager", "(Thread manager)") \ 10075 V(kThreadManager, "threadmanager", "(Thread manager)") \
10084 V(kExtensions, "Extensions", "(Extensions)") 10076 V(kExtensions, "Extensions", "(Extensions)")
10085 10077
10086 class VisitorSynchronization V8_FINAL : public AllStatic { 10078 class VisitorSynchronization : public AllStatic {
10087 public: 10079 public:
10088 #define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item, 10080 #define DECLARE_ENUM(enum_item, ignore1, ignore2) enum_item,
10089 enum SyncTag { 10081 enum SyncTag {
10090 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_ENUM) 10082 VISITOR_SYNCHRONIZATION_TAGS_LIST(DECLARE_ENUM)
10091 kNumberOfSyncTags 10083 kNumberOfSyncTags
10092 }; 10084 };
10093 #undef DECLARE_ENUM 10085 #undef DECLARE_ENUM
10094 10086
10095 static const char* const kTags[kNumberOfSyncTags]; 10087 static const char* const kTags[kNumberOfSyncTags];
10096 static const char* const kTagNames[kNumberOfSyncTags]; 10088 static const char* const kTagNames[kNumberOfSyncTags];
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
10154 // Visits a handle that has an embedder-assigned class ID. 10146 // Visits a handle that has an embedder-assigned class ID.
10155 virtual void VisitEmbedderReference(Object** p, uint16_t class_id) {} 10147 virtual void VisitEmbedderReference(Object** p, uint16_t class_id) {}
10156 10148
10157 // Intended for serialization/deserialization checking: insert, or 10149 // Intended for serialization/deserialization checking: insert, or
10158 // check for the presence of, a tag at this position in the stream. 10150 // check for the presence of, a tag at this position in the stream.
10159 // Also used for marking up GC roots in heap snapshots. 10151 // Also used for marking up GC roots in heap snapshots.
10160 virtual void Synchronize(VisitorSynchronization::SyncTag tag) {} 10152 virtual void Synchronize(VisitorSynchronization::SyncTag tag) {}
10161 }; 10153 };
10162 10154
10163 10155
10164 class StructBodyDescriptor V8_FINAL : public 10156 class StructBodyDescriptor : public
10165 FlexibleBodyDescriptor<HeapObject::kHeaderSize> { 10157 FlexibleBodyDescriptor<HeapObject::kHeaderSize> {
10166 public: 10158 public:
10167 static inline int SizeOf(Map* map, HeapObject* object) { 10159 static inline int SizeOf(Map* map, HeapObject* object) {
10168 return map->instance_size(); 10160 return map->instance_size();
10169 } 10161 }
10170 }; 10162 };
10171 10163
10172 10164
10173 // BooleanBit is a helper class for setting and getting a bit in an 10165 // BooleanBit is a helper class for setting and getting a bit in an
10174 // integer or Smi. 10166 // integer or Smi.
10175 class BooleanBit V8_FINAL : public AllStatic { 10167 class BooleanBit : public AllStatic {
10176 public: 10168 public:
10177 static inline bool get(Smi* smi, int bit_position) { 10169 static inline bool get(Smi* smi, int bit_position) {
10178 return get(smi->value(), bit_position); 10170 return get(smi->value(), bit_position);
10179 } 10171 }
10180 10172
10181 static inline bool get(int value, int bit_position) { 10173 static inline bool get(int value, int bit_position) {
10182 return (value & (1 << bit_position)) != 0; 10174 return (value & (1 << bit_position)) != 0;
10183 } 10175 }
10184 10176
10185 static inline Smi* set(Smi* smi, int bit_position, bool v) { 10177 static inline Smi* set(Smi* smi, int bit_position, bool v) {
10186 return Smi::FromInt(set(smi->value(), bit_position, v)); 10178 return Smi::FromInt(set(smi->value(), bit_position, v));
10187 } 10179 }
10188 10180
10189 static inline int set(int value, int bit_position, bool v) { 10181 static inline int set(int value, int bit_position, bool v) {
10190 if (v) { 10182 if (v) {
10191 value |= (1 << bit_position); 10183 value |= (1 << bit_position);
10192 } else { 10184 } else {
10193 value &= ~(1 << bit_position); 10185 value &= ~(1 << bit_position);
10194 } 10186 }
10195 return value; 10187 return value;
10196 } 10188 }
10197 }; 10189 };
10198 10190
10199 } } // namespace v8::internal 10191 } } // namespace v8::internal
10200 10192
10201 #endif // V8_OBJECTS_H_ 10193 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips/lithium-mips.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698