v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 572 | skipping to change at line 572 | |||
private: | private: | |||
friend class Isolate; | friend class Isolate; | |||
friend class Utils; | friend class Utils; | |||
template<class F> friend class Handle; | template<class F> friend class Handle; | |||
template<class F> friend class Local; | template<class F> friend class Local; | |||
template<class F1, class F2> friend class Persistent; | template<class F1, class F2> friend class Persistent; | |||
template<class F> friend class UniquePersistent; | template<class F> friend class UniquePersistent; | |||
template<class F> friend class PersistentBase; | template<class F> friend class PersistentBase; | |||
template<class F> friend class ReturnValue; | template<class F> friend class ReturnValue; | |||
friend class Object; | ||||
explicit V8_INLINE PersistentBase(T* val) : val_(val) {} | explicit V8_INLINE PersistentBase(T* val) : val_(val) {} | |||
PersistentBase(PersistentBase& other); // NOLINT | PersistentBase(PersistentBase& other); // NOLINT | |||
void operator=(PersistentBase&); | void operator=(PersistentBase&); | |||
V8_INLINE static T* New(Isolate* isolate, T* that); | V8_INLINE static T* New(Isolate* isolate, T* that); | |||
T* val_; | T* val_; | |||
}; | }; | |||
/** | /** | |||
skipping to change at line 995 | skipping to change at line 996 | |||
public: | public: | |||
/** | /** | |||
* Compiles the specified script (context-independent). | * Compiles the specified script (context-independent). | |||
* | * | |||
* \param source Script source code. | * \param source Script source code. | |||
* \param origin Script origin, owned by caller, no references are kept | * \param origin Script origin, owned by caller, no references are kept | |||
* when New() returns | * when New() returns | |||
* \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompil e() | * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompil e() | |||
* using pre_data speeds compilation if it's done multiple times. | * using pre_data speeds compilation if it's done multiple times. | |||
* Owned by caller, no references are kept when New() returns. | * Owned by caller, no references are kept when New() returns. | |||
* \param script_data Arbitrary data associated with script. Using | ||||
* this has same effect as calling SetData(), but allows data to be | ||||
* available to compile event handlers. | ||||
* \return Compiled script object (context independent; when run it | * \return Compiled script object (context independent; when run it | |||
* will use the currently entered context). | * will use the currently entered context). | |||
*/ | */ | |||
static Local<Script> New(Handle<String> source, | static Local<Script> New(Handle<String> source, | |||
ScriptOrigin* origin = NULL, | ScriptOrigin* origin = NULL, | |||
ScriptData* pre_data = NULL, | ScriptData* pre_data = NULL); | |||
Handle<String> script_data = Handle<String>()); | ||||
/** | /** | |||
* Compiles the specified script using the specified file name | * Compiles the specified script using the specified file name | |||
* object (typically a string) as the script's origin. | * object (typically a string) as the script's origin. | |||
* | * | |||
* \param source Script source code. | * \param source Script source code. | |||
* \param file_name file name object (typically a string) to be used | * \param file_name file name object (typically a string) to be used | |||
* as the script's origin. | * as the script's origin. | |||
* \return Compiled script object (context independent; when run it | * \return Compiled script object (context independent; when run it | |||
* will use the currently entered context). | * will use the currently entered context). | |||
skipping to change at line 1028 | skipping to change at line 1025 | |||
/** | /** | |||
* Compiles the specified script (bound to current context). | * Compiles the specified script (bound to current context). | |||
* | * | |||
* \param source Script source code. | * \param source Script source code. | |||
* \param origin Script origin, owned by caller, no references are kept | * \param origin Script origin, owned by caller, no references are kept | |||
* when Compile() returns | * when Compile() returns | |||
* \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompil e() | * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompil e() | |||
* using pre_data speeds compilation if it's done multiple times. | * using pre_data speeds compilation if it's done multiple times. | |||
* Owned by caller, no references are kept when Compile() returns. | * Owned by caller, no references are kept when Compile() returns. | |||
* \param script_data Arbitrary data associated with script. Using | ||||
* this has same effect as calling SetData(), but makes data available | ||||
* earlier (i.e. to compile event handlers). | ||||
* \return Compiled script object, bound to the context that was active | * \return Compiled script object, bound to the context that was active | |||
* when this function was called. When run it will always use this | * when this function was called. When run it will always use this | |||
* context. | * context. | |||
*/ | */ | |||
static Local<Script> Compile(Handle<String> source, | static Local<Script> Compile(Handle<String> source, | |||
ScriptOrigin* origin = NULL, | ScriptOrigin* origin = NULL, | |||
ScriptData* pre_data = NULL, | ScriptData* pre_data = NULL); | |||
Handle<String> script_data = Handle<String>( | ||||
)); | ||||
/** | /** | |||
* Compiles the specified script using the specified file name | * Compiles the specified script using the specified file name | |||
* object (typically a string) as the script's origin. | * object (typically a string) as the script's origin. | |||
* | * | |||
* \param source Script source code. | * \param source Script source code. | |||
* \param file_name File name to use as script's origin | * \param file_name File name to use as script's origin | |||
* \param script_data Arbitrary data associated with script. Using | ||||
* this has same effect as calling SetData(), but makes data available | ||||
* earlier (i.e. to compile event handlers). | ||||
* \return Compiled script object, bound to the context that was active | * \return Compiled script object, bound to the context that was active | |||
* when this function was called. When run it will always use this | * when this function was called. When run it will always use this | |||
* context. | * context. | |||
*/ | */ | |||
static Local<Script> Compile(Handle<String> source, | static Local<Script> Compile(Handle<String> source, | |||
Handle<Value> file_name, | Handle<Value> file_name); | |||
Handle<String> script_data = Handle<String>( | ||||
)); | ||||
/** | /** | |||
* Runs the script returning the resulting value. If the script is | * Runs the script returning the resulting value. If the script is | |||
* context independent (created using ::New) it will be run in the | * context independent (created using ::New) it will be run in the | |||
* currently entered context. If it is context specific (created | * currently entered context. If it is context specific (created | |||
* using ::Compile) it will be run in the context in which it was | * using ::Compile) it will be run in the context in which it was | |||
* compiled. | * compiled. | |||
*/ | */ | |||
Local<Value> Run(); | Local<Value> Run(); | |||
/** | /** | |||
* Returns the script id. | * Returns the script id. | |||
*/ | */ | |||
int GetId(); | int GetId(); | |||
/** | /** | |||
* Associate an additional data object with the script. This is mainly us | ||||
ed | ||||
* with the debugger as this data object is only available through the | ||||
* debugger API. | ||||
*/ | ||||
void SetData(Handle<String> data); | ||||
/** | ||||
* Returns the name value of one Script. | * Returns the name value of one Script. | |||
*/ | */ | |||
Handle<Value> GetScriptName(); | Handle<Value> GetScriptName(); | |||
/** | /** | |||
* Returns zero based line number of the code_pos location in the script. | * Returns zero based line number of the code_pos location in the script. | |||
* -1 will be returned if no information available. | * -1 will be returned if no information available. | |||
*/ | */ | |||
int GetLineNumber(int code_pos); | int GetLineNumber(int code_pos); | |||
skipping to change at line 1905 | skipping to change at line 1887 | |||
* A private symbol | * A private symbol | |||
* | * | |||
* This is an experimental feature. Use at your own risk. | * This is an experimental feature. Use at your own risk. | |||
*/ | */ | |||
class V8_EXPORT Private : public Data { | class V8_EXPORT Private : public Data { | |||
public: | public: | |||
// Returns the print name string of the private symbol, or undefined if n one. | // Returns the print name string of the private symbol, or undefined if n one. | |||
Local<Value> Name() const; | Local<Value> Name() const; | |||
// Create a private symbol. If data is not NULL, it will be the print nam e. | // Create a private symbol. If data is not NULL, it will be the print nam e. | |||
static Local<Private> New( | static Local<Private> New(Isolate *isolate, | |||
Isolate *isolate, const char* data = NULL, int length = -1); | Local<String> name = Local<String>()); | |||
private: | private: | |||
Private(); | Private(); | |||
}; | }; | |||
/** | /** | |||
* A JavaScript number value (ECMA-262, 4.3.20) | * A JavaScript number value (ECMA-262, 4.3.20) | |||
*/ | */ | |||
class V8_EXPORT Number : public Primitive { | class V8_EXPORT Number : public Primitive { | |||
public: | public: | |||
skipping to change at line 2149 | skipping to change at line 2131 | |||
Local<Value> GetConstructor(); | Local<Value> GetConstructor(); | |||
/** | /** | |||
* Returns the name of the function invoked as a constructor for this obj ect. | * Returns the name of the function invoked as a constructor for this obj ect. | |||
*/ | */ | |||
Local<String> GetConstructorName(); | Local<String> GetConstructorName(); | |||
/** Gets the number of internal fields for this Object. */ | /** Gets the number of internal fields for this Object. */ | |||
int InternalFieldCount(); | int InternalFieldCount(); | |||
/** Same as above, but works for Persistents */ | ||||
V8_INLINE static int InternalFieldCount( | ||||
const PersistentBase<Object>& object) { | ||||
return object.val_->InternalFieldCount(); | ||||
} | ||||
/** Gets the value from an internal field. */ | /** Gets the value from an internal field. */ | |||
V8_INLINE Local<Value> GetInternalField(int index); | V8_INLINE Local<Value> GetInternalField(int index); | |||
/** Sets the value in an internal field. */ | /** Sets the value in an internal field. */ | |||
void SetInternalField(int index, Handle<Value> value); | void SetInternalField(int index, Handle<Value> value); | |||
/** | /** | |||
* Gets a 2-byte-aligned native pointer from an internal field. This fiel d | * Gets a 2-byte-aligned native pointer from an internal field. This fiel d | |||
* must have been set by SetAlignedPointerInInternalField, everything els e | * must have been set by SetAlignedPointerInInternalField, everything els e | |||
* leads to undefined behavior. | * leads to undefined behavior. | |||
*/ | */ | |||
V8_INLINE void* GetAlignedPointerFromInternalField(int index); | V8_INLINE void* GetAlignedPointerFromInternalField(int index); | |||
/** Same as above, but works for Persistents */ | ||||
V8_INLINE static void* GetAlignedPointerFromInternalField( | ||||
const PersistentBase<Object>& object, int index) { | ||||
return object.val_->GetAlignedPointerFromInternalField(index); | ||||
} | ||||
/** | /** | |||
* Sets a 2-byte-aligned native pointer in an internal field. To retrieve such | * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such | |||
* a field, GetAlignedPointerFromInternalField must be used, everything e lse | * a field, GetAlignedPointerFromInternalField must be used, everything e lse | |||
* leads to undefined behavior. | * leads to undefined behavior. | |||
*/ | */ | |||
void SetAlignedPointerInInternalField(int index, void* value); | void SetAlignedPointerInInternalField(int index, void* value); | |||
// Testers for local properties. | // Testers for local properties. | |||
bool HasOwnProperty(Handle<String> key); | bool HasOwnProperty(Handle<String> key); | |||
bool HasRealNamedProperty(Handle<String> key); | bool HasRealNamedProperty(Handle<String> key); | |||
skipping to change at line 3711 | skipping to change at line 3705 | |||
*/ | */ | |||
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); | |||
typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> erro r); | typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> erro r); | |||
// --- Tracing --- | ||||
typedef void (*LogEventCallback)(const char* name, int event); | ||||
/** | /** | |||
* Create new error objects by calling the corresponding error object | * Create new error objects by calling the corresponding error object | |||
* constructor with the message. | * constructor with the message. | |||
*/ | */ | |||
class V8_EXPORT Exception { | class V8_EXPORT Exception { | |||
public: | public: | |||
static Local<Value> RangeError(Handle<String> message); | static Local<Value> RangeError(Handle<String> message); | |||
static Local<Value> ReferenceError(Handle<String> message); | static Local<Value> ReferenceError(Handle<String> message); | |||
static Local<Value> SyntaxError(Handle<String> message); | static Local<Value> SyntaxError(Handle<String> message); | |||
static Local<Value> TypeError(Handle<String> message); | static Local<Value> TypeError(Handle<String> message); | |||
skipping to change at line 4093 | skipping to change at line 4091 | |||
* Request garbage collection in this Isolate. It is only valid to call t his | * Request garbage collection in this Isolate. It is only valid to call t his | |||
* function if --expose_gc was specified. | * function if --expose_gc was specified. | |||
* | * | |||
* This should only be used for testing purposes and not to enforce a gar bage | * This should only be used for testing purposes and not to enforce a gar bage | |||
* collection schedule. It has strong negative impact on the garbage | * collection schedule. It has strong negative impact on the garbage | |||
* collection performance. Use IdleNotification() or LowMemoryNotificatio n() | * collection performance. Use IdleNotification() or LowMemoryNotificatio n() | |||
* instead to influence the garbage collection schedule. | * instead to influence the garbage collection schedule. | |||
*/ | */ | |||
void RequestGarbageCollectionForTesting(GarbageCollectionType type); | void RequestGarbageCollectionForTesting(GarbageCollectionType type); | |||
/** | ||||
* Set the callback to invoke for logging event. | ||||
*/ | ||||
void SetEventLogger(LogEventCallback that); | ||||
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); | |||
void SetObjectGroupId(internal::Object** object, UniqueId id); | void SetObjectGroupId(internal::Object** object, UniqueId id); | |||
void SetReferenceFromGroup(UniqueId id, internal::Object** object); | void SetReferenceFromGroup(UniqueId id, internal::Object** object); | |||
skipping to change at line 5296 | skipping to change at line 5299 | |||
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 = 0 * kApiPointerSize; | static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize; | |||
static const int kIsolateRootsOffset = 5 * 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 = 142; | static const int kEmptyStringRootIndex = 144; | |||
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; | |||
static const int kNodeStateIsPendingValue = 3; | static const int kNodeStateIsPendingValue = 3; | |||
static const int kNodeStateIsNearDeathValue = 4; | static const int kNodeStateIsNearDeathValue = 4; | |||
static const int kNodeIsIndependentShift = 4; | static const int kNodeIsIndependentShift = 4; | |||
static const int kNodeIsPartiallyDependentShift = 5; | static const int kNodeIsPartiallyDependentShift = 5; | |||
End of changes. 14 change blocks. | ||||
28 lines changed or deleted | 28 lines changed or added | |||