v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 3750 | skipping to change at line 3750 | |||
} | } | |||
private: | private: | |||
int max_young_space_size_; | int max_young_space_size_; | |||
int max_old_space_size_; | int max_old_space_size_; | |||
int max_executable_size_; | int max_executable_size_; | |||
uint32_t* stack_limit_; | uint32_t* stack_limit_; | |||
int max_available_threads_; | int max_available_threads_; | |||
}; | }; | |||
V8_DEPRECATED( | ||||
"Use SetResourceConstraints(isolate, constraints) instead", | ||||
bool V8_EXPORT SetResourceConstraints(ResourceConstraints* constraints) | ||||
); | ||||
/** | /** | |||
* Sets the given ResourceConstraints on the given Isolate. | * Sets the given ResourceConstraints on the given Isolate. | |||
*/ | */ | |||
bool V8_EXPORT SetResourceConstraints(Isolate* isolate, | bool V8_EXPORT SetResourceConstraints(Isolate* isolate, | |||
ResourceConstraints* constraints); | ResourceConstraints* constraints); | |||
// --- Exceptions --- | // --- Exceptions --- | |||
typedef void (*FatalErrorCallback)(const char* location, const char* messag e); | typedef void (*FatalErrorCallback)(const char* location, const char* messag e); | |||
skipping to change at line 3960 | skipping to change at line 3956 | |||
*/ | */ | |||
void Exit(); | void Exit(); | |||
/** | /** | |||
* Disposes the isolate. The isolate must not be entered by any | * Disposes the isolate. The isolate must not be entered by any | |||
* thread to be disposable. | * thread to be disposable. | |||
*/ | */ | |||
void Dispose(); | void Dispose(); | |||
/** | /** | |||
* Associate embedder-specific data with the isolate | * Associate embedder-specific data with the isolate. This legacy method | |||
* puts the data in the 0th slot. It will be deprecated soon. | ||||
*/ | */ | |||
V8_INLINE void SetData(void* data); | V8_INLINE void SetData(void* data); | |||
/** | /** | |||
* Retrieve embedder-specific data from the isolate. | * Associate embedder-specific data with the isolate. |slot| has to be | |||
* between 0 and GetNumberOfDataSlots() - 1. | ||||
*/ | ||||
V8_INLINE void SetData(uint32_t slot, void* data); | ||||
/** | ||||
* Retrieve embedder-specific data from the isolate. This legacy method | ||||
* retrieves the data from slot 0. It will be deprecated soon. | ||||
* Returns NULL if SetData has never been called. | * Returns NULL if SetData has never been called. | |||
*/ | */ | |||
V8_INLINE void* GetData(); | V8_INLINE void* GetData(); | |||
/** | /** | |||
* Retrieve embedder-specific data from the isolate. | ||||
* Returns NULL if SetData has never been called for the given |slot|. | ||||
*/ | ||||
V8_INLINE void* GetData(uint32_t slot); | ||||
/** | ||||
* Returns the maximum number of available embedder data slots. Valid slo | ||||
ts | ||||
* are in the range of 0 - GetNumberOfDataSlots() - 1. | ||||
*/ | ||||
V8_INLINE static uint32_t GetNumberOfDataSlots(); | ||||
/** | ||||
* Get statistics about the heap memory usage. | * Get statistics about the heap memory usage. | |||
*/ | */ | |||
void GetHeapStatistics(HeapStatistics* heap_statistics); | void GetHeapStatistics(HeapStatistics* heap_statistics); | |||
/** | /** | |||
* Adjusts the amount of registered external memory. Used to give V8 an | * Adjusts the amount of registered external memory. Used to give V8 an | |||
* indication of the amount of externally allocated memory that is kept a live | * indication of the amount of externally allocated memory that is kept a live | |||
* by JavaScript objects. V8 uses this to decide when to perform global | * by JavaScript objects. V8 uses this to decide when to perform global | |||
* garbage collections. Registering externally allocated memory will trig ger | * garbage collections. Registering externally allocated memory will trig ger | |||
* global garbage collections more often than it would otherwise in an at tempt | * global garbage collections more often than it would otherwise in an at tempt | |||
* to garbage collect the JavaScript objects that keep the externally | * to garbage collect the JavaScript objects that keep the externally | |||
* allocated memory alive. | * allocated memory alive. | |||
* | * | |||
* \param change_in_bytes the change in externally allocated memory that is | * \param change_in_bytes the change in externally allocated memory that is | |||
* kept alive by JavaScript objects. | * kept alive by JavaScript objects. | |||
* \returns the adjusted value. | * \returns the adjusted value. | |||
*/ | */ | |||
intptr_t AdjustAmountOfExternalAllocatedMemory(intptr_t change_in_bytes); | int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes); | |||
/** | /** | |||
* Returns heap profiler for this isolate. Will return NULL until the iso late | * Returns heap profiler for this isolate. Will return NULL until the iso late | |||
* is initialized. | * is initialized. | |||
*/ | */ | |||
HeapProfiler* GetHeapProfiler(); | HeapProfiler* GetHeapProfiler(); | |||
/** | /** | |||
* Returns CPU profiler for this isolate. Will return NULL unless the iso late | * Returns CPU profiler for this isolate. Will return NULL unless the iso late | |||
* is initialized. It is the embedder's responsibility to stop all CPU | * is initialized. It is the embedder's responsibility to stop all CPU | |||
skipping to change at line 4561 | skipping to change at line 4577 | |||
* \note the set of events declared in JitCodeEvent::EventType is expecte d to | * \note the set of events declared in JitCodeEvent::EventType is expecte d to | |||
* grow over time, and the JitCodeEvent structure is expected to accr ue | * grow over time, and the JitCodeEvent structure is expected to accr ue | |||
* new members. The \p event_handler function must ignore event codes | * new members. The \p event_handler function must ignore event codes | |||
* it does not recognize to maintain future compatibility. | * it does not recognize to maintain future compatibility. | |||
*/ | */ | |||
static void SetJitCodeEventHandler(JitCodeEventOptions options, | static void SetJitCodeEventHandler(JitCodeEventOptions options, | |||
JitCodeEventHandler event_handler); | JitCodeEventHandler event_handler); | |||
V8_DEPRECATED( | V8_DEPRECATED( | |||
"Use Isolate::AdjustAmountOfExternalAllocatedMemory instead", | "Use Isolate::AdjustAmountOfExternalAllocatedMemory instead", | |||
static intptr_t AdjustAmountOfExternalAllocatedMemory( | static int64_t AdjustAmountOfExternalAllocatedMemory( | |||
intptr_t change_in_bytes)); | int64_t change_in_bytes)); | |||
/** | /** | |||
* Forcefully terminate the current thread of JavaScript execution | * Forcefully terminate the current thread of JavaScript execution | |||
* in the given isolate. If no isolate is provided, the default | * in the given isolate. If no isolate is provided, the default | |||
* isolate is used. | * isolate is used. | |||
* | * | |||
* This method can be used by any thread even if that thread has not | * This method can be used by any thread even if that thread has not | |||
* acquired the V8 lock with a Locker object. | * acquired the V8 lock with a Locker object. | |||
* | * | |||
* \param isolate The isolate in which to terminate the current JS execut ion. | * \param isolate The isolate in which to terminate the current JS execut ion. | |||
skipping to change at line 5333 | skipping to change at line 5349 | |||
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 kFixedArrayHeaderSize = 2 * kApiPointerSize; | static const int kFixedArrayHeaderSize = 2 * kApiPointerSize; | |||
static const int kContextHeaderSize = 2 * kApiPointerSize; | static const int kContextHeaderSize = 2 * kApiPointerSize; | |||
static const int kContextEmbedderDataIndex = 65; | static const int kContextEmbedderDataIndex = 65; | |||
static const int kFullStringRepresentationMask = 0x07; | static const int kFullStringRepresentationMask = 0x07; | |||
static const int kStringEncodingMask = 0x4; | static const int kStringEncodingMask = 0x4; | |||
static const int kExternalTwoByteRepresentationTag = 0x02; | static const int kExternalTwoByteRepresentationTag = 0x02; | |||
static const int kExternalAsciiRepresentationTag = 0x06; | static const int kExternalAsciiRepresentationTag = 0x06; | |||
static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; | static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize; | |||
static const int kIsolateRootsOffset = 3 * kApiPointerSize; | static const int kIsolateRootsOffset = 5 * kApiPointerSize; | |||
static const int kUndefinedValueRootIndex = 5; | static const int kUndefinedValueRootIndex = 5; | |||
static const int kNullValueRootIndex = 7; | static const int kNullValueRootIndex = 7; | |||
static const int kTrueValueRootIndex = 8; | static const int kTrueValueRootIndex = 8; | |||
static const int kFalseValueRootIndex = 9; | static const int kFalseValueRootIndex = 9; | |||
static const int kEmptyStringRootIndex = 134; | static const int kEmptyStringRootIndex = 134; | |||
static const int kNodeClassIdOffset = 1 * kApiPointerSize; | static const int kNodeClassIdOffset = 1 * kApiPointerSize; | |||
static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; | static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; | |||
static const int kNodeStateMask = 0xf; | static const int kNodeStateMask = 0xf; | |||
static const int kNodeStateIsWeakValue = 2; | static const int kNodeStateIsWeakValue = 2; | |||
skipping to change at line 5358 | skipping to change at line 5374 | |||
static const int kNodeIsPartiallyDependentShift = 5; | static const int kNodeIsPartiallyDependentShift = 5; | |||
static const int kJSObjectType = 0xb2; | static const int kJSObjectType = 0xb2; | |||
static const int kFirstNonstringType = 0x80; | static const int kFirstNonstringType = 0x80; | |||
static const int kOddballType = 0x83; | static const int kOddballType = 0x83; | |||
static const int kForeignType = 0x87; | static const int kForeignType = 0x87; | |||
static const int kUndefinedOddballKind = 5; | static const int kUndefinedOddballKind = 5; | |||
static const int kNullOddballKind = 3; | static const int kNullOddballKind = 3; | |||
static const uint32_t kNumIsolateDataSlots = 4; | ||||
V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate); | V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate); | |||
V8_INLINE static void CheckInitialized(v8::Isolate* isolate) { | V8_INLINE static void CheckInitialized(v8::Isolate* isolate) { | |||
#ifdef V8_ENABLE_CHECKS | #ifdef V8_ENABLE_CHECKS | |||
CheckInitializedImpl(isolate); | CheckInitializedImpl(isolate); | |||
#endif | #endif | |||
} | } | |||
V8_INLINE static bool HasHeapObjectTag(internal::Object* value) { | V8_INLINE static bool HasHeapObjectTag(internal::Object* value) { | |||
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == | return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == | |||
kHeapObjectTag); | kHeapObjectTag); | |||
skipping to change at line 5421 | skipping to change at line 5439 | |||
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | |||
return *addr & kNodeStateMask; | return *addr & kNodeStateMask; | |||
} | } | |||
V8_INLINE static void UpdateNodeState(internal::Object** obj, | V8_INLINE static void UpdateNodeState(internal::Object** obj, | |||
uint8_t value) { | uint8_t value) { | |||
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; | |||
*addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value); | *addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value); | |||
} | } | |||
V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, void* data) { | V8_INLINE static void SetEmbedderData(v8::Isolate *isolate, | |||
uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + | uint32_t slot, | |||
kIsolateEmbedderDataOffset; | void *data) { | |||
uint8_t *addr = reinterpret_cast<uint8_t *>(isolate) + | ||||
kIsolateEmbedderDataOffset + slot * kApiPointerSize; | ||||
*reinterpret_cast<void**>(addr) = data; | *reinterpret_cast<void**>(addr) = data; | |||
} | } | |||
V8_INLINE static void* GetEmbedderData(v8::Isolate* isolate) { | V8_INLINE static void* GetEmbedderData(v8::Isolate* isolate, uint32_t slo t) { | |||
uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + | uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + | |||
kIsolateEmbedderDataOffset; | kIsolateEmbedderDataOffset + slot * kApiPointerSize; | |||
return *reinterpret_cast<void**>(addr); | return *reinterpret_cast<void**>(addr); | |||
} | } | |||
V8_INLINE static internal::Object** GetRoot(v8::Isolate* isolate, | V8_INLINE static internal::Object** GetRoot(v8::Isolate* isolate, | |||
int index) { | int index) { | |||
uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffs et; | uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffs et; | |||
return reinterpret_cast<internal::Object**>(addr + index * kApiPointerS ize); | return reinterpret_cast<internal::Object**>(addr + index * kApiPointerS ize); | |||
} | } | |||
template <typename T> V8_INLINE static T ReadField(Object* ptr, int offse t) { | template <typename T> V8_INLINE static T ReadField(Object* ptr, int offse t) { | |||
skipping to change at line 6265 | skipping to change at line 6285 | |||
Handle<Boolean> False(Isolate* isolate) { | Handle<Boolean> False(Isolate* isolate) { | |||
typedef internal::Object* S; | typedef internal::Object* S; | |||
typedef internal::Internals I; | typedef internal::Internals I; | |||
I::CheckInitialized(isolate); | I::CheckInitialized(isolate); | |||
S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); | S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); | |||
return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); | return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); | |||
} | } | |||
void Isolate::SetData(void* data) { | void Isolate::SetData(void* data) { | |||
typedef internal::Internals I; | typedef internal::Internals I; | |||
I::SetEmbedderData(this, data); | I::SetEmbedderData(this, 0, data); | |||
} | } | |||
void* Isolate::GetData() { | void* Isolate::GetData() { | |||
typedef internal::Internals I; | typedef internal::Internals I; | |||
return I::GetEmbedderData(this); | return I::GetEmbedderData(this, 0); | |||
} | ||||
void Isolate::SetData(uint32_t slot, void* data) { | ||||
typedef internal::Internals I; | ||||
I::SetEmbedderData(this, slot, data); | ||||
} | ||||
void* Isolate::GetData(uint32_t slot) { | ||||
typedef internal::Internals I; | ||||
return I::GetEmbedderData(this, slot); | ||||
} | ||||
uint32_t Isolate::GetNumberOfDataSlots() { | ||||
typedef internal::Internals I; | ||||
return I::kNumIsolateDataSlots; | ||||
} | } | |||
template<typename T> | template<typename T> | |||
void Isolate::SetObjectGroupId(const Persistent<T>& object, | void Isolate::SetObjectGroupId(const Persistent<T>& object, | |||
UniqueId id) { | UniqueId id) { | |||
TYPE_CHECK(Value, T); | TYPE_CHECK(Value, T); | |||
SetObjectGroupId(reinterpret_cast<v8::internal::Object**>(object.val_), i d); | SetObjectGroupId(reinterpret_cast<v8::internal::Object**>(object.val_), i d); | |||
} | } | |||
template<typename T> | template<typename T> | |||
End of changes. 13 change blocks. | ||||
19 lines changed or deleted | 54 lines changed or added | |||