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 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3175 // The format of the pool is: | 3175 // The format of the pool is: |
3176 // [0]: Field holding the first index which is a raw code target pointer entry | 3176 // [0]: Field holding the first index which is a raw code target pointer entry |
3177 // [1]: Field holding the first index which is a heap pointer entry | 3177 // [1]: Field holding the first index which is a heap pointer entry |
3178 // [2]: Field holding the first index which is a int32 entry | 3178 // [2]: Field holding the first index which is a int32 entry |
3179 // [3] ... [first_code_ptr_index() - 1] : 64 bit entries | 3179 // [3] ... [first_code_ptr_index() - 1] : 64 bit entries |
3180 // [first_code_ptr_index()] ... [first_heap_ptr_index() - 1] : code pointers | 3180 // [first_code_ptr_index()] ... [first_heap_ptr_index() - 1] : code pointers |
3181 // [first_heap_ptr_index()] ... [first_int32_index() - 1] : heap pointers | 3181 // [first_heap_ptr_index()] ... [first_int32_index() - 1] : heap pointers |
3182 // [first_int32_index()] ... [length - 1] : 32 bit entries | 3182 // [first_int32_index()] ... [length - 1] : 32 bit entries |
3183 class ConstantPoolArray: public FixedArrayBase { | 3183 class ConstantPoolArray: public FixedArrayBase { |
3184 public: | 3184 public: |
3185 enum WeakObjectState { | |
3186 NO_WEAK_OBJECTS, | |
3187 WEAK_OBJECTS_IN_OPTIMIZED_CODE | |
3188 }; | |
3189 | |
3185 // Getters for the field storing the first index for different type entries. | 3190 // Getters for the field storing the first index for different type entries. |
3186 inline int first_code_ptr_index(); | 3191 inline int first_code_ptr_index(); |
3187 inline int first_heap_ptr_index(); | 3192 inline int first_heap_ptr_index(); |
3188 inline int first_int64_index(); | 3193 inline int first_int64_index(); |
3189 inline int first_int32_index(); | 3194 inline int first_int32_index(); |
3190 | 3195 |
3191 // Getters for counts of different type entries. | 3196 // Getters for counts of different type entries. |
3192 inline int count_of_code_ptr_entries(); | 3197 inline int count_of_code_ptr_entries(); |
3193 inline int count_of_heap_ptr_entries(); | 3198 inline int count_of_heap_ptr_entries(); |
3194 inline int count_of_int64_entries(); | 3199 inline int count_of_int64_entries(); |
3195 inline int count_of_int32_entries(); | 3200 inline int count_of_int32_entries(); |
3196 | 3201 |
3197 // Setter and getter for pool elements. | 3202 // Setter and getter for pool elements. |
3198 inline Address get_code_ptr_entry(int index); | 3203 inline Address get_code_ptr_entry(int index); |
3199 inline Object* get_heap_ptr_entry(int index); | 3204 inline Object* get_heap_ptr_entry(int index); |
3200 inline int64_t get_int64_entry(int index); | 3205 inline int64_t get_int64_entry(int index); |
3201 inline int32_t get_int32_entry(int index); | 3206 inline int32_t get_int32_entry(int index); |
3202 inline double get_int64_entry_as_double(int index); | 3207 inline double get_int64_entry_as_double(int index); |
3203 | 3208 |
3209 // Setter and getter for weak objects state | |
3210 inline void set_weak_object_state(WeakObjectState state); | |
3211 inline WeakObjectState get_weak_object_state(); | |
3212 | |
3204 inline void set(int index, Address value); | 3213 inline void set(int index, Address value); |
3205 inline void set(int index, Object* value); | 3214 inline void set(int index, Object* value); |
3206 inline void set(int index, int64_t value); | 3215 inline void set(int index, int64_t value); |
3207 inline void set(int index, double value); | 3216 inline void set(int index, double value); |
3208 inline void set(int index, int32_t value); | 3217 inline void set(int index, int32_t value); |
3209 | 3218 |
3210 // Set up initial state. | 3219 // Set up initial state. |
3211 inline void SetEntryCounts(int number_of_int64_entries, | 3220 inline void Init(int number_of_int64_entries, |
3212 int number_of_code_ptr_entries, | 3221 int number_of_code_ptr_entries, |
3213 int number_of_heap_ptr_entries, | 3222 int number_of_heap_ptr_entries, |
3214 int number_of_int32_entries); | 3223 int number_of_int32_entries); |
3215 | 3224 |
3216 // Copy operations | 3225 // Copy operations |
3217 MUST_USE_RESULT inline MaybeObject* Copy(); | 3226 MUST_USE_RESULT inline MaybeObject* Copy(); |
3218 | 3227 |
3219 // Garbage collection support. | 3228 // Garbage collection support. |
3220 inline static int SizeFor(int number_of_int64_entries, | 3229 inline static int SizeFor(int number_of_int64_entries, |
3221 int number_of_code_ptr_entries, | 3230 int number_of_code_ptr_entries, |
3222 int number_of_heap_ptr_entries, | 3231 int number_of_heap_ptr_entries, |
3223 int number_of_int32_entries) { | 3232 int number_of_int32_entries) { |
3224 return RoundUp(OffsetAt(number_of_int64_entries, | 3233 return RoundUp(OffsetAt(number_of_int64_entries, |
(...skipping 22 matching lines...) Expand all Loading... | |
3247 | 3256 |
3248 // Casting. | 3257 // Casting. |
3249 static inline ConstantPoolArray* cast(Object* obj); | 3258 static inline ConstantPoolArray* cast(Object* obj); |
3250 | 3259 |
3251 // Garbage collection support. | 3260 // Garbage collection support. |
3252 Object** RawFieldOfElementAt(int index) { | 3261 Object** RawFieldOfElementAt(int index) { |
3253 return HeapObject::RawField(this, OffsetOfElementAt(index)); | 3262 return HeapObject::RawField(this, OffsetOfElementAt(index)); |
3254 } | 3263 } |
3255 | 3264 |
3256 // Layout description. | 3265 // Layout description. |
3257 static const int kFirstCodePointerIndexOffset = FixedArray::kHeaderSize; | 3266 static const int kArrayLayoutOffset = FixedArray::kHeaderSize; |
3258 static const int kFirstHeapPointerIndexOffset = | 3267 static const int kFirstOffset = kArrayLayoutOffset + kPointerSize; |
3259 kFirstCodePointerIndexOffset + kPointerSize; | 3268 |
3260 static const int kFirstInt32IndexOffset = | 3269 class NumberOfInt64EntriesField: public BitField<int, 0, 10> {}; |
ulan
2014/04/01 19:09:14
How do we guarantee that the number of entries doe
rmcilroy
2014/04/07 14:03:55
Good point (on Arm we never would due to checks in
| |
3261 kFirstHeapPointerIndexOffset + kPointerSize; | 3270 class NumberOfCodePtrEntriesField: public BitField<int, 10, 10> {}; |
3262 static const int kFirstOffset = kFirstInt32IndexOffset + kPointerSize; | 3271 class NumberOfHeapPtrEntriesField: public BitField<int, 20, 10> {}; |
3272 class WeakObjectStateField: public BitField<WeakObjectState, 30, 2> {}; | |
3263 | 3273 |
3264 // Dispatched behavior. | 3274 // Dispatched behavior. |
3265 void ConstantPoolIterateBody(ObjectVisitor* v); | 3275 void ConstantPoolIterateBody(ObjectVisitor* v); |
3266 | 3276 |
3267 DECLARE_PRINTER(ConstantPoolArray) | 3277 DECLARE_PRINTER(ConstantPoolArray) |
3268 DECLARE_VERIFIER(ConstantPoolArray) | 3278 DECLARE_VERIFIER(ConstantPoolArray) |
3269 | 3279 |
3270 private: | 3280 private: |
3271 inline void set_first_code_ptr_index(int value); | |
3272 inline void set_first_heap_ptr_index(int value); | |
3273 inline void set_first_int32_index(int value); | |
3274 | |
3275 inline static int OffsetAt(int number_of_int64_entries, | 3281 inline static int OffsetAt(int number_of_int64_entries, |
3276 int number_of_code_ptr_entries, | 3282 int number_of_code_ptr_entries, |
3277 int number_of_heap_ptr_entries, | 3283 int number_of_heap_ptr_entries, |
3278 int number_of_int32_entries) { | 3284 int number_of_int32_entries) { |
3279 return kFirstOffset | 3285 return kFirstOffset |
3280 + (number_of_int64_entries * kInt64Size) | 3286 + (number_of_int64_entries * kInt64Size) |
3281 + (number_of_code_ptr_entries * kPointerSize) | 3287 + (number_of_code_ptr_entries * kPointerSize) |
3282 + (number_of_heap_ptr_entries * kPointerSize) | 3288 + (number_of_heap_ptr_entries * kPointerSize) |
3283 + (number_of_int32_entries * kInt32Size); | 3289 + (number_of_int32_entries * kInt32Size); |
3284 } | 3290 } |
(...skipping 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5545 bool CanDeoptAt(Address pc); | 5551 bool CanDeoptAt(Address pc); |
5546 | 5552 |
5547 #ifdef VERIFY_HEAP | 5553 #ifdef VERIFY_HEAP |
5548 void VerifyEmbeddedObjectsDependency(); | 5554 void VerifyEmbeddedObjectsDependency(); |
5549 #endif | 5555 #endif |
5550 | 5556 |
5551 inline bool IsWeakObject(Object* object) { | 5557 inline bool IsWeakObject(Object* object) { |
5552 return is_optimized_code() && IsWeakObjectInOptimizedCode(object); | 5558 return is_optimized_code() && IsWeakObjectInOptimizedCode(object); |
5553 } | 5559 } |
5554 | 5560 |
5555 inline bool IsWeakObjectInOptimizedCode(Object* object); | 5561 static inline bool IsWeakObjectInOptimizedCode(Object* object); |
5556 | 5562 |
5557 // Max loop nesting marker used to postpose OSR. We don't take loop | 5563 // Max loop nesting marker used to postpose OSR. We don't take loop |
5558 // nesting that is deeper than 5 levels into account. | 5564 // nesting that is deeper than 5 levels into account. |
5559 static const int kMaxLoopNestingMarker = 6; | 5565 static const int kMaxLoopNestingMarker = 6; |
5560 | 5566 |
5561 // Layout description. | 5567 // Layout description. |
5562 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 5568 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
5563 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; | 5569 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; |
5564 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; | 5570 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; |
5565 static const int kDeoptimizationDataOffset = | 5571 static const int kDeoptimizationDataOffset = |
(...skipping 5220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10786 } else { | 10792 } else { |
10787 value &= ~(1 << bit_position); | 10793 value &= ~(1 << bit_position); |
10788 } | 10794 } |
10789 return value; | 10795 return value; |
10790 } | 10796 } |
10791 }; | 10797 }; |
10792 | 10798 |
10793 } } // namespace v8::internal | 10799 } } // namespace v8::internal |
10794 | 10800 |
10795 #endif // V8_OBJECTS_H_ | 10801 #endif // V8_OBJECTS_H_ |
OLD | NEW |