| 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 3141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3152 DECLARE_VERIFIER(FixedDoubleArray) | 3152 DECLARE_VERIFIER(FixedDoubleArray) |
| 3153 | 3153 |
| 3154 private: | 3154 private: |
| 3155 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); | 3155 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); |
| 3156 }; | 3156 }; |
| 3157 | 3157 |
| 3158 | 3158 |
| 3159 // ConstantPoolArray describes a fixed-sized array containing constant pool | 3159 // ConstantPoolArray describes a fixed-sized array containing constant pool |
| 3160 // entires. | 3160 // entires. |
| 3161 // The format of the pool is: | 3161 // The format of the pool is: |
| 3162 // [0]: Field holding the first index which is a pointer entry | 3162 // [0]: Field holding the first index which is a raw code target pointer entry |
| 3163 // [1]: Field holding the first index which is a int32 entry | 3163 // [1]: Field holding the first index which is a heap pointer entry |
| 3164 // [2] ... [first_ptr_index() - 1]: 64 bit entries | 3164 // [2]: Field holding the first index which is a int32 entry |
| 3165 // [first_ptr_index()] ... [first_int32_index() - 1]: pointer entries | 3165 // [3] ... [first_code_ptr_index() - 1] : 64 bit entries |
| 3166 // [first_int32_index()] ... [length - 1]: 32 bit entries | 3166 // [first_code_ptr_index()] ... [first_heap_ptr_index() - 1] : code pointers |
| 3167 // [first_heap_ptr_index()] ... [first_int32_index() - 1] : heap pointers |
| 3168 // [first_int32_index()] ... [length - 1] : 32 bit entries |
| 3167 class ConstantPoolArray: public FixedArrayBase { | 3169 class ConstantPoolArray: public FixedArrayBase { |
| 3168 public: | 3170 public: |
| 3169 // Getters for the field storing the first index for different type entries. | 3171 // Getters for the field storing the first index for different type entries. |
| 3170 inline int first_ptr_index(); | 3172 inline int first_code_ptr_index(); |
| 3173 inline int first_heap_ptr_index(); |
| 3171 inline int first_int64_index(); | 3174 inline int first_int64_index(); |
| 3172 inline int first_int32_index(); | 3175 inline int first_int32_index(); |
| 3173 | 3176 |
| 3174 // Getters for counts of different type entries. | 3177 // Getters for counts of different type entries. |
| 3175 inline int count_of_ptr_entries(); | 3178 inline int count_of_code_ptr_entries(); |
| 3179 inline int count_of_heap_ptr_entries(); |
| 3176 inline int count_of_int64_entries(); | 3180 inline int count_of_int64_entries(); |
| 3177 inline int count_of_int32_entries(); | 3181 inline int count_of_int32_entries(); |
| 3178 | 3182 |
| 3179 // Setter and getter for pool elements. | 3183 // Setter and getter for pool elements. |
| 3180 inline Object* get_ptr_entry(int index); | 3184 inline Address get_code_ptr_entry(int index); |
| 3185 inline Object* get_heap_ptr_entry(int index); |
| 3181 inline int64_t get_int64_entry(int index); | 3186 inline int64_t get_int64_entry(int index); |
| 3182 inline int32_t get_int32_entry(int index); | 3187 inline int32_t get_int32_entry(int index); |
| 3183 inline double get_int64_entry_as_double(int index); | 3188 inline double get_int64_entry_as_double(int index); |
| 3184 | 3189 |
| 3190 inline void set(int index, Address value); |
| 3185 inline void set(int index, Object* value); | 3191 inline void set(int index, Object* value); |
| 3186 inline void set(int index, int64_t value); | 3192 inline void set(int index, int64_t value); |
| 3187 inline void set(int index, double value); | 3193 inline void set(int index, double value); |
| 3188 inline void set(int index, int32_t value); | 3194 inline void set(int index, int32_t value); |
| 3189 | 3195 |
| 3190 // Set up initial state. | 3196 // Set up initial state. |
| 3191 inline void SetEntryCounts(int number_of_int64_entries, | 3197 inline void SetEntryCounts(int number_of_int64_entries, |
| 3192 int number_of_ptr_entries, | 3198 int number_of_code_ptr_entries, |
| 3199 int number_of_heap_ptr_entries, |
| 3193 int number_of_int32_entries); | 3200 int number_of_int32_entries); |
| 3194 | 3201 |
| 3195 // Copy operations | 3202 // Copy operations |
| 3196 MUST_USE_RESULT inline MaybeObject* Copy(); | 3203 MUST_USE_RESULT inline MaybeObject* Copy(); |
| 3197 | 3204 |
| 3198 // Garbage collection support. | 3205 // Garbage collection support. |
| 3199 inline static int SizeFor(int number_of_int64_entries, | 3206 inline static int SizeFor(int number_of_int64_entries, |
| 3200 int number_of_ptr_entries, | 3207 int number_of_code_ptr_entries, |
| 3208 int number_of_heap_ptr_entries, |
| 3201 int number_of_int32_entries) { | 3209 int number_of_int32_entries) { |
| 3202 return RoundUp(OffsetAt(number_of_int64_entries, | 3210 return RoundUp(OffsetAt(number_of_int64_entries, |
| 3203 number_of_ptr_entries, | 3211 number_of_code_ptr_entries, |
| 3212 number_of_heap_ptr_entries, |
| 3204 number_of_int32_entries), | 3213 number_of_int32_entries), |
| 3205 kPointerSize); | 3214 kPointerSize); |
| 3206 } | 3215 } |
| 3207 | 3216 |
| 3208 // Code Generation support. | 3217 // Code Generation support. |
| 3209 inline int OffsetOfElementAt(int index) { | 3218 inline int OffsetOfElementAt(int index) { |
| 3210 ASSERT(index < length()); | 3219 ASSERT(index < length()); |
| 3211 if (index >= first_int32_index()) { | 3220 if (index >= first_int32_index()) { |
| 3212 return OffsetAt(count_of_int64_entries(), count_of_ptr_entries(), | 3221 return OffsetAt(count_of_int64_entries(), count_of_code_ptr_entries(), |
| 3213 index - first_int32_index()); | 3222 count_of_heap_ptr_entries(), index - first_int32_index()); |
| 3214 } else if (index >= first_ptr_index()) { | 3223 } else if (index >= first_heap_ptr_index()) { |
| 3215 return OffsetAt(count_of_int64_entries(), index - first_ptr_index(), 0); | 3224 return OffsetAt(count_of_int64_entries(), count_of_code_ptr_entries(), |
| 3225 index - first_heap_ptr_index(), 0); |
| 3226 } else if (index >= first_code_ptr_index()) { |
| 3227 return OffsetAt(count_of_int64_entries(), index - first_code_ptr_index(), |
| 3228 0, 0); |
| 3216 } else { | 3229 } else { |
| 3217 return OffsetAt(index, 0, 0); | 3230 return OffsetAt(index, 0, 0, 0); |
| 3218 } | 3231 } |
| 3219 } | 3232 } |
| 3220 | 3233 |
| 3221 // Casting. | 3234 // Casting. |
| 3222 static inline ConstantPoolArray* cast(Object* obj); | 3235 static inline ConstantPoolArray* cast(Object* obj); |
| 3223 | 3236 |
| 3237 // Garbage collection support. |
| 3238 Object** RawFieldOfElementAt(int index) { |
| 3239 return HeapObject::RawField(this, OffsetOfElementAt(index)); |
| 3240 } |
| 3241 |
| 3224 // Layout description. | 3242 // Layout description. |
| 3225 static const int kFirstPointerIndexOffset = FixedArray::kHeaderSize; | 3243 static const int kFirstCodePointerIndexOffset = FixedArray::kHeaderSize; |
| 3244 static const int kFirstHeapPointerIndexOffset = |
| 3245 kFirstCodePointerIndexOffset + kPointerSize; |
| 3226 static const int kFirstInt32IndexOffset = | 3246 static const int kFirstInt32IndexOffset = |
| 3227 kFirstPointerIndexOffset + kPointerSize; | 3247 kFirstHeapPointerIndexOffset + kPointerSize; |
| 3228 static const int kFirstOffset = kFirstInt32IndexOffset + kPointerSize; | 3248 static const int kFirstOffset = kFirstInt32IndexOffset + kPointerSize; |
| 3229 | 3249 |
| 3230 // Dispatched behavior. | 3250 // Dispatched behavior. |
| 3231 void ConstantPoolIterateBody(ObjectVisitor* v); | 3251 void ConstantPoolIterateBody(ObjectVisitor* v); |
| 3232 | 3252 |
| 3233 DECLARE_PRINTER(ConstantPoolArray) | 3253 DECLARE_PRINTER(ConstantPoolArray) |
| 3234 DECLARE_VERIFIER(ConstantPoolArray) | 3254 DECLARE_VERIFIER(ConstantPoolArray) |
| 3235 | 3255 |
| 3236 private: | 3256 private: |
| 3237 inline void set_first_ptr_index(int value); | 3257 inline void set_first_code_ptr_index(int value); |
| 3258 inline void set_first_heap_ptr_index(int value); |
| 3238 inline void set_first_int32_index(int value); | 3259 inline void set_first_int32_index(int value); |
| 3239 | 3260 |
| 3240 inline static int OffsetAt(int number_of_int64_entries, | 3261 inline static int OffsetAt(int number_of_int64_entries, |
| 3241 int number_of_ptr_entries, | 3262 int number_of_code_ptr_entries, |
| 3263 int number_of_heap_ptr_entries, |
| 3242 int number_of_int32_entries) { | 3264 int number_of_int32_entries) { |
| 3243 return kFirstOffset | 3265 return kFirstOffset |
| 3244 + (number_of_int64_entries * kInt64Size) | 3266 + (number_of_int64_entries * kInt64Size) |
| 3245 + (number_of_ptr_entries * kPointerSize) | 3267 + (number_of_code_ptr_entries * kPointerSize) |
| 3268 + (number_of_heap_ptr_entries * kPointerSize) |
| 3246 + (number_of_int32_entries * kInt32Size); | 3269 + (number_of_int32_entries * kInt32Size); |
| 3247 } | 3270 } |
| 3248 | 3271 |
| 3249 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolArray); | 3272 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstantPoolArray); |
| 3250 }; | 3273 }; |
| 3251 | 3274 |
| 3252 | 3275 |
| 3253 // DescriptorArrays are fixed arrays used to hold instance descriptors. | 3276 // DescriptorArrays are fixed arrays used to hold instance descriptors. |
| 3254 // The format of the these objects is: | 3277 // The format of the these objects is: |
| 3255 // [0]: Number of descriptors | 3278 // [0]: Number of descriptors |
| (...skipping 7521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10777 } else { | 10800 } else { |
| 10778 value &= ~(1 << bit_position); | 10801 value &= ~(1 << bit_position); |
| 10779 } | 10802 } |
| 10780 return value; | 10803 return value; |
| 10781 } | 10804 } |
| 10782 }; | 10805 }; |
| 10783 | 10806 |
| 10784 } } // namespace v8::internal | 10807 } } // namespace v8::internal |
| 10785 | 10808 |
| 10786 #endif // V8_OBJECTS_H_ | 10809 #endif // V8_OBJECTS_H_ |
| OLD | NEW |