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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 V(SCRIPT_TYPE) \ | 431 V(SCRIPT_TYPE) \ |
432 V(CODE_CACHE_TYPE) \ | 432 V(CODE_CACHE_TYPE) \ |
433 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 433 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
434 V(TYPE_FEEDBACK_INFO_TYPE) \ | 434 V(TYPE_FEEDBACK_INFO_TYPE) \ |
435 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 435 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
436 V(BOX_TYPE) \ | 436 V(BOX_TYPE) \ |
437 V(PROTOTYPE_INFO_TYPE) \ | 437 V(PROTOTYPE_INFO_TYPE) \ |
438 \ | 438 \ |
439 V(FIXED_ARRAY_TYPE) \ | 439 V(FIXED_ARRAY_TYPE) \ |
440 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 440 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
441 V(CONSTANT_POOL_ARRAY_TYPE) \ | |
442 V(SHARED_FUNCTION_INFO_TYPE) \ | 441 V(SHARED_FUNCTION_INFO_TYPE) \ |
443 V(WEAK_CELL_TYPE) \ | 442 V(WEAK_CELL_TYPE) \ |
444 \ | 443 \ |
445 V(JS_MESSAGE_OBJECT_TYPE) \ | 444 V(JS_MESSAGE_OBJECT_TYPE) \ |
446 \ | 445 \ |
447 V(JS_VALUE_TYPE) \ | 446 V(JS_VALUE_TYPE) \ |
448 V(JS_DATE_TYPE) \ | 447 V(JS_DATE_TYPE) \ |
449 V(JS_OBJECT_TYPE) \ | 448 V(JS_OBJECT_TYPE) \ |
450 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 449 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
451 V(JS_GENERATOR_OBJECT_TYPE) \ | 450 V(JS_GENERATOR_OBJECT_TYPE) \ |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
723 ALLOCATION_MEMENTO_TYPE, | 722 ALLOCATION_MEMENTO_TYPE, |
724 SCRIPT_TYPE, | 723 SCRIPT_TYPE, |
725 CODE_CACHE_TYPE, | 724 CODE_CACHE_TYPE, |
726 POLYMORPHIC_CODE_CACHE_TYPE, | 725 POLYMORPHIC_CODE_CACHE_TYPE, |
727 TYPE_FEEDBACK_INFO_TYPE, | 726 TYPE_FEEDBACK_INFO_TYPE, |
728 ALIASED_ARGUMENTS_ENTRY_TYPE, | 727 ALIASED_ARGUMENTS_ENTRY_TYPE, |
729 BOX_TYPE, | 728 BOX_TYPE, |
730 DEBUG_INFO_TYPE, | 729 DEBUG_INFO_TYPE, |
731 BREAK_POINT_INFO_TYPE, | 730 BREAK_POINT_INFO_TYPE, |
732 FIXED_ARRAY_TYPE, | 731 FIXED_ARRAY_TYPE, |
733 CONSTANT_POOL_ARRAY_TYPE, | |
734 SHARED_FUNCTION_INFO_TYPE, | 732 SHARED_FUNCTION_INFO_TYPE, |
735 CELL_TYPE, | 733 CELL_TYPE, |
736 WEAK_CELL_TYPE, | 734 WEAK_CELL_TYPE, |
737 PROPERTY_CELL_TYPE, | 735 PROPERTY_CELL_TYPE, |
738 PROTOTYPE_INFO_TYPE, | 736 PROTOTYPE_INFO_TYPE, |
739 | 737 |
740 // All the following types are subtypes of JSReceiver, which corresponds to | 738 // All the following types are subtypes of JSReceiver, which corresponds to |
741 // objects in the JS sense. The first and the last type in this range are | 739 // objects in the JS sense. The first and the last type in this range are |
742 // the two forms of function. This organization enables using the same | 740 // the two forms of function. This organization enables using the same |
743 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the | 741 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
954 V(TransitionArray) \ | 952 V(TransitionArray) \ |
955 V(TypeFeedbackVector) \ | 953 V(TypeFeedbackVector) \ |
956 V(DeoptimizationInputData) \ | 954 V(DeoptimizationInputData) \ |
957 V(DeoptimizationOutputData) \ | 955 V(DeoptimizationOutputData) \ |
958 V(DependentCode) \ | 956 V(DependentCode) \ |
959 V(HandlerTable) \ | 957 V(HandlerTable) \ |
960 V(FixedArray) \ | 958 V(FixedArray) \ |
961 V(FixedDoubleArray) \ | 959 V(FixedDoubleArray) \ |
962 V(WeakFixedArray) \ | 960 V(WeakFixedArray) \ |
963 V(ArrayList) \ | 961 V(ArrayList) \ |
964 V(ConstantPoolArray) \ | |
965 V(Context) \ | 962 V(Context) \ |
966 V(ScriptContextTable) \ | 963 V(ScriptContextTable) \ |
967 V(NativeContext) \ | 964 V(NativeContext) \ |
968 V(ScopeInfo) \ | 965 V(ScopeInfo) \ |
969 V(JSFunction) \ | 966 V(JSFunction) \ |
970 V(Code) \ | 967 V(Code) \ |
971 V(Oddball) \ | 968 V(Oddball) \ |
972 V(SharedFunctionInfo) \ | 969 V(SharedFunctionInfo) \ |
973 V(JSValue) \ | 970 V(JSValue) \ |
974 V(JSDate) \ | 971 V(JSDate) \ |
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2691 DECLARE_CAST(ArrayList) | 2688 DECLARE_CAST(ArrayList) |
2692 | 2689 |
2693 private: | 2690 private: |
2694 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); | 2691 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); |
2695 static const int kLengthIndex = 0; | 2692 static const int kLengthIndex = 0; |
2696 static const int kFirstIndex = 1; | 2693 static const int kFirstIndex = 1; |
2697 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); | 2694 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); |
2698 }; | 2695 }; |
2699 | 2696 |
2700 | 2697 |
2701 // ConstantPoolArray describes a fixed-sized array containing constant pool | |
2702 // entries. | |
2703 // | |
2704 // A ConstantPoolArray can be structured in two different ways depending upon | |
2705 // whether it is extended or small. The is_extended_layout() method can be used | |
2706 // to discover which layout the constant pool has. | |
2707 // | |
2708 // The format of a small constant pool is: | |
2709 // [kSmallLayout1Offset] : Small section layout bitmap 1 | |
2710 // [kSmallLayout2Offset] : Small section layout bitmap 2 | |
2711 // [first_index(INT64, SMALL_SECTION)] : 64 bit entries | |
2712 // ... : ... | |
2713 // [first_index(CODE_PTR, SMALL_SECTION)] : code pointer entries | |
2714 // ... : ... | |
2715 // [first_index(HEAP_PTR, SMALL_SECTION)] : heap pointer entries | |
2716 // ... : ... | |
2717 // [first_index(INT32, SMALL_SECTION)] : 32 bit entries | |
2718 // ... : ... | |
2719 // | |
2720 // If the constant pool has an extended layout, the extended section constant | |
2721 // pool also contains an extended section, which has the following format at | |
2722 // location get_extended_section_header_offset(): | |
2723 // [kExtendedInt64CountOffset] : count of extended 64 bit entries | |
2724 // [kExtendedCodePtrCountOffset] : count of extended code pointers | |
2725 // [kExtendedHeapPtrCountOffset] : count of extended heap pointers | |
2726 // [kExtendedInt32CountOffset] : count of extended 32 bit entries | |
2727 // [first_index(INT64, EXTENDED_SECTION)] : 64 bit entries | |
2728 // ... : ... | |
2729 // [first_index(CODE_PTR, EXTENDED_SECTION)]: code pointer entries | |
2730 // ... : ... | |
2731 // [first_index(HEAP_PTR, EXTENDED_SECTION)]: heap pointer entries | |
2732 // ... : ... | |
2733 // [first_index(INT32, EXTENDED_SECTION)] : 32 bit entries | |
2734 // ... : ... | |
2735 // | |
2736 class ConstantPoolArray: public HeapObject { | |
2737 public: | |
2738 enum WeakObjectState { NO_WEAK_OBJECTS, WEAK_OBJECTS_IN_OPTIMIZED_CODE }; | |
2739 | |
2740 enum Type { | |
2741 INT64 = 0, | |
2742 CODE_PTR, | |
2743 HEAP_PTR, | |
2744 INT32, | |
2745 // Number of types stored by the ConstantPoolArrays. | |
2746 NUMBER_OF_TYPES, | |
2747 FIRST_TYPE = INT64, | |
2748 LAST_TYPE = INT32 | |
2749 }; | |
2750 | |
2751 enum LayoutSection { | |
2752 SMALL_SECTION = 0, | |
2753 EXTENDED_SECTION, | |
2754 NUMBER_OF_LAYOUT_SECTIONS | |
2755 }; | |
2756 | |
2757 class NumberOfEntries BASE_EMBEDDED { | |
2758 public: | |
2759 inline NumberOfEntries() { | |
2760 for (int i = 0; i < NUMBER_OF_TYPES; i++) { | |
2761 element_counts_[i] = 0; | |
2762 } | |
2763 } | |
2764 | |
2765 inline NumberOfEntries(int int64_count, int code_ptr_count, | |
2766 int heap_ptr_count, int int32_count) { | |
2767 element_counts_[INT64] = int64_count; | |
2768 element_counts_[CODE_PTR] = code_ptr_count; | |
2769 element_counts_[HEAP_PTR] = heap_ptr_count; | |
2770 element_counts_[INT32] = int32_count; | |
2771 } | |
2772 | |
2773 inline NumberOfEntries(ConstantPoolArray* array, LayoutSection section) { | |
2774 element_counts_[INT64] = array->number_of_entries(INT64, section); | |
2775 element_counts_[CODE_PTR] = array->number_of_entries(CODE_PTR, section); | |
2776 element_counts_[HEAP_PTR] = array->number_of_entries(HEAP_PTR, section); | |
2777 element_counts_[INT32] = array->number_of_entries(INT32, section); | |
2778 } | |
2779 | |
2780 inline void increment(Type type); | |
2781 inline int equals(const NumberOfEntries& other) const; | |
2782 inline bool is_empty() const; | |
2783 inline int count_of(Type type) const; | |
2784 inline int base_of(Type type) const; | |
2785 inline int total_count() const; | |
2786 inline int are_in_range(int min, int max) const; | |
2787 | |
2788 private: | |
2789 int element_counts_[NUMBER_OF_TYPES]; | |
2790 }; | |
2791 | |
2792 class Iterator BASE_EMBEDDED { | |
2793 public: | |
2794 inline Iterator(ConstantPoolArray* array, Type type) | |
2795 : array_(array), | |
2796 type_(type), | |
2797 final_section_(array->final_section()), | |
2798 current_section_(SMALL_SECTION), | |
2799 next_index_(array->first_index(type, SMALL_SECTION)) { | |
2800 update_section(); | |
2801 } | |
2802 | |
2803 inline Iterator(ConstantPoolArray* array, Type type, LayoutSection section) | |
2804 : array_(array), | |
2805 type_(type), | |
2806 final_section_(section), | |
2807 current_section_(section), | |
2808 next_index_(array->first_index(type, section)) { | |
2809 update_section(); | |
2810 } | |
2811 | |
2812 inline int next_index(); | |
2813 inline bool is_finished(); | |
2814 | |
2815 private: | |
2816 inline void update_section(); | |
2817 ConstantPoolArray* array_; | |
2818 const Type type_; | |
2819 const LayoutSection final_section_; | |
2820 | |
2821 LayoutSection current_section_; | |
2822 int next_index_; | |
2823 }; | |
2824 | |
2825 // Getters for the first index, the last index and the count of entries of | |
2826 // a given type for a given layout section. | |
2827 inline int first_index(Type type, LayoutSection layout_section); | |
2828 inline int last_index(Type type, LayoutSection layout_section); | |
2829 inline int number_of_entries(Type type, LayoutSection layout_section); | |
2830 | |
2831 // Returns the type of the entry at the given index. | |
2832 inline Type get_type(int index); | |
2833 inline bool offset_is_type(int offset, Type type); | |
2834 | |
2835 // Setter and getter for pool elements. | |
2836 inline Address get_code_ptr_entry(int index); | |
2837 inline Object* get_heap_ptr_entry(int index); | |
2838 inline int64_t get_int64_entry(int index); | |
2839 inline int32_t get_int32_entry(int index); | |
2840 inline double get_int64_entry_as_double(int index); | |
2841 | |
2842 inline void set(int index, Address value); | |
2843 inline void set(int index, Object* value); | |
2844 inline void set(int index, int64_t value); | |
2845 inline void set(int index, double value); | |
2846 inline void set(int index, int32_t value); | |
2847 | |
2848 // Setters which take a raw offset rather than an index (for code generation). | |
2849 inline void set_at_offset(int offset, int32_t value); | |
2850 inline void set_at_offset(int offset, int64_t value); | |
2851 inline void set_at_offset(int offset, double value); | |
2852 inline void set_at_offset(int offset, Address value); | |
2853 inline void set_at_offset(int offset, Object* value); | |
2854 | |
2855 // Setter and getter for weak objects state | |
2856 inline void set_weak_object_state(WeakObjectState state); | |
2857 inline WeakObjectState get_weak_object_state(); | |
2858 | |
2859 // Returns true if the constant pool has an extended layout, false if it has | |
2860 // only the small layout. | |
2861 inline bool is_extended_layout(); | |
2862 | |
2863 // Returns the last LayoutSection in this constant pool array. | |
2864 inline LayoutSection final_section(); | |
2865 | |
2866 // Set up initial state for a small layout constant pool array. | |
2867 inline void Init(const NumberOfEntries& small); | |
2868 | |
2869 // Set up initial state for an extended layout constant pool array. | |
2870 inline void InitExtended(const NumberOfEntries& small, | |
2871 const NumberOfEntries& extended); | |
2872 | |
2873 // Clears the pointer entries with GC safe values. | |
2874 void ClearPtrEntries(Isolate* isolate); | |
2875 | |
2876 // returns the total number of entries in the constant pool array. | |
2877 inline int length(); | |
2878 | |
2879 // Garbage collection support. | |
2880 inline int size(); | |
2881 | |
2882 | |
2883 inline static int MaxInt64Offset(int number_of_int64) { | |
2884 return kFirstEntryOffset + (number_of_int64 * kInt64Size); | |
2885 } | |
2886 | |
2887 inline static int SizeFor(const NumberOfEntries& small) { | |
2888 int size = kFirstEntryOffset + | |
2889 (small.count_of(INT64) * kInt64Size) + | |
2890 (small.count_of(CODE_PTR) * kPointerSize) + | |
2891 (small.count_of(HEAP_PTR) * kPointerSize) + | |
2892 (small.count_of(INT32) * kInt32Size); | |
2893 return RoundUp(size, kPointerSize); | |
2894 } | |
2895 | |
2896 inline static int SizeForExtended(const NumberOfEntries& small, | |
2897 const NumberOfEntries& extended) { | |
2898 int size = SizeFor(small); | |
2899 size = RoundUp(size, kInt64Size); // Align extended header to 64 bits. | |
2900 size += kExtendedFirstOffset + | |
2901 (extended.count_of(INT64) * kInt64Size) + | |
2902 (extended.count_of(CODE_PTR) * kPointerSize) + | |
2903 (extended.count_of(HEAP_PTR) * kPointerSize) + | |
2904 (extended.count_of(INT32) * kInt32Size); | |
2905 return RoundUp(size, kPointerSize); | |
2906 } | |
2907 | |
2908 inline static int entry_size(Type type) { | |
2909 switch (type) { | |
2910 case INT32: | |
2911 return kInt32Size; | |
2912 case INT64: | |
2913 return kInt64Size; | |
2914 case CODE_PTR: | |
2915 case HEAP_PTR: | |
2916 return kPointerSize; | |
2917 default: | |
2918 UNREACHABLE(); | |
2919 return 0; | |
2920 } | |
2921 } | |
2922 | |
2923 // Code Generation support. | |
2924 inline int OffsetOfElementAt(int index) { | |
2925 int offset; | |
2926 LayoutSection section; | |
2927 if (is_extended_layout() && index >= first_extended_section_index()) { | |
2928 section = EXTENDED_SECTION; | |
2929 offset = get_extended_section_header_offset() + kExtendedFirstOffset; | |
2930 } else { | |
2931 section = SMALL_SECTION; | |
2932 offset = kFirstEntryOffset; | |
2933 } | |
2934 | |
2935 // Add offsets for the preceding type sections. | |
2936 DCHECK(index <= last_index(LAST_TYPE, section)); | |
2937 for (Type type = FIRST_TYPE; index > last_index(type, section); | |
2938 type = next_type(type)) { | |
2939 offset += entry_size(type) * number_of_entries(type, section); | |
2940 } | |
2941 | |
2942 // Add offset for the index in it's type. | |
2943 Type type = get_type(index); | |
2944 offset += entry_size(type) * (index - first_index(type, section)); | |
2945 return offset; | |
2946 } | |
2947 | |
2948 DECLARE_CAST(ConstantPoolArray) | |
2949 | |
2950 // Garbage collection support. | |
2951 Object** RawFieldOfElementAt(int index) { | |
2952 return HeapObject::RawField(this, OffsetOfElementAt(index)); | |
2953 } | |
2954 | |
2955 // Small Layout description. | |
2956 static const int kSmallLayout1Offset = HeapObject::kHeaderSize; | |
2957 static const int kSmallLayout2Offset = kSmallLayout1Offset + kInt32Size; | |
2958 static const int kHeaderSize = kSmallLayout2Offset + kInt32Size; | |
2959 static const int kFirstEntryOffset = ROUND_UP(kHeaderSize, kInt64Size); | |
2960 | |
2961 static const int kSmallLayoutCountBits = 10; | |
2962 static const int kMaxSmallEntriesPerType = (1 << kSmallLayoutCountBits) - 1; | |
2963 | |
2964 // Fields in kSmallLayout1Offset. | |
2965 class Int64CountField: public BitField<int, 1, kSmallLayoutCountBits> {}; | |
2966 class CodePtrCountField: public BitField<int, 11, kSmallLayoutCountBits> {}; | |
2967 class HeapPtrCountField: public BitField<int, 21, kSmallLayoutCountBits> {}; | |
2968 class IsExtendedField: public BitField<bool, 31, 1> {}; | |
2969 | |
2970 // Fields in kSmallLayout2Offset. | |
2971 class Int32CountField: public BitField<int, 1, kSmallLayoutCountBits> {}; | |
2972 class TotalCountField: public BitField<int, 11, 12> {}; | |
2973 class WeakObjectStateField: public BitField<WeakObjectState, 23, 2> {}; | |
2974 | |
2975 // Extended layout description, which starts at | |
2976 // get_extended_section_header_offset(). | |
2977 static const int kExtendedInt64CountOffset = 0; | |
2978 static const int kExtendedCodePtrCountOffset = | |
2979 kExtendedInt64CountOffset + kInt32Size; | |
2980 static const int kExtendedHeapPtrCountOffset = | |
2981 kExtendedCodePtrCountOffset + kInt32Size; | |
2982 static const int kExtendedInt32CountOffset = | |
2983 kExtendedHeapPtrCountOffset + kInt32Size; | |
2984 static const int kExtendedFirstOffset = | |
2985 kExtendedInt32CountOffset + kInt32Size; | |
2986 | |
2987 // Dispatched behavior. | |
2988 void ConstantPoolIterateBody(ObjectVisitor* v); | |
2989 | |
2990 DECLARE_PRINTER(ConstantPoolArray) | |
2991 DECLARE_VERIFIER(ConstantPoolArray) | |
2992 | |
2993 private: | |
2994 inline int first_extended_section_index(); | |
2995 inline int get_extended_section_header_offset(); | |
2996 | |
2997 inline static Type next_type(Type type) { | |
2998 DCHECK(type >= FIRST_TYPE && type < NUMBER_OF_TYPES); | |
2999 int type_int = static_cast<int>(type); | |
3000 return static_cast<Type>(++type_int); | |
3001 } | |
3002 | |
3003 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolArray); | |
3004 }; | |
3005 | |
3006 | |
3007 // DescriptorArrays are fixed arrays used to hold instance descriptors. | 2698 // DescriptorArrays are fixed arrays used to hold instance descriptors. |
3008 // The format of the these objects is: | 2699 // The format of the these objects is: |
3009 // [0]: Number of descriptors | 2700 // [0]: Number of descriptors |
3010 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: | 2701 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: |
3011 // [0]: pointer to fixed array with enum cache | 2702 // [0]: pointer to fixed array with enum cache |
3012 // [1]: either Smi(0) or pointer to fixed array with indices | 2703 // [1]: either Smi(0) or pointer to fixed array with indices |
3013 // [2]: first key | 2704 // [2]: first key |
3014 // [2 + number of descriptors * kDescriptorSize]: start of slack | 2705 // [2 + number of descriptors * kDescriptorSize]: start of slack |
3015 class DescriptorArray: public FixedArray { | 2706 class DescriptorArray: public FixedArray { |
3016 public: | 2707 public: |
(...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5256 // [ic_age]: Inline caching age: the value of the Heap::global_ic_age | 4947 // [ic_age]: Inline caching age: the value of the Heap::global_ic_age |
5257 // at the moment when this object was created. | 4948 // at the moment when this object was created. |
5258 inline void set_ic_age(int count); | 4949 inline void set_ic_age(int count); |
5259 inline int ic_age() const; | 4950 inline int ic_age() const; |
5260 | 4951 |
5261 // [prologue_offset]: Offset of the function prologue, used for aging | 4952 // [prologue_offset]: Offset of the function prologue, used for aging |
5262 // FUNCTIONs and OPTIMIZED_FUNCTIONs. | 4953 // FUNCTIONs and OPTIMIZED_FUNCTIONs. |
5263 inline int prologue_offset() const; | 4954 inline int prologue_offset() const; |
5264 inline void set_prologue_offset(int offset); | 4955 inline void set_prologue_offset(int offset); |
5265 | 4956 |
4957 // [constant_pool offset]: Offset of the constant pool. | |
4958 // Valid for FLAG_enable_embedded_constant_pool only | |
4959 inline int constant_pool_offset() const; | |
4960 inline void set_constant_pool_offset(int offset); | |
4961 | |
5266 // Unchecked accessors to be used during GC. | 4962 // Unchecked accessors to be used during GC. |
5267 inline ByteArray* unchecked_relocation_info(); | 4963 inline ByteArray* unchecked_relocation_info(); |
5268 | 4964 |
5269 inline int relocation_size(); | 4965 inline int relocation_size(); |
5270 | 4966 |
5271 // [flags]: Various code flags. | 4967 // [flags]: Various code flags. |
5272 inline Flags flags(); | 4968 inline Flags flags(); |
5273 inline void set_flags(Flags flags); | 4969 inline void set_flags(Flags flags); |
5274 | 4970 |
5275 // [flags]: Access to specific code flags. | 4971 // [flags]: Access to specific code flags. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5393 inline bool has_function_cache(); | 5089 inline bool has_function_cache(); |
5394 inline void set_has_function_cache(bool flag); | 5090 inline void set_has_function_cache(bool flag); |
5395 | 5091 |
5396 | 5092 |
5397 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether | 5093 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether |
5398 // the code is going to be deoptimized because of dead embedded maps. | 5094 // the code is going to be deoptimized because of dead embedded maps. |
5399 inline bool marked_for_deoptimization(); | 5095 inline bool marked_for_deoptimization(); |
5400 inline void set_marked_for_deoptimization(bool flag); | 5096 inline void set_marked_for_deoptimization(bool flag); |
5401 | 5097 |
5402 // [constant_pool]: The constant pool for this function. | 5098 // [constant_pool]: The constant pool for this function. |
5403 inline ConstantPoolArray* constant_pool(); | 5099 inline Address constant_pool(); |
5404 inline void set_constant_pool(Object* constant_pool); | |
5405 | 5100 |
5406 // Get the safepoint entry for the given pc. | 5101 // Get the safepoint entry for the given pc. |
5407 SafepointEntry GetSafepointEntry(Address pc); | 5102 SafepointEntry GetSafepointEntry(Address pc); |
5408 | 5103 |
5409 // Find an object in a stub with a specified map | 5104 // Find an object in a stub with a specified map |
5410 Object* FindNthObject(int n, Map* match_map); | 5105 Object* FindNthObject(int n, Map* match_map); |
5411 | 5106 |
5412 // Find the first allocation site in an IC stub. | 5107 // Find the first allocation site in an IC stub. |
5413 AllocationSite* FindFirstAllocationSite(); | 5108 AllocationSite* FindFirstAllocationSite(); |
5414 | 5109 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5595 | 5290 |
5596 static inline bool IsWeakObjectInOptimizedCode(Object* object); | 5291 static inline bool IsWeakObjectInOptimizedCode(Object* object); |
5597 | 5292 |
5598 static Handle<WeakCell> WeakCellFor(Handle<Code> code); | 5293 static Handle<WeakCell> WeakCellFor(Handle<Code> code); |
5599 WeakCell* CachedWeakCell(); | 5294 WeakCell* CachedWeakCell(); |
5600 | 5295 |
5601 // Max loop nesting marker used to postpose OSR. We don't take loop | 5296 // Max loop nesting marker used to postpose OSR. We don't take loop |
5602 // nesting that is deeper than 5 levels into account. | 5297 // nesting that is deeper than 5 levels into account. |
5603 static const int kMaxLoopNestingMarker = 6; | 5298 static const int kMaxLoopNestingMarker = 6; |
5604 | 5299 |
5300 static const int kCPSize = FLAG_enable_embedded_constant_pool ? kIntSize : 0; | |
rmcilroy
2015/05/20 14:32:12
nit - kConstantPoolSize
MTBrandyberry
2015/05/20 22:28:23
Done.
| |
5301 | |
5605 // Layout description. | 5302 // Layout description. |
5606 static const int kRelocationInfoOffset = HeapObject::kHeaderSize; | 5303 static const int kRelocationInfoOffset = HeapObject::kHeaderSize; |
5607 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; | 5304 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; |
5608 static const int kDeoptimizationDataOffset = | 5305 static const int kDeoptimizationDataOffset = |
5609 kHandlerTableOffset + kPointerSize; | 5306 kHandlerTableOffset + kPointerSize; |
5610 // For FUNCTION kind, we store the type feedback info here. | 5307 // For FUNCTION kind, we store the type feedback info here. |
5611 static const int kTypeFeedbackInfoOffset = | 5308 static const int kTypeFeedbackInfoOffset = |
5612 kDeoptimizationDataOffset + kPointerSize; | 5309 kDeoptimizationDataOffset + kPointerSize; |
5613 static const int kNextCodeLinkOffset = kTypeFeedbackInfoOffset + kPointerSize; | 5310 static const int kNextCodeLinkOffset = kTypeFeedbackInfoOffset + kPointerSize; |
5614 static const int kGCMetadataOffset = kNextCodeLinkOffset + kPointerSize; | 5311 static const int kGCMetadataOffset = kNextCodeLinkOffset + kPointerSize; |
5615 static const int kInstructionSizeOffset = kGCMetadataOffset + kPointerSize; | 5312 static const int kInstructionSizeOffset = kGCMetadataOffset + kPointerSize; |
5616 static const int kICAgeOffset = kInstructionSizeOffset + kIntSize; | 5313 static const int kICAgeOffset = kInstructionSizeOffset + kIntSize; |
5617 static const int kFlagsOffset = kICAgeOffset + kIntSize; | 5314 static const int kFlagsOffset = kICAgeOffset + kIntSize; |
5618 static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize; | 5315 static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize; |
5619 static const int kKindSpecificFlags2Offset = | 5316 static const int kKindSpecificFlags2Offset = |
5620 kKindSpecificFlags1Offset + kIntSize; | 5317 kKindSpecificFlags1Offset + kIntSize; |
5621 // Note: We might be able to squeeze this into the flags above. | 5318 // Note: We might be able to squeeze this into the flags above. |
5622 static const int kPrologueOffset = kKindSpecificFlags2Offset + kIntSize; | 5319 static const int kPrologueOffset = kKindSpecificFlags2Offset + kIntSize; |
5623 static const int kConstantPoolOffset = kPrologueOffset + kIntSize; | 5320 static const int kConstantPoolOffset = kPrologueOffset + kIntSize; |
5624 | 5321 static const int kHeaderPaddingStart = kConstantPoolOffset + kCPSize; |
5625 static const int kHeaderPaddingStart = kConstantPoolOffset + kPointerSize; | |
5626 | 5322 |
5627 // Add padding to align the instruction start following right after | 5323 // Add padding to align the instruction start following right after |
5628 // the Code object header. | 5324 // the Code object header. |
5629 static const int kHeaderSize = | 5325 static const int kHeaderSize = |
5630 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; | 5326 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; |
5631 // Ensure that the slot for the constant pool pointer is aligned. | |
5632 STATIC_ASSERT((kConstantPoolOffset & kPointerAlignmentMask) == 0); | |
5633 | 5327 |
5634 // Byte offsets within kKindSpecificFlags1Offset. | 5328 // Byte offsets within kKindSpecificFlags1Offset. |
5635 static const int kOptimizableOffset = kKindSpecificFlags1Offset; | 5329 static const int kOptimizableOffset = kKindSpecificFlags1Offset; |
5636 | 5330 |
5637 static const int kFullCodeFlags = kOptimizableOffset + 1; | 5331 static const int kFullCodeFlags = kOptimizableOffset + 1; |
5638 class FullCodeFlagsHasDeoptimizationSupportField: | 5332 class FullCodeFlagsHasDeoptimizationSupportField: |
5639 public BitField<bool, 0, 1> {}; // NOLINT | 5333 public BitField<bool, 0, 1> {}; // NOLINT |
5640 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; | 5334 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; |
5641 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; | 5335 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; |
5642 class FullCodeFlagsHasRelocInfoForSerialization | 5336 class FullCodeFlagsHasRelocInfoForSerialization |
(...skipping 5458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11101 } else { | 10795 } else { |
11102 value &= ~(1 << bit_position); | 10796 value &= ~(1 << bit_position); |
11103 } | 10797 } |
11104 return value; | 10798 return value; |
11105 } | 10799 } |
11106 }; | 10800 }; |
11107 | 10801 |
11108 } } // namespace v8::internal | 10802 } } // namespace v8::internal |
11109 | 10803 |
11110 #endif // V8_OBJECTS_H_ | 10804 #endif // V8_OBJECTS_H_ |
OLD | NEW |