Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: src/objects.h

Issue 209473006: Ensure that we don't mark weak heap references in the constant pool array. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix typo Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 3193 matching lines...) Expand 10 before | Expand all | Expand 10 after
3204 // The format of the pool is: 3204 // The format of the pool is:
3205 // [0]: Field holding the first index which is a raw code target pointer entry 3205 // [0]: Field holding the first index which is a raw code target pointer entry
3206 // [1]: Field holding the first index which is a heap pointer entry 3206 // [1]: Field holding the first index which is a heap pointer entry
3207 // [2]: Field holding the first index which is a int32 entry 3207 // [2]: Field holding the first index which is a int32 entry
3208 // [3] ... [first_code_ptr_index() - 1] : 64 bit entries 3208 // [3] ... [first_code_ptr_index() - 1] : 64 bit entries
3209 // [first_code_ptr_index()] ... [first_heap_ptr_index() - 1] : code pointers 3209 // [first_code_ptr_index()] ... [first_heap_ptr_index() - 1] : code pointers
3210 // [first_heap_ptr_index()] ... [first_int32_index() - 1] : heap pointers 3210 // [first_heap_ptr_index()] ... [first_int32_index() - 1] : heap pointers
3211 // [first_int32_index()] ... [length - 1] : 32 bit entries 3211 // [first_int32_index()] ... [length - 1] : 32 bit entries
3212 class ConstantPoolArray: public FixedArrayBase { 3212 class ConstantPoolArray: public FixedArrayBase {
3213 public: 3213 public:
3214 enum WeakObjectState {
3215 NO_WEAK_OBJECTS,
3216 WEAK_OBJECTS_IN_OPTIMIZED_CODE
3217 };
3218
3214 // Getters for the field storing the first index for different type entries. 3219 // Getters for the field storing the first index for different type entries.
3215 inline int first_code_ptr_index(); 3220 inline int first_code_ptr_index();
3216 inline int first_heap_ptr_index(); 3221 inline int first_heap_ptr_index();
3217 inline int first_int64_index(); 3222 inline int first_int64_index();
3218 inline int first_int32_index(); 3223 inline int first_int32_index();
3219 3224
3220 // Getters for counts of different type entries. 3225 // Getters for counts of different type entries.
3221 inline int count_of_code_ptr_entries(); 3226 inline int count_of_code_ptr_entries();
3222 inline int count_of_heap_ptr_entries(); 3227 inline int count_of_heap_ptr_entries();
3223 inline int count_of_int64_entries(); 3228 inline int count_of_int64_entries();
3224 inline int count_of_int32_entries(); 3229 inline int count_of_int32_entries();
3225 3230
3226 // Setter and getter for pool elements. 3231 // Setter and getter for pool elements.
3227 inline Address get_code_ptr_entry(int index); 3232 inline Address get_code_ptr_entry(int index);
3228 inline Object* get_heap_ptr_entry(int index); 3233 inline Object* get_heap_ptr_entry(int index);
3229 inline int64_t get_int64_entry(int index); 3234 inline int64_t get_int64_entry(int index);
3230 inline int32_t get_int32_entry(int index); 3235 inline int32_t get_int32_entry(int index);
3231 inline double get_int64_entry_as_double(int index); 3236 inline double get_int64_entry_as_double(int index);
3232 3237
3238 // Setter and getter for weak objects state
3239 inline void set_weak_object_state(WeakObjectState state);
3240 inline WeakObjectState get_weak_object_state();
3241
3233 inline void set(int index, Address value); 3242 inline void set(int index, Address value);
3234 inline void set(int index, Object* value); 3243 inline void set(int index, Object* value);
3235 inline void set(int index, int64_t value); 3244 inline void set(int index, int64_t value);
3236 inline void set(int index, double value); 3245 inline void set(int index, double value);
3237 inline void set(int index, int32_t value); 3246 inline void set(int index, int32_t value);
3238 3247
3239 // Set up initial state. 3248 // Set up initial state.
3240 inline void SetEntryCounts(int number_of_int64_entries, 3249 inline void Init(int number_of_int64_entries,
3241 int number_of_code_ptr_entries, 3250 int number_of_code_ptr_entries,
3242 int number_of_heap_ptr_entries, 3251 int number_of_heap_ptr_entries,
3243 int number_of_int32_entries); 3252 int number_of_int32_entries);
3244 3253
3245 // Copy operations 3254 // Copy operations
3246 MUST_USE_RESULT inline MaybeObject* Copy(); 3255 MUST_USE_RESULT inline MaybeObject* Copy();
3247 3256
3248 // Garbage collection support. 3257 // Garbage collection support.
3249 inline static int SizeFor(int number_of_int64_entries, 3258 inline static int SizeFor(int number_of_int64_entries,
3250 int number_of_code_ptr_entries, 3259 int number_of_code_ptr_entries,
3251 int number_of_heap_ptr_entries, 3260 int number_of_heap_ptr_entries,
3252 int number_of_int32_entries) { 3261 int number_of_int32_entries) {
3253 return RoundUp(OffsetAt(number_of_int64_entries, 3262 return RoundUp(OffsetAt(number_of_int64_entries,
(...skipping 22 matching lines...) Expand all
3276 3285
3277 // Casting. 3286 // Casting.
3278 static inline ConstantPoolArray* cast(Object* obj); 3287 static inline ConstantPoolArray* cast(Object* obj);
3279 3288
3280 // Garbage collection support. 3289 // Garbage collection support.
3281 Object** RawFieldOfElementAt(int index) { 3290 Object** RawFieldOfElementAt(int index) {
3282 return HeapObject::RawField(this, OffsetOfElementAt(index)); 3291 return HeapObject::RawField(this, OffsetOfElementAt(index));
3283 } 3292 }
3284 3293
3285 // Layout description. 3294 // Layout description.
3286 static const int kFirstCodePointerIndexOffset = FixedArray::kHeaderSize; 3295 static const int kArrayLayoutOffset = FixedArray::kHeaderSize;
3287 static const int kFirstHeapPointerIndexOffset = 3296 static const int kFirstOffset = kArrayLayoutOffset + kPointerSize;
3288 kFirstCodePointerIndexOffset + kPointerSize; 3297
3289 static const int kFirstInt32IndexOffset = 3298 static const int kFieldBitSize = 10;
3290 kFirstHeapPointerIndexOffset + kPointerSize; 3299 static const int kMaxEntriesPerType = (1 << kFieldBitSize) - 1;
3291 static const int kFirstOffset = kFirstInt32IndexOffset + kPointerSize; 3300
3301 class NumberOfInt64EntriesField: public BitField<int, 0, kFieldBitSize> {};
3302 class NumberOfCodePtrEntriesField: public BitField<int, 10, kFieldBitSize> {};
3303 class NumberOfHeapPtrEntriesField: public BitField<int, 20, kFieldBitSize> {};
3304 class WeakObjectStateField: public BitField<WeakObjectState, 30, 2> {};
3292 3305
3293 // Dispatched behavior. 3306 // Dispatched behavior.
3294 void ConstantPoolIterateBody(ObjectVisitor* v); 3307 void ConstantPoolIterateBody(ObjectVisitor* v);
3295 3308
3296 DECLARE_PRINTER(ConstantPoolArray) 3309 DECLARE_PRINTER(ConstantPoolArray)
3297 DECLARE_VERIFIER(ConstantPoolArray) 3310 DECLARE_VERIFIER(ConstantPoolArray)
3298 3311
3299 private: 3312 private:
3300 inline void set_first_code_ptr_index(int value);
3301 inline void set_first_heap_ptr_index(int value);
3302 inline void set_first_int32_index(int value);
3303
3304 inline static int OffsetAt(int number_of_int64_entries, 3313 inline static int OffsetAt(int number_of_int64_entries,
3305 int number_of_code_ptr_entries, 3314 int number_of_code_ptr_entries,
3306 int number_of_heap_ptr_entries, 3315 int number_of_heap_ptr_entries,
3307 int number_of_int32_entries) { 3316 int number_of_int32_entries) {
3308 return kFirstOffset 3317 return kFirstOffset
3309 + (number_of_int64_entries * kInt64Size) 3318 + (number_of_int64_entries * kInt64Size)
3310 + (number_of_code_ptr_entries * kPointerSize) 3319 + (number_of_code_ptr_entries * kPointerSize)
3311 + (number_of_heap_ptr_entries * kPointerSize) 3320 + (number_of_heap_ptr_entries * kPointerSize)
3312 + (number_of_int32_entries * kInt32Size); 3321 + (number_of_int32_entries * kInt32Size);
3313 } 3322 }
(...skipping 2418 matching lines...) Expand 10 before | Expand all | Expand 10 after
5732 bool CanDeoptAt(Address pc); 5741 bool CanDeoptAt(Address pc);
5733 5742
5734 #ifdef VERIFY_HEAP 5743 #ifdef VERIFY_HEAP
5735 void VerifyEmbeddedObjectsDependency(); 5744 void VerifyEmbeddedObjectsDependency();
5736 #endif 5745 #endif
5737 5746
5738 inline bool IsWeakObject(Object* object) { 5747 inline bool IsWeakObject(Object* object) {
5739 return is_optimized_code() && IsWeakObjectInOptimizedCode(object); 5748 return is_optimized_code() && IsWeakObjectInOptimizedCode(object);
5740 } 5749 }
5741 5750
5742 inline bool IsWeakObjectInOptimizedCode(Object* object); 5751 static inline bool IsWeakObjectInOptimizedCode(Object* object);
5743 5752
5744 // Max loop nesting marker used to postpose OSR. We don't take loop 5753 // Max loop nesting marker used to postpose OSR. We don't take loop
5745 // nesting that is deeper than 5 levels into account. 5754 // nesting that is deeper than 5 levels into account.
5746 static const int kMaxLoopNestingMarker = 6; 5755 static const int kMaxLoopNestingMarker = 6;
5747 5756
5748 // Layout description. 5757 // Layout description.
5749 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; 5758 static const int kInstructionSizeOffset = HeapObject::kHeaderSize;
5750 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; 5759 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize;
5751 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize; 5760 static const int kHandlerTableOffset = kRelocationInfoOffset + kPointerSize;
5752 static const int kDeoptimizationDataOffset = 5761 static const int kDeoptimizationDataOffset =
(...skipping 5237 matching lines...) Expand 10 before | Expand all | Expand 10 after
10990 } else { 10999 } else {
10991 value &= ~(1 << bit_position); 11000 value &= ~(1 << bit_position);
10992 } 11001 }
10993 return value; 11002 return value;
10994 } 11003 }
10995 }; 11004 };
10996 11005
10997 } } // namespace v8::internal 11006 } } // namespace v8::internal
10998 11007
10999 #endif // V8_OBJECTS_H_ 11008 #endif // V8_OBJECTS_H_
OLDNEW
« src/heap.cc ('K') | « src/lithium-codegen.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698