v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 137 | skipping to change at line 137 | |||
class ObjectTemplate; | class ObjectTemplate; | |||
class Data; | class Data; | |||
class AccessorInfo; | class AccessorInfo; | |||
class StackTrace; | class StackTrace; | |||
class StackFrame; | class StackFrame; | |||
namespace internal { | namespace internal { | |||
class Arguments; | class Arguments; | |||
class Object; | class Object; | |||
class Heap; | ||||
class Top; | class Top; | |||
} | } | |||
// --- W e a k H a n d l e s | // --- W e a k H a n d l e s | |||
/** | /** | |||
* A weak reference callback function. | * A weak reference callback function. | |||
* | * | |||
* \param object the weak global object to be reclaimed by the garbage coll ector | * \param object the weak global object to be reclaimed by the garbage coll ector | |||
skipping to change at line 507 | skipping to change at line 508 | |||
/** | /** | |||
* Pre-compilation data that can be associated with a script. This | * Pre-compilation data that can be associated with a script. This | |||
* data can be calculated for a script in advance of actually | * data can be calculated for a script in advance of actually | |||
* compiling it, and can be stored between compilations. When script | * compiling it, and can be stored between compilations. When script | |||
* data is given to the compile method compilation will be faster. | * data is given to the compile method compilation will be faster. | |||
*/ | */ | |||
class V8EXPORT ScriptData { // NOLINT | class V8EXPORT ScriptData { // NOLINT | |||
public: | public: | |||
virtual ~ScriptData() { } | virtual ~ScriptData() { } | |||
/** | /** | |||
* Pre-compiles the specified script (context-independent). | * Pre-compiles the specified script (context-independent). | |||
* | * | |||
* \param input Pointer to UTF-8 script source code. | * \param input Pointer to UTF-8 script source code. | |||
* \param length Length of UTF-8 script source code. | * \param length Length of UTF-8 script source code. | |||
*/ | */ | |||
static ScriptData* PreCompile(const char* input, int length); | static ScriptData* PreCompile(const char* input, int length); | |||
/** | /** | |||
* Pre-compiles the specified script (context-independent). | ||||
* | ||||
* NOTE: Pre-compilation using this method cannot happen on another threa | ||||
d | ||||
* without using Lockers. | ||||
* | ||||
* \param source Script source code. | ||||
*/ | ||||
static ScriptData* PreCompile(Handle<String> source); | ||||
/** | ||||
* Load previous pre-compilation data. | * Load previous pre-compilation data. | |||
* | * | |||
* \param data Pointer to data returned by a call to Data() of a previous | * \param data Pointer to data returned by a call to Data() of a previous | |||
* ScriptData. Ownership is not transferred. | * ScriptData. Ownership is not transferred. | |||
* \param length Length of data. | * \param length Length of data. | |||
*/ | */ | |||
static ScriptData* New(const char* data, int length); | static ScriptData* New(const char* data, int length); | |||
/** | /** | |||
* Returns the length of Data(). | * Returns the length of Data(). | |||
skipping to change at line 1010 | skipping to change at line 1022 | |||
bool IsExternal() const; | bool IsExternal() const; | |||
/** | /** | |||
* Returns true if the string is both external and ascii | * Returns true if the string is both external and ascii | |||
*/ | */ | |||
bool IsExternalAscii() const; | bool IsExternalAscii() const; | |||
class V8EXPORT ExternalStringResourceBase { | class V8EXPORT ExternalStringResourceBase { | |||
public: | public: | |||
virtual ~ExternalStringResourceBase() {} | virtual ~ExternalStringResourceBase() {} | |||
protected: | protected: | |||
ExternalStringResourceBase() {} | ExternalStringResourceBase() {} | |||
/** | ||||
* Internally V8 will call this Dispose method when the external string | ||||
* resource is no longer needed. The default implementation will use th | ||||
e | ||||
* delete operator. This method can be overridden in subclasses to | ||||
* control how allocated external string resources are disposed. | ||||
*/ | ||||
virtual void Dispose() { delete this; } | ||||
private: | private: | |||
// Disallow copying and assigning. | // Disallow copying and assigning. | |||
ExternalStringResourceBase(const ExternalStringResourceBase&); | ExternalStringResourceBase(const ExternalStringResourceBase&); | |||
void operator=(const ExternalStringResourceBase&); | void operator=(const ExternalStringResourceBase&); | |||
friend class v8::internal::Heap; | ||||
}; | }; | |||
/** | /** | |||
* An ExternalStringResource is a wrapper around a two-byte string | * An ExternalStringResource is a wrapper around a two-byte string | |||
* buffer that resides outside V8's heap. Implement an | * buffer that resides outside V8's heap. Implement an | |||
* ExternalStringResource to manage the life cycle of the underlying | * ExternalStringResource to manage the life cycle of the underlying | |||
* buffer. Note that the string data must be immutable. | * buffer. Note that the string data must be immutable. | |||
*/ | */ | |||
class V8EXPORT ExternalStringResource | class V8EXPORT ExternalStringResource | |||
: public ExternalStringResourceBase { | : public ExternalStringResourceBase { | |||
public: | public: | |||
/** | /** | |||
* Override the destructor to manage the life cycle of the underlying | * Override the destructor to manage the life cycle of the underlying | |||
* buffer. | * buffer. | |||
*/ | */ | |||
virtual ~ExternalStringResource() {} | virtual ~ExternalStringResource() {} | |||
/** The string data from the underlying buffer.*/ | ||||
/** | ||||
* The string data from the underlying buffer. | ||||
*/ | ||||
virtual const uint16_t* data() const = 0; | virtual const uint16_t* data() const = 0; | |||
/** The length of the string. That is, the number of two-byte character | ||||
s.*/ | /** | |||
* The length of the string. That is, the number of two-byte characters | ||||
. | ||||
*/ | ||||
virtual size_t length() const = 0; | virtual size_t length() const = 0; | |||
protected: | protected: | |||
ExternalStringResource() {} | ExternalStringResource() {} | |||
}; | }; | |||
/** | /** | |||
* An ExternalAsciiStringResource is a wrapper around an ascii | * An ExternalAsciiStringResource is a wrapper around an ascii | |||
* string buffer that resides outside V8's heap. Implement an | * string buffer that resides outside V8's heap. Implement an | |||
* ExternalAsciiStringResource to manage the life cycle of the | * ExternalAsciiStringResource to manage the life cycle of the | |||
* underlying buffer. Note that the string data must be immutable | * underlying buffer. Note that the string data must be immutable | |||
* and that the data must be strict 7-bit ASCII, not Latin1 or | * and that the data must be strict 7-bit ASCII, not Latin1 or | |||
skipping to change at line 1107 | skipping to change at line 1138 | |||
/** | /** | |||
* Creates a new string by concatenating the left and the right strings | * Creates a new string by concatenating the left and the right strings | |||
* passed in as parameters. | * passed in as parameters. | |||
*/ | */ | |||
static Local<String> Concat(Handle<String> left, Handle<String>right); | static Local<String> Concat(Handle<String> left, Handle<String>right); | |||
/** | /** | |||
* Creates a new external string using the data defined in the given | * Creates a new external string using the data defined in the given | |||
* resource. When the external string is no longer live on V8's heap the | * resource. When the external string is no longer live on V8's heap the | |||
* resource will be disposed. If a disposal callback has been set using | * resource will be disposed by calling its Dispose method. The caller of | |||
* SetExternalStringDiposeCallback this callback will be called to dispos | * this function should not otherwise delete or modify the resource. Neit | |||
e | her | |||
* the resource. Otherwise, V8 will dispose the resource using the C++ de | * should the underlying buffer be deallocated or modified except through | |||
lete | the | |||
* operator. The caller of this function should not otherwise delete or | * destructor of the external string resource. | |||
* modify the resource. Neither should the underlying buffer be deallocat | ||||
ed | ||||
* or modified except through the destructor of the external string resou | ||||
rce. | ||||
*/ | */ | |||
static Local<String> NewExternal(ExternalStringResource* resource); | static Local<String> NewExternal(ExternalStringResource* resource); | |||
/** | /** | |||
* Associate an external string resource with this string by transforming it | * Associate an external string resource with this string by transforming it | |||
* in place so that existing references to this string in the JavaScript heap | * in place so that existing references to this string in the JavaScript heap | |||
* will use the external string resource. The external string resource's | * will use the external string resource. The external string resource's | |||
* character contents needs to be equivalent to this string. | * character contents needs to be equivalent to this string. | |||
* Returns true if the string has been changed to be an external string. | * Returns true if the string has been changed to be an external string. | |||
* The string is not modified if the operation fails. See NewExternal for | * The string is not modified if the operation fails. See NewExternal for | |||
* information on the lifetime of the resource. | * information on the lifetime of the resource. | |||
*/ | */ | |||
bool MakeExternal(ExternalStringResource* resource); | bool MakeExternal(ExternalStringResource* resource); | |||
/** | /** | |||
* Creates a new external string using the ascii data defined in the give n | * Creates a new external string using the ascii data defined in the give n | |||
* resource. When the external string is no longer live on V8's heap the | * resource. When the external string is no longer live on V8's heap the | |||
* resource will be disposed. If a disposal callback has been set using | * resource will be disposed by calling its Dispose method. The caller of | |||
* SetExternalStringDiposeCallback this callback will be called to dispos | * this function should not otherwise delete or modify the resource. Neit | |||
e | her | |||
* the resource. Otherwise, V8 will dispose the resource using the C++ de | * should the underlying buffer be deallocated or modified except through | |||
lete | the | |||
* operator. The caller of this function should not otherwise delete or | * destructor of the external string resource. | |||
* modify the resource. Neither should the underlying buffer be deallocat | ||||
ed | ||||
* or modified except through the destructor of the external string resou | ||||
rce. | ||||
*/ | */ | |||
static Local<String> NewExternal(ExternalAsciiStringResource* resource); | static Local<String> NewExternal(ExternalAsciiStringResource* resource); | |||
/** | /** | |||
* Associate an external string resource with this string by transforming it | * Associate an external string resource with this string by transforming it | |||
* in place so that existing references to this string in the JavaScript heap | * in place so that existing references to this string in the JavaScript heap | |||
* will use the external string resource. The external string resource's | * will use the external string resource. The external string resource's | |||
* character contents needs to be equivalent to this string. | * character contents needs to be equivalent to this string. | |||
* Returns true if the string has been changed to be an external string. | * Returns true if the string has been changed to be an external string. | |||
* The string is not modified if the operation fails. See NewExternal for | * The string is not modified if the operation fails. See NewExternal for | |||
skipping to change at line 1234 | skipping to change at line 1261 | |||
// Disallow copying and assigning. | // Disallow copying and assigning. | |||
Value(const Value&); | Value(const Value&); | |||
void operator=(const Value&); | void operator=(const Value&); | |||
}; | }; | |||
private: | private: | |||
void VerifyExternalStringResource(ExternalStringResource* val) const; | void VerifyExternalStringResource(ExternalStringResource* val) const; | |||
static void CheckCast(v8::Value* obj); | static void CheckCast(v8::Value* obj); | |||
}; | }; | |||
typedef void (*ExternalStringDiposeCallback) | ||||
(String::ExternalStringResourceBase* resource); | ||||
/** | /** | |||
* A JavaScript number value (ECMA-262, 4.3.20) | * A JavaScript number value (ECMA-262, 4.3.20) | |||
*/ | */ | |||
class V8EXPORT Number : public Primitive { | class V8EXPORT Number : public Primitive { | |||
public: | public: | |||
double Value() const; | double Value() const; | |||
static Local<Number> New(double value); | static Local<Number> New(double value); | |||
static inline Number* Cast(v8::Value* obj); | static inline Number* Cast(v8::Value* obj); | |||
private: | private: | |||
Number(); | Number(); | |||
skipping to change at line 2408 | skipping to change at line 2432 | |||
*/ | */ | |||
static bool AddMessageListener(MessageCallback that, | static bool AddMessageListener(MessageCallback that, | |||
Handle<Value> data = Handle<Value>()); | 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); | |||
/** | /** | |||
* Set a callback to be called when an external string is no longer live | ||||
on | ||||
* V8's heap. The resource will no longer be needed by V8 and the embedde | ||||
r | ||||
* can dispose of if. If this callback is not set V8 will free the resour | ||||
ce | ||||
* using the C++ delete operator. | ||||
*/ | ||||
static void SetExternalStringDiposeCallback( | ||||
ExternalStringDiposeCallback that); | ||||
/** | ||||
* Sets V8 flags from a string. | * Sets V8 flags from a string. | |||
*/ | */ | |||
static void SetFlagsFromString(const char* str, int length); | static void SetFlagsFromString(const char* str, int length); | |||
/** | /** | |||
* Sets V8 flags from the command line. | * Sets V8 flags from the command line. | |||
*/ | */ | |||
static void SetFlagsFromCommandLine(int* argc, | static void SetFlagsFromCommandLine(int* argc, | |||
char** argv, | char** argv, | |||
bool remove_flags); | bool remove_flags); | |||
End of changes. 13 change blocks. | ||||
38 lines changed or deleted | 48 lines changed or added | |||