Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 V(SCRIPT_TYPE) \ | 440 V(SCRIPT_TYPE) \ |
| 441 V(CODE_CACHE_TYPE) \ | 441 V(CODE_CACHE_TYPE) \ |
| 442 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 442 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
| 443 V(TYPE_FEEDBACK_INFO_TYPE) \ | 443 V(TYPE_FEEDBACK_INFO_TYPE) \ |
| 444 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 444 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
| 445 V(BOX_TYPE) \ | 445 V(BOX_TYPE) \ |
| 446 V(PROTOTYPE_INFO_TYPE) \ | 446 V(PROTOTYPE_INFO_TYPE) \ |
| 447 \ | 447 \ |
| 448 V(FIXED_ARRAY_TYPE) \ | 448 V(FIXED_ARRAY_TYPE) \ |
| 449 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 449 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
| 450 V(CONSTANT_POOL_ARRAY_TYPE) \ | |
| 451 V(SHARED_FUNCTION_INFO_TYPE) \ | 450 V(SHARED_FUNCTION_INFO_TYPE) \ |
| 452 V(WEAK_CELL_TYPE) \ | 451 V(WEAK_CELL_TYPE) \ |
| 453 \ | 452 \ |
| 454 V(JS_MESSAGE_OBJECT_TYPE) \ | 453 V(JS_MESSAGE_OBJECT_TYPE) \ |
| 455 \ | 454 \ |
| 456 V(JS_VALUE_TYPE) \ | 455 V(JS_VALUE_TYPE) \ |
| 457 V(JS_DATE_TYPE) \ | 456 V(JS_DATE_TYPE) \ |
| 458 V(JS_OBJECT_TYPE) \ | 457 V(JS_OBJECT_TYPE) \ |
| 459 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 458 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
| 460 V(JS_GENERATOR_OBJECT_TYPE) \ | 459 V(JS_GENERATOR_OBJECT_TYPE) \ |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 733 ALLOCATION_MEMENTO_TYPE, | 732 ALLOCATION_MEMENTO_TYPE, |
| 734 SCRIPT_TYPE, | 733 SCRIPT_TYPE, |
| 735 CODE_CACHE_TYPE, | 734 CODE_CACHE_TYPE, |
| 736 POLYMORPHIC_CODE_CACHE_TYPE, | 735 POLYMORPHIC_CODE_CACHE_TYPE, |
| 737 TYPE_FEEDBACK_INFO_TYPE, | 736 TYPE_FEEDBACK_INFO_TYPE, |
| 738 ALIASED_ARGUMENTS_ENTRY_TYPE, | 737 ALIASED_ARGUMENTS_ENTRY_TYPE, |
| 739 BOX_TYPE, | 738 BOX_TYPE, |
| 740 DEBUG_INFO_TYPE, | 739 DEBUG_INFO_TYPE, |
| 741 BREAK_POINT_INFO_TYPE, | 740 BREAK_POINT_INFO_TYPE, |
| 742 FIXED_ARRAY_TYPE, | 741 FIXED_ARRAY_TYPE, |
| 743 CONSTANT_POOL_ARRAY_TYPE, | |
|
jochen (gone - plz use gerrit)
2015/06/08 12:54:29
the constants in tools/v8heapconst.py are now inco
| |
| 744 SHARED_FUNCTION_INFO_TYPE, | 742 SHARED_FUNCTION_INFO_TYPE, |
| 745 CELL_TYPE, | 743 CELL_TYPE, |
| 746 WEAK_CELL_TYPE, | 744 WEAK_CELL_TYPE, |
| 747 PROPERTY_CELL_TYPE, | 745 PROPERTY_CELL_TYPE, |
| 748 PROTOTYPE_INFO_TYPE, | 746 PROTOTYPE_INFO_TYPE, |
| 749 | 747 |
| 750 // All the following types are subtypes of JSReceiver, which corresponds to | 748 // All the following types are subtypes of JSReceiver, which corresponds to |
| 751 // objects in the JS sense. The first and the last type in this range are | 749 // objects in the JS sense. The first and the last type in this range are |
| 752 // the two forms of function. This organization enables using the same | 750 // the two forms of function. This organization enables using the same |
| 753 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the | 751 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 968 V(TransitionArray) \ | 966 V(TransitionArray) \ |
| 969 V(TypeFeedbackVector) \ | 967 V(TypeFeedbackVector) \ |
| 970 V(DeoptimizationInputData) \ | 968 V(DeoptimizationInputData) \ |
| 971 V(DeoptimizationOutputData) \ | 969 V(DeoptimizationOutputData) \ |
| 972 V(DependentCode) \ | 970 V(DependentCode) \ |
| 973 V(HandlerTable) \ | 971 V(HandlerTable) \ |
| 974 V(FixedArray) \ | 972 V(FixedArray) \ |
| 975 V(FixedDoubleArray) \ | 973 V(FixedDoubleArray) \ |
| 976 V(WeakFixedArray) \ | 974 V(WeakFixedArray) \ |
| 977 V(ArrayList) \ | 975 V(ArrayList) \ |
| 978 V(ConstantPoolArray) \ | |
| 979 V(Context) \ | 976 V(Context) \ |
| 980 V(ScriptContextTable) \ | 977 V(ScriptContextTable) \ |
| 981 V(NativeContext) \ | 978 V(NativeContext) \ |
| 982 V(ScopeInfo) \ | 979 V(ScopeInfo) \ |
| 983 V(JSFunction) \ | 980 V(JSFunction) \ |
| 984 V(Code) \ | 981 V(Code) \ |
| 985 V(Oddball) \ | 982 V(Oddball) \ |
| 986 V(SharedFunctionInfo) \ | 983 V(SharedFunctionInfo) \ |
| 987 V(JSValue) \ | 984 V(JSValue) \ |
| 988 V(JSDate) \ | 985 V(JSDate) \ |
| (...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2675 DECLARE_CAST(ArrayList) | 2672 DECLARE_CAST(ArrayList) |
| 2676 | 2673 |
| 2677 private: | 2674 private: |
| 2678 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); | 2675 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); |
| 2679 static const int kLengthIndex = 0; | 2676 static const int kLengthIndex = 0; |
| 2680 static const int kFirstIndex = 1; | 2677 static const int kFirstIndex = 1; |
| 2681 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); | 2678 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); |
| 2682 }; | 2679 }; |
| 2683 | 2680 |
| 2684 | 2681 |
| 2685 // ConstantPoolArray describes a fixed-sized array containing constant pool | |
| 2686 // entries. | |
| 2687 // | |
| 2688 // A ConstantPoolArray can be structured in two different ways depending upon | |
| 2689 // whether it is extended or small. The is_extended_layout() method can be used | |
| 2690 // to discover which layout the constant pool has. | |
| 2691 // | |
| 2692 // The format of a small constant pool is: | |
| 2693 // [kSmallLayout1Offset] : Small section layout bitmap 1 | |
| 2694 // [kSmallLayout2Offset] : Small section layout bitmap 2 | |
| 2695 // [first_index(INT64, SMALL_SECTION)] : 64 bit entries | |
| 2696 // ... : ... | |
| 2697 // [first_index(CODE_PTR, SMALL_SECTION)] : code pointer entries | |
| 2698 // ... : ... | |
| 2699 // [first_index(HEAP_PTR, SMALL_SECTION)] : heap pointer entries | |
| 2700 // ... : ... | |
| 2701 // [first_index(INT32, SMALL_SECTION)] : 32 bit entries | |
| 2702 // ... : ... | |
| 2703 // | |
| 2704 // If the constant pool has an extended layout, the extended section constant | |
| 2705 // pool also contains an extended section, which has the following format at | |
| 2706 // location get_extended_section_header_offset(): | |
| 2707 // [kExtendedInt64CountOffset] : count of extended 64 bit entries | |
| 2708 // [kExtendedCodePtrCountOffset] : count of extended code pointers | |
| 2709 // [kExtendedHeapPtrCountOffset] : count of extended heap pointers | |
| 2710 // [kExtendedInt32CountOffset] : count of extended 32 bit entries | |
| 2711 // [first_index(INT64, EXTENDED_SECTION)] : 64 bit entries | |
| 2712 // ... : ... | |
| 2713 // [first_index(CODE_PTR, EXTENDED_SECTION)]: code pointer entries | |
| 2714 // ... : ... | |
| 2715 // [first_index(HEAP_PTR, EXTENDED_SECTION)]: heap pointer entries | |
| 2716 // ... : ... | |
| 2717 // [first_index(INT32, EXTENDED_SECTION)] : 32 bit entries | |
| 2718 // ... : ... | |
| 2719 // | |
| 2720 class ConstantPoolArray: public HeapObject { | |
| 2721 public: | |
| 2722 enum WeakObjectState { NO_WEAK_OBJECTS, WEAK_OBJECTS_IN_OPTIMIZED_CODE }; | |
| 2723 | |
| 2724 enum Type { | |
| 2725 INT64 = 0, | |
| 2726 CODE_PTR, | |
| 2727 HEAP_PTR, | |
| 2728 INT32, | |
| 2729 // Number of types stored by the ConstantPoolArrays. | |
| 2730 NUMBER_OF_TYPES, | |
| 2731 FIRST_TYPE = INT64, | |
| 2732 LAST_TYPE = INT32 | |
| 2733 }; | |
| 2734 | |
| 2735 enum LayoutSection { | |
| 2736 SMALL_SECTION = 0, | |
| 2737 EXTENDED_SECTION, | |
| 2738 NUMBER_OF_LAYOUT_SECTIONS | |
| 2739 }; | |
| 2740 | |
| 2741 class NumberOfEntries BASE_EMBEDDED { | |
| 2742 public: | |
| 2743 inline NumberOfEntries() { | |
| 2744 for (int i = 0; i < NUMBER_OF_TYPES; i++) { | |
| 2745 element_counts_[i] = 0; | |
| 2746 } | |
| 2747 } | |
| 2748 | |
| 2749 inline NumberOfEntries(int int64_count, int code_ptr_count, | |
| 2750 int heap_ptr_count, int int32_count) { | |
| 2751 element_counts_[INT64] = int64_count; | |
| 2752 element_counts_[CODE_PTR] = code_ptr_count; | |
| 2753 element_counts_[HEAP_PTR] = heap_ptr_count; | |
| 2754 element_counts_[INT32] = int32_count; | |
| 2755 } | |
| 2756 | |
| 2757 inline NumberOfEntries(ConstantPoolArray* array, LayoutSection section) { | |
| 2758 element_counts_[INT64] = array->number_of_entries(INT64, section); | |
| 2759 element_counts_[CODE_PTR] = array->number_of_entries(CODE_PTR, section); | |
| 2760 element_counts_[HEAP_PTR] = array->number_of_entries(HEAP_PTR, section); | |
| 2761 element_counts_[INT32] = array->number_of_entries(INT32, section); | |
| 2762 } | |
| 2763 | |
| 2764 inline void increment(Type type); | |
| 2765 inline int equals(const NumberOfEntries& other) const; | |
| 2766 inline bool is_empty() const; | |
| 2767 inline int count_of(Type type) const; | |
| 2768 inline int base_of(Type type) const; | |
| 2769 inline int total_count() const; | |
| 2770 inline int are_in_range(int min, int max) const; | |
| 2771 | |
| 2772 private: | |
| 2773 int element_counts_[NUMBER_OF_TYPES]; | |
| 2774 }; | |
| 2775 | |
| 2776 class Iterator BASE_EMBEDDED { | |
| 2777 public: | |
| 2778 inline Iterator(ConstantPoolArray* array, Type type) | |
| 2779 : array_(array), | |
| 2780 type_(type), | |
| 2781 final_section_(array->final_section()), | |
| 2782 current_section_(SMALL_SECTION), | |
| 2783 next_index_(array->first_index(type, SMALL_SECTION)) { | |
| 2784 update_section(); | |
| 2785 } | |
| 2786 | |
| 2787 inline Iterator(ConstantPoolArray* array, Type type, LayoutSection section) | |
| 2788 : array_(array), | |
| 2789 type_(type), | |
| 2790 final_section_(section), | |
| 2791 current_section_(section), | |
| 2792 next_index_(array->first_index(type, section)) { | |
| 2793 update_section(); | |
| 2794 } | |
| 2795 | |
| 2796 inline int next_index(); | |
| 2797 inline bool is_finished(); | |
| 2798 | |
| 2799 private: | |
| 2800 inline void update_section(); | |
| 2801 ConstantPoolArray* array_; | |
| 2802 const Type type_; | |
| 2803 const LayoutSection final_section_; | |
| 2804 | |
| 2805 LayoutSection current_section_; | |
| 2806 int next_index_; | |
| 2807 }; | |
| 2808 | |
| 2809 // Getters for the first index, the last index and the count of entries of | |
| 2810 // a given type for a given layout section. | |
| 2811 inline int first_index(Type type, LayoutSection layout_section); | |
| 2812 inline int last_index(Type type, LayoutSection layout_section); | |
| 2813 inline int number_of_entries(Type type, LayoutSection layout_section); | |
| 2814 | |
| 2815 // Returns the type of the entry at the given index. | |
| 2816 inline Type get_type(int index); | |
| 2817 inline bool offset_is_type(int offset, Type type); | |
| 2818 | |
| 2819 // Setter and getter for pool elements. | |
| 2820 inline Address get_code_ptr_entry(int index); | |
| 2821 inline Object* get_heap_ptr_entry(int index); | |
| 2822 inline int64_t get_int64_entry(int index); | |
| 2823 inline int32_t get_int32_entry(int index); | |
| 2824 inline double get_int64_entry_as_double(int index); | |
| 2825 | |
| 2826 inline void set(int index, Address value); | |
| 2827 inline void set(int index, Object* value); | |
| 2828 inline void set(int index, int64_t value); | |
| 2829 inline void set(int index, double value); | |
| 2830 inline void set(int index, int32_t value); | |
| 2831 | |
| 2832 // Setters which take a raw offset rather than an index (for code generation). | |
| 2833 inline void set_at_offset(int offset, int32_t value); | |
| 2834 inline void set_at_offset(int offset, int64_t value); | |
| 2835 inline void set_at_offset(int offset, double value); | |
| 2836 inline void set_at_offset(int offset, Address value); | |
| 2837 inline void set_at_offset(int offset, Object* value); | |
| 2838 | |
| 2839 // Setter and getter for weak objects state | |
| 2840 inline void set_weak_object_state(WeakObjectState state); | |
| 2841 inline WeakObjectState get_weak_object_state(); | |
| 2842 | |
| 2843 // Returns true if the constant pool has an extended layout, false if it has | |
| 2844 // only the small layout. | |
| 2845 inline bool is_extended_layout(); | |
| 2846 | |
| 2847 // Returns the last LayoutSection in this constant pool array. | |
| 2848 inline LayoutSection final_section(); | |
| 2849 | |
| 2850 // Set up initial state for a small layout constant pool array. | |
| 2851 inline void Init(const NumberOfEntries& small); | |
| 2852 | |
| 2853 // Set up initial state for an extended layout constant pool array. | |
| 2854 inline void InitExtended(const NumberOfEntries& small, | |
| 2855 const NumberOfEntries& extended); | |
| 2856 | |
| 2857 // Clears the pointer entries with GC safe values. | |
| 2858 void ClearPtrEntries(Isolate* isolate); | |
| 2859 | |
| 2860 // returns the total number of entries in the constant pool array. | |
| 2861 inline int length(); | |
| 2862 | |
| 2863 // Garbage collection support. | |
| 2864 inline int size(); | |
| 2865 | |
| 2866 | |
| 2867 inline static int MaxInt64Offset(int number_of_int64) { | |
| 2868 return kFirstEntryOffset + (number_of_int64 * kInt64Size); | |
| 2869 } | |
| 2870 | |
| 2871 inline static int SizeFor(const NumberOfEntries& small) { | |
| 2872 int size = kFirstEntryOffset + | |
| 2873 (small.count_of(INT64) * kInt64Size) + | |
| 2874 (small.count_of(CODE_PTR) * kPointerSize) + | |
| 2875 (small.count_of(HEAP_PTR) * kPointerSize) + | |
| 2876 (small.count_of(INT32) * kInt32Size); | |
| 2877 return RoundUp(size, kPointerSize); | |
| 2878 } | |
| 2879 | |
| 2880 inline static int SizeForExtended(const NumberOfEntries& small, | |
| 2881 const NumberOfEntries& extended) { | |
| 2882 int size = SizeFor(small); | |
| 2883 size = RoundUp(size, kInt64Size); // Align extended header to 64 bits. | |
| 2884 size += kExtendedFirstOffset + | |
| 2885 (extended.count_of(INT64) * kInt64Size) + | |
| 2886 (extended.count_of(CODE_PTR) * kPointerSize) + | |
| 2887 (extended.count_of(HEAP_PTR) * kPointerSize) + | |
| 2888 (extended.count_of(INT32) * kInt32Size); | |
| 2889 return RoundUp(size, kPointerSize); | |
| 2890 } | |
| 2891 | |
| 2892 inline static int entry_size(Type type) { | |
| 2893 switch (type) { | |
| 2894 case INT32: | |
| 2895 return kInt32Size; | |
| 2896 case INT64: | |
| 2897 return kInt64Size; | |
| 2898 case CODE_PTR: | |
| 2899 case HEAP_PTR: | |
| 2900 return kPointerSize; | |
| 2901 default: | |
| 2902 UNREACHABLE(); | |
| 2903 return 0; | |
| 2904 } | |
| 2905 } | |
| 2906 | |
| 2907 // Code Generation support. | |
| 2908 inline int OffsetOfElementAt(int index) { | |
| 2909 int offset; | |
| 2910 LayoutSection section; | |
| 2911 if (is_extended_layout() && index >= first_extended_section_index()) { | |
| 2912 section = EXTENDED_SECTION; | |
| 2913 offset = get_extended_section_header_offset() + kExtendedFirstOffset; | |
| 2914 } else { | |
| 2915 section = SMALL_SECTION; | |
| 2916 offset = kFirstEntryOffset; | |
| 2917 } | |
| 2918 | |
| 2919 // Add offsets for the preceding type sections. | |
| 2920 DCHECK(index <= last_index(LAST_TYPE, section)); | |
| 2921 for (Type type = FIRST_TYPE; index > last_index(type, section); | |
| 2922 type = next_type(type)) { | |
| 2923 offset += entry_size(type) * number_of_entries(type, section); | |
| 2924 } | |
| 2925 | |
| 2926 // Add offset for the index in it's type. | |
| 2927 Type type = get_type(index); | |
| 2928 offset += entry_size(type) * (index - first_index(type, section)); | |
| 2929 return offset; | |
| 2930 } | |
| 2931 | |
| 2932 DECLARE_CAST(ConstantPoolArray) | |
| 2933 | |
| 2934 // Garbage collection support. | |
| 2935 Object** RawFieldOfElementAt(int index) { | |
| 2936 return HeapObject::RawField(this, OffsetOfElementAt(index)); | |
| 2937 } | |
| 2938 | |
| 2939 // Small Layout description. | |
| 2940 static const int kSmallLayout1Offset = HeapObject::kHeaderSize; | |
| 2941 static const int kSmallLayout2Offset = kSmallLayout1Offset + kInt32Size; | |
| 2942 static const int kHeaderSize = kSmallLayout2Offset + kInt32Size; | |
| 2943 static const int kFirstEntryOffset = ROUND_UP(kHeaderSize, kInt64Size); | |
| 2944 | |
| 2945 static const int kSmallLayoutCountBits = 10; | |
| 2946 static const int kMaxSmallEntriesPerType = (1 << kSmallLayoutCountBits) - 1; | |
| 2947 | |
| 2948 // Fields in kSmallLayout1Offset. | |
| 2949 class Int64CountField: public BitField<int, 1, kSmallLayoutCountBits> {}; | |
| 2950 class CodePtrCountField: public BitField<int, 11, kSmallLayoutCountBits> {}; | |
| 2951 class HeapPtrCountField: public BitField<int, 21, kSmallLayoutCountBits> {}; | |
| 2952 class IsExtendedField: public BitField<bool, 31, 1> {}; | |
| 2953 | |
| 2954 // Fields in kSmallLayout2Offset. | |
| 2955 class Int32CountField: public BitField<int, 1, kSmallLayoutCountBits> {}; | |
| 2956 class TotalCountField: public BitField<int, 11, 12> {}; | |
| 2957 class WeakObjectStateField: public BitField<WeakObjectState, 23, 2> {}; | |
| 2958 | |
| 2959 // Extended layout description, which starts at | |
| 2960 // get_extended_section_header_offset(). | |
| 2961 static const int kExtendedInt64CountOffset = 0; | |
| 2962 static const int kExtendedCodePtrCountOffset = | |
| 2963 kExtendedInt64CountOffset + kInt32Size; | |
| 2964 static const int kExtendedHeapPtrCountOffset = | |
| 2965 kExtendedCodePtrCountOffset + kInt32Size; | |
| 2966 static const int kExtendedInt32CountOffset = | |
| 2967 kExtendedHeapPtrCountOffset + kInt32Size; | |
| 2968 static const int kExtendedFirstOffset = | |
| 2969 kExtendedInt32CountOffset + kInt32Size; | |
| 2970 | |
| 2971 // Dispatched behavior. | |
| 2972 void ConstantPoolIterateBody(ObjectVisitor* v); | |
| 2973 | |
| 2974 DECLARE_PRINTER(ConstantPoolArray) | |
| 2975 DECLARE_VERIFIER(ConstantPoolArray) | |
| 2976 | |
| 2977 private: | |
| 2978 inline int first_extended_section_index(); | |
| 2979 inline int get_extended_section_header_offset(); | |
| 2980 | |
| 2981 inline static Type next_type(Type type) { | |
| 2982 DCHECK(type >= FIRST_TYPE && type < NUMBER_OF_TYPES); | |
| 2983 int type_int = static_cast<int>(type); | |
| 2984 return static_cast<Type>(++type_int); | |
| 2985 } | |
| 2986 | |
| 2987 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolArray); | |
| 2988 }; | |
| 2989 | |
| 2990 | |
| 2991 // DescriptorArrays are fixed arrays used to hold instance descriptors. | 2682 // DescriptorArrays are fixed arrays used to hold instance descriptors. |
| 2992 // The format of the these objects is: | 2683 // The format of the these objects is: |
| 2993 // [0]: Number of descriptors | 2684 // [0]: Number of descriptors |
| 2994 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: | 2685 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: |
| 2995 // [0]: pointer to fixed array with enum cache | 2686 // [0]: pointer to fixed array with enum cache |
| 2996 // [1]: either Smi(0) or pointer to fixed array with indices | 2687 // [1]: either Smi(0) or pointer to fixed array with indices |
| 2997 // [2]: first key | 2688 // [2]: first key |
| 2998 // [2 + number of descriptors * kDescriptorSize]: start of slack | 2689 // [2 + number of descriptors * kDescriptorSize]: start of slack |
| 2999 class DescriptorArray: public FixedArray { | 2690 class DescriptorArray: public FixedArray { |
| 3000 public: | 2691 public: |
| (...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5307 // [ic_age]: Inline caching age: the value of the Heap::global_ic_age | 4998 // [ic_age]: Inline caching age: the value of the Heap::global_ic_age |
| 5308 // at the moment when this object was created. | 4999 // at the moment when this object was created. |
| 5309 inline void set_ic_age(int count); | 5000 inline void set_ic_age(int count); |
| 5310 inline int ic_age() const; | 5001 inline int ic_age() const; |
| 5311 | 5002 |
| 5312 // [prologue_offset]: Offset of the function prologue, used for aging | 5003 // [prologue_offset]: Offset of the function prologue, used for aging |
| 5313 // FUNCTIONs and OPTIMIZED_FUNCTIONs. | 5004 // FUNCTIONs and OPTIMIZED_FUNCTIONs. |
| 5314 inline int prologue_offset() const; | 5005 inline int prologue_offset() const; |
| 5315 inline void set_prologue_offset(int offset); | 5006 inline void set_prologue_offset(int offset); |
| 5316 | 5007 |
| 5008 // [constant_pool offset]: Offset of the constant pool. | |
| 5009 // Valid for FLAG_enable_embedded_constant_pool only | |
| 5010 inline int constant_pool_offset() const; | |
| 5011 inline void set_constant_pool_offset(int offset); | |
| 5012 | |
| 5317 // Unchecked accessors to be used during GC. | 5013 // Unchecked accessors to be used during GC. |
| 5318 inline ByteArray* unchecked_relocation_info(); | 5014 inline ByteArray* unchecked_relocation_info(); |
| 5319 | 5015 |
| 5320 inline int relocation_size(); | 5016 inline int relocation_size(); |
| 5321 | 5017 |
| 5322 // [flags]: Various code flags. | 5018 // [flags]: Various code flags. |
| 5323 inline Flags flags(); | 5019 inline Flags flags(); |
| 5324 inline void set_flags(Flags flags); | 5020 inline void set_flags(Flags flags); |
| 5325 | 5021 |
| 5326 // [flags]: Access to specific code flags. | 5022 // [flags]: Access to specific code flags. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5440 inline bool has_function_cache(); | 5136 inline bool has_function_cache(); |
| 5441 inline void set_has_function_cache(bool flag); | 5137 inline void set_has_function_cache(bool flag); |
| 5442 | 5138 |
| 5443 | 5139 |
| 5444 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether | 5140 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether |
| 5445 // the code is going to be deoptimized because of dead embedded maps. | 5141 // the code is going to be deoptimized because of dead embedded maps. |
| 5446 inline bool marked_for_deoptimization(); | 5142 inline bool marked_for_deoptimization(); |
| 5447 inline void set_marked_for_deoptimization(bool flag); | 5143 inline void set_marked_for_deoptimization(bool flag); |
| 5448 | 5144 |
| 5449 // [constant_pool]: The constant pool for this function. | 5145 // [constant_pool]: The constant pool for this function. |
| 5450 inline ConstantPoolArray* constant_pool(); | 5146 inline Address constant_pool(); |
| 5451 inline void set_constant_pool(Object* constant_pool); | |
| 5452 | 5147 |
| 5453 // Get the safepoint entry for the given pc. | 5148 // Get the safepoint entry for the given pc. |
| 5454 SafepointEntry GetSafepointEntry(Address pc); | 5149 SafepointEntry GetSafepointEntry(Address pc); |
| 5455 | 5150 |
| 5456 // Find an object in a stub with a specified map | 5151 // Find an object in a stub with a specified map |
| 5457 Object* FindNthObject(int n, Map* match_map); | 5152 Object* FindNthObject(int n, Map* match_map); |
| 5458 | 5153 |
| 5459 // Find the first allocation site in an IC stub. | 5154 // Find the first allocation site in an IC stub. |
| 5460 AllocationSite* FindFirstAllocationSite(); | 5155 AllocationSite* FindFirstAllocationSite(); |
| 5461 | 5156 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5642 | 5337 |
| 5643 static inline bool IsWeakObjectInOptimizedCode(Object* object); | 5338 static inline bool IsWeakObjectInOptimizedCode(Object* object); |
| 5644 | 5339 |
| 5645 static Handle<WeakCell> WeakCellFor(Handle<Code> code); | 5340 static Handle<WeakCell> WeakCellFor(Handle<Code> code); |
| 5646 WeakCell* CachedWeakCell(); | 5341 WeakCell* CachedWeakCell(); |
| 5647 | 5342 |
| 5648 // Max loop nesting marker used to postpose OSR. We don't take loop | 5343 // Max loop nesting marker used to postpose OSR. We don't take loop |
| 5649 // nesting that is deeper than 5 levels into account. | 5344 // nesting that is deeper than 5 levels into account. |
| 5650 static const int kMaxLoopNestingMarker = 6; | 5345 static const int kMaxLoopNestingMarker = 6; |
| 5651 | 5346 |
| 5347 static const int kConstantPoolSize = | |
| 5348 FLAG_enable_embedded_constant_pool ? kIntSize : 0; | |
| 5349 | |
| 5652 // Layout description. | 5350 // Layout description. |
| 5653 static const int kRelocationInfoOffset = HeapObject::kHeaderSize; | 5351 static const int kRelocationInfoOffset = HeapObject::kHeaderSize; |
| 5654 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; | 5352 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; |
| 5655 static const int kDeoptimizationDataOffset = | 5353 static const int kDeoptimizationDataOffset = |
| 5656 kHandlerTableOffset + kPointerSize; | 5354 kHandlerTableOffset + kPointerSize; |
| 5657 // For FUNCTION kind, we store the type feedback info here. | 5355 // For FUNCTION kind, we store the type feedback info here. |
| 5658 static const int kTypeFeedbackInfoOffset = | 5356 static const int kTypeFeedbackInfoOffset = |
| 5659 kDeoptimizationDataOffset + kPointerSize; | 5357 kDeoptimizationDataOffset + kPointerSize; |
| 5660 static const int kNextCodeLinkOffset = kTypeFeedbackInfoOffset + kPointerSize; | 5358 static const int kNextCodeLinkOffset = kTypeFeedbackInfoOffset + kPointerSize; |
| 5661 static const int kGCMetadataOffset = kNextCodeLinkOffset + kPointerSize; | 5359 static const int kGCMetadataOffset = kNextCodeLinkOffset + kPointerSize; |
| 5662 static const int kInstructionSizeOffset = kGCMetadataOffset + kPointerSize; | 5360 static const int kInstructionSizeOffset = kGCMetadataOffset + kPointerSize; |
| 5663 static const int kICAgeOffset = kInstructionSizeOffset + kIntSize; | 5361 static const int kICAgeOffset = kInstructionSizeOffset + kIntSize; |
| 5664 static const int kFlagsOffset = kICAgeOffset + kIntSize; | 5362 static const int kFlagsOffset = kICAgeOffset + kIntSize; |
| 5665 static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize; | 5363 static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize; |
| 5666 static const int kKindSpecificFlags2Offset = | 5364 static const int kKindSpecificFlags2Offset = |
| 5667 kKindSpecificFlags1Offset + kIntSize; | 5365 kKindSpecificFlags1Offset + kIntSize; |
| 5668 // Note: We might be able to squeeze this into the flags above. | 5366 // Note: We might be able to squeeze this into the flags above. |
| 5669 static const int kPrologueOffset = kKindSpecificFlags2Offset + kIntSize; | 5367 static const int kPrologueOffset = kKindSpecificFlags2Offset + kIntSize; |
| 5670 static const int kConstantPoolOffset = kPrologueOffset + kIntSize; | 5368 static const int kConstantPoolOffset = kPrologueOffset + kIntSize; |
| 5671 | 5369 static const int kHeaderPaddingStart = |
| 5672 static const int kHeaderPaddingStart = kConstantPoolOffset + kPointerSize; | 5370 kConstantPoolOffset + kConstantPoolSize; |
| 5673 | 5371 |
| 5674 // Add padding to align the instruction start following right after | 5372 // Add padding to align the instruction start following right after |
| 5675 // the Code object header. | 5373 // the Code object header. |
| 5676 static const int kHeaderSize = | 5374 static const int kHeaderSize = |
| 5677 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; | 5375 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; |
| 5678 // Ensure that the slot for the constant pool pointer is aligned. | |
| 5679 STATIC_ASSERT((kConstantPoolOffset & kPointerAlignmentMask) == 0); | |
| 5680 | 5376 |
| 5681 // Byte offsets within kKindSpecificFlags1Offset. | 5377 // Byte offsets within kKindSpecificFlags1Offset. |
| 5682 static const int kFullCodeFlags = kKindSpecificFlags1Offset; | 5378 static const int kFullCodeFlags = kKindSpecificFlags1Offset; |
| 5683 class FullCodeFlagsHasDeoptimizationSupportField: | 5379 class FullCodeFlagsHasDeoptimizationSupportField: |
| 5684 public BitField<bool, 0, 1> {}; // NOLINT | 5380 public BitField<bool, 0, 1> {}; // NOLINT |
| 5685 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; | 5381 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; |
| 5686 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; | 5382 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; |
| 5687 class FullCodeFlagsHasRelocInfoForSerialization | 5383 class FullCodeFlagsHasRelocInfoForSerialization |
| 5688 : public BitField<bool, 3, 1> {}; | 5384 : public BitField<bool, 3, 1> {}; |
| 5689 | 5385 |
| (...skipping 5486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11176 } else { | 10872 } else { |
| 11177 value &= ~(1 << bit_position); | 10873 value &= ~(1 << bit_position); |
| 11178 } | 10874 } |
| 11179 return value; | 10875 return value; |
| 11180 } | 10876 } |
| 11181 }; | 10877 }; |
| 11182 | 10878 |
| 11183 } } // namespace v8::internal | 10879 } } // namespace v8::internal |
| 11184 | 10880 |
| 11185 #endif // V8_OBJECTS_H_ | 10881 #endif // V8_OBJECTS_H_ |
| OLD | NEW |