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

Side by Side Diff: include/v8.h

Issue 1844413002: Use EmbedderHeapTracer instead of object grouping when trace_embedder_heap flag is set (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move logic from heap to mark compact Created 4 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
« no previous file with comments | « no previous file | src/api-natives.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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 V8_INLINE P* ClearWeak(); 593 V8_INLINE P* ClearWeak();
594 594
595 // TODO(dcarney): remove this. 595 // TODO(dcarney): remove this.
596 V8_INLINE void ClearWeak() { ClearWeak<void>(); } 596 V8_INLINE void ClearWeak() { ClearWeak<void>(); }
597 597
598 /** 598 /**
599 * Allows the embedder to tell the v8 garbage collector that a certain object 599 * Allows the embedder to tell the v8 garbage collector that a certain object
600 * is alive. Only allowed when the embedder is asked to trace its heap by 600 * is alive. Only allowed when the embedder is asked to trace its heap by
601 * EmbedderHeapTracer. 601 * EmbedderHeapTracer.
602 */ 602 */
603 V8_INLINE void RegisterExternalReference(Isolate* isolate); 603 V8_INLINE void RegisterExternalReference(Isolate* isolate) const;
604 604
605 /** 605 /**
606 * Marks the reference to this object independent. Garbage collector is free 606 * Marks the reference to this object independent. Garbage collector is free
607 * to ignore any object groups containing this object. Weak callback for an 607 * to ignore any object groups containing this object. Weak callback for an
608 * independent handle should not assume that it will be preceded by a global 608 * independent handle should not assume that it will be preceded by a global
609 * GC prologue callback or followed by a global GC epilogue callback. 609 * GC prologue callback or followed by a global GC epilogue callback.
610 */ 610 */
611 V8_INLINE void MarkIndependent(); 611 V8_INLINE void MarkIndependent();
612 612
613 /** 613 /**
(...skipping 6732 matching lines...) Expand 10 before | Expand all | Expand 10 after
7346 static const int kNodeClassIdOffset = 1 * kApiPointerSize; 7346 static const int kNodeClassIdOffset = 1 * kApiPointerSize;
7347 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; 7347 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
7348 static const int kNodeStateMask = 0x7; 7348 static const int kNodeStateMask = 0x7;
7349 static const int kNodeStateIsWeakValue = 2; 7349 static const int kNodeStateIsWeakValue = 2;
7350 static const int kNodeStateIsPendingValue = 3; 7350 static const int kNodeStateIsPendingValue = 3;
7351 static const int kNodeStateIsNearDeathValue = 4; 7351 static const int kNodeStateIsNearDeathValue = 4;
7352 static const int kNodeIsIndependentShift = 3; 7352 static const int kNodeIsIndependentShift = 3;
7353 static const int kNodeIsPartiallyDependentShift = 4; 7353 static const int kNodeIsPartiallyDependentShift = 4;
7354 static const int kNodeIsActiveShift = 4; 7354 static const int kNodeIsActiveShift = 4;
7355 7355
7356 static const int kJSObjectType = 0xb6; 7356 static const int kJSObjectType = 0xb7;
7357 static const int kJSApiObjectType = 0xb6;
7357 static const int kFirstNonstringType = 0x80; 7358 static const int kFirstNonstringType = 0x80;
7358 static const int kOddballType = 0x83; 7359 static const int kOddballType = 0x83;
7359 static const int kForeignType = 0x87; 7360 static const int kForeignType = 0x87;
7360 7361
7361 static const int kUndefinedOddballKind = 5; 7362 static const int kUndefinedOddballKind = 5;
7362 static const int kNullOddballKind = 3; 7363 static const int kNullOddballKind = 3;
7363 7364
7364 static const uint32_t kNumIsolateDataSlots = 4; 7365 static const uint32_t kNumIsolateDataSlots = 4;
7365 7366
7366 V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate); 7367 V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate);
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
7651 7652
7652 7653
7653 template <class T> 7654 template <class T>
7654 template <typename P> 7655 template <typename P>
7655 P* PersistentBase<T>::ClearWeak() { 7656 P* PersistentBase<T>::ClearWeak() {
7656 return reinterpret_cast<P*>( 7657 return reinterpret_cast<P*>(
7657 V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_))); 7658 V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_)));
7658 } 7659 }
7659 7660
7660 template <class T> 7661 template <class T>
7661 void PersistentBase<T>::RegisterExternalReference(Isolate* isolate) { 7662 void PersistentBase<T>::RegisterExternalReference(Isolate* isolate) const {
7662 if (IsEmpty()) return; 7663 if (IsEmpty()) return;
7663 V8::RegisterExternallyReferencedObject( 7664 V8::RegisterExternallyReferencedObject(
7664 reinterpret_cast<internal::Object**>(this->val_), 7665 reinterpret_cast<internal::Object**>(this->val_),
7665 reinterpret_cast<internal::Isolate*>(isolate)); 7666 reinterpret_cast<internal::Isolate*>(isolate));
7666 } 7667 }
7667 7668
7668 template <class T> 7669 template <class T>
7669 void PersistentBase<T>::MarkIndependent() { 7670 void PersistentBase<T>::MarkIndependent() {
7670 typedef internal::Internals I; 7671 typedef internal::Internals I;
7671 if (this->IsEmpty()) return; 7672 if (this->IsEmpty()) return;
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
7978 7979
7979 7980
7980 Local<Value> Object::GetInternalField(int index) { 7981 Local<Value> Object::GetInternalField(int index) {
7981 #ifndef V8_ENABLE_CHECKS 7982 #ifndef V8_ENABLE_CHECKS
7982 typedef internal::Object O; 7983 typedef internal::Object O;
7983 typedef internal::HeapObject HO; 7984 typedef internal::HeapObject HO;
7984 typedef internal::Internals I; 7985 typedef internal::Internals I;
7985 O* obj = *reinterpret_cast<O**>(this); 7986 O* obj = *reinterpret_cast<O**>(this);
7986 // Fast path: If the object is a plain JSObject, which is the common case, we 7987 // Fast path: If the object is a plain JSObject, which is the common case, we
7987 // know where to find the internal fields and can return the value directly. 7988 // know where to find the internal fields and can return the value directly.
7988 if (I::GetInstanceType(obj) == I::kJSObjectType) { 7989 auto instance_type = I::GetInstanceType(obj);
7990 if (instance_type == I::kJSObjectType ||
7991 instance_type == I::kJSApiObjectType) {
7989 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); 7992 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
7990 O* value = I::ReadField<O*>(obj, offset); 7993 O* value = I::ReadField<O*>(obj, offset);
7991 O** result = HandleScope::CreateHandle(reinterpret_cast<HO*>(obj), value); 7994 O** result = HandleScope::CreateHandle(reinterpret_cast<HO*>(obj), value);
7992 return Local<Value>(reinterpret_cast<Value*>(result)); 7995 return Local<Value>(reinterpret_cast<Value*>(result));
7993 } 7996 }
7994 #endif 7997 #endif
7995 return SlowGetInternalField(index); 7998 return SlowGetInternalField(index);
7996 } 7999 }
7997 8000
7998 8001
7999 void* Object::GetAlignedPointerFromInternalField(int index) { 8002 void* Object::GetAlignedPointerFromInternalField(int index) {
8000 #ifndef V8_ENABLE_CHECKS 8003 #ifndef V8_ENABLE_CHECKS
8001 typedef internal::Object O; 8004 typedef internal::Object O;
8002 typedef internal::Internals I; 8005 typedef internal::Internals I;
8003 O* obj = *reinterpret_cast<O**>(this); 8006 O* obj = *reinterpret_cast<O**>(this);
8004 // Fast path: If the object is a plain JSObject, which is the common case, we 8007 // Fast path: If the object is a plain JSObject, which is the common case, we
8005 // know where to find the internal fields and can return the value directly. 8008 // know where to find the internal fields and can return the value directly.
8006 if (V8_LIKELY(I::GetInstanceType(obj) == I::kJSObjectType)) { 8009 auto instance_type = I::GetInstanceType(obj);
8010 if (V8_LIKELY(instance_type == I::kJSObjectType ||
8011 instance_type == I::kJSApiObjectType)) {
8007 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); 8012 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
8008 return I::ReadField<void*>(obj, offset); 8013 return I::ReadField<void*>(obj, offset);
8009 } 8014 }
8010 #endif 8015 #endif
8011 return SlowGetAlignedPointerFromInternalField(index); 8016 return SlowGetAlignedPointerFromInternalField(index);
8012 } 8017 }
8013 8018
8014 8019
8015 String* String::Cast(v8::Value* value) { 8020 String* String::Cast(v8::Value* value) {
8016 #ifdef V8_ENABLE_CHECKS 8021 #ifdef V8_ENABLE_CHECKS
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
8749 */ 8754 */
8750 8755
8751 8756
8752 } // namespace v8 8757 } // namespace v8
8753 8758
8754 8759
8755 #undef TYPE_CHECK 8760 #undef TYPE_CHECK
8756 8761
8757 8762
8758 #endif // INCLUDE_V8_H_ 8763 #endif // INCLUDE_V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api-natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698