OLD | NEW |
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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 V(ALLOCATION_SITE_TYPE) \ | 398 V(ALLOCATION_SITE_TYPE) \ |
399 V(SCRIPT_TYPE) \ | 399 V(SCRIPT_TYPE) \ |
400 V(CODE_CACHE_TYPE) \ | 400 V(CODE_CACHE_TYPE) \ |
401 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 401 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
402 V(TYPE_FEEDBACK_INFO_TYPE) \ | 402 V(TYPE_FEEDBACK_INFO_TYPE) \ |
403 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 403 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
404 V(BOX_TYPE) \ | 404 V(BOX_TYPE) \ |
405 \ | 405 \ |
406 V(FIXED_ARRAY_TYPE) \ | 406 V(FIXED_ARRAY_TYPE) \ |
407 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 407 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
| 408 V(CONSTANT_POOL_ARRAY_TYPE) \ |
408 V(SHARED_FUNCTION_INFO_TYPE) \ | 409 V(SHARED_FUNCTION_INFO_TYPE) \ |
409 \ | 410 \ |
410 V(JS_MESSAGE_OBJECT_TYPE) \ | 411 V(JS_MESSAGE_OBJECT_TYPE) \ |
411 \ | 412 \ |
412 V(JS_VALUE_TYPE) \ | 413 V(JS_VALUE_TYPE) \ |
413 V(JS_DATE_TYPE) \ | 414 V(JS_DATE_TYPE) \ |
414 V(JS_OBJECT_TYPE) \ | 415 V(JS_OBJECT_TYPE) \ |
415 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 416 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
416 V(JS_GENERATOR_OBJECT_TYPE) \ | 417 V(JS_GENERATOR_OBJECT_TYPE) \ |
417 V(JS_MODULE_TYPE) \ | 418 V(JS_MODULE_TYPE) \ |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE | 709 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
709 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, | 710 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, |
710 EXTERNAL_SHORT_ARRAY_TYPE, | 711 EXTERNAL_SHORT_ARRAY_TYPE, |
711 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, | 712 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, |
712 EXTERNAL_INT_ARRAY_TYPE, | 713 EXTERNAL_INT_ARRAY_TYPE, |
713 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, | 714 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, |
714 EXTERNAL_FLOAT_ARRAY_TYPE, | 715 EXTERNAL_FLOAT_ARRAY_TYPE, |
715 EXTERNAL_DOUBLE_ARRAY_TYPE, | 716 EXTERNAL_DOUBLE_ARRAY_TYPE, |
716 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE | 717 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE |
717 FIXED_DOUBLE_ARRAY_TYPE, | 718 FIXED_DOUBLE_ARRAY_TYPE, |
| 719 CONSTANT_POOL_ARRAY_TYPE, |
718 FILLER_TYPE, // LAST_DATA_TYPE | 720 FILLER_TYPE, // LAST_DATA_TYPE |
719 | 721 |
720 // Structs. | 722 // Structs. |
721 DECLARED_ACCESSOR_DESCRIPTOR_TYPE, | 723 DECLARED_ACCESSOR_DESCRIPTOR_TYPE, |
722 DECLARED_ACCESSOR_INFO_TYPE, | 724 DECLARED_ACCESSOR_INFO_TYPE, |
723 EXECUTABLE_ACCESSOR_INFO_TYPE, | 725 EXECUTABLE_ACCESSOR_INFO_TYPE, |
724 ACCESSOR_PAIR_TYPE, | 726 ACCESSOR_PAIR_TYPE, |
725 ACCESS_CHECK_INFO_TYPE, | 727 ACCESS_CHECK_INFO_TYPE, |
726 INTERCEPTOR_INFO_TYPE, | 728 INTERCEPTOR_INFO_TYPE, |
727 CALL_HANDLER_INFO_TYPE, | 729 CALL_HANDLER_INFO_TYPE, |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 V(JSModule) \ | 995 V(JSModule) \ |
994 V(Map) \ | 996 V(Map) \ |
995 V(DescriptorArray) \ | 997 V(DescriptorArray) \ |
996 V(TransitionArray) \ | 998 V(TransitionArray) \ |
997 V(DeoptimizationInputData) \ | 999 V(DeoptimizationInputData) \ |
998 V(DeoptimizationOutputData) \ | 1000 V(DeoptimizationOutputData) \ |
999 V(DependentCode) \ | 1001 V(DependentCode) \ |
1000 V(TypeFeedbackCells) \ | 1002 V(TypeFeedbackCells) \ |
1001 V(FixedArray) \ | 1003 V(FixedArray) \ |
1002 V(FixedDoubleArray) \ | 1004 V(FixedDoubleArray) \ |
| 1005 V(ConstantPoolArray) \ |
1003 V(Context) \ | 1006 V(Context) \ |
1004 V(NativeContext) \ | 1007 V(NativeContext) \ |
1005 V(ScopeInfo) \ | 1008 V(ScopeInfo) \ |
1006 V(JSFunction) \ | 1009 V(JSFunction) \ |
1007 V(Code) \ | 1010 V(Code) \ |
1008 V(Oddball) \ | 1011 V(Oddball) \ |
1009 V(SharedFunctionInfo) \ | 1012 V(SharedFunctionInfo) \ |
1010 V(JSValue) \ | 1013 V(JSValue) \ |
1011 V(JSDate) \ | 1014 V(JSDate) \ |
1012 V(JSMessageObject) \ | 1015 V(JSMessageObject) \ |
(...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3025 | 3028 |
3026 // Dispatched behavior. | 3029 // Dispatched behavior. |
3027 DECLARE_PRINTER(FixedDoubleArray) | 3030 DECLARE_PRINTER(FixedDoubleArray) |
3028 DECLARE_VERIFIER(FixedDoubleArray) | 3031 DECLARE_VERIFIER(FixedDoubleArray) |
3029 | 3032 |
3030 private: | 3033 private: |
3031 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); | 3034 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); |
3032 }; | 3035 }; |
3033 | 3036 |
3034 | 3037 |
| 3038 // ConstantPoolArray describes a fixed-sized array containing constant pool |
| 3039 // entires. |
| 3040 // The format of the pool is: |
| 3041 // [0]: Field holding the first index which is a pointer entry |
| 3042 // [1]: Field holding the first index which is a int32 entry |
| 3043 // [2] ... [first_ptr_index() - 1]: 64 bit entries |
| 3044 // [first_ptr_index()] ... [first_int32_index() - 1]: pointer entries |
| 3045 // [first_int32_index()] ... [length - 1]: 32 bit entries |
| 3046 class ConstantPoolArray: public FixedArrayBase { |
| 3047 public: |
| 3048 // Getters for the field storing the first index for different type entries. |
| 3049 inline int first_ptr_index(); |
| 3050 inline int first_int64_index(); |
| 3051 inline int first_int32_index(); |
| 3052 |
| 3053 // Getters for counts of different type entries. |
| 3054 inline int count_of_ptr_entries(); |
| 3055 inline int count_of_int64_entries(); |
| 3056 inline int count_of_int32_entries(); |
| 3057 |
| 3058 // Setter and getter for pool elements. |
| 3059 inline Object* get_ptr_entry(int index); |
| 3060 inline int64_t get_int64_entry(int index); |
| 3061 inline int32_t get_int32_entry(int index); |
| 3062 inline double get_int64_entry_as_double(int index); |
| 3063 |
| 3064 inline void set(int index, Object* value); |
| 3065 inline void set(int index, int64_t value); |
| 3066 inline void set(int index, double value); |
| 3067 inline void set(int index, int32_t value); |
| 3068 |
| 3069 // Set up initial state. |
| 3070 inline void SetEntryCounts(int number_of_int64_entries, |
| 3071 int number_of_ptr_entries, |
| 3072 int number_of_int32_entries); |
| 3073 |
| 3074 // Copy operations |
| 3075 MUST_USE_RESULT inline MaybeObject* Copy(); |
| 3076 |
| 3077 // Garbage collection support. |
| 3078 inline static int SizeFor(int number_of_int64_entries, |
| 3079 int number_of_ptr_entries, |
| 3080 int number_of_int32_entries) { |
| 3081 return RoundUp(OffsetAt(number_of_int64_entries, |
| 3082 number_of_ptr_entries, |
| 3083 number_of_int32_entries), |
| 3084 kPointerSize); |
| 3085 } |
| 3086 |
| 3087 // Code Generation support. |
| 3088 inline int OffsetOfElementAt(int index) { |
| 3089 ASSERT(index < length()); |
| 3090 if (index >= first_int32_index()) { |
| 3091 return OffsetAt(count_of_int64_entries(), count_of_ptr_entries(), |
| 3092 index - first_int32_index()); |
| 3093 } else if (index >= first_ptr_index()) { |
| 3094 return OffsetAt(count_of_int64_entries(), index - first_ptr_index(), 0); |
| 3095 } else { |
| 3096 return OffsetAt(index, 0, 0); |
| 3097 } |
| 3098 } |
| 3099 |
| 3100 // Casting. |
| 3101 static inline ConstantPoolArray* cast(Object* obj); |
| 3102 |
| 3103 // Layout description. |
| 3104 static const int kFirstPointerIndexOffset = FixedArray::kHeaderSize; |
| 3105 static const int kFirstInt32IndexOffset = |
| 3106 kFirstPointerIndexOffset + kPointerSize; |
| 3107 static const int kFirstOffset = kFirstInt32IndexOffset + kPointerSize; |
| 3108 |
| 3109 // Dispatched behavior. |
| 3110 void ConstantPoolIterateBody(ObjectVisitor* v); |
| 3111 |
| 3112 DECLARE_PRINTER(ConstantPoolArray) |
| 3113 DECLARE_VERIFIER(ConstantPoolArray) |
| 3114 |
| 3115 private: |
| 3116 inline void set_first_ptr_index(int value); |
| 3117 inline void set_first_int32_index(int value); |
| 3118 |
| 3119 inline static int OffsetAt(int number_of_int64_entries, |
| 3120 int number_of_ptr_entries, |
| 3121 int number_of_int32_entries) { |
| 3122 return kFirstOffset |
| 3123 + (number_of_int64_entries * kInt64Size) |
| 3124 + (number_of_ptr_entries * kPointerSize) |
| 3125 + (number_of_int32_entries * kInt32Size); |
| 3126 } |
| 3127 |
| 3128 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolArray); |
| 3129 }; |
| 3130 |
| 3131 |
3035 // DescriptorArrays are fixed arrays used to hold instance descriptors. | 3132 // DescriptorArrays are fixed arrays used to hold instance descriptors. |
3036 // The format of the these objects is: | 3133 // The format of the these objects is: |
3037 // [0]: Number of descriptors | 3134 // [0]: Number of descriptors |
3038 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: | 3135 // [1]: Either Smi(0) if uninitialized, or a pointer to small fixed array: |
3039 // [0]: pointer to fixed array with enum cache | 3136 // [0]: pointer to fixed array with enum cache |
3040 // [1]: either Smi(0) or pointer to fixed array with indices | 3137 // [1]: either Smi(0) or pointer to fixed array with indices |
3041 // [2]: first key | 3138 // [2]: first key |
3042 // [2 + number of descriptors * kDescriptorSize]: start of slack | 3139 // [2 + number of descriptors * kDescriptorSize]: start of slack |
3043 class DescriptorArray: public FixedArray { | 3140 class DescriptorArray: public FixedArray { |
3044 public: | 3141 public: |
(...skipping 7265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10310 } else { | 10407 } else { |
10311 value &= ~(1 << bit_position); | 10408 value &= ~(1 << bit_position); |
10312 } | 10409 } |
10313 return value; | 10410 return value; |
10314 } | 10411 } |
10315 }; | 10412 }; |
10316 | 10413 |
10317 } } // namespace v8::internal | 10414 } } // namespace v8::internal |
10318 | 10415 |
10319 #endif // V8_OBJECTS_H_ | 10416 #endif // V8_OBJECTS_H_ |
OLD | NEW |