v8.h   v8.h 
skipping to change at line 54 skipping to change at line 54
typedef int int32_t; typedef int int32_t;
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
typedef unsigned short uint16_t; // NOLINT typedef unsigned short uint16_t; // NOLINT
typedef long long int64_t; // NOLINT typedef long long int64_t; // NOLINT
// Setup for Windows DLL export/import. When building the V8 DLL the // Setup for Windows DLL export/import. When building the V8 DLL the
// BUILDING_V8_SHARED needs to be defined. When building a program which us es // BUILDING_V8_SHARED needs to be defined. When building a program which us es
// the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
// static library or building a program which uses the V8 static library ne ither // static library or building a program which uses the V8 static library ne ither
// BUILDING_V8_SHARED nor USING_V8_SHARED should be defined. // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
// The reason for having both EXPORT and EXPORT_INLINE is that classes whic // The reason for having both V8EXPORT and V8EXPORT_INLINE is that classes
h which
// have their code inside this header file needs to have __declspec(dllexpo // have their code inside this header file need to have __declspec(dllexpor
rt) t)
// when building the DLL but cannot have __declspec(dllimport) when buildin g // when building the DLL but cannot have __declspec(dllimport) when buildin g
// a program which uses the DLL. // a program which uses the DLL.
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED) #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check t he\ #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check t he\
build configuration to ensure that at most one of these is set build configuration to ensure that at most one of these is set
#endif #endif
#ifdef BUILDING_V8_SHARED #ifdef BUILDING_V8_SHARED
#define EXPORT __declspec(dllexport) #define V8EXPORT __declspec(dllexport)
#define EXPORT_INLINE __declspec(dllexport) #define V8EXPORT_INLINE __declspec(dllexport)
#elif USING_V8_SHARED #elif USING_V8_SHARED
#define EXPORT __declspec(dllimport) #define V8EXPORT __declspec(dllimport)
#define EXPORT_INLINE #define V8EXPORT_INLINE
#else #else
#define EXPORT #define V8EXPORT
#define EXPORT_INLINE #define V8EXPORT_INLINE
#endif // BUILDING_V8_SHARED #endif // BUILDING_V8_SHARED
#else // _WIN32 #else // _WIN32
#include <stdint.h> #include <stdint.h>
// Setup for Linux shared library export. There is no need to destinguish // Setup for Linux shared library export. There is no need to destinguish
// neither between building or using the V8 shared library nor between usin g // neither between building or using the V8 shared library nor between usin g
// the shared or static V8 library as there is on Windows. Therefore there is // the shared or static V8 library as there is on Windows. Therefore there is
// no checking of BUILDING_V8_SHARED and USING_V8_SHARED. // no checking of BUILDING_V8_SHARED and USING_V8_SHARED.
#if defined(__GNUC__) && (__GNUC__ >= 4) #if defined(__GNUC__) && (__GNUC__ >= 4)
#define EXPORT __attribute__ ((visibility("default"))) #define V8EXPORT __attribute__ ((visibility("default")))
#define EXPORT_INLINE __attribute__ ((visibility("default"))) #define V8EXPORT_INLINE __attribute__ ((visibility("default")))
#else // defined(__GNUC__) && (__GNUC__ >= 4) #else // defined(__GNUC__) && (__GNUC__ >= 4)
#define EXPORT #define V8EXPORT
#define EXPORT_INLINE #define V8EXPORT_INLINE
#endif // defined(__GNUC__) && (__GNUC__ >= 4) #endif // defined(__GNUC__) && (__GNUC__ >= 4)
#endif // _WIN32 #endif // _WIN32
/** /**
* The v8 JavaScript engine. * The v8 JavaScript engine.
*/ */
namespace v8 { namespace v8 {
class Context; class Context;
skipping to change at line 164 skipping to change at line 164
* handles can be used when storing objects across several independent * handles can be used when storing objects across several independent
* operations and have to be explicitly deallocated when they're no * operations and have to be explicitly deallocated when they're no
* longer used. * longer used.
* *
* It is safe to extract the object stored in the handle by * It is safe to extract the object stored in the handle by
* dereferencing the handle (for instance, to extract the Object* from * dereferencing the handle (for instance, to extract the Object* from
* an Handle<Object>); the value will still be governed by a handle * an Handle<Object>); the value will still be governed by a handle
* behind the scenes and the same rules apply to these values as to * behind the scenes and the same rules apply to these values as to
* their handles. * their handles.
*/ */
template <class T> class EXPORT_INLINE Handle { template <class T> class V8EXPORT_INLINE Handle {
public: public:
/** /**
* Creates an empty handle. * Creates an empty handle.
*/ */
Handle(); Handle();
/** /**
* Creates a new handle for the specified value. * Creates a new handle for the specified value.
*/ */
skipping to change at line 251 skipping to change at line 251
T* val_; T* val_;
}; };
/** /**
* A light-weight stack-allocated object handle. All operations * A light-weight stack-allocated object handle. All operations
* that return objects from within v8 return them in local handles. They * that return objects from within v8 return them in local handles. They
* are created within HandleScopes, and all local handles allocated within a * are created within HandleScopes, and all local handles allocated within a
* handle scope are destroyed when the handle scope is destroyed. Hence it * handle scope are destroyed when the handle scope is destroyed. Hence it
* is not necessary to explicitly deallocate local handles. * is not necessary to explicitly deallocate local handles.
*/ */
template <class T> class EXPORT_INLINE Local : public Handle<T> { template <class T> class V8EXPORT_INLINE Local : public Handle<T> {
public: public:
Local(); Local();
template <class S> inline Local(Local<S> that) template <class S> inline Local(Local<S> that)
: Handle<T>(reinterpret_cast<T*>(*that)) { : Handle<T>(reinterpret_cast<T*>(*that)) {
/** /**
* This check fails when trying to convert between incompatible * This check fails when trying to convert between incompatible
* handles. For example, converting from a Handle<String> to a * handles. For example, converting from a Handle<String> to a
* Handle<Number>. * Handle<Number>.
*/ */
TYPE_CHECK(T, S); TYPE_CHECK(T, S);
skipping to change at line 293 skipping to change at line 293
* 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 Persistent::New and existing handles can * cell can be created using Persistent::New and existing handles can
* be disposed using Persistent::Dispose. Since persistent handles * be disposed using Persistent::Dispose. Since persistent handles
* are passed by value you may have many persistent handle objects * are passed by value you may have many persistent handle objects
* that point to the same storage cell. For instance, if you pass a * that point to the same storage cell. For instance, if you pass a
* persistent handle as an argument to a function you will not get two * persistent handle as an argument to a function you will not get two
* different storage cells but rather two references to the same * different storage cells but rather two references to the same
* storage cell. * storage cell.
*/ */
template <class T> class EXPORT_INLINE Persistent : public Handle<T> { template <class T> class V8EXPORT_INLINE Persistent : public Handle<T> {
public: public:
/** /**
* Creates an empty persistent handle that doesn't point to any * Creates an empty persistent handle that doesn't point to any
* storage cell. * storage cell.
*/ */
Persistent(); Persistent();
/** /**
* Creates a persistent handle for the same storage cell as the * Creates a persistent handle for the same storage cell as the
skipping to change at line 391 skipping to change at line 391
* deleted or another handle scope is created. If there is already a * deleted or another handle scope is created. If there is already a
* handle scope and a new one is created, all allocations will take * handle scope and a new one is created, all allocations will take
* place in the new handle scope until it is deleted. After that, * place in the new handle scope until it is deleted. After that,
* new handles will again be allocated in the original handle scope. * new handles will again be allocated in the original handle scope.
* *
* After the handle scope of a local handle has been deleted the * After the handle scope of a local handle has been deleted the
* garbage collector will no longer track the object stored in the * garbage collector will no longer track the object stored in the
* handle and may deallocate it. The behavior of accessing a handle * handle and may deallocate it. The behavior of accessing a handle
* for which the handle scope has been deleted is undefined. * for which the handle scope has been deleted is undefined.
*/ */
class EXPORT HandleScope { class V8EXPORT HandleScope {
public: public:
HandleScope(); HandleScope();
~HandleScope(); ~HandleScope();
/** /**
* Closes the handle scope and returns the value as a handle in the * Closes the handle scope and returns the value as a handle in the
* previous scope, which is the new current scope after the call. * previous scope, which is the new current scope after the call.
*/ */
template <class T> Local<T> Close(Handle<T> value); template <class T> Local<T> Close(Handle<T> value);
skipping to change at line 423 skipping to change at line 423
private: private:
// Make it impossible to create heap-allocated or illegal handle // Make it impossible to create heap-allocated or illegal handle
// scopes by disallowing certain operations. // scopes by disallowing certain operations.
HandleScope(const HandleScope&); HandleScope(const HandleScope&);
void operator=(const HandleScope&); void operator=(const HandleScope&);
void* operator new(size_t size); void* operator new(size_t size);
void operator delete(void*, size_t); void operator delete(void*, size_t);
// This Data class is accessible internally through a typedef in the // This Data class is accessible internally through a typedef in the
// ImplementationUtilities class. // ImplementationUtilities class.
class EXPORT Data { class V8EXPORT Data {
public: public:
int extensions; int extensions;
void** next; void** next;
void** limit; void** limit;
inline void Initialize() { inline void Initialize() {
extensions = -1; extensions = -1;
next = limit = NULL; next = limit = NULL;
} }
}; };
skipping to change at line 449 skipping to change at line 449
void** RawClose(void** value); void** RawClose(void** value);
friend class ImplementationUtilities; friend class ImplementationUtilities;
}; };
// --- S p e c i a l o b j e c t s --- // --- S p e c i a l o b j e c t s ---
/** /**
* The superclass of values and API object templates. * The superclass of values and API object templates.
*/ */
class EXPORT Data { class V8EXPORT Data {
private: private:
Data(); Data();
}; };
/** /**
* 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 EXPORT ScriptData { // NOLINT class V8EXPORT ScriptData { // NOLINT
public: public:
virtual ~ScriptData() { } virtual ~ScriptData() { }
static ScriptData* PreCompile(const char* input, int length); static ScriptData* PreCompile(const char* input, int length);
static ScriptData* New(unsigned* data, int length); static ScriptData* New(unsigned* data, int length);
virtual int Length() = 0; virtual int Length() = 0;
virtual unsigned* Data() = 0; virtual unsigned* Data() = 0;
}; };
/** /**
* The origin, within a file, of a script. * The origin, within a file, of a script.
*/ */
class EXPORT ScriptOrigin { class V8EXPORT ScriptOrigin {
public: public:
ScriptOrigin(Handle<Value> resource_name, ScriptOrigin(Handle<Value> resource_name,
Handle<Integer> resource_line_offset = Handle<Integer>(), Handle<Integer> resource_line_offset = Handle<Integer>(),
Handle<Integer> resource_column_offset = Handle<Integer>()) Handle<Integer> resource_column_offset = Handle<Integer>())
: resource_name_(resource_name), : resource_name_(resource_name),
resource_line_offset_(resource_line_offset), resource_line_offset_(resource_line_offset),
resource_column_offset_(resource_column_offset) { } resource_column_offset_(resource_column_offset) { }
inline Handle<Value> ResourceName() const; inline Handle<Value> ResourceName() const;
inline Handle<Integer> ResourceLineOffset() const; inline Handle<Integer> ResourceLineOffset() const;
inline Handle<Integer> ResourceColumnOffset() const; inline Handle<Integer> ResourceColumnOffset() const;
private: private:
Handle<Value> resource_name_; Handle<Value> resource_name_;
Handle<Integer> resource_line_offset_; Handle<Integer> resource_line_offset_;
Handle<Integer> resource_column_offset_; Handle<Integer> resource_column_offset_;
}; };
/** /**
* A compiled JavaScript script. * A compiled JavaScript script.
*/ */
class EXPORT Script { class V8EXPORT Script {
public: public:
/** /**
* Compiles the specified script. The ScriptOrigin* and ScriptData* * Compiles the specified script. The ScriptOrigin* and ScriptData*
* parameters are owned by the caller of Script::Compile. No * parameters are owned by the caller of Script::Compile. No
* references to these objects are kept after compilation finishes. * references to these objects are kept after compilation finishes.
*/ */
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);
skipping to change at line 516 skipping to change at line 516
* 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.
*/ */
static Local<Script> Compile(Handle<String> source, static Local<Script> Compile(Handle<String> source,
Handle<Value> file_name); Handle<Value> file_name);
/** /**
* Runs the script returning the resulting value. * Runs the script returning the resulting value.
*/ */
Local<Value> Run(); Local<Value> Run();
/**
* Returns the script id value.
*/
Local<Value> Id();
}; };
/** /**
* An error message. * An error message.
*/ */
class EXPORT Message { class V8EXPORT Message {
public: public:
Local<String> Get() const; Local<String> Get() const;
Local<String> GetSourceLine() const; Local<String> GetSourceLine() const;
Handle<Value> GetScriptResourceName() const; Handle<Value> GetScriptResourceName() const;
/** /**
* Returns the number, 1-based, of the line where the error occurred. * Returns the number, 1-based, of the line where the error occurred.
*/ */
int GetLineNumber() const; int GetLineNumber() const;
skipping to change at line 566 skipping to change at line 571
// TODO(1245381): Print to a string instead of on a FILE. // TODO(1245381): Print to a string instead of on a FILE.
static void PrintCurrentStackTrace(FILE* out); static void PrintCurrentStackTrace(FILE* out);
}; };
// --- V a l u e --- // --- V a l u e ---
/** /**
* The superclass of all JavaScript values and objects. * The superclass of all JavaScript values and objects.
*/ */
class EXPORT Value : public Data { class V8EXPORT Value : public Data {
public: public:
/** /**
* Returns true if this value is the undefined value. See ECMA-262 * Returns true if this value is the undefined value. See ECMA-262
* 4.3.10. * 4.3.10.
*/ */
bool IsUndefined() const; bool IsUndefined() const;
/** /**
* Returns true if this value is the null value. See ECMA-262 * Returns true if this value is the null value. See ECMA-262
skipping to change at line 666 skipping to change at line 671
int32_t Int32Value() const; int32_t Int32Value() const;
/** JS == */ /** JS == */
bool Equals(Handle<Value> that) const; bool Equals(Handle<Value> that) const;
bool StrictEquals(Handle<Value> that) const; bool StrictEquals(Handle<Value> that) const;
}; };
/** /**
* The superclass of primitive values. See ECMA-262 4.3.2. * The superclass of primitive values. See ECMA-262 4.3.2.
*/ */
class EXPORT Primitive : public Value { }; class V8EXPORT Primitive : public Value { };
/** /**
* A primitive boolean value (ECMA-262, 4.3.14). Either the true * A primitive boolean value (ECMA-262, 4.3.14). Either the true
* or false value. * or false value.
*/ */
class EXPORT Boolean : public Primitive { class V8EXPORT Boolean : public Primitive {
public: public:
bool Value() const; bool Value() const;
static inline Handle<Boolean> New(bool value); static inline Handle<Boolean> New(bool value);
}; };
/** /**
* A JavaScript string value (ECMA-262, 4.3.17). * A JavaScript string value (ECMA-262, 4.3.17).
*/ */
class EXPORT String : public Primitive { class V8EXPORT String : public Primitive {
public: public:
/** /**
* Returns the number of characters in this string. * Returns the number of characters in this string.
*/ */
int Length() const; int Length() const;
/** /**
* Returns the number of bytes in the UTF-8 encoded * Returns the number of bytes in the UTF-8 encoded
* representation of this string. * representation of this string.
skipping to change at line 717 skipping to change at line 722
* copying begins. * copying begins.
* \param length The number of bytes to copy from the string. * \param length The number of bytes to copy from the string.
* \return The number of characters copied to the buffer * \return The number of characters copied to the buffer
* excluding the NULL terminator. * excluding the NULL terminator.
*/ */
int Write(uint16_t* buffer, int start = 0, int length = -1) const; // UT F-16 int Write(uint16_t* buffer, int start = 0, int length = -1) const; // UT F-16
int WriteAscii(char* buffer, int start = 0, int length = -1) const; // A SCII int WriteAscii(char* buffer, int start = 0, int length = -1) const; // A SCII
int WriteUtf8(char* buffer, int length = -1) const; // UTF-8 int WriteUtf8(char* buffer, int length = -1) const; // UTF-8
/** /**
* A zero length string.
*/
static v8::Local<v8::String> Empty();
/**
* Returns true if the string is external * Returns true if the string is external
*/ */
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;
/** /**
* 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 EXPORT ExternalStringResource { // NOLINT class V8EXPORT ExternalStringResource { // NOLINT
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 character s.*/
virtual size_t length() const = 0; virtual size_t length() const = 0;
skipping to change at line 761 skipping to change at line 771
* 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
* UTF-8, which would require special treatment internally in the * UTF-8, which would require special treatment internally in the
* engine and, in the case of UTF-8, do not allow efficient indexing. * engine and, in the case of UTF-8, do not allow efficient indexing.
* Use String::New or convert to 16 bit data for non-ASCII. * Use String::New or convert to 16 bit data for non-ASCII.
*/ */
class EXPORT ExternalAsciiStringResource { // NOLINT class V8EXPORT ExternalAsciiStringResource { // NOLINT
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 ~ExternalAsciiStringResource() {} virtual ~ExternalAsciiStringResource() {}
/** The string data from the underlying buffer.*/ /** The string data from the underlying buffer.*/
virtual const char* data() const = 0; virtual const char* data() const = 0;
/** The number of ascii characters in the string.*/ /** The number of ascii characters in the string.*/
virtual size_t length() const = 0; virtual size_t length() const = 0;
skipping to change at line 859 skipping to change at line 869
bool MakeExternal(ExternalAsciiStringResource* resource); bool MakeExternal(ExternalAsciiStringResource* resource);
/** Creates an undetectable string from the supplied ascii or utf-8 data. */ /** Creates an undetectable string from the supplied ascii or utf-8 data. */
static Local<String> NewUndetectable(const char* data, int length = -1); static Local<String> NewUndetectable(const char* data, int length = -1);
/** Creates an undetectable string from the supplied utf-16 data.*/ /** Creates an undetectable string from the supplied utf-16 data.*/
static Local<String> NewUndetectable(const uint16_t* data, int length = - 1); static Local<String> NewUndetectable(const uint16_t* data, int length = - 1);
/** /**
* Converts an object to a utf8-encoded character array. Useful if * Converts an object to a utf8-encoded character array. Useful if
* you want to print the object. * you want to print the object. If conversion to a string fails
* (eg. due to an exception in the toString() method of the object)
* then the length() method returns 0 and the * operator returns
* NULL.
*/ */
class EXPORT Utf8Value { class V8EXPORT Utf8Value {
public: public:
explicit Utf8Value(Handle<v8::Value> obj); explicit Utf8Value(Handle<v8::Value> obj);
~Utf8Value(); ~Utf8Value();
char* operator*() const { return str_; } char* operator*() const { return str_; }
int length() { return length_; } int length() { return length_; }
private: private:
char* str_; char* str_;
int length_; int length_;
// Disallow copying and assigning. // Disallow copying and assigning.
Utf8Value(const Utf8Value&); Utf8Value(const Utf8Value&);
void operator=(const Utf8Value&); void operator=(const Utf8Value&);
}; };
/** /**
* Converts an object to an ascii string. * Converts an object to an ascii string.
* Useful if you want to print the object. * Useful if you want to print the object.
* If conversion to a string fails (eg. due to an exception in the toStri
ng()
* method of the object) then the length() method returns 0 and the * ope
rator
* returns NULL.
*/ */
class EXPORT AsciiValue { class V8EXPORT AsciiValue {
public: public:
explicit AsciiValue(Handle<v8::Value> obj); explicit AsciiValue(Handle<v8::Value> obj);
~AsciiValue(); ~AsciiValue();
char* operator*() const { return str_; } char* operator*() const { return str_; }
int length() { return length_; } int length() { return length_; }
private: private:
char* str_; char* str_;
int length_; int length_;
// Disallow copying and assigning. // Disallow copying and assigning.
AsciiValue(const AsciiValue&); AsciiValue(const AsciiValue&);
void operator=(const AsciiValue&); void operator=(const AsciiValue&);
}; };
/** /**
* Converts an object to a two-byte string. * Converts an object to a two-byte string.
* If conversion to a string fails (eg. due to an exception in the toStri
ng()
* method of the object) then the length() method returns 0 and the * ope
rator
* returns NULL.
*/ */
class EXPORT Value { class V8EXPORT Value {
public: public:
explicit Value(Handle<v8::Value> obj); explicit Value(Handle<v8::Value> obj);
~Value(); ~Value();
uint16_t* operator*() const { return str_; } uint16_t* operator*() const { return str_; }
int length() { return length_; } int length() { return length_; }
private: private:
uint16_t* str_; uint16_t* str_;
int length_; int length_;
// Disallow copying and assigning. // Disallow copying and assigning.
Value(const Value&); Value(const Value&);
void operator=(const Value&); void operator=(const Value&);
}; };
}; };
/** /**
* A JavaScript number value (ECMA-262, 4.3.20) * A JavaScript number value (ECMA-262, 4.3.20)
*/ */
class EXPORT 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 Number* Cast(v8::Value* obj); static Number* Cast(v8::Value* obj);
private: private:
Number(); Number();
}; };
/** /**
* A JavaScript value representing a signed integer. * A JavaScript value representing a signed integer.
*/ */
class EXPORT Integer : public Number { class V8EXPORT Integer : public Number {
public: public:
static Local<Integer> New(int32_t value); static Local<Integer> New(int32_t value);
int64_t Value() const; int64_t Value() const;
static Integer* Cast(v8::Value* obj); static Integer* Cast(v8::Value* obj);
private: private:
Integer(); Integer();
}; };
/** /**
* A JavaScript value representing a 32-bit signed integer. * A JavaScript value representing a 32-bit signed integer.
*/ */
class EXPORT Int32 : public Integer { class V8EXPORT Int32 : public Integer {
public: public:
int32_t Value() const; int32_t Value() const;
private: private:
Int32(); Int32();
}; };
/** /**
* A JavaScript value representing a 32-bit unsigned integer. * A JavaScript value representing a 32-bit unsigned integer.
*/ */
class EXPORT Uint32 : public Integer { class V8EXPORT Uint32 : public Integer {
public: public:
uint32_t Value() const; uint32_t Value() const;
private: private:
Uint32(); Uint32();
}; };
/** /**
* An instance of the built-in Date constructor (ECMA-262, 15.9). * An instance of the built-in Date constructor (ECMA-262, 15.9).
*/ */
class EXPORT Date : public Value { class V8EXPORT Date : public Value {
public: public:
static Local<Value> New(double time); static Local<Value> New(double time);
/** /**
* A specialization of Value::NumberValue that is more efficient * A specialization of Value::NumberValue that is more efficient
* because we know the structure of this object. * because we know the structure of this object.
*/ */
double NumberValue() const; double NumberValue() const;
static Date* Cast(v8::Value* obj); static Date* Cast(v8::Value* obj);
skipping to change at line 984 skipping to change at line 1003
enum PropertyAttribute { enum PropertyAttribute {
None = 0, None = 0,
ReadOnly = 1 << 0, ReadOnly = 1 << 0,
DontEnum = 1 << 1, DontEnum = 1 << 1,
DontDelete = 1 << 2 DontDelete = 1 << 2
}; };
/** /**
* A JavaScript object (ECMA-262, 4.3.3) * A JavaScript object (ECMA-262, 4.3.3)
*/ */
class EXPORT Object : public Value { class V8EXPORT Object : public Value {
public: public:
bool Set(Handle<Value> key, bool Set(Handle<Value> key,
Handle<Value> value, Handle<Value> value,
PropertyAttribute attribs = None); PropertyAttribute attribs = None);
Local<Value> Get(Handle<Value> key); Local<Value> Get(Handle<Value> key);
// TODO(1245389): Replace the type-specific versions of these // TODO(1245389): Replace the type-specific versions of these
// functions with generic ones that accept a Handle<Value> key. // functions with generic ones that accept a Handle<Value> key.
bool Has(Handle<String> key); bool Has(Handle<String> key);
bool Delete(Handle<String> key); bool Delete(Handle<String> key);
skipping to change at line 1051 skipping to change at line 1070
/** Tests for an index lookup interceptor.*/ /** Tests for an index lookup interceptor.*/
bool HasIndexedLookupInterceptor(); bool HasIndexedLookupInterceptor();
/** /**
* Turns on access check on the object if the object is an instance of * Turns on access check on the object if the object is an instance of
* a template that has access check callbacks. If an object has no * a template that has access check callbacks. If an object has no
* access check info, the object cannot be accessed by anyone. * access check info, the object cannot be accessed by anyone.
*/ */
void TurnOnAccessCheck(); void TurnOnAccessCheck();
/**
* Returns the identity hash for this object. The current implemenation u
ses
* a hidden property on the object to store the identity hash.
*/
int GetIdentityHash();
/**
* Access hidden properties on JavaScript objects. These properties are
* hidden from the executing JavaScript and only accessible through the V
8
* C++ API. Hidden properties introduced by V8 internally (for example th
e
* identity hash) are prefixed with "v8::".
*/
bool SetHiddenValue(Handle<String> key, Handle<Value> value);
Local<Value> GetHiddenValue(Handle<String> key);
bool DeleteHiddenValue(Handle<String> key);
/**
* Clone this object with a fast but shallow copy. Values will point
* to the same values as the original object.
*/
Local<Object> Clone();
static Local<Object> New(); static Local<Object> New();
static Object* Cast(Value* obj); static Object* Cast(Value* obj);
private: private:
Object(); Object();
}; };
/** /**
* An instance of the built-in array constructor (ECMA-262, 15.4.2). * An instance of the built-in array constructor (ECMA-262, 15.4.2).
*/ */
class EXPORT Array : public Object { class V8EXPORT Array : public Object {
public: public:
uint32_t Length() const; uint32_t Length() const;
static Local<Array> New(int length = 0); static Local<Array> New(int length = 0);
static Array* Cast(Value* obj); static Array* Cast(Value* obj);
private: private:
Array(); Array();
}; };
/** /**
* A JavaScript function object (ECMA-262, 15.3). * A JavaScript function object (ECMA-262, 15.3).
*/ */
class EXPORT Function : public Object { class V8EXPORT Function : public Object {
public: public:
Local<Object> NewInstance() const; Local<Object> NewInstance() const;
Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]);
void SetName(Handle<String> name); void SetName(Handle<String> name);
Handle<Value> GetName() const; Handle<Value> GetName() const;
static Function* Cast(Value* obj); static Function* Cast(Value* obj);
private: private:
Function(); Function();
}; };
/** /**
* A JavaScript value that wraps a c++ void*. This type of value is * A JavaScript value that wraps a C++ void*. This type of value is
* mainly used to associate c++ data structures with JavaScript * mainly used to associate C++ data structures with JavaScript
* objects. * objects.
*
* The Wrap function V8 will return the most optimal Value object wrapping
the
* C++ void*. The type of the value is not guaranteed to be an External obj
ect
* and no assumptions about its type should be made. To access the wrapped
* value Unwrap should be used, all other operations on that object will le
ad
* to unpredictable results.
*/ */
class EXPORT External : public Value { class V8EXPORT External : public Value {
public: public:
static Local<Value> Wrap(void* data);
static void* Unwrap(Handle<Value> obj);
static Local<External> New(void* value); static Local<External> New(void* value);
static External* Cast(Value* obj); static External* Cast(Value* obj);
void* Value() const; void* Value() const;
private: private:
External(); External();
}; };
// --- T e m p l a t e s --- // --- T e m p l a t e s ---
/** /**
* The superclass of object and function templates. * The superclass of object and function templates.
*/ */
class EXPORT Template : public Data { class V8EXPORT Template : public Data {
public: public:
/** Adds a property to each instance created by this template.*/ /** Adds a property to each instance created by this template.*/
void Set(Handle<String> name, Handle<Data> value, void Set(Handle<String> name, Handle<Data> value,
PropertyAttribute attributes = None); PropertyAttribute attributes = None);
inline void Set(const char* name, Handle<Data> value); inline void Set(const char* name, Handle<Data> value);
private: private:
Template(); Template();
friend class ObjectTemplate; friend class ObjectTemplate;
friend class FunctionTemplate; friend class FunctionTemplate;
}; };
/** /**
* The argument information given to function call callbacks. This * The argument information given to function call callbacks. This
* class provides access to information about the context of the call, * class provides access to information about the context of the call,
* including the receiver, the number and values of arguments, and * including the receiver, the number and values of arguments, and
* the holder of the function. * the holder of the function.
*/ */
class EXPORT Arguments { class V8EXPORT Arguments {
public: public:
inline int Length() const; inline int Length() const;
inline Local<Value> operator[](int i) const; inline Local<Value> operator[](int i) const;
inline Local<Function> Callee() const; inline Local<Function> Callee() const;
inline Local<Object> This() const; inline Local<Object> This() const;
inline Local<Object> Holder() const; inline Local<Object> Holder() const;
inline bool IsConstructCall() const; inline bool IsConstructCall() const;
inline Local<Value> Data() const; inline Local<Value> Data() const;
private: private:
Arguments(); Arguments();
skipping to change at line 1152 skipping to change at line 1202
Local<Function> callee_; Local<Function> callee_;
bool is_construct_call_; bool is_construct_call_;
void** values_; void** values_;
int length_; int length_;
}; };
/** /**
* The information passed to an accessor callback about the context * The information passed to an accessor callback about the context
* of the property access. * of the property access.
*/ */
class EXPORT AccessorInfo { class V8EXPORT AccessorInfo {
public: public:
inline AccessorInfo(Local<Object> self, inline AccessorInfo(Local<Object> self,
Local<Value> data, Local<Value> data,
Local<Object> holder) Local<Object> holder)
: self_(self), data_(data), holder_(holder) { } : self_(self), data_(data), holder_(holder) { }
inline Local<Value> Data() const; inline Local<Value> Data() const;
inline Local<Object> This() const; inline Local<Object> This() const;
inline Local<Object> Holder() const; inline Local<Object> Holder() const;
private: private:
Local<Object> self_; Local<Object> self_;
skipping to change at line 1392 skipping to change at line 1442
* *
* The Child function and Child instance will have the following * The Child function and Child instance will have the following
* properties: * properties:
* *
* \code * \code
* child_func.prototype.__proto__ == function.prototype; * child_func.prototype.__proto__ == function.prototype;
* child_instance.instance_accessor calls 'InstanceAccessorCallback' * child_instance.instance_accessor calls 'InstanceAccessorCallback'
* child_instance.instance_property == 3; * child_instance.instance_property == 3;
* \endcode * \endcode
*/ */
class EXPORT FunctionTemplate : public Template { class V8EXPORT FunctionTemplate : public Template {
public: public:
/** Creates a function template.*/ /** Creates a function template.*/
static Local<FunctionTemplate> New( static Local<FunctionTemplate> New(
InvocationCallback callback = 0, InvocationCallback callback = 0,
Handle<Value> data = Handle<Value>(), Handle<Value> data = Handle<Value>(),
Handle<Signature> signature = Handle<Signature>()); Handle<Signature> signature = Handle<Signature>());
/** Returns the unique function instance in the current execution context .*/ /** Returns the unique function instance in the current execution context .*/
Local<Function> GetFunction(); Local<Function> GetFunction();
/** /**
skipping to change at line 1482 skipping to change at line 1532
friend class Context; friend class Context;
friend class ObjectTemplate; friend class ObjectTemplate;
}; };
/** /**
* An ObjectTemplate is used to create objects at runtime. * An ObjectTemplate is used to create objects at runtime.
* *
* Properties added to an ObjectTemplate are added to each object * Properties added to an ObjectTemplate are added to each object
* created from the ObjectTemplate. * created from the ObjectTemplate.
*/ */
class EXPORT ObjectTemplate : public Template { class V8EXPORT ObjectTemplate : public Template {
public: public:
/** Creates an ObjectTemplate. */ /** Creates an ObjectTemplate. */
static Local<ObjectTemplate> New(); static Local<ObjectTemplate> New();
/** Creates a new instance of this template.*/ /** Creates a new instance of this template.*/
Local<Object> NewInstance(); Local<Object> NewInstance();
/** /**
* Sets an accessor on the object template. * Sets an accessor on the object template.
* *
skipping to change at line 1623 skipping to change at line 1673
private: private:
ObjectTemplate(); ObjectTemplate();
static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor); static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor);
friend class FunctionTemplate; friend class FunctionTemplate;
}; };
/** /**
* A Signature specifies which receivers and arguments a function can * A Signature specifies which receivers and arguments a function can
* legally be called with. * legally be called with.
*/ */
class EXPORT Signature : public Data { class V8EXPORT Signature : public Data {
public: public:
static Local<Signature> New(Handle<FunctionTemplate> receiver = static Local<Signature> New(Handle<FunctionTemplate> receiver =
Handle<FunctionTemplate>(), Handle<FunctionTemplate>(),
int argc = 0, int argc = 0,
Handle<FunctionTemplate> argv[] = 0); Handle<FunctionTemplate> argv[] = 0);
private: private:
Signature(); Signature();
}; };
/** /**
* A utility for determining the type of objects based on the template * A utility for determining the type of objects based on the template
* they were constructed from. * they were constructed from.
*/ */
class EXPORT TypeSwitch : public Data { class V8EXPORT TypeSwitch : public Data {
public: public:
static Local<TypeSwitch> New(Handle<FunctionTemplate> type); static Local<TypeSwitch> New(Handle<FunctionTemplate> type);
static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]); static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]);
int match(Handle<Value> value); int match(Handle<Value> value);
private: private:
TypeSwitch(); TypeSwitch();
}; };
// --- E x t e n s i o n s --- // --- E x t e n s i o n s ---
/** /**
* Ignore * Ignore
*/ */
class EXPORT Extension { // NOLINT class V8EXPORT Extension { // NOLINT
public: public:
Extension(const char* name, Extension(const char* name,
const char* source = 0, const char* source = 0,
int dep_count = 0, int dep_count = 0,
const char** deps = 0); const char** deps = 0);
virtual ~Extension() { } virtual ~Extension() { }
virtual v8::Handle<v8::FunctionTemplate> virtual v8::Handle<v8::FunctionTemplate>
GetNativeFunction(v8::Handle<v8::String> name) { GetNativeFunction(v8::Handle<v8::String> name) {
return v8::Handle<v8::FunctionTemplate>(); return v8::Handle<v8::FunctionTemplate>();
} }
skipping to change at line 1682 skipping to change at line 1732
const char* source_; const char* source_;
int dep_count_; int dep_count_;
const char** deps_; const char** deps_;
bool auto_enable_; bool auto_enable_;
// Disallow copying and assigning. // Disallow copying and assigning.
Extension(const Extension&); Extension(const Extension&);
void operator=(const Extension&); void operator=(const Extension&);
}; };
void EXPORT RegisterExtension(Extension* extension); void V8EXPORT RegisterExtension(Extension* extension);
/** /**
* Ignore * Ignore
*/ */
class EXPORT DeclareExtension { class V8EXPORT DeclareExtension {
public: public:
inline DeclareExtension(Extension* extension) { inline DeclareExtension(Extension* extension) {
RegisterExtension(extension); RegisterExtension(extension);
} }
}; };
// --- S t a t i c s --- // --- S t a t i c s ---
Handle<Primitive> EXPORT Undefined(); Handle<Primitive> V8EXPORT Undefined();
Handle<Primitive> EXPORT Null(); Handle<Primitive> V8EXPORT Null();
Handle<Boolean> EXPORT True(); Handle<Boolean> V8EXPORT True();
Handle<Boolean> EXPORT False(); Handle<Boolean> V8EXPORT False();
/** /**
* A set of constraints that specifies the limits of the runtime's * A set of constraints that specifies the limits of the runtime's
* memory use. * memory use.
*/ */
class EXPORT ResourceConstraints { class V8EXPORT ResourceConstraints {
public: public:
ResourceConstraints(); ResourceConstraints();
int max_young_space_size() const { return max_young_space_size_; } int max_young_space_size() const { return max_young_space_size_; }
void set_max_young_space_size(int value) { max_young_space_size_ = value; } void set_max_young_space_size(int value) { max_young_space_size_ = value; }
int max_old_space_size() const { return max_old_space_size_; } int max_old_space_size() const { return max_old_space_size_; }
void set_max_old_space_size(int value) { max_old_space_size_ = value; } void set_max_old_space_size(int value) { max_old_space_size_ = value; }
uint32_t* stack_limit() const { return stack_limit_; } uint32_t* stack_limit() const { return stack_limit_; }
void set_stack_limit(uint32_t* value) { stack_limit_ = value; } void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
private: private:
int max_young_space_size_; int max_young_space_size_;
skipping to change at line 1734 skipping to change at line 1784
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> data );
/** /**
* 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> EXPORT ThrowException(Handle<Value> exception); Handle<Value> V8EXPORT ThrowException(Handle<Value> exception);
/** /**
* 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 EXPORT Exception { class V8EXPORT 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);
static Local<Value> Error(Handle<String> message); static Local<Value> Error(Handle<String> message);
}; };
// --- C o u n t e r s C a l l b a c k s --- // --- C o u n t e r s C a l l b a c k s ---
typedef int* (*CounterLookupCallback)(const char* name); typedef int* (*CounterLookupCallback)(const char* name);
typedef void* (*CreateHistogramCallback)(const char* name,
int min,
int max,
size_t buckets);
typedef void (*AddHistogramSampleCallback)(void* histogram, int sample);
// --- F a i l e d A c c e s s C h e c k C a l l b a c k --- // --- F a i l e d A c c e s s C h e c k C a l l b a c k ---
typedef void (*FailedAccessCheckCallback)(Local<Object> target, typedef void (*FailedAccessCheckCallback)(Local<Object> target,
AccessType type, AccessType type,
Local<Value> data); Local<Value> data);
// --- G a r b a g e C o l l e c t i o n C a l l b a c k s // --- G a r b a g e C o l l e c t i o n C a l l b a c k s
/** /**
* Applications can register a callback function which is called * Applications can register a callback function which is called
* before and after a major garbage collection. Allocations are not * before and after a major garbage collection. Allocations are not
skipping to change at line 1780 skipping to change at line 1837
/** /**
* Applications must provide a callback function which is called to generat e * Applications must provide a callback function which is called to generat e
* a context if a context was not deserialized from the snapshot. * a context if a context was not deserialized from the snapshot.
*/ */
typedef Persistent<Context> (*ContextGenerator)(); typedef Persistent<Context> (*ContextGenerator)();
/** /**
* Container class for static utility functions. * Container class for static utility functions.
*/ */
class EXPORT 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);
/** /**
* Ignore out-of-memory exceptions. * Ignore out-of-memory exceptions.
* *
* V8 running out of memory is treated as a fatal error by default. * V8 running out of memory is treated as a fatal error by default.
* This means that the fatal error handler is called and that V8 is * This means that the fatal error handler is called and that V8 is
* terminated. * terminated.
skipping to change at line 1841 skipping to change at line 1898
/** Get the version string. */ /** Get the version string. */
static const char* GetVersion(); static const char* GetVersion();
/** /**
* Enables the host application to provide a mechanism for recording * Enables the host application to provide a mechanism for recording
* statistics counters. * statistics counters.
*/ */
static void SetCounterFunction(CounterLookupCallback); static void SetCounterFunction(CounterLookupCallback);
/** /**
* Enables the host application to provide a mechanism for recording
* histograms. The CreateHistogram function returns a
* histogram which will later be passed to the AddHistogramSample
* function.
*/
static void SetCreateHistogramFunction(CreateHistogramCallback);
static void SetAddHistogramSampleFunction(AddHistogramSampleCallback);
/**
* Enables the computation of a sliding window of states. The sliding * Enables the computation of a sliding window of states. The sliding
* window information is recorded in statistics counters. * window information is recorded in statistics counters.
*/ */
static void EnableSlidingStateWindow(); static void EnableSlidingStateWindow();
/** Callback function for reporting failed access checks.*/ /** Callback function for reporting failed access checks.*/
static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallbac k); static void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallbac k);
/** /**
* Enables the host application to receive a notification before a * Enables the host application to receive a notification before a
skipping to change at line 1916 skipping to change at line 1982
* enable V8 profiling. * enable V8 profiling.
*/ */
static void PauseProfiler(); static void PauseProfiler();
/** /**
* Resumes recording of tick samples in the profiler. * Resumes recording of tick samples in the profiler.
* See also PauseProfiler(). * See also PauseProfiler().
*/ */
static void ResumeProfiler(); static void ResumeProfiler();
/**
* Releases any resources used by v8 and stops any utility threads
* that may be running. Note that disposing v8 is permanent, it
* cannot be reinitialized.
*
* It should generally not be necessary to dispose v8 before exiting
* a process, this should happen automatically. It is only necessary
* to use if the process needs the resources taken up by v8.
*/
static bool Dispose();
private: private:
V8(); V8();
static void** GlobalizeReference(void** handle); static void** GlobalizeReference(void** handle);
static void DisposeGlobal(void** global_handle); static void DisposeGlobal(void** global_handle);
static void MakeWeak(void** global_handle, void* data, WeakReferenceCallb ack); static void MakeWeak(void** global_handle, void* data, WeakReferenceCallb ack);
static void ClearWeak(void** global_handle); static void ClearWeak(void** global_handle);
static bool IsGlobalNearDeath(void** global_handle); static bool IsGlobalNearDeath(void** global_handle);
static bool IsGlobalWeak(void** global_handle); static bool IsGlobalWeak(void** 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.
*/ */
class EXPORT TryCatch { class V8EXPORT TryCatch {
public: public:
/** /**
* Creates a new try/catch block and registers it with v8. * Creates a new try/catch block and registers it with v8.
*/ */
TryCatch(); TryCatch();
/** /**
* Unregisters and deletes this try/catch block. * Unregisters and deletes this try/catch block.
*/ */
skipping to change at line 2012 skipping to change at line 2089
bool is_verbose_; bool is_verbose_;
bool capture_message_; bool capture_message_;
void* js_handler_; void* js_handler_;
}; };
// --- C o n t e x t --- // --- C o n t e x t ---
/** /**
* Ignore * Ignore
*/ */
class EXPORT ExtensionConfiguration { class V8EXPORT ExtensionConfiguration {
public: public:
ExtensionConfiguration(int name_count, const char* names[]) ExtensionConfiguration(int name_count, const char* names[])
: name_count_(name_count), names_(names) { } : name_count_(name_count), names_(names) { }
private: private:
friend class ImplementationUtilities; friend class ImplementationUtilities;
int name_count_; int name_count_;
const char** names_; const char** names_;
}; };
/** /**
* A sandboxed execution context with its own set of built-in objects * A sandboxed execution context with its own set of built-in objects
* and functions. * and functions.
*/ */
class EXPORT Context { class V8EXPORT Context {
public: public:
/** Returns the global object of the context. */ /** Returns the global object of the context. */
Local<Object> Global(); Local<Object> Global();
/** /**
* Detaches the global object from its context before * Detaches the global object from its context before
* the global object can be reused to create a new context. * the global object can be reused to create a new context.
*/ */
void DetachGlobal(); void DetachGlobal();
skipping to change at line 2085 skipping to change at line 2162
/** 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. */ /** Returns true if V8 has a current context. */
static bool InContext(); static bool InContext();
/** /**
* Stack-allocated class which sets the execution context for all * Stack-allocated class which sets the execution context for all
* operations executed within a local scope. * operations executed within a local scope.
*/ */
class EXPORT Scope { class V8EXPORT Scope {
public: public:
inline Scope(Handle<Context> context) : context_(context) { inline Scope(Handle<Context> context) : context_(context) {
context_->Enter(); context_->Enter();
} }
inline ~Scope() { context_->Exit(); } inline ~Scope() { context_->Exit(); }
private: private:
Handle<Context> context_; Handle<Context> context_;
}; };
private: private:
skipping to change at line 2170 skipping to change at line 2247
* v8::Unlocker unlocker; * v8::Unlocker unlocker;
* // V8 not locked. * // V8 not locked.
* } * }
* // V8 locked again (2 levels). * // V8 locked again (2 levels).
* } * }
* // V8 still locked (1 level). * // V8 still locked (1 level).
* } * }
* // V8 Now no longer locked. * // V8 Now no longer locked.
* \endcode * \endcode
*/ */
class EXPORT Unlocker { class V8EXPORT Unlocker {
public: public:
Unlocker(); Unlocker();
~Unlocker(); ~Unlocker();
}; };
class EXPORT Locker { class V8EXPORT Locker {
public: public:
Locker(); Locker();
~Locker(); ~Locker();
/** /**
* Start preemption. * Start preemption.
* *
* When preemption is started, a timer is fired every n milli seconds * When preemption is started, a timer is fired every n milli seconds
* that will switch between multiple threads that are in contention * that will switch between multiple threads that are in contention
* for the V8 lock. * for the V8 lock.
skipping to change at line 2358 skipping to change at line 2435
* A simple shell that takes a list of expressions on the * A simple shell that takes a list of expressions on the
* command-line and executes them. * command-line and executes them.
*/ */
/** /**
* \example process.cc * \example process.cc
*/ */
} // namespace v8 } // namespace v8
#undef EXPORT #undef V8EXPORT
#undef EXPORT_INLINE #undef V8EXPORT_INLINE
#undef TYPE_CHECK #undef TYPE_CHECK
#endif // V8_H_ #endif // V8_H_
 End of changes. 68 change blocks. 
71 lines changed or deleted 158 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/