v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 388 | skipping to change at line 388 | |||
inline void Dispose(); | inline void Dispose(); | |||
/** | /** | |||
* Make the reference to this object weak. When only weak handles | * Make the reference to this object weak. When only weak handles | |||
* refer to the object, the garbage collector will perform a | * refer to the object, the garbage collector will perform a | |||
* callback to the given V8::WeakReferenceCallback function, passing | * callback to the given V8::WeakReferenceCallback function, passing | |||
* it the object reference and the given parameters. | * it the object reference and the given parameters. | |||
*/ | */ | |||
inline void MakeWeak(void* parameters, WeakReferenceCallback callback); | inline void MakeWeak(void* parameters, WeakReferenceCallback callback); | |||
/** Clears the weak reference to this object.*/ | /** Clears the weak reference to this object. */ | |||
inline void ClearWeak(); | inline void ClearWeak(); | |||
/** | /** | |||
* Marks the reference to this object independent. Garbage collector | * Marks the reference to this object independent. Garbage collector | |||
* is free to ignore any object groups containing this object. | * is free to ignore any object groups containing this object. | |||
* Weak callback for an independent handle should not | * Weak callback for an independent handle should not | |||
* assume that it will be preceded by a global GC prologue callback | * assume that it will be preceded by a global GC prologue callback | |||
* or followed by a global GC epilogue callback. | * or followed by a global GC epilogue callback. | |||
*/ | */ | |||
inline void MarkIndependent(); | inline void MarkIndependent(); | |||
/** | /** Returns true if this handle was previously marked as independent. */ | |||
*Checks if the handle holds the only reference to an object. | inline bool IsIndependent() const; | |||
*/ | ||||
/** Checks if the handle holds the only reference to an object. */ | ||||
inline bool IsNearDeath() const; | inline bool IsNearDeath() const; | |||
/** | /** Returns true if the handle's reference is weak. */ | |||
* Returns true if the handle's reference is weak. | ||||
*/ | ||||
inline bool IsWeak() const; | inline bool IsWeak() const; | |||
/** | /** | |||
* Assigns a wrapper class ID to the handle. See RetainedObjectInfo | * Assigns a wrapper class ID to the handle. See RetainedObjectInfo | |||
* interface description in v8-profiler.h for details. | * interface description in v8-profiler.h for details. | |||
*/ | */ | |||
inline void SetWrapperClassId(uint16_t class_id); | inline void SetWrapperClassId(uint16_t class_id); | |||
/** | ||||
* Returns the class ID previously assigned to this handle or 0 if no cla | ||||
ss | ||||
* ID was previously assigned. | ||||
*/ | ||||
inline uint16_t WrapperClassId() const; | ||||
private: | private: | |||
friend class ImplementationUtilities; | friend class ImplementationUtilities; | |||
friend class ObjectTemplate; | friend class ObjectTemplate; | |||
}; | }; | |||
/** | /** | |||
* A stack-allocated class that governs a number of local handles. | * A stack-allocated class that governs a number of local handles. | |||
* After a handle scope has been created, all local handles will be | * After a handle scope has been created, all local handles will be | |||
* allocated within that handle scope until either the handle scope is | * allocated within that handle scope until either the handle scope is | |||
* deleted or another handle scope is created. If there is already a | * deleted or another handle scope is created. If there is already a | |||
skipping to change at line 1366 | skipping to change at line 1371 | |||
V8EXPORT static void CheckCast(v8::Value* obj); | V8EXPORT static void CheckCast(v8::Value* obj); | |||
}; | }; | |||
/** | /** | |||
* A JavaScript value representing a signed integer. | * A JavaScript value representing a signed integer. | |||
*/ | */ | |||
class Integer : public Number { | class Integer : public Number { | |||
public: | public: | |||
V8EXPORT static Local<Integer> New(int32_t value); | V8EXPORT static Local<Integer> New(int32_t value); | |||
V8EXPORT static Local<Integer> NewFromUnsigned(uint32_t value); | V8EXPORT static Local<Integer> NewFromUnsigned(uint32_t value); | |||
V8EXPORT static Local<Integer> New(int32_t value, Isolate*); | ||||
V8EXPORT static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*); | ||||
V8EXPORT int64_t Value() const; | V8EXPORT int64_t Value() const; | |||
static inline Integer* Cast(v8::Value* obj); | static inline Integer* Cast(v8::Value* obj); | |||
private: | private: | |||
V8EXPORT Integer(); | V8EXPORT Integer(); | |||
V8EXPORT static void CheckCast(v8::Value* obj); | V8EXPORT static void CheckCast(v8::Value* obj); | |||
}; | }; | |||
/** | /** | |||
* A JavaScript value representing a 32-bit signed integer. | * A JavaScript value representing a 32-bit signed integer. | |||
*/ | */ | |||
skipping to change at line 2592 | skipping to change at line 2599 | |||
int max_executable_size_; | int max_executable_size_; | |||
uint32_t* stack_limit_; | uint32_t* stack_limit_; | |||
}; | }; | |||
bool V8EXPORT SetResourceConstraints(ResourceConstraints* constraints); | bool V8EXPORT SetResourceConstraints(ResourceConstraints* constraints); | |||
// --- Exceptions --- | // --- Exceptions --- | |||
typedef void (*FatalErrorCallback)(const char* location, const char* messag e); | typedef void (*FatalErrorCallback)(const char* location, const char* messag e); | |||
typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> data ); | typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> erro r); | |||
/** | /** | |||
* Schedules an exception to be thrown when returning to JavaScript. When an | * Schedules an exception to be thrown when returning to JavaScript. When an | |||
* exception has been scheduled it is illegal to invoke any JavaScript | * exception has been scheduled it is illegal to invoke any JavaScript | |||
* operation; the caller must return immediately and only after the excepti on | * operation; the caller must return immediately and only after the excepti on | |||
* has been handled does it become legal to invoke JavaScript operations. | * has been handled does it become legal to invoke JavaScript operations. | |||
*/ | */ | |||
Handle<Value> V8EXPORT ThrowException(Handle<Value> exception); | Handle<Value> V8EXPORT ThrowException(Handle<Value> exception); | |||
/** | /** | |||
skipping to change at line 2938 | skipping to change at line 2945 | |||
}; | }; | |||
/** | /** | |||
* Callback function passed to SetJitCodeEventHandler. | * Callback function passed to SetJitCodeEventHandler. | |||
* | * | |||
* \param event code add, move or removal event. | * \param event code add, move or removal event. | |||
*/ | */ | |||
typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); | typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); | |||
/** | /** | |||
* Interface for iterating though all external resources in the heap. | * Interface for iterating through all external resources in the heap. | |||
*/ | */ | |||
class V8EXPORT ExternalResourceVisitor { // NOLINT | class V8EXPORT ExternalResourceVisitor { // NOLINT | |||
public: | public: | |||
virtual ~ExternalResourceVisitor() {} | virtual ~ExternalResourceVisitor() {} | |||
virtual void VisitExternalString(Handle<String> string) {} | virtual void VisitExternalString(Handle<String> string) {} | |||
}; | }; | |||
/** | /** | |||
* Interface for iterating through all the persistent handles in the heap. | ||||
*/ | ||||
class V8EXPORT PersistentHandleVisitor { // NOLINT | ||||
public: | ||||
virtual ~PersistentHandleVisitor() {} | ||||
virtual void VisitPersistentHandle(Persistent<Value> value, | ||||
uint16_t class_id) {} | ||||
}; | ||||
/** | ||||
* Container class for static utility functions. | * Container class for static utility functions. | |||
*/ | */ | |||
class V8EXPORT V8 { | class V8EXPORT V8 { | |||
public: | public: | |||
/** Set the callback to invoke in case of fatal errors. */ | /** Set the callback to invoke in case of fatal errors. */ | |||
static void SetFatalErrorHandler(FatalErrorCallback that); | static void SetFatalErrorHandler(FatalErrorCallback that); | |||
/** | /** | |||
* Set the callback to invoke to check if code generation from | * Set the callback to invoke to check if code generation from | |||
* strings should be allowed. | * strings should be allowed. | |||
skipping to change at line 3011 | skipping to change at line 3028 | |||
static int GetCompressedStartupDataCount(); | static int GetCompressedStartupDataCount(); | |||
static void GetCompressedStartupData(StartupData* compressed_data); | static void GetCompressedStartupData(StartupData* compressed_data); | |||
static void SetDecompressedStartupData(StartupData* decompressed_data); | static void SetDecompressedStartupData(StartupData* decompressed_data); | |||
/** | /** | |||
* Adds a message listener. | * Adds a message listener. | |||
* | * | |||
* The same message listener can be added more than once and in that | * The same message listener can be added more than once and in that | |||
* case it will be called more than once for each message. | * case it will be called more than once for each message. | |||
*/ | */ | |||
static bool AddMessageListener(MessageCallback that, | static bool AddMessageListener(MessageCallback that); | |||
Handle<Value> data = Handle<Value>()); | ||||
/** | /** | |||
* Remove all message listeners from the specified callback function. | * Remove all message listeners from the specified callback function. | |||
*/ | */ | |||
static void RemoveMessageListeners(MessageCallback that); | static void RemoveMessageListeners(MessageCallback that); | |||
/** | /** | |||
* Tells V8 to capture current stack trace when uncaught exception occurs | * Tells V8 to capture current stack trace when uncaught exception occurs | |||
* and report it to the message listeners. The option is off by default. | * and report it to the message listeners. The option is off by default. | |||
*/ | */ | |||
skipping to change at line 3354 | skipping to change at line 3370 | |||
static void GetHeapStatistics(HeapStatistics* heap_statistics); | static void GetHeapStatistics(HeapStatistics* heap_statistics); | |||
/** | /** | |||
* Iterates through all external resources referenced from current isolat e | * Iterates through all external resources referenced from current isolat e | |||
* heap. This method is not expected to be used except for debugging purp oses | * heap. This method is not expected to be used except for debugging purp oses | |||
* and may be quite slow. | * and may be quite slow. | |||
*/ | */ | |||
static void VisitExternalResources(ExternalResourceVisitor* visitor); | static void VisitExternalResources(ExternalResourceVisitor* visitor); | |||
/** | /** | |||
* Iterates through all the persistent handles in the current isolate's h | ||||
eap | ||||
* that have class_ids. | ||||
*/ | ||||
static void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor); | ||||
/** | ||||
* Optional notification that the embedder is idle. | * Optional notification that the embedder is idle. | |||
* V8 uses the notification to reduce memory footprint. | * V8 uses the notification to reduce memory footprint. | |||
* This call can be used repeatedly if the embedder remains idle. | * This call can be used repeatedly if the embedder remains idle. | |||
* Returns true if the embedder should stop calling IdleNotification | * Returns true if the embedder should stop calling IdleNotification | |||
* until real work has been done. This indicates that V8 has done | * until real work has been done. This indicates that V8 has done | |||
* as much cleanup as it will be able to do. | * as much cleanup as it will be able to do. | |||
* | * | |||
* The hint argument specifies the amount of work to be done in the funct ion | * The hint argument specifies the amount of work to be done in the funct ion | |||
* on scale from 1 to 1000. There is no guarantee that the actual work wi ll | * on scale from 1 to 1000. There is no guarantee that the actual work wi ll | |||
* match the hint. | * match the hint. | |||
skipping to change at line 3391 | skipping to change at line 3413 | |||
private: | private: | |||
V8(); | V8(); | |||
static internal::Object** GlobalizeReference(internal::Object** handle); | static internal::Object** GlobalizeReference(internal::Object** handle); | |||
static void DisposeGlobal(internal::Object** global_handle); | static void DisposeGlobal(internal::Object** global_handle); | |||
static void MakeWeak(internal::Object** global_handle, | static void MakeWeak(internal::Object** global_handle, | |||
void* data, | void* data, | |||
WeakReferenceCallback); | WeakReferenceCallback); | |||
static void ClearWeak(internal::Object** global_handle); | static void ClearWeak(internal::Object** global_handle); | |||
static void MarkIndependent(internal::Object** global_handle); | static void MarkIndependent(internal::Object** global_handle); | |||
static bool IsGlobalIndependent(internal::Object** global_handle); | ||||
static bool IsGlobalNearDeath(internal::Object** global_handle); | static bool IsGlobalNearDeath(internal::Object** global_handle); | |||
static bool IsGlobalWeak(internal::Object** global_handle); | static bool IsGlobalWeak(internal::Object** global_handle); | |||
static void SetWrapperClassId(internal::Object** global_handle, | static void SetWrapperClassId(internal::Object** global_handle, | |||
uint16_t class_id); | uint16_t class_id); | |||
static uint16_t GetWrapperClassId(internal::Object** global_handle); | ||||
template <class T> friend class Handle; | template <class T> friend class Handle; | |||
template <class T> friend class Local; | template <class T> friend class Local; | |||
template <class T> friend class Persistent; | template <class T> friend class Persistent; | |||
friend class Context; | friend class Context; | |||
}; | }; | |||
/** | /** | |||
* An external exception handler. | * An external exception handler. | |||
*/ | */ | |||
skipping to change at line 4097 | skipping to change at line 4121 | |||
} | } | |||
template <class T> | template <class T> | |||
Persistent<T> Persistent<T>::New(Handle<T> that) { | Persistent<T> Persistent<T>::New(Handle<T> that) { | |||
if (that.IsEmpty()) return Persistent<T>(); | if (that.IsEmpty()) return Persistent<T>(); | |||
internal::Object** p = reinterpret_cast<internal::Object**>(*that); | internal::Object** p = reinterpret_cast<internal::Object**>(*that); | |||
return Persistent<T>(reinterpret_cast<T*>(V8::GlobalizeReference(p))); | return Persistent<T>(reinterpret_cast<T*>(V8::GlobalizeReference(p))); | |||
} | } | |||
template <class T> | template <class T> | |||
bool Persistent<T>::IsIndependent() const { | ||||
if (this->IsEmpty()) return false; | ||||
return V8::IsGlobalIndependent(reinterpret_cast<internal::Object**>(**thi | ||||
s)); | ||||
} | ||||
template <class T> | ||||
bool Persistent<T>::IsNearDeath() const { | bool Persistent<T>::IsNearDeath() const { | |||
if (this->IsEmpty()) return false; | if (this->IsEmpty()) return false; | |||
return V8::IsGlobalNearDeath(reinterpret_cast<internal::Object**>(**this) ); | return V8::IsGlobalNearDeath(reinterpret_cast<internal::Object**>(**this) ); | |||
} | } | |||
template <class T> | template <class T> | |||
bool Persistent<T>::IsWeak() const { | bool Persistent<T>::IsWeak() const { | |||
if (this->IsEmpty()) return false; | if (this->IsEmpty()) return false; | |||
return V8::IsGlobalWeak(reinterpret_cast<internal::Object**>(**this)); | return V8::IsGlobalWeak(reinterpret_cast<internal::Object**>(**this)); | |||
} | } | |||
skipping to change at line 4139 | skipping to change at line 4169 | |||
template <class T> | template <class T> | |||
void Persistent<T>::MarkIndependent() { | void Persistent<T>::MarkIndependent() { | |||
V8::MarkIndependent(reinterpret_cast<internal::Object**>(**this)); | V8::MarkIndependent(reinterpret_cast<internal::Object**>(**this)); | |||
} | } | |||
template <class T> | template <class T> | |||
void Persistent<T>::SetWrapperClassId(uint16_t class_id) { | void Persistent<T>::SetWrapperClassId(uint16_t class_id) { | |||
V8::SetWrapperClassId(reinterpret_cast<internal::Object**>(**this), class _id); | V8::SetWrapperClassId(reinterpret_cast<internal::Object**>(**this), class _id); | |||
} | } | |||
template <class T> | ||||
uint16_t Persistent<T>::WrapperClassId() const { | ||||
return V8::GetWrapperClassId(reinterpret_cast<internal::Object**>(**this) | ||||
); | ||||
} | ||||
Arguments::Arguments(internal::Object** implicit_args, | Arguments::Arguments(internal::Object** implicit_args, | |||
internal::Object** values, int length, | internal::Object** values, int length, | |||
bool is_construct_call) | bool is_construct_call) | |||
: implicit_args_(implicit_args), | : implicit_args_(implicit_args), | |||
values_(values), | values_(values), | |||
length_(length), | length_(length), | |||
is_construct_call_(is_construct_call) { } | is_construct_call_(is_construct_call) { } | |||
Local<Value> Arguments::operator[](int i) const { | Local<Value> Arguments::operator[](int i) const { | |||
if (i < 0 || length_ <= i) return Local<Value>(*Undefined()); | if (i < 0 || length_ <= i) return Local<Value>(*Undefined()); | |||
End of changes. 14 change blocks. | ||||
11 lines changed or deleted | 50 lines changed or added | |||