v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 474 | skipping to change at line 474 | |||
NonCopyablePersistent* dest) { | NonCopyablePersistent* dest) { | |||
Uncompilable<Object>(); | Uncompilable<Object>(); | |||
} | } | |||
// TODO(dcarney): come up with a good compile error here. | // TODO(dcarney): come up with a good compile error here. | |||
template<class O> V8_INLINE static void Uncompilable() { | template<class O> V8_INLINE static void Uncompilable() { | |||
TYPE_CHECK(O, Primitive); | TYPE_CHECK(O, Primitive); | |||
} | } | |||
}; | }; | |||
/** | /** | |||
* Helper class traits to allow copying and assignment of Persistent. | ||||
* This will clone the contents of storage cell, but not any of the flags, | ||||
etc. | ||||
*/ | ||||
template<class T> | ||||
struct CopyablePersistentTraits { | ||||
typedef Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent; | ||||
static const bool kResetInDestructor = true; | ||||
template<class S, class M> | ||||
static V8_INLINE void Copy(const Persistent<S, M>& source, | ||||
CopyablePersistent* dest) { | ||||
// do nothing, just allow copy | ||||
} | ||||
}; | ||||
/** | ||||
* An object reference that is independent of any handle scope. Where | * An object reference that is independent of any handle scope. Where | |||
* a Local handle only lives as long as the HandleScope in which it was | * a Local handle only lives as long as the HandleScope in which it was | |||
* allocated, a Persistent handle remains valid until it is explicitly | * allocated, a Persistent handle remains valid until it is explicitly | |||
* disposed. | * disposed. | |||
* | * | |||
* A persistent handle contains a reference to a storage cell within | * A persistent handle contains a reference to a storage cell within | |||
* the v8 engine which holds an object value and which is updated by | * the v8 engine which holds an object value and which is updated by | |||
* the garbage collector whenever the object is moved. A new storage | * the garbage collector whenever the object is moved. A new storage | |||
* cell can be created using the constructor or Persistent::Reset and | * cell can be created using the constructor or Persistent::Reset and | |||
* existing handles can be disposed using Persistent::Reset. | * existing handles can be disposed using Persistent::Reset. | |||
skipping to change at line 812 | skipping to change at line 827 | |||
internal::Object** RawClose(internal::Object** value); | internal::Object** RawClose(internal::Object** value); | |||
friend class ImplementationUtilities; | friend class ImplementationUtilities; | |||
}; | }; | |||
/** | /** | |||
* A simple Maybe type, representing an object which may or may not have a | * A simple Maybe type, representing an object which may or may not have a | |||
* value. | * value. | |||
*/ | */ | |||
template<class T> | template<class T> | |||
struct Maybe { | struct V8_EXPORT Maybe { | |||
Maybe() : has_value(false) {} | Maybe() : has_value(false) {} | |||
explicit Maybe(T t) : has_value(true), value(t) {} | explicit Maybe(T t) : has_value(true), value(t) {} | |||
Maybe(bool has, T t) : has_value(has), value(t) {} | Maybe(bool has, T t) : has_value(has), value(t) {} | |||
bool has_value; | bool has_value; | |||
T value; | T value; | |||
}; | }; | |||
// --- Special objects --- | // --- Special objects --- | |||
skipping to change at line 2330 | skipping to change at line 2345 | |||
V8_INLINE int Length() const; | V8_INLINE int Length() const; | |||
V8_INLINE Local<Value> operator[](int i) const; | V8_INLINE Local<Value> operator[](int i) const; | |||
V8_INLINE Local<Function> Callee() const; | V8_INLINE Local<Function> Callee() const; | |||
V8_INLINE Local<Object> This() const; | V8_INLINE Local<Object> This() const; | |||
V8_INLINE Local<Object> Holder() const; | V8_INLINE Local<Object> Holder() const; | |||
V8_INLINE bool IsConstructCall() const; | V8_INLINE bool IsConstructCall() const; | |||
V8_INLINE Local<Value> Data() const; | V8_INLINE Local<Value> Data() const; | |||
V8_INLINE Isolate* GetIsolate() const; | V8_INLINE Isolate* GetIsolate() const; | |||
V8_INLINE ReturnValue<T> GetReturnValue() const; | V8_INLINE ReturnValue<T> GetReturnValue() const; | |||
// This shouldn't be public, but the arm compiler needs it. | // This shouldn't be public, but the arm compiler needs it. | |||
static const int kArgsLength = 6; | static const int kArgsLength = 7; | |||
protected: | protected: | |||
friend class internal::FunctionCallbackArguments; | friend class internal::FunctionCallbackArguments; | |||
friend class internal::CustomArguments<FunctionCallbackInfo>; | friend class internal::CustomArguments<FunctionCallbackInfo>; | |||
static const int kReturnValueIndex = 0; | static const int kReturnValueIndex = 0; | |||
static const int kReturnValueDefaultValueIndex = -1; | static const int kReturnValueDefaultValueIndex = -1; | |||
static const int kIsolateIndex = -2; | static const int kIsolateIndex = -2; | |||
static const int kDataIndex = -3; | static const int kDataIndex = -3; | |||
static const int kCalleeIndex = -4; | static const int kCalleeIndex = -4; | |||
static const int kHolderIndex = -5; | static const int kHolderIndex = -5; | |||
static const int kContextSaveIndex = -6; | ||||
V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args, | V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args, | |||
internal::Object** values, | internal::Object** values, | |||
int length, | int length, | |||
bool is_construct_call); | bool is_construct_call); | |||
internal::Object** implicit_args_; | internal::Object** implicit_args_; | |||
internal::Object** values_; | internal::Object** values_; | |||
int length_; | int length_; | |||
bool is_construct_call_; | bool is_construct_call_; | |||
}; | }; | |||
skipping to change at line 3777 | skipping to change at line 3793 | |||
enum GCCallbackFlags { | enum GCCallbackFlags { | |||
kNoGCCallbackFlags = 0, | kNoGCCallbackFlags = 0, | |||
kGCCallbackFlagCompacted = 1 << 0, | kGCCallbackFlagCompacted = 1 << 0, | |||
kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1 | kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1 | |||
}; | }; | |||
typedef void (*GCPrologueCallback)(GCType type, GCCallbackFlags flags); | typedef void (*GCPrologueCallback)(GCType type, GCCallbackFlags flags); | |||
typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags); | typedef void (*GCEpilogueCallback)(GCType type, GCCallbackFlags flags); | |||
typedef void (*GCCallback)(); | ||||
/** | /** | |||
* Collection of V8 heap information. | * Collection of V8 heap information. | |||
* | * | |||
* Instances of this class can be passed to v8::V8::HeapStatistics to | * Instances of this class can be passed to v8::V8::HeapStatistics to | |||
* get heap statistics from V8. | * get heap statistics from V8. | |||
*/ | */ | |||
class V8_EXPORT HeapStatistics { | class V8_EXPORT HeapStatistics { | |||
public: | public: | |||
HeapStatistics(); | HeapStatistics(); | |||
size_t total_heap_size() { return total_heap_size_; } | size_t total_heap_size() { return total_heap_size_; } | |||
skipping to change at line 3924 | skipping to change at line 3938 | |||
*/ | */ | |||
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 | |||
* profiling activities if it has started any. | * profiling activities if it has started any. | |||
*/ | */ | |||
CpuProfiler* GetCpuProfiler(); | CpuProfiler* GetCpuProfiler(); | |||
/** Returns true if this isolate has a current context. */ | ||||
bool InContext(); | ||||
/** Returns the context that is on the top of the stack. */ | /** Returns the context that is on the top of the stack. */ | |||
Local<Context> GetCurrentContext(); | Local<Context> GetCurrentContext(); | |||
/** | /** | |||
* Returns the context of the calling JavaScript code. That is the | ||||
* context of the top-most JavaScript frame. If there are no | ||||
* JavaScript frames an empty handle is returned. | ||||
*/ | ||||
Local<Context> GetCallingContext(); | ||||
/** Returns the last entered context. */ | ||||
Local<Context> GetEnteredContext(); | ||||
/** | ||||
* Allows the host application to group objects together. If one | * Allows the host application to group objects together. If one | |||
* object in the group is alive, all objects in the group are alive. | * object in the group is alive, all objects in the group are alive. | |||
* After each garbage collection, object groups are removed. It is | * After each garbage collection, object groups are removed. It is | |||
* intended to be used in the before-garbage-collection callback | * intended to be used in the before-garbage-collection callback | |||
* function, for instance to simulate DOM tree connections among JS | * function, for instance to simulate DOM tree connections among JS | |||
* wrapper objects. Object groups for all dependent handles need to | * wrapper objects. Object groups for all dependent handles need to | |||
* be provided for kGCTypeMarkSweepCompact collections, for all other | * be provided for kGCTypeMarkSweepCompact collections, for all other | |||
* garbage collection types it is sufficient to provide object groups | * garbage collection types it is sufficient to provide object groups | |||
* for partially dependent handles only. | * for partially dependent handles only. | |||
*/ | */ | |||
skipping to change at line 3960 | skipping to change at line 3987 | |||
/** | /** | |||
* Allows the host application to declare implicit references from an obj ect | * Allows the host application to declare implicit references from an obj ect | |||
* to another object. If the parent object is alive, the child object is alive | * to another object. If the parent object is alive, the child object is alive | |||
* too. After each garbage collection, all implicit references are remove d. It | * too. After each garbage collection, all implicit references are remove d. It | |||
* is intended to be used in the before-garbage-collection callback funct ion. | * is intended to be used in the before-garbage-collection callback funct ion. | |||
*/ | */ | |||
void SetReference(const Persistent<Object>& parent, | void SetReference(const Persistent<Object>& parent, | |||
const Persistent<Value>& child); | const Persistent<Value>& child); | |||
typedef void (*GCPrologueCallback)(Isolate* isolate, | ||||
GCType type, | ||||
GCCallbackFlags flags); | ||||
typedef void (*GCEpilogueCallback)(Isolate* isolate, | ||||
GCType type, | ||||
GCCallbackFlags flags); | ||||
/** | ||||
* Enables the host application to receive a notification before a | ||||
* garbage collection. Allocations are not allowed in the | ||||
* callback function, you therefore cannot manipulate objects (set | ||||
* or delete properties for example) since it is possible such | ||||
* operations will result in the allocation of objects. It is possible | ||||
* to specify the GCType filter for your callback. But it is not possible | ||||
to | ||||
* register the same callback function two times with different | ||||
* GCType filters. | ||||
*/ | ||||
void AddGCPrologueCallback( | ||||
GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll); | ||||
/** | ||||
* This function removes callback which was installed by | ||||
* AddGCPrologueCallback function. | ||||
*/ | ||||
void RemoveGCPrologueCallback(GCPrologueCallback callback); | ||||
/** | ||||
* Enables the host application to receive a notification after a | ||||
* garbage collection. Allocations are not allowed in the | ||||
* callback function, you therefore cannot manipulate objects (set | ||||
* or delete properties for example) since it is possible such | ||||
* operations will result in the allocation of objects. It is possible | ||||
* to specify the GCType filter for your callback. But it is not possible | ||||
to | ||||
* register the same callback function two times with different | ||||
* GCType filters. | ||||
*/ | ||||
void AddGCEpilogueCallback( | ||||
GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll); | ||||
/** | ||||
* This function removes callback which was installed by | ||||
* AddGCEpilogueCallback function. | ||||
*/ | ||||
void RemoveGCEpilogueCallback(GCEpilogueCallback callback); | ||||
private: | private: | |||
Isolate(); | Isolate(); | |||
Isolate(const Isolate&); | Isolate(const Isolate&); | |||
~Isolate(); | ~Isolate(); | |||
Isolate& operator=(const Isolate&); | Isolate& operator=(const Isolate&); | |||
void* operator new(size_t size); | void* operator new(size_t size); | |||
void operator delete(void*, size_t); | void operator delete(void*, size_t); | |||
}; | }; | |||
class V8_EXPORT StartupData { | class V8_EXPORT StartupData { | |||
skipping to change at line 4306 | skipping to change at line 4378 | |||
static void AddGCPrologueCallback( | static void AddGCPrologueCallback( | |||
GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll); | GCPrologueCallback callback, GCType gc_type_filter = kGCTypeAll); | |||
/** | /** | |||
* This function removes callback which was installed by | * This function removes callback which was installed by | |||
* AddGCPrologueCallback function. | * AddGCPrologueCallback function. | |||
*/ | */ | |||
static void RemoveGCPrologueCallback(GCPrologueCallback callback); | static void RemoveGCPrologueCallback(GCPrologueCallback callback); | |||
/** | /** | |||
* The function is deprecated. Please use AddGCPrologueCallback instead. | ||||
* Enables the host application to receive a notification before a | ||||
* garbage collection. Allocations are not allowed in the | ||||
* callback function, you therefore cannot manipulate objects (set | ||||
* or delete properties for example) since it is possible such | ||||
* operations will result in the allocation of objects. | ||||
*/ | ||||
V8_DEPRECATED(static void SetGlobalGCPrologueCallback(GCCallback)); | ||||
/** | ||||
* Enables the host application to receive a notification after a | * Enables the host application to receive a notification after a | |||
* garbage collection. Allocations are not allowed in the | * garbage collection. Allocations are not allowed in the | |||
* callback function, you therefore cannot manipulate objects (set | * callback function, you therefore cannot manipulate objects (set | |||
* or delete properties for example) since it is possible such | * or delete properties for example) since it is possible such | |||
* operations will result in the allocation of objects. It is possible | * operations will result in the allocation of objects. It is possible | |||
* to specify the GCType filter for your callback. But it is not possible to | * to specify the GCType filter for your callback. But it is not possible to | |||
* register the same callback function two times with different | * register the same callback function two times with different | |||
* GCType filters. | * GCType filters. | |||
*/ | */ | |||
static void AddGCEpilogueCallback( | static void AddGCEpilogueCallback( | |||
GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll); | GCEpilogueCallback callback, GCType gc_type_filter = kGCTypeAll); | |||
/** | /** | |||
* This function removes callback which was installed by | * This function removes callback which was installed by | |||
* AddGCEpilogueCallback function. | * AddGCEpilogueCallback function. | |||
*/ | */ | |||
static void RemoveGCEpilogueCallback(GCEpilogueCallback callback); | static void RemoveGCEpilogueCallback(GCEpilogueCallback callback); | |||
/** | /** | |||
* The function is deprecated. Please use AddGCEpilogueCallback instead. | ||||
* Enables the host application to receive a notification after a | ||||
* major garbage collection. Allocations are not allowed in the | ||||
* callback function, you therefore cannot manipulate objects (set | ||||
* or delete properties for example) since it is possible such | ||||
* operations will result in the allocation of objects. | ||||
*/ | ||||
V8_DEPRECATED(static void SetGlobalGCEpilogueCallback(GCCallback)); | ||||
/** | ||||
* Enables the host application to provide a mechanism to be notified | * Enables the host application to provide a mechanism to be notified | |||
* and perform custom logging when V8 Allocates Executable Memory. | * and perform custom logging when V8 Allocates Executable Memory. | |||
*/ | */ | |||
static void AddMemoryAllocationCallback(MemoryAllocationCallback callback , | static void AddMemoryAllocationCallback(MemoryAllocationCallback callback , | |||
ObjectSpace space, | ObjectSpace space, | |||
AllocationAction action); | AllocationAction action); | |||
/** | /** | |||
* Removes callback that was installed by AddMemoryAllocationCallback. | * Removes callback that was installed by AddMemoryAllocationCallback. | |||
*/ | */ | |||
skipping to change at line 4789 | skipping to change at line 4841 | |||
* created by a previous call to Context::New with the same global | * created by a previous call to Context::New with the same global | |||
* template. The state of the global object will be completely reset | * template. The state of the global object will be completely reset | |||
* and only object identify will remain. | * and only object identify will remain. | |||
*/ | */ | |||
static Local<Context> New( | static Local<Context> New( | |||
Isolate* isolate, | Isolate* isolate, | |||
ExtensionConfiguration* extensions = NULL, | ExtensionConfiguration* extensions = NULL, | |||
Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(), | Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(), | |||
Handle<Value> global_object = Handle<Value>()); | Handle<Value> global_object = Handle<Value>()); | |||
/** Deprecated. Use Isolate version instead. */ | // TODO(dcarney): Remove this function. | |||
V8_DEPRECATED(static Persistent<Context> New( | /** Deprecated. Use Isolate::GetEnteredContext */ | |||
ExtensionConfiguration* extensions = NULL, | ||||
Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(), | ||||
Handle<Value> global_object = Handle<Value>())); | ||||
/** Returns the last entered context. */ | ||||
static Local<Context> GetEntered(); | static Local<Context> GetEntered(); | |||
// TODO(svenpanne) Actually deprecate this. | // TODO(dcarney) Remove this function. | |||
/** Deprecated. Use Isolate::GetCurrentContext instead. */ | /** Deprecated. Use Isolate::GetCurrentContext instead. */ | |||
static Local<Context> GetCurrent(); | static Local<Context> GetCurrent(); | |||
/** | // TODO(dcarney) Remove this function. | |||
* Returns the context of the calling JavaScript code. That is the | /** Deprecated. Use Isolate::GetCallingContext instead. */ | |||
* context of the top-most JavaScript frame. If there are no | ||||
* JavaScript frames an empty handle is returned. | ||||
*/ | ||||
static Local<Context> GetCalling(); | static Local<Context> GetCalling(); | |||
/** | /** | |||
* Sets the security token for the context. To access an object in | * Sets the security token for the context. To access an object in | |||
* another context, the security tokens must match. | * another context, the security tokens must match. | |||
*/ | */ | |||
void SetSecurityToken(Handle<Value> token); | void SetSecurityToken(Handle<Value> token); | |||
/** Restores the security token to the default value. */ | /** Restores the security token to the default value. */ | |||
void UseDefaultSecurityToken(); | void UseDefaultSecurityToken(); | |||
skipping to change at line 4838 | skipping to change at line 4882 | |||
/** | /** | |||
* Exit this context. Exiting the current context restores the | * Exit this context. Exiting the current context restores the | |||
* context that was in place when entering the current context. | * context that was in place when entering the current context. | |||
*/ | */ | |||
void Exit(); | void Exit(); | |||
/** Returns true if the context has experienced an out of memory situatio n. */ | /** Returns true if the context has experienced an out of memory situatio n. */ | |||
bool HasOutOfMemoryException(); | bool HasOutOfMemoryException(); | |||
/** Returns true if V8 has a current context. */ | // TODO(dcarney) Remove this function. | |||
/** Deprecated. Use Isolate::InContext instead. */ | ||||
static bool InContext(); | static bool InContext(); | |||
/** Returns an isolate associated with a current context. */ | /** Returns an isolate associated with a current context. */ | |||
v8::Isolate* GetIsolate(); | v8::Isolate* GetIsolate(); | |||
/** | /** | |||
* Gets the embedder data with the given index, which must have been set by a | * Gets the embedder data with the given index, which must have been set by a | |||
* previous call to SetEmbedderData with the same index. Note that index 0 | * previous call to SetEmbedderData with the same index. Note that index 0 | |||
* currently has a special meaning for Chrome's debugger. | * currently has a special meaning for Chrome's debugger. | |||
*/ | */ | |||
End of changes. 14 change blocks. | ||||
38 lines changed or deleted | 86 lines changed or added | |||