v8-profiler.h | v8-profiler.h | |||
---|---|---|---|---|
skipping to change at line 441 | skipping to change at line 441 | |||
* this method, all heap objects relocations done by the garbage collecto r | * this method, all heap objects relocations done by the garbage collecto r | |||
* are being registered. | * are being registered. | |||
*/ | */ | |||
static void StartHeapObjectsTracking(); | static void StartHeapObjectsTracking(); | |||
/** | /** | |||
* Adds a new time interval entry to the aggregated statistics array. The | * Adds a new time interval entry to the aggregated statistics array. The | |||
* time interval entry contains information on the current heap objects | * time interval entry contains information on the current heap objects | |||
* population size. The method also updates aggregated statistics and | * population size. The method also updates aggregated statistics and | |||
* reports updates for all previous time intervals via the OutputStream | * reports updates for all previous time intervals via the OutputStream | |||
* object. Updates on each time interval are provided as a triplet. It ha | * object. Updates on each time interval are provided as a stream of the | |||
s | * HeapStatsUpdate structure instances. | |||
* time interval index, updated heap objects count and updated heap objec | ||||
ts | ||||
* size. | ||||
* | * | |||
* StartHeapObjectsTracking must be called before the first call to this | * StartHeapObjectsTracking must be called before the first call to this | |||
* method. | * method. | |||
*/ | */ | |||
static void PushHeapObjectsStats(OutputStream* stream); | static void PushHeapObjectsStats(OutputStream* stream); | |||
/** | /** | |||
* Stops tracking of heap objects population statistics, cleans up all | * Stops tracking of heap objects population statistics, cleans up all | |||
* collected data. StartHeapObjectsTracking must be called again prior to | * collected data. StartHeapObjectsTracking must be called again prior to | |||
* calling PushHeapObjectsStats next time. | * calling PushHeapObjectsStats next time. | |||
skipping to change at line 552 | skipping to change at line 551 | |||
protected: | protected: | |||
RetainedObjectInfo() {} | RetainedObjectInfo() {} | |||
virtual ~RetainedObjectInfo() {} | virtual ~RetainedObjectInfo() {} | |||
private: | private: | |||
RetainedObjectInfo(const RetainedObjectInfo&); | RetainedObjectInfo(const RetainedObjectInfo&); | |||
RetainedObjectInfo& operator=(const RetainedObjectInfo&); | RetainedObjectInfo& operator=(const RetainedObjectInfo&); | |||
}; | }; | |||
/** | ||||
* A struct for exporting HeapStats data from V8, using "push" model. | ||||
* See HeapProfiler::PushHeapObjectsStats. | ||||
*/ | ||||
struct HeapStatsUpdate { | ||||
HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size) | ||||
: index(index), count(count), size(size) { } | ||||
uint32_t index; // Index of the time interval that was changed. | ||||
uint32_t count; // New value of count field for the interval with this i | ||||
ndex. | ||||
uint32_t size; // New value of size field for the interval with this ind | ||||
ex. | ||||
}; | ||||
} // namespace v8 | } // namespace v8 | |||
#undef V8EXPORT | #undef V8EXPORT | |||
#endif // V8_V8_PROFILER_H_ | #endif // V8_V8_PROFILER_H_ | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 16 lines changed or added | |||
v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 850 | skipping to change at line 850 | |||
/** | /** | |||
* The superclass of all JavaScript values and objects. | * The superclass of all JavaScript values and objects. | |||
*/ | */ | |||
class Value : public Data { | class Value : public Data { | |||
public: | public: | |||
/** | /** | |||
* Returns true if this value is the undefined value. See ECMA-262 | * Returns true if this value is the undefined value. See ECMA-262 | |||
* 4.3.10. | * 4.3.10. | |||
*/ | */ | |||
V8EXPORT bool IsUndefined() const; | inline bool IsUndefined() const; | |||
/** | /** | |||
* Returns true if this value is the null value. See ECMA-262 | * Returns true if this value is the null value. See ECMA-262 | |||
* 4.3.11. | * 4.3.11. | |||
*/ | */ | |||
V8EXPORT bool IsNull() const; | inline bool IsNull() const; | |||
/** | /** | |||
* Returns true if this value is true. | * Returns true if this value is true. | |||
*/ | */ | |||
V8EXPORT bool IsTrue() const; | V8EXPORT bool IsTrue() const; | |||
/** | /** | |||
* Returns true if this value is false. | * Returns true if this value is false. | |||
*/ | */ | |||
V8EXPORT bool IsFalse() const; | V8EXPORT bool IsFalse() const; | |||
skipping to change at line 970 | skipping to change at line 970 | |||
V8EXPORT double NumberValue() const; | V8EXPORT double NumberValue() const; | |||
V8EXPORT int64_t IntegerValue() const; | V8EXPORT int64_t IntegerValue() const; | |||
V8EXPORT uint32_t Uint32Value() const; | V8EXPORT uint32_t Uint32Value() const; | |||
V8EXPORT int32_t Int32Value() const; | V8EXPORT int32_t Int32Value() const; | |||
/** JS == */ | /** JS == */ | |||
V8EXPORT bool Equals(Handle<Value> that) const; | V8EXPORT bool Equals(Handle<Value> that) const; | |||
V8EXPORT bool StrictEquals(Handle<Value> that) const; | V8EXPORT bool StrictEquals(Handle<Value> that) const; | |||
private: | private: | |||
inline bool QuickIsUndefined() const; | ||||
inline bool QuickIsNull() const; | ||||
inline bool QuickIsString() const; | inline bool QuickIsString() const; | |||
V8EXPORT bool FullIsUndefined() const; | ||||
V8EXPORT bool FullIsNull() const; | ||||
V8EXPORT bool FullIsString() const; | V8EXPORT bool FullIsString() const; | |||
}; | }; | |||
/** | /** | |||
* The superclass of primitive values. See ECMA-262 4.3.2. | * The superclass of primitive values. See ECMA-262 4.3.2. | |||
*/ | */ | |||
class Primitive : public Value { }; | class Primitive : public Value { }; | |||
/** | /** | |||
* A primitive boolean value (ECMA-262, 4.3.14). Either the true | * A primitive boolean value (ECMA-262, 4.3.14). Either the true | |||
skipping to change at line 3665 | skipping to change at line 3669 | |||
internal::Isolate* isolate_; | internal::Isolate* isolate_; | |||
static bool active_; | static bool active_; | |||
// Disallow copying and assigning. | // Disallow copying and assigning. | |||
Locker(const Locker&); | Locker(const Locker&); | |||
void operator=(const Locker&); | void operator=(const Locker&); | |||
}; | }; | |||
/** | /** | |||
* A struct for exporting HeapStats data from V8, using "push" model. | ||||
*/ | ||||
struct HeapStatsUpdate; | ||||
/** | ||||
* An interface for exporting data from V8, using "push" model. | * An interface for exporting data from V8, using "push" model. | |||
*/ | */ | |||
class V8EXPORT OutputStream { // NOLINT | class V8EXPORT OutputStream { // NOLINT | |||
public: | public: | |||
enum OutputEncoding { | enum OutputEncoding { | |||
kAscii = 0, // 7-bit ASCII. | kAscii = 0 // 7-bit ASCII. | |||
kUint32 = 1 | ||||
}; | }; | |||
enum WriteResult { | enum WriteResult { | |||
kContinue = 0, | kContinue = 0, | |||
kAbort = 1 | kAbort = 1 | |||
}; | }; | |||
virtual ~OutputStream() {} | virtual ~OutputStream() {} | |||
/** Notify about the end of stream. */ | /** Notify about the end of stream. */ | |||
virtual void EndOfStream() = 0; | virtual void EndOfStream() = 0; | |||
/** Get preferred output chunk size. Called only once. */ | /** Get preferred output chunk size. Called only once. */ | |||
virtual int GetChunkSize() { return 1024; } | virtual int GetChunkSize() { return 1024; } | |||
skipping to change at line 3695 | skipping to change at line 3703 | |||
* Writes the next chunk of snapshot data into the stream. Writing | * Writes the next chunk of snapshot data into the stream. Writing | |||
* can be stopped by returning kAbort as function result. EndOfStream | * can be stopped by returning kAbort as function result. EndOfStream | |||
* will not be called in case writing was aborted. | * will not be called in case writing was aborted. | |||
*/ | */ | |||
virtual WriteResult WriteAsciiChunk(char* data, int size) = 0; | virtual WriteResult WriteAsciiChunk(char* data, int size) = 0; | |||
/** | /** | |||
* Writes the next chunk of heap stats data into the stream. Writing | * Writes the next chunk of heap stats data into the stream. Writing | |||
* can be stopped by returning kAbort as function result. EndOfStream | * can be stopped by returning kAbort as function result. EndOfStream | |||
* will not be called in case writing was aborted. | * will not be called in case writing was aborted. | |||
*/ | */ | |||
// TODO(loislo): Make this pure virtual when WebKit's V8 bindings | virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) | |||
// have been updated. | { | |||
virtual WriteResult WriteUint32Chunk(uint32_t* data, int count) { | ||||
return kAbort; | return kAbort; | |||
}; | }; | |||
}; | }; | |||
/** | /** | |||
* An interface for reporting progress and controlling long-running | * An interface for reporting progress and controlling long-running | |||
* activities. | * activities. | |||
*/ | */ | |||
class V8EXPORT ActivityControl { // NOLINT | class V8EXPORT ActivityControl { // NOLINT | |||
public: | public: | |||
skipping to change at line 3811 | skipping to change at line 3817 | |||
*/ | */ | |||
class Internals { | class Internals { | |||
public: | public: | |||
// These values match non-compiler-dependent values defined within | // These values match non-compiler-dependent values defined within | |||
// the implementation of v8. | // the implementation of v8. | |||
static const int kHeapObjectMapOffset = 0; | static const int kHeapObjectMapOffset = 0; | |||
static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSi ze; | static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSi ze; | |||
static const int kStringResourceOffset = | static const int kStringResourceOffset = | |||
InternalConstants<kApiPointerSize>::kStringResourceOffset; | InternalConstants<kApiPointerSize>::kStringResourceOffset; | |||
static const int kOddballKindOffset = 3 * kApiPointerSize; | ||||
static const int kForeignAddressOffset = kApiPointerSize; | static const int kForeignAddressOffset = kApiPointerSize; | |||
static const int kJSObjectHeaderSize = 3 * kApiPointerSize; | static const int kJSObjectHeaderSize = 3 * kApiPointerSize; | |||
static const int kFullStringRepresentationMask = 0x07; | static const int kFullStringRepresentationMask = 0x07; | |||
static const int kExternalTwoByteRepresentationTag = 0x02; | static const int kExternalTwoByteRepresentationTag = 0x02; | |||
static const int kJSObjectType = 0xaa; | static const int kJSObjectType = 0xaa; | |||
static const int kFirstNonstringType = 0x80; | static const int kFirstNonstringType = 0x80; | |||
static const int kOddballType = 0x82; | ||||
static const int kForeignType = 0x85; | static const int kForeignType = 0x85; | |||
static const int kUndefinedOddballKind = 5; | ||||
static const int kNullOddballKind = 3; | ||||
static inline bool HasHeapObjectTag(internal::Object* value) { | static inline bool HasHeapObjectTag(internal::Object* value) { | |||
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == | return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == | |||
kHeapObjectTag); | kHeapObjectTag); | |||
} | } | |||
static inline bool HasSmiTag(internal::Object* value) { | static inline bool HasSmiTag(internal::Object* value) { | |||
return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag); | return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag); | |||
} | } | |||
static inline int SmiValue(internal::Object* value) { | static inline int SmiValue(internal::Object* value) { | |||
return PlatformSmiTagging::SmiToInt(value); | return PlatformSmiTagging::SmiToInt(value); | |||
} | } | |||
static inline int GetInstanceType(internal::Object* obj) { | static inline int GetInstanceType(internal::Object* obj) { | |||
typedef internal::Object O; | typedef internal::Object O; | |||
O* map = ReadField<O*>(obj, kHeapObjectMapOffset); | O* map = ReadField<O*>(obj, kHeapObjectMapOffset); | |||
return ReadField<uint8_t>(map, kMapInstanceTypeOffset); | return ReadField<uint8_t>(map, kMapInstanceTypeOffset); | |||
} | } | |||
static inline int GetOddballKind(internal::Object* obj) { | ||||
typedef internal::Object O; | ||||
return SmiValue(ReadField<O*>(obj, kOddballKindOffset)); | ||||
} | ||||
static inline void* GetExternalPointerFromSmi(internal::Object* value) { | static inline void* GetExternalPointerFromSmi(internal::Object* value) { | |||
const uintptr_t address = reinterpret_cast<uintptr_t>(value); | const uintptr_t address = reinterpret_cast<uintptr_t>(value); | |||
return reinterpret_cast<void*>(address >> kPointerToSmiShift); | return reinterpret_cast<void*>(address >> kPointerToSmiShift); | |||
} | } | |||
static inline void* GetExternalPointer(internal::Object* obj) { | static inline void* GetExternalPointer(internal::Object* obj) { | |||
if (HasSmiTag(obj)) { | if (HasSmiTag(obj)) { | |||
return GetExternalPointerFromSmi(obj); | return GetExternalPointerFromSmi(obj); | |||
} else if (GetInstanceType(obj) == kForeignType) { | } else if (GetInstanceType(obj) == kForeignType) { | |||
return ReadField<void*>(obj, kForeignAddressOffset); | return ReadField<void*>(obj, kForeignAddressOffset); | |||
skipping to change at line 4092 | skipping to change at line 4108 | |||
result = reinterpret_cast<String::ExternalStringResource*>(value); | result = reinterpret_cast<String::ExternalStringResource*>(value); | |||
} else { | } else { | |||
result = NULL; | result = NULL; | |||
} | } | |||
#ifdef V8_ENABLE_CHECKS | #ifdef V8_ENABLE_CHECKS | |||
VerifyExternalStringResource(result); | VerifyExternalStringResource(result); | |||
#endif | #endif | |||
return result; | return result; | |||
} | } | |||
bool Value::IsUndefined() const { | ||||
#ifdef V8_ENABLE_CHECKS | ||||
return FullIsUndefined(); | ||||
#else | ||||
return QuickIsUndefined(); | ||||
#endif | ||||
} | ||||
bool Value::QuickIsUndefined() const { | ||||
typedef internal::Object O; | ||||
typedef internal::Internals I; | ||||
O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this)); | ||||
if (!I::HasHeapObjectTag(obj)) return false; | ||||
if (I::GetInstanceType(obj) != I::kOddballType) return false; | ||||
return (I::GetOddballKind(obj) == I::kUndefinedOddballKind); | ||||
} | ||||
bool Value::IsNull() const { | ||||
#ifdef V8_ENABLE_CHECKS | ||||
return FullIsNull(); | ||||
#else | ||||
return QuickIsNull(); | ||||
#endif | ||||
} | ||||
bool Value::QuickIsNull() const { | ||||
typedef internal::Object O; | ||||
typedef internal::Internals I; | ||||
O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this)); | ||||
if (!I::HasHeapObjectTag(obj)) return false; | ||||
if (I::GetInstanceType(obj) != I::kOddballType) return false; | ||||
return (I::GetOddballKind(obj) == I::kNullOddballKind); | ||||
} | ||||
bool Value::IsString() const { | bool Value::IsString() const { | |||
#ifdef V8_ENABLE_CHECKS | #ifdef V8_ENABLE_CHECKS | |||
return FullIsString(); | return FullIsString(); | |||
#else | #else | |||
return QuickIsString(); | return QuickIsString(); | |||
#endif | #endif | |||
} | } | |||
bool Value::QuickIsString() const { | bool Value::QuickIsString() const { | |||
typedef internal::Object O; | typedef internal::Object O; | |||
End of changes. 12 change blocks. | ||||
7 lines changed or deleted | 58 lines changed or added | |||