From 8a31eba00023874d4a1dcdc5f411cc4336776874 Mon Sep 17 00:00:00 2001 From: "Shimeng (Simon) Wang" Date: Mon, 6 Dec 2010 19:01:33 -0800 Subject: Update V8 to r5901 as required by WebKit r73109 Change-Id: Ic48c5b085ce90e0151e2e7e58c4c5afe87fce9d1 --- include/v8-profiler.h | 29 ++++++++++++++++++++++------- include/v8.h | 31 ++++++++++++++++++------------- 2 files changed, 40 insertions(+), 20 deletions(-) (limited to 'include') diff --git a/include/v8-profiler.h b/include/v8-profiler.h index fb492d95..72195c44 100644 --- a/include/v8-profiler.h +++ b/include/v8-profiler.h @@ -197,8 +197,13 @@ class V8EXPORT HeapGraphEdge { kContextVariable = 0, // A variable from a function context. kElement = 1, // An element of an array. kProperty = 2, // A named object property. - kInternal = 3 // A link that can't be accessed from JS, - // thus, its name isn't a real property name. + kInternal = 3, // A link that can't be accessed from JS, + // thus, its name isn't a real property name + // (e.g. parts of a ConsString). + kHidden = 4, // A link that is needed for proper sizes + // calculation, but may be hidden from user. + kShortcut = 5 // A link that must not be followed during + // sizes calculation. }; /** Returns edge type (see HeapGraphEdge::Type). */ @@ -240,7 +245,8 @@ class V8EXPORT HeapGraphPath { class V8EXPORT HeapGraphNode { public: enum Type { - kInternal = 0, // Internal node, a virtual one, for housekeeping. + kInternal = 0, // For compatibility, will be removed. + kHidden = 0, // Hidden node, may be filtered when shown to user. kArray = 1, // An array of elements. kString = 2, // A string. kObject = 3, // A JS object (except for arrays and strings). @@ -276,16 +282,19 @@ class V8EXPORT HeapGraphNode { /** Returns node's own size, in bytes. */ int GetSelfSize() const; - /** Returns node's network (self + reachable nodes) size, in bytes. */ - int GetReachableSize() const; - /** * Returns node's retained size, in bytes. That is, self + sizes of * the objects that are reachable only from this object. In other * words, the size of memory that will be reclaimed having this node * collected. + * + * Exact retained size calculation has O(N) (number of nodes) + * computational complexity, while approximate has O(1). It is + * assumed that initially heap profiling tools provide approximate + * sizes for all nodes, and then exact sizes are calculated for the + * most 'interesting' nodes. */ - int GetRetainedSize() const; + int GetRetainedSize(bool exact) const; /** Returns child nodes count of the node. */ int GetChildrenCount() const; @@ -304,6 +313,12 @@ class V8EXPORT HeapGraphNode { /** Returns a retaining path by index. */ const HeapGraphPath* GetRetainingPath(int index) const; + + /** + * Returns a dominator node. This is the node that participates in every + * path from the snapshot root to the current node. + */ + const HeapGraphNode* GetDominatorNode() const; }; diff --git a/include/v8.h b/include/v8.h index f6c3c8b3..8ecf63ae 100644 --- a/include/v8.h +++ b/include/v8.h @@ -1539,6 +1539,11 @@ class Object : public Value { */ V8EXPORT Local ObjectProtoToString(); + /** + * Returns the name of the function invoked as a constructor for this object. + */ + V8EXPORT Local GetConstructorName(); + /** Gets the number of internal fields for this Object. */ V8EXPORT int InternalFieldCount(); /** Gets the value in an internal field. */ @@ -3282,8 +3287,8 @@ class V8EXPORT OutputStream { // NOLINT namespace internal { -const int kPointerSize = sizeof(void*); // NOLINT -const int kIntSize = sizeof(int); // NOLINT +static const int kApiPointerSize = sizeof(void*); // NOLINT +static const int kApiIntSize = sizeof(int); // NOLINT // Tag information for HeapObject. const int kHeapObjectTag = 1; @@ -3319,19 +3324,19 @@ template <> struct SmiConstants<8> { } }; -const int kSmiShiftSize = SmiConstants::kSmiShiftSize; -const int kSmiValueSize = SmiConstants::kSmiValueSize; +const int kSmiShiftSize = SmiConstants::kSmiShiftSize; +const int kSmiValueSize = SmiConstants::kSmiValueSize; template struct InternalConstants; // Internal constants for 32-bit systems. template <> struct InternalConstants<4> { - static const int kStringResourceOffset = 3 * kPointerSize; + static const int kStringResourceOffset = 3 * kApiPointerSize; }; // Internal constants for 64-bit systems. template <> struct InternalConstants<8> { - static const int kStringResourceOffset = 3 * kPointerSize; + static const int kStringResourceOffset = 3 * kApiPointerSize; }; /** @@ -3345,12 +3350,12 @@ class Internals { // These values match non-compiler-dependent values defined within // the implementation of v8. static const int kHeapObjectMapOffset = 0; - static const int kMapInstanceTypeOffset = kPointerSize + kIntSize; + static const int kMapInstanceTypeOffset = kApiPointerSize + kApiIntSize; static const int kStringResourceOffset = - InternalConstants::kStringResourceOffset; + InternalConstants::kStringResourceOffset; - static const int kProxyProxyOffset = kPointerSize; - static const int kJSObjectHeaderSize = 3 * kPointerSize; + static const int kProxyProxyOffset = kApiPointerSize; + static const int kJSObjectHeaderSize = 3 * kApiPointerSize; static const int kFullStringRepresentationMask = 0x07; static const int kExternalTwoByteRepresentationTag = 0x02; @@ -3368,7 +3373,7 @@ class Internals { } static inline int SmiValue(internal::Object* value) { - return SmiConstants::SmiToInt(value); + return SmiConstants::SmiToInt(value); } static inline int GetInstanceType(internal::Object* obj) { @@ -3559,7 +3564,7 @@ Local Object::UncheckedGetInternalField(int index) { // If the object is a plain JSObject, which is the common case, // we know where to find the internal fields and can return the // value directly. - int offset = I::kJSObjectHeaderSize + (internal::kPointerSize * index); + int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); O* value = I::ReadField(obj, offset); O** result = HandleScope::CreateHandle(value); return Local(reinterpret_cast(result)); @@ -3595,7 +3600,7 @@ void* Object::GetPointerFromInternalField(int index) { // If the object is a plain JSObject, which is the common case, // we know where to find the internal fields and can return the // value directly. - int offset = I::kJSObjectHeaderSize + (internal::kPointerSize * index); + int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); O* value = I::ReadField(obj, offset); return I::GetExternalPointer(value); } -- cgit v1.2.3