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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 V(SCRIPT_TYPE) \ | 438 V(SCRIPT_TYPE) \ |
439 V(CODE_CACHE_TYPE) \ | 439 V(CODE_CACHE_TYPE) \ |
440 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 440 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
441 V(TYPE_FEEDBACK_INFO_TYPE) \ | 441 V(TYPE_FEEDBACK_INFO_TYPE) \ |
442 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 442 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
443 V(BOX_TYPE) \ | 443 V(BOX_TYPE) \ |
444 V(PROTOTYPE_INFO_TYPE) \ | 444 V(PROTOTYPE_INFO_TYPE) \ |
445 \ | 445 \ |
446 V(FIXED_ARRAY_TYPE) \ | 446 V(FIXED_ARRAY_TYPE) \ |
447 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 447 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
| 448 V(CONSTANT_POOL_ARRAY_TYPE) \ |
448 V(SHARED_FUNCTION_INFO_TYPE) \ | 449 V(SHARED_FUNCTION_INFO_TYPE) \ |
449 V(WEAK_CELL_TYPE) \ | 450 V(WEAK_CELL_TYPE) \ |
450 \ | 451 \ |
451 V(JS_MESSAGE_OBJECT_TYPE) \ | 452 V(JS_MESSAGE_OBJECT_TYPE) \ |
452 \ | 453 \ |
453 V(JS_VALUE_TYPE) \ | 454 V(JS_VALUE_TYPE) \ |
454 V(JS_DATE_TYPE) \ | 455 V(JS_DATE_TYPE) \ |
455 V(JS_OBJECT_TYPE) \ | 456 V(JS_OBJECT_TYPE) \ |
456 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 457 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
457 V(JS_GENERATOR_OBJECT_TYPE) \ | 458 V(JS_GENERATOR_OBJECT_TYPE) \ |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 ALLOCATION_MEMENTO_TYPE, | 730 ALLOCATION_MEMENTO_TYPE, |
730 SCRIPT_TYPE, | 731 SCRIPT_TYPE, |
731 CODE_CACHE_TYPE, | 732 CODE_CACHE_TYPE, |
732 POLYMORPHIC_CODE_CACHE_TYPE, | 733 POLYMORPHIC_CODE_CACHE_TYPE, |
733 TYPE_FEEDBACK_INFO_TYPE, | 734 TYPE_FEEDBACK_INFO_TYPE, |
734 ALIASED_ARGUMENTS_ENTRY_TYPE, | 735 ALIASED_ARGUMENTS_ENTRY_TYPE, |
735 BOX_TYPE, | 736 BOX_TYPE, |
736 DEBUG_INFO_TYPE, | 737 DEBUG_INFO_TYPE, |
737 BREAK_POINT_INFO_TYPE, | 738 BREAK_POINT_INFO_TYPE, |
738 FIXED_ARRAY_TYPE, | 739 FIXED_ARRAY_TYPE, |
| 740 CONSTANT_POOL_ARRAY_TYPE, |
739 SHARED_FUNCTION_INFO_TYPE, | 741 SHARED_FUNCTION_INFO_TYPE, |
740 CELL_TYPE, | 742 CELL_TYPE, |
741 WEAK_CELL_TYPE, | 743 WEAK_CELL_TYPE, |
742 PROPERTY_CELL_TYPE, | 744 PROPERTY_CELL_TYPE, |
743 PROTOTYPE_INFO_TYPE, | 745 PROTOTYPE_INFO_TYPE, |
744 | 746 |
745 // All the following types are subtypes of JSReceiver, which corresponds to | 747 // All the following types are subtypes of JSReceiver, which corresponds to |
746 // objects in the JS sense. The first and the last type in this range are | 748 // objects in the JS sense. The first and the last type in this range are |
747 // the two forms of function. This organization enables using the same | 749 // the two forms of function. This organization enables using the same |
748 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the | 750 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 V(TransitionArray) \ | 961 V(TransitionArray) \ |
960 V(TypeFeedbackVector) \ | 962 V(TypeFeedbackVector) \ |
961 V(DeoptimizationInputData) \ | 963 V(DeoptimizationInputData) \ |
962 V(DeoptimizationOutputData) \ | 964 V(DeoptimizationOutputData) \ |
963 V(DependentCode) \ | 965 V(DependentCode) \ |
964 V(HandlerTable) \ | 966 V(HandlerTable) \ |
965 V(FixedArray) \ | 967 V(FixedArray) \ |
966 V(FixedDoubleArray) \ | 968 V(FixedDoubleArray) \ |
967 V(WeakFixedArray) \ | 969 V(WeakFixedArray) \ |
968 V(ArrayList) \ | 970 V(ArrayList) \ |
| 971 V(ConstantPoolArray) \ |
969 V(Context) \ | 972 V(Context) \ |
970 V(ScriptContextTable) \ | 973 V(ScriptContextTable) \ |
971 V(NativeContext) \ | 974 V(NativeContext) \ |
972 V(ScopeInfo) \ | 975 V(ScopeInfo) \ |
973 V(JSFunction) \ | 976 V(JSFunction) \ |
974 V(Code) \ | 977 V(Code) \ |
975 V(Oddball) \ | 978 V(Oddball) \ |
976 V(SharedFunctionInfo) \ | 979 V(SharedFunctionInfo) \ |
977 V(JSValue) \ | 980 V(JSValue) \ |
978 V(JSDate) \ | 981 V(JSDate) \ |
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2643 DECLARE_CAST(ArrayList) | 2646 DECLARE_CAST(ArrayList) |
2644 | 2647 |
2645 private: | 2648 private: |
2646 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); | 2649 static Handle<ArrayList> EnsureSpace(Handle<ArrayList> array, int length); |
2647 static const int kLengthIndex = 0; | 2650 static const int kLengthIndex = 0; |
2648 static const int kFirstIndex = 1; | 2651 static const int kFirstIndex = 1; |
2649 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); | 2652 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayList); |
2650 }; | 2653 }; |
2651 | 2654 |
2652 | 2655 |
| 2656 // ConstantPoolArray describes a fixed-sized array containing constant pool |
| 2657 // entries. |
| 2658 // |
| 2659 // A ConstantPoolArray can be structured in two different ways depending upon |
| 2660 // whether it is extended or small. The is_extended_layout() method can be used |
| 2661 // to discover which layout the constant pool has. |
| 2662 // |
| 2663 // The format of a small constant pool is: |
| 2664 // [kSmallLayout1Offset] : Small section layout bitmap 1 |
| 2665 // [kSmallLayout2Offset] : Small section layout bitmap 2 |
| 2666 // [first_index(INT64, SMALL_SECTION)] : 64 bit entries |
| 2667 // ... : ... |
| 2668 // [first_index(CODE_PTR, SMALL_SECTION)] : code pointer entries |
| 2669 // ... : ... |
| 2670 // [first_index(HEAP_PTR, SMALL_SECTION)] : heap pointer entries |
| 2671 // ... : ... |
| 2672 // [first_index(INT32, SMALL_SECTION)] : 32 bit entries |
| 2673 // ... : ... |
| 2674 // |
| 2675 // If the constant pool has an extended layout, the extended section constant |
| 2676 // pool also contains an extended section, which has the following format at |
| 2677 // location get_extended_section_header_offset(): |
| 2678 // [kExtendedInt64CountOffset] : count of extended 64 bit entries |
| 2679 // [kExtendedCodePtrCountOffset] : count of extended code pointers |
| 2680 // [kExtendedHeapPtrCountOffset] : count of extended heap pointers |
| 2681 // [kExtendedInt32CountOffset] : count of extended 32 bit entries |
| 2682 // [first_index(INT64, EXTENDED_SECTION)] : 64 bit entries |
| 2683 // ... : ... |
| 2684 // [first_index(CODE_PTR, EXTENDED_SECTION)]: code pointer entries |
| 2685 // ... : ... |
| 2686 // [first_index(HEAP_PTR, EXTENDED_SECTION)]: heap pointer entries |
| 2687 // ... : ... |
| 2688 // [first_index(INT32, EXTENDED_SECTION)] : 32 bit entries |
| 2689 // ... : ... |
| 2690 // |
| 2691 class ConstantPoolArray: public HeapObject { |
| 2692 public: |
| 2693 enum WeakObjectState { NO_WEAK_OBJECTS, WEAK_OBJECTS_IN_OPTIMIZED_CODE }; |
| 2694 |
| 2695 enum Type { |
| 2696 INT64 = 0, |
| 2697 CODE_PTR, |
| 2698 HEAP_PTR, |
| 2699 INT32, |
| 2700 // Number of types stored by the ConstantPoolArrays. |
| 2701 NUMBER_OF_TYPES, |
| 2702 FIRST_TYPE = INT64, |
| 2703 LAST_TYPE = INT32 |
| 2704 }; |
| 2705 |
| 2706 enum LayoutSection { |
| 2707 SMALL_SECTION = 0, |
| 2708 EXTENDED_SECTION, |
| 2709 NUMBER_OF_LAYOUT_SECTIONS |
| 2710 }; |
| 2711 |
| 2712 class NumberOfEntries BASE_EMBEDDED { |
| 2713 public: |
| 2714 inline NumberOfEntries() { |
| 2715 for (int i = 0; i < NUMBER_OF_TYPES; i++) { |
| 2716 element_counts_[i] = 0; |
| 2717 } |
| 2718 } |
| 2719 |
| 2720 inline NumberOfEntries(int int64_count, int code_ptr_count, |
| 2721 int heap_ptr_count, int int32_count) { |
| 2722 element_counts_[INT64] = int64_count; |
| 2723 element_counts_[CODE_PTR] = code_ptr_count; |
| 2724 element_counts_[HEAP_PTR] = heap_ptr_count; |
| 2725 element_counts_[INT32] = int32_count; |
| 2726 } |
| 2727 |
| 2728 inline NumberOfEntries(ConstantPoolArray* array, LayoutSection section) { |
| 2729 element_counts_[INT64] = array->number_of_entries(INT64, section); |
| 2730 element_counts_[CODE_PTR] = array->number_of_entries(CODE_PTR, section); |
| 2731 element_counts_[HEAP_PTR] = array->number_of_entries(HEAP_PTR, section); |
| 2732 element_counts_[INT32] = array->number_of_entries(INT32, section); |
| 2733 } |
| 2734 |
| 2735 inline void increment(Type type); |
| 2736 inline int equals(const NumberOfEntries& other) const; |
| 2737 inline bool is_empty() const; |
| 2738 inline int count_of(Type type) const; |
| 2739 inline int base_of(Type type) const; |
| 2740 inline int total_count() const; |
| 2741 inline int are_in_range(int min, int max) const; |
| 2742 |
| 2743 private: |
| 2744 int element_counts_[NUMBER_OF_TYPES]; |
| 2745 }; |
| 2746 |
| 2747 class Iterator BASE_EMBEDDED { |
| 2748 public: |
| 2749 inline Iterator(ConstantPoolArray* array, Type type) |
| 2750 : array_(array), |
| 2751 type_(type), |
| 2752 final_section_(array->final_section()), |
| 2753 current_section_(SMALL_SECTION), |
| 2754 next_index_(array->first_index(type, SMALL_SECTION)) { |
| 2755 update_section(); |
| 2756 } |
| 2757 |
| 2758 inline Iterator(ConstantPoolArray* array, Type type, LayoutSection section) |
| 2759 : array_(array), |
| 2760 type_(type), |
| 2761 final_section_(section), |
| 2762 current_section_(section), |
| 2763 next_index_(array->first_index(type, section)) { |
| 2764 update_section(); |
| 2765 } |
| 2766 |
| 2767 inline int next_index(); |
| 2768 inline bool is_finished(); |
| 2769 |
| 2770 private: |
| 2771 inline void update_section(); |
| 2772 ConstantPoolArray* array_; |
| 2773 const Type type_; |
| 2774 const LayoutSection final_section_; |
| 2775 |
| 2776 LayoutSection current_section_; |
| 2777 int next_index_; |
| 2778 }; |
| 2779 |
| 2780 // Getters for the first index, the last index and the count of entries of |
| 2781 // a given type for a given layout section. |
| 2782 inline int first_index(Type type, LayoutSection layout_section); |
| 2783 inline int last_index(Type type, LayoutSection layout_section); |
| 2784 inline int number_of_entries(Type type, LayoutSection layout_section); |
| 2785 |
| 2786 // Returns the type of the entry at the given index. |
| 2787 inline Type get_type(int index); |
| 2788 inline bool offset_is_type(int offset, Type type); |
| 2789 |
| 2790 // Setter and getter for pool elements. |
| 2791 inline Address get_code_ptr_entry(int index); |
| 2792 inline Object* get_heap_ptr_entry(int index); |
| 2793 inline int64_t get_int64_entry(int index); |
| 2794 inline int32_t get_int32_entry(int index); |
| 2795 inline double get_int64_entry_as_double(int index); |
| 2796 |
| 2797 inline void set(int index, Address value); |
| 2798 inline void set(int index, Object* value); |
| 2799 inline void set(int index, int64_t value); |
| 2800 inline void set(int index, double value); |
| 2801 inline void set(int index, int32_t value); |
| 2802 |
| 2803 // Setters which take a raw offset rather than an index (for code generation). |
| 2804 inline void set_at_offset(int offset, int32_t value); |
| 2805 inline void set_at_offset(int offset, int64_t value); |
| 2806 inline void set_at_offset(int offset, double value); |
| 2807 inline void set_at_offset(int offset, Address value); |
| 2808 inline void set_at_offset(int offset, Object* value); |
| 2809 |
| 2810 // Setter and getter for weak objects state |
| 2811 inline void set_weak_object_state(WeakObjectState state); |
| 2812 inline WeakObjectState get_weak_object_state(); |
| 2813 |
| 2814 // Returns true if the constant pool has an extended layout, false if it has |
| 2815 // only the small layout. |
| 2816 inline bool is_extended_layout(); |
| 2817 |
| 2818 // Returns the last LayoutSection in this constant pool array. |
| 2819 inline LayoutSection final_section(); |
| 2820 |
| 2821 // Set up initial state for a small layout constant pool array. |
| 2822 inline void Init(const NumberOfEntries& small); |
| 2823 |
| 2824 // Set up initial state for an extended layout constant pool array. |
| 2825 inline void InitExtended(const NumberOfEntries& small, |
| 2826 const NumberOfEntries& extended); |
| 2827 |
| 2828 // Clears the pointer entries with GC safe values. |
| 2829 void ClearPtrEntries(Isolate* isolate); |
| 2830 |
| 2831 // returns the total number of entries in the constant pool array. |
| 2832 inline int length(); |
| 2833 |
| 2834 // Garbage collection support. |
| 2835 inline int size(); |
| 2836 |
| 2837 |
| 2838 inline static int MaxInt64Offset(int number_of_int64) { |
| 2839 return kFirstEntryOffset + (number_of_int64 * kInt64Size); |
| 2840 } |
| 2841 |
| 2842 inline static int SizeFor(const NumberOfEntries& small) { |
| 2843 int size = kFirstEntryOffset + |
| 2844 (small.count_of(INT64) * kInt64Size) + |
| 2845 (small.count_of(CODE_PTR) * kPointerSize) + |
| 2846 (small.count_of(HEAP_PTR) * kPointerSize) + |
| 2847 (small.count_of(INT32) * kInt32Size); |
| 2848 return RoundUp(size, kPointerSize); |
| 2849 } |
| 2850 |
| 2851 inline static int SizeForExtended(const NumberOfEntries& small, |
| 2852 const NumberOfEntries& extended) { |
| 2853 int size = SizeFor(small); |
| 2854 size = RoundUp(size, kInt64Size); // Align extended header to 64 bits. |
| 2855 size += kExtendedFirstOffset + |
| 2856 (extended.count_of(INT64) * kInt64Size) + |
| 2857 (extended.count_of(CODE_PTR) * kPointerSize) + |
| 2858 (extended.count_of(HEAP_PTR) * kPointerSize) + |
| 2859 (extended.count_of(INT32) * kInt32Size); |
| 2860 return RoundUp(size, kPointerSize); |
| 2861 } |
| 2862 |
| 2863 inline static int entry_size(Type type) { |
| 2864 switch (type) { |
| 2865 case INT32: |
| 2866 return kInt32Size; |
| 2867 case INT64: |
| 2868 return kInt64Size; |
| 2869 case CODE_PTR: |
| 2870 case HEAP_PTR: |
| 2871 return kPointerSize; |
| 2872 default: |
| 2873 UNREACHABLE(); |
| 2874 return 0; |
| 2875 } |
| 2876 } |
| 2877 |
| 2878 // Code Generation support. |
| 2879 inline int OffsetOfElementAt(int index) { |
| 2880 int offset; |
| 2881 LayoutSection section; |
| 2882 if (is_extended_layout() && index >= first_extended_section_index()) { |
| 2883 section = EXTENDED_SECTION; |
| 2884 offset = get_extended_section_header_offset() + kExtendedFirstOffset; |
| 2885 } else { |
| 2886 section = SMALL_SECTION; |
| 2887 offset = kFirstEntryOffset; |
| 2888 } |
| 2889 |
| 2890 // Add offsets for the preceding type sections. |
| 2891 DCHECK(index <= last_index(LAST_TYPE, section)); |
| 2892 for (Type type = FIRST_TYPE; index > last_index(type, section); |
| 2893 type = next_type(type)) { |
| 2894 offset += entry_size(type) * number_of_entries(type, section); |
| 2895 } |
| 2896 |
| 2897 // Add offset for the index in it's type. |
| 2898 Type type = get_type(index); |
| 2899 offset += entry_size(type) * (index - first_index(type, section)); |
| 2900 return offset; |
| 2901 } |
| 2902 |
| 2903 DECLARE_CAST(ConstantPoolArray) |
| 2904 |
| 2905 // Garbage collection support. |
| 2906 Object** RawFieldOfElementAt(int index) { |
| 2907 return HeapObject::RawField(this, OffsetOfElementAt(index)); |
| 2908 } |
| 2909 |
| 2910 // Small Layout description. |
| 2911 static const int kSmallLayout1Offset = HeapObject::kHeaderSize; |
| 2912 static const int kSmallLayout2Offset = kSmallLayout1Offset + kInt32Size; |
| 2913 static const int kHeaderSize = kSmallLayout2Offset + kInt32Size; |
| 2914 static const int kFirstEntryOffset = ROUND_UP(kHeaderSize, kInt64Size); |
| 2915 |
| 2916 static const int kSmallLayoutCountBits = 10; |
| 2917 static const int kMaxSmallEntriesPerType = (1 << kSmallLayoutCountBits) - 1; |
| 2918 |
| 2919 // Fields in kSmallLayout1Offset. |
| 2920 class Int64CountField: public BitField<int, 1, kSmallLayoutCountBits> {}; |
| 2921 class CodePtrCountField: public BitField<int, 11, kSmallLayoutCountBits> {}; |
| 2922 class HeapPtrCountField: public BitField<int, 21, kSmallLayoutCountBits> {}; |
| 2923 class IsExtendedField: public BitField<bool, 31, 1> {}; |
| 2924 |
| 2925 // Fields in kSmallLayout2Offset. |
| 2926 class Int32CountField: public BitField<int, 1, kSmallLayoutCountBits> {}; |
| 2927 class TotalCountField: public BitField<int, 11, 12> {}; |
| 2928 class WeakObjectStateField: public BitField<WeakObjectState, 23, 2> {}; |
| 2929 |
| 2930 // Extended layout description, which starts at |
| 2931 // get_extended_section_header_offset(). |
| 2932 static const int kExtendedInt64CountOffset = 0; |
| 2933 static const int kExtendedCodePtrCountOffset = |
| 2934 kExtendedInt64CountOffset + kInt32Size; |
| 2935 static const int kExtendedHeapPtrCountOffset = |
| 2936 kExtendedCodePtrCountOffset + kInt32Size; |
| 2937 static const int kExtendedInt32CountOffset = |
| 2938 kExtendedHeapPtrCountOffset + kInt32Size; |
| 2939 static const int kExtendedFirstOffset = |
| 2940 kExtendedInt32CountOffset + kInt32Size; |
| 2941 |
| 2942 // Dispatched behavior. |
| 2943 void ConstantPoolIterateBody(ObjectVisitor* v); |
| 2944 |
| 2945 DECLARE_PRINTER(ConstantPoolArray) |
| 2946 DECLARE_VERIFIER(ConstantPoolArray) |
| 2947 |
| 2948 private: |
| 2949 inline int first_extended_section_index(); |
| 2950 inline int get_extended_section_header_offset(); |
| 2951 |
| 2952 inline static Type next_type(Type type) { |
| 2953 DCHECK(type >= FIRST_TYPE && type < NUMBER_OF_TYPES); |
| 2954 int type_int = static_cast<int>(type); |
| 2955 return static_cast<Type>(++type_int); |
| 2956 } |
| 2957 |
| 2958 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolArray); |
| 2959 }; |
| 2960 |
| 2961 |
2653 // DescriptorArrays are fixed arrays used to hold instance descriptors. | 2962 // DescriptorArrays are fixed arrays used to hold instance descriptors. |
2654 // The format of the these objects is: | 2963 // The format of the these objects is: |
2655 // [0]: Number of descriptors | 2964 // [0]: Number of descriptors |
2656 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: | 2965 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: |
2657 // [0]: pointer to fixed array with enum cache | 2966 // [0]: pointer to fixed array with enum cache |
2658 // [1]: either Smi(0) or pointer to fixed array with indices | 2967 // [1]: either Smi(0) or pointer to fixed array with indices |
2659 // [2]: first key | 2968 // [2]: first key |
2660 // [2 + number of descriptors * kDescriptorSize]: start of slack | 2969 // [2 + number of descriptors * kDescriptorSize]: start of slack |
2661 class DescriptorArray: public FixedArray { | 2970 class DescriptorArray: public FixedArray { |
2662 public: | 2971 public: |
(...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4969 // [ic_age]: Inline caching age: the value of the Heap::global_ic_age | 5278 // [ic_age]: Inline caching age: the value of the Heap::global_ic_age |
4970 // at the moment when this object was created. | 5279 // at the moment when this object was created. |
4971 inline void set_ic_age(int count); | 5280 inline void set_ic_age(int count); |
4972 inline int ic_age() const; | 5281 inline int ic_age() const; |
4973 | 5282 |
4974 // [prologue_offset]: Offset of the function prologue, used for aging | 5283 // [prologue_offset]: Offset of the function prologue, used for aging |
4975 // FUNCTIONs and OPTIMIZED_FUNCTIONs. | 5284 // FUNCTIONs and OPTIMIZED_FUNCTIONs. |
4976 inline int prologue_offset() const; | 5285 inline int prologue_offset() const; |
4977 inline void set_prologue_offset(int offset); | 5286 inline void set_prologue_offset(int offset); |
4978 | 5287 |
4979 // [constant_pool offset]: Offset of the constant pool. | |
4980 // Valid for FLAG_enable_embedded_constant_pool only | |
4981 inline int constant_pool_offset() const; | |
4982 inline void set_constant_pool_offset(int offset); | |
4983 | |
4984 // Unchecked accessors to be used during GC. | 5288 // Unchecked accessors to be used during GC. |
4985 inline ByteArray* unchecked_relocation_info(); | 5289 inline ByteArray* unchecked_relocation_info(); |
4986 | 5290 |
4987 inline int relocation_size(); | 5291 inline int relocation_size(); |
4988 | 5292 |
4989 // [flags]: Various code flags. | 5293 // [flags]: Various code flags. |
4990 inline Flags flags(); | 5294 inline Flags flags(); |
4991 inline void set_flags(Flags flags); | 5295 inline void set_flags(Flags flags); |
4992 | 5296 |
4993 // [flags]: Access to specific code flags. | 5297 // [flags]: Access to specific code flags. |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5107 inline bool has_function_cache(); | 5411 inline bool has_function_cache(); |
5108 inline void set_has_function_cache(bool flag); | 5412 inline void set_has_function_cache(bool flag); |
5109 | 5413 |
5110 | 5414 |
5111 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether | 5415 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether |
5112 // the code is going to be deoptimized because of dead embedded maps. | 5416 // the code is going to be deoptimized because of dead embedded maps. |
5113 inline bool marked_for_deoptimization(); | 5417 inline bool marked_for_deoptimization(); |
5114 inline void set_marked_for_deoptimization(bool flag); | 5418 inline void set_marked_for_deoptimization(bool flag); |
5115 | 5419 |
5116 // [constant_pool]: The constant pool for this function. | 5420 // [constant_pool]: The constant pool for this function. |
5117 inline Address constant_pool(); | 5421 inline ConstantPoolArray* constant_pool(); |
| 5422 inline void set_constant_pool(Object* constant_pool); |
5118 | 5423 |
5119 // Get the safepoint entry for the given pc. | 5424 // Get the safepoint entry for the given pc. |
5120 SafepointEntry GetSafepointEntry(Address pc); | 5425 SafepointEntry GetSafepointEntry(Address pc); |
5121 | 5426 |
5122 // Find an object in a stub with a specified map | 5427 // Find an object in a stub with a specified map |
5123 Object* FindNthObject(int n, Map* match_map); | 5428 Object* FindNthObject(int n, Map* match_map); |
5124 | 5429 |
5125 // Find the first allocation site in an IC stub. | 5430 // Find the first allocation site in an IC stub. |
5126 AllocationSite* FindFirstAllocationSite(); | 5431 AllocationSite* FindFirstAllocationSite(); |
5127 | 5432 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5308 | 5613 |
5309 static inline bool IsWeakObjectInOptimizedCode(Object* object); | 5614 static inline bool IsWeakObjectInOptimizedCode(Object* object); |
5310 | 5615 |
5311 static Handle<WeakCell> WeakCellFor(Handle<Code> code); | 5616 static Handle<WeakCell> WeakCellFor(Handle<Code> code); |
5312 WeakCell* CachedWeakCell(); | 5617 WeakCell* CachedWeakCell(); |
5313 | 5618 |
5314 // Max loop nesting marker used to postpose OSR. We don't take loop | 5619 // Max loop nesting marker used to postpose OSR. We don't take loop |
5315 // nesting that is deeper than 5 levels into account. | 5620 // nesting that is deeper than 5 levels into account. |
5316 static const int kMaxLoopNestingMarker = 6; | 5621 static const int kMaxLoopNestingMarker = 6; |
5317 | 5622 |
5318 static const int kConstantPoolSize = | |
5319 FLAG_enable_embedded_constant_pool ? kIntSize : 0; | |
5320 | |
5321 // Layout description. | 5623 // Layout description. |
5322 static const int kRelocationInfoOffset = HeapObject::kHeaderSize; | 5624 static const int kRelocationInfoOffset = HeapObject::kHeaderSize; |
5323 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; | 5625 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; |
5324 static const int kDeoptimizationDataOffset = | 5626 static const int kDeoptimizationDataOffset = |
5325 kHandlerTableOffset + kPointerSize; | 5627 kHandlerTableOffset + kPointerSize; |
5326 // For FUNCTION kind, we store the type feedback info here. | 5628 // For FUNCTION kind, we store the type feedback info here. |
5327 static const int kTypeFeedbackInfoOffset = | 5629 static const int kTypeFeedbackInfoOffset = |
5328 kDeoptimizationDataOffset + kPointerSize; | 5630 kDeoptimizationDataOffset + kPointerSize; |
5329 static const int kNextCodeLinkOffset = kTypeFeedbackInfoOffset + kPointerSize; | 5631 static const int kNextCodeLinkOffset = kTypeFeedbackInfoOffset + kPointerSize; |
5330 static const int kGCMetadataOffset = kNextCodeLinkOffset + kPointerSize; | 5632 static const int kGCMetadataOffset = kNextCodeLinkOffset + kPointerSize; |
5331 static const int kInstructionSizeOffset = kGCMetadataOffset + kPointerSize; | 5633 static const int kInstructionSizeOffset = kGCMetadataOffset + kPointerSize; |
5332 static const int kICAgeOffset = kInstructionSizeOffset + kIntSize; | 5634 static const int kICAgeOffset = kInstructionSizeOffset + kIntSize; |
5333 static const int kFlagsOffset = kICAgeOffset + kIntSize; | 5635 static const int kFlagsOffset = kICAgeOffset + kIntSize; |
5334 static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize; | 5636 static const int kKindSpecificFlags1Offset = kFlagsOffset + kIntSize; |
5335 static const int kKindSpecificFlags2Offset = | 5637 static const int kKindSpecificFlags2Offset = |
5336 kKindSpecificFlags1Offset + kIntSize; | 5638 kKindSpecificFlags1Offset + kIntSize; |
5337 // Note: We might be able to squeeze this into the flags above. | 5639 // Note: We might be able to squeeze this into the flags above. |
5338 static const int kPrologueOffset = kKindSpecificFlags2Offset + kIntSize; | 5640 static const int kPrologueOffset = kKindSpecificFlags2Offset + kIntSize; |
5339 static const int kConstantPoolOffset = kPrologueOffset + kIntSize; | 5641 static const int kConstantPoolOffset = kPrologueOffset + kIntSize; |
5340 static const int kHeaderPaddingStart = | 5642 |
5341 kConstantPoolOffset + kConstantPoolSize; | 5643 static const int kHeaderPaddingStart = kConstantPoolOffset + kPointerSize; |
5342 | 5644 |
5343 // Add padding to align the instruction start following right after | 5645 // Add padding to align the instruction start following right after |
5344 // the Code object header. | 5646 // the Code object header. |
5345 static const int kHeaderSize = | 5647 static const int kHeaderSize = |
5346 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; | 5648 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; |
| 5649 // Ensure that the slot for the constant pool pointer is aligned. |
| 5650 STATIC_ASSERT((kConstantPoolOffset & kPointerAlignmentMask) == 0); |
5347 | 5651 |
5348 // Byte offsets within kKindSpecificFlags1Offset. | 5652 // Byte offsets within kKindSpecificFlags1Offset. |
5349 static const int kFullCodeFlags = kKindSpecificFlags1Offset; | 5653 static const int kFullCodeFlags = kKindSpecificFlags1Offset; |
5350 class FullCodeFlagsHasDeoptimizationSupportField: | 5654 class FullCodeFlagsHasDeoptimizationSupportField: |
5351 public BitField<bool, 0, 1> {}; // NOLINT | 5655 public BitField<bool, 0, 1> {}; // NOLINT |
5352 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; | 5656 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; |
5353 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; | 5657 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; |
5354 class FullCodeFlagsHasRelocInfoForSerialization | 5658 class FullCodeFlagsHasRelocInfoForSerialization |
5355 : public BitField<bool, 3, 1> {}; | 5659 : public BitField<bool, 3, 1> {}; |
5356 | 5660 |
(...skipping 5481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10838 } else { | 11142 } else { |
10839 value &= ~(1 << bit_position); | 11143 value &= ~(1 << bit_position); |
10840 } | 11144 } |
10841 return value; | 11145 return value; |
10842 } | 11146 } |
10843 }; | 11147 }; |
10844 | 11148 |
10845 } } // namespace v8::internal | 11149 } } // namespace v8::internal |
10846 | 11150 |
10847 #endif // V8_OBJECTS_H_ | 11151 #endif // V8_OBJECTS_H_ |
OLD | NEW |