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

Side by Side Diff: include/v8.h

Issue 1358703003: Changed scavenge GC to collect unmodified references (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Checks if the object is not active inaddition to unmodified before reclaiming it. The browser test … Created 5 years, 2 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
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 /** 596 /**
597 * Marks the reference to this object partially dependent. Partially dependent 597 * Marks the reference to this object partially dependent. Partially dependent
598 * handles only depend on other partially dependent handles and these 598 * handles only depend on other partially dependent handles and these
599 * dependencies are provided through object groups. It provides a way to build 599 * dependencies are provided through object groups. It provides a way to build
600 * smaller object groups for young objects that represent only a subset of all 600 * smaller object groups for young objects that represent only a subset of all
601 * external dependencies. This mark is automatically cleared after each 601 * external dependencies. This mark is automatically cleared after each
602 * garbage collection. 602 * garbage collection.
603 */ 603 */
604 V8_INLINE void MarkPartiallyDependent(); 604 V8_INLINE void MarkPartiallyDependent();
605 605
606 /**
607 * Marks the reference to this object as active. The scavenge garbage
608 * collection should not reclaim the objects marked as active.
609 * This bit is cleared after the each garbage collection pass.
610 */
611 V8_INLINE void MarkInactive();
612
606 V8_INLINE bool IsIndependent() const; 613 V8_INLINE bool IsIndependent() const;
607 614
608 /** Checks if the handle holds the only reference to an object. */ 615 /** Checks if the handle holds the only reference to an object. */
609 V8_INLINE bool IsNearDeath() const; 616 V8_INLINE bool IsNearDeath() const;
610 617
611 /** Returns true if the handle's reference is weak. */ 618 /** Returns true if the handle's reference is weak. */
612 V8_INLINE bool IsWeak() const; 619 V8_INLINE bool IsWeak() const;
613 620
614 /** 621 /**
615 * Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface 622 * Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface
(...skipping 5304 matching lines...) Expand 10 before | Expand all | Expand 10 after
5920 5927
5921 /** 5928 /**
5922 * Iterates through all the persistent handles in the current isolate's heap 5929 * Iterates through all the persistent handles in the current isolate's heap
5923 * that have class_ids and are candidates to be marked as partially dependent 5930 * that have class_ids and are candidates to be marked as partially dependent
5924 * handles. This will visit handles to young objects created since the last 5931 * handles. This will visit handles to young objects created since the last
5925 * garbage collection but is free to visit an arbitrary superset of these 5932 * garbage collection but is free to visit an arbitrary superset of these
5926 * objects. 5933 * objects.
5927 */ 5934 */
5928 void VisitHandlesForPartialDependence(PersistentHandleVisitor* visitor); 5935 void VisitHandlesForPartialDependence(PersistentHandleVisitor* visitor);
5929 5936
5937 /**
5938 * Iterates through all the persistent handles in the current isolate's heap
5939 * that have class_ids and are weak to be marked as inactive if there is no
5940 * pending activity for the handle.
5941 */
5942 void VisitWeakHandles(PersistentHandleVisitor* visitor);
5943
5944
5930 private: 5945 private:
5931 template <class K, class V, class Traits> 5946 template <class K, class V, class Traits>
5932 friend class PersistentValueMapBase; 5947 friend class PersistentValueMapBase;
5933 5948
5934 Isolate(); 5949 Isolate();
5935 Isolate(const Isolate&); 5950 Isolate(const Isolate&);
5936 ~Isolate(); 5951 ~Isolate();
5937 Isolate& operator=(const Isolate&); 5952 Isolate& operator=(const Isolate&);
5938 void* operator new(size_t size); 5953 void* operator new(size_t size);
5939 void operator delete(void*, size_t); 5954 void operator delete(void*, size_t);
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
7002 static const int kExternalAllocationLimit = 192 * 1024 * 1024; 7017 static const int kExternalAllocationLimit = 192 * 1024 * 1024;
7003 7018
7004 static const int kNodeClassIdOffset = 1 * kApiPointerSize; 7019 static const int kNodeClassIdOffset = 1 * kApiPointerSize;
7005 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; 7020 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
7006 static const int kNodeStateMask = 0x7; 7021 static const int kNodeStateMask = 0x7;
7007 static const int kNodeStateIsWeakValue = 2; 7022 static const int kNodeStateIsWeakValue = 2;
7008 static const int kNodeStateIsPendingValue = 3; 7023 static const int kNodeStateIsPendingValue = 3;
7009 static const int kNodeStateIsNearDeathValue = 4; 7024 static const int kNodeStateIsNearDeathValue = 4;
7010 static const int kNodeIsIndependentShift = 3; 7025 static const int kNodeIsIndependentShift = 3;
7011 static const int kNodeIsPartiallyDependentShift = 4; 7026 static const int kNodeIsPartiallyDependentShift = 4;
7027 static const int kNodeIsInactiveShift = 4;
7012 7028
7013 static const int kJSObjectType = 0xb7; 7029 static const int kJSObjectType = 0xb7;
7014 static const int kFirstNonstringType = 0x80; 7030 static const int kFirstNonstringType = 0x80;
7015 static const int kOddballType = 0x83; 7031 static const int kOddballType = 0x83;
7016 static const int kForeignType = 0x87; 7032 static const int kForeignType = 0x87;
7017 7033
7018 static const int kUndefinedOddballKind = 5; 7034 static const int kUndefinedOddballKind = 5;
7019 static const int kNullOddballKind = 3; 7035 static const int kNullOddballKind = 3;
7020 7036
7021 static const uint32_t kNumIsolateDataSlots = 4; 7037 static const uint32_t kNumIsolateDataSlots = 4;
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
7329 void PersistentBase<T>::MarkPartiallyDependent() { 7345 void PersistentBase<T>::MarkPartiallyDependent() {
7330 typedef internal::Internals I; 7346 typedef internal::Internals I;
7331 if (this->IsEmpty()) return; 7347 if (this->IsEmpty()) return;
7332 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_), 7348 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
7333 true, 7349 true,
7334 I::kNodeIsPartiallyDependentShift); 7350 I::kNodeIsPartiallyDependentShift);
7335 } 7351 }
7336 7352
7337 7353
7338 template <class T> 7354 template <class T>
7355 void PersistentBase<T>::MarkInactive() {
7356 typedef internal::Internals I;
7357 if (this->IsEmpty()) return;
7358 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_), true,
7359 I::kNodeIsInactiveShift);
7360 }
7361
7362
7363 template <class T>
7339 void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) { 7364 void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) {
7340 typedef internal::Internals I; 7365 typedef internal::Internals I;
7341 if (this->IsEmpty()) return; 7366 if (this->IsEmpty()) return;
7342 internal::Object** obj = reinterpret_cast<internal::Object**>(this->val_); 7367 internal::Object** obj = reinterpret_cast<internal::Object**>(this->val_);
7343 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset; 7368 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
7344 *reinterpret_cast<uint16_t*>(addr) = class_id; 7369 *reinterpret_cast<uint16_t*>(addr) = class_id;
7345 } 7370 }
7346 7371
7347 7372
7348 template <class T> 7373 template <class T>
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
8376 */ 8401 */
8377 8402
8378 8403
8379 } // namespace v8 8404 } // namespace v8
8380 8405
8381 8406
8382 #undef TYPE_CHECK 8407 #undef TYPE_CHECK
8383 8408
8384 8409
8385 #endif // V8_H_ 8410 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698