v8.h   v8.h 
skipping to change at line 117 skipping to change at line 117
namespace internal { namespace internal {
class Arguments; class Arguments;
class Object; class Object;
class Heap; class Heap;
class HeapObject; class HeapObject;
class Isolate; class Isolate;
} }
// --- W e a k H a n d l e s // --- Weak Handles ---
/** /**
* A weak reference callback function. * A weak reference callback function.
* *
* This callback should either explicitly invoke Dispose on |object| if * This callback should either explicitly invoke Dispose on |object| if
* V8 wrapper is not needed anymore, or 'revive' it by invocation of MakeWe ak. * V8 wrapper is not needed anymore, or 'revive' it by invocation of MakeWe ak.
* *
* \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
* \param parameter the value passed in when making the weak global object * \param parameter the value passed in when making the weak global object
*/ */
typedef void (*WeakReferenceCallback)(Persistent<Value> object, typedef void (*WeakReferenceCallback)(Persistent<Value> object,
void* parameter); void* parameter);
// --- H a n d l e s --- // --- Handles ---
#define TYPE_CHECK(T, S) \ #define TYPE_CHECK(T, S) \
while (false) { \ while (false) { \
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \ *(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
} }
/** /**
* An object reference managed by the v8 garbage collector. * An object reference managed by the v8 garbage collector.
* *
* All objects returned from v8 have to be tracked by the garbage * All objects returned from v8 have to be tracked by the garbage
skipping to change at line 479 skipping to change at line 479
internal::Object** prev_limit_; internal::Object** prev_limit_;
// Allow for the active closing of HandleScopes which allows to pass a ha ndle // Allow for the active closing of HandleScopes which allows to pass a ha ndle
// from the HandleScope being closed to the next top most HandleScope. // from the HandleScope being closed to the next top most HandleScope.
bool is_closed_; bool is_closed_;
internal::Object** RawClose(internal::Object** value); internal::Object** RawClose(internal::Object** value);
friend class ImplementationUtilities; friend class ImplementationUtilities;
}; };
// --- S p e c i a l o b j e c t s --- // --- Special objects ---
/** /**
* The superclass of values and API object templates. * The superclass of values and API object templates.
*/ */
class V8EXPORT Data { class V8EXPORT Data {
private: private:
Data(); Data();
}; };
/** /**
skipping to change at line 829 skipping to change at line 829
*/ */
bool IsEval() const; bool IsEval() const;
/** /**
* Returns whther or not the associated function is called as a * Returns whther or not the associated function is called as a
* constructor via "new". * constructor via "new".
*/ */
bool IsConstructor() const; bool IsConstructor() const;
}; };
// --- V a l u e --- // --- Value ---
/** /**
* The superclass of all JavaScript values and objects. * The superclass of all JavaScript values and objects.
*/ */
class Value : public Data { class 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.
skipping to change at line 1328 skipping to change at line 1328
/** /**
* A JavaScript value representing a 32-bit unsigned integer. * A JavaScript value representing a 32-bit unsigned integer.
*/ */
class Uint32 : public Integer { class Uint32 : public Integer {
public: public:
V8EXPORT uint32_t Value() const; V8EXPORT uint32_t Value() const;
private: private:
V8EXPORT Uint32(); V8EXPORT Uint32();
}; };
/**
* An instance of the built-in Date constructor (ECMA-262, 15.9).
*/
class Date : public Value {
public:
V8EXPORT static Local<Value> New(double time);
/**
* A specialization of Value::NumberValue that is more efficient
* because we know the structure of this object.
*/
V8EXPORT double NumberValue() const;
static inline Date* Cast(v8::Value* obj);
/**
* Notification that the embedder has changed the time zone,
* daylight savings time, or other date / time configuration
* parameters. V8 keeps a cache of various values used for
* date / time computation. This notification will reset
* those cached values for the current context so that date /
* time configuration changes would be reflected in the Date
* object.
*
* This API should not be called more than needed as it will
* negatively impact the performance of date operations.
*/
V8EXPORT static void DateTimeConfigurationChangeNotification();
private:
V8EXPORT static void CheckCast(v8::Value* obj);
};
/**
* An instance of the built-in RegExp constructor (ECMA-262, 15.10).
*/
class RegExp : public Value {
public:
/**
* Regular expression flag bits. They can be or'ed to enable a set
* of flags.
*/
enum Flags {
kNone = 0,
kGlobal = 1,
kIgnoreCase = 2,
kMultiline = 4
};
/**
* Creates a regular expression from the given pattern string and
* the flags bit field. May throw a JavaScript exception as
* described in ECMA-262, 15.10.4.1.
*
* For example,
* RegExp::New(v8::String::New("foo"),
* static_cast<RegExp::Flags>(kGlobal | kMultiline))
* is equivalent to evaluating "/foo/gm".
*/
V8EXPORT static Local<RegExp> New(Handle<String> pattern,
Flags flags);
/**
* Returns the value of the source property: a string representing
* the regular expression.
*/
V8EXPORT Local<String> GetSource() const;
/**
* Returns the flags bit field.
*/
V8EXPORT Flags GetFlags() const;
static inline RegExp* Cast(v8::Value* obj);
private:
V8EXPORT static void CheckCast(v8::Value* obj);
};
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
}; };
enum ExternalArrayType { enum ExternalArrayType {
kExternalByteArray = 1, kExternalByteArray = 1,
kExternalUnsignedByteArray, kExternalUnsignedByteArray,
skipping to change at line 1728 skipping to change at line 1649
V8EXPORT int GetScriptLineNumber() const; V8EXPORT int GetScriptLineNumber() const;
V8EXPORT ScriptOrigin GetScriptOrigin() const; V8EXPORT ScriptOrigin GetScriptOrigin() const;
static inline Function* Cast(Value* obj); static inline Function* Cast(Value* obj);
V8EXPORT static const int kLineOffsetNotFound; V8EXPORT static const int kLineOffsetNotFound;
private: private:
V8EXPORT Function(); V8EXPORT Function();
V8EXPORT static void CheckCast(Value* obj); V8EXPORT static void CheckCast(Value* obj);
}; };
/** /**
* An instance of the built-in Date constructor (ECMA-262, 15.9).
*/
class Date : public Object {
public:
V8EXPORT static Local<Value> New(double time);
/**
* A specialization of Value::NumberValue that is more efficient
* because we know the structure of this object.
*/
V8EXPORT double NumberValue() const;
static inline Date* Cast(v8::Value* obj);
/**
* Notification that the embedder has changed the time zone,
* daylight savings time, or other date / time configuration
* parameters. V8 keeps a cache of various values used for
* date / time computation. This notification will reset
* those cached values for the current context so that date /
* time configuration changes would be reflected in the Date
* object.
*
* This API should not be called more than needed as it will
* negatively impact the performance of date operations.
*/
V8EXPORT static void DateTimeConfigurationChangeNotification();
private:
V8EXPORT static void CheckCast(v8::Value* obj);
};
/**
* An instance of the built-in RegExp constructor (ECMA-262, 15.10).
*/
class RegExp : public Object {
public:
/**
* Regular expression flag bits. They can be or'ed to enable a set
* of flags.
*/
enum Flags {
kNone = 0,
kGlobal = 1,
kIgnoreCase = 2,
kMultiline = 4
};
/**
* Creates a regular expression from the given pattern string and
* the flags bit field. May throw a JavaScript exception as
* described in ECMA-262, 15.10.4.1.
*
* For example,
* RegExp::New(v8::String::New("foo"),
* static_cast<RegExp::Flags>(kGlobal | kMultiline))
* is equivalent to evaluating "/foo/gm".
*/
V8EXPORT static Local<RegExp> New(Handle<String> pattern,
Flags flags);
/**
* Returns the value of the source property: a string representing
* the regular expression.
*/
V8EXPORT Local<String> GetSource() const;
/**
* Returns the flags bit field.
*/
V8EXPORT Flags GetFlags() const;
static inline RegExp* Cast(v8::Value* obj);
private:
V8EXPORT static void CheckCast(v8::Value* obj);
};
/**
* 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 * 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 * 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 * 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 * value Unwrap should be used, all other operations on that object will le ad
* to unpredictable results. * to unpredictable results.
*/ */
skipping to change at line 1753 skipping to change at line 1753
V8EXPORT static Local<External> New(void* value); V8EXPORT static Local<External> New(void* value);
static inline External* Cast(Value* obj); static inline External* Cast(Value* obj);
V8EXPORT void* Value() const; V8EXPORT void* Value() const;
private: private:
V8EXPORT External(); V8EXPORT External();
V8EXPORT static void CheckCast(v8::Value* obj); V8EXPORT static void CheckCast(v8::Value* obj);
static inline void* QuickUnwrap(Handle<v8::Value> obj); static inline void* QuickUnwrap(Handle<v8::Value> obj);
V8EXPORT static void* FullUnwrap(Handle<v8::Value> obj); V8EXPORT static void* FullUnwrap(Handle<v8::Value> obj);
}; };
// --- T e m p l a t e s --- // --- Templates ---
/** /**
* The superclass of object and function templates. * The superclass of object and function templates.
*/ */
class V8EXPORT 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);
skipping to change at line 2269 skipping to change at line 2269
*/ */
class V8EXPORT 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 --- // --- Extensions ---
/** /**
* Ignore * Ignore
*/ */
class V8EXPORT 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);
skipping to change at line 2317 skipping to change at line 2317
/** /**
* Ignore * Ignore
*/ */
class V8EXPORT 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 --- // --- Statics ---
Handle<Primitive> V8EXPORT Undefined(); Handle<Primitive> V8EXPORT Undefined();
Handle<Primitive> V8EXPORT Null(); Handle<Primitive> V8EXPORT Null();
Handle<Boolean> V8EXPORT True(); Handle<Boolean> V8EXPORT True();
Handle<Boolean> V8EXPORT False(); Handle<Boolean> V8EXPORT False();
/** /**
* A set of constraints that specifies the limits of the runtime's memory u se. * A set of constraints that specifies the limits of the runtime's memory u se.
* You must set the heap size before initializing the VM - the size cannot be * You must set the heap size before initializing the VM - the size cannot be
* adjusted after the VM is initialized. * adjusted after the VM is initialized.
skipping to change at line 2354 skipping to change at line 2354
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_;
int max_old_space_size_; int max_old_space_size_;
int max_executable_size_; int max_executable_size_;
uint32_t* stack_limit_; uint32_t* stack_limit_;
}; };
bool V8EXPORT SetResourceConstraints(ResourceConstraints* constraints); bool V8EXPORT SetResourceConstraints(ResourceConstraints* constraints);
// --- E x c e p t i o n s --- // --- Exceptions ---
typedef void (*FatalErrorCallback)(const char* location, const char* messag e); typedef void (*FatalErrorCallback)(const char* location, const char* messag e);
typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> data ); typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> 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.
skipping to change at line 2381 skipping to change at line 2381
*/ */
class V8EXPORT 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 --- // --- Counters Callbacks ---
typedef int* (*CounterLookupCallback)(const char* name); typedef int* (*CounterLookupCallback)(const char* name);
typedef void* (*CreateHistogramCallback)(const char* name, typedef void* (*CreateHistogramCallback)(const char* name,
int min, int min,
int max, int max,
size_t buckets); size_t buckets);
typedef void (*AddHistogramSampleCallback)(void* histogram, int sample); typedef void (*AddHistogramSampleCallback)(void* histogram, int sample);
// --- M e m o r y A l l o c a t i o n C a l l b a c k --- // --- Memory Allocation Callback ---
enum ObjectSpace { enum ObjectSpace {
kObjectSpaceNewSpace = 1 << 0, kObjectSpaceNewSpace = 1 << 0,
kObjectSpaceOldPointerSpace = 1 << 1, kObjectSpaceOldPointerSpace = 1 << 1,
kObjectSpaceOldDataSpace = 1 << 2, kObjectSpaceOldDataSpace = 1 << 2,
kObjectSpaceCodeSpace = 1 << 3, kObjectSpaceCodeSpace = 1 << 3,
kObjectSpaceMapSpace = 1 << 4, kObjectSpaceMapSpace = 1 << 4,
kObjectSpaceLoSpace = 1 << 5, kObjectSpaceLoSpace = 1 << 5,
kObjectSpaceAll = kObjectSpaceNewSpace | kObjectSpaceOldPointerSpace | kObjectSpaceAll = kObjectSpaceNewSpace | kObjectSpaceOldPointerSpace |
kObjectSpaceOldDataSpace | kObjectSpaceCodeSpace | kObjectSpaceMapSpa ce | kObjectSpaceOldDataSpace | kObjectSpaceCodeSpace | kObjectSpaceMapSpa ce |
skipping to change at line 2416 skipping to change at line 2416
enum AllocationAction { enum AllocationAction {
kAllocationActionAllocate = 1 << 0, kAllocationActionAllocate = 1 << 0,
kAllocationActionFree = 1 << 1, kAllocationActionFree = 1 << 1,
kAllocationActionAll = kAllocationActionAllocate | kAllocationActionFre e kAllocationActionAll = kAllocationActionAllocate | kAllocationActionFre e
}; };
typedef void (*MemoryAllocationCallback)(ObjectSpace space, typedef void (*MemoryAllocationCallback)(ObjectSpace space,
AllocationAction action, AllocationAction action,
int size); int size);
// --- 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 --- // --- Failed Access Check Callback ---
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 // --- AllowCodeGenerationFromStrings callbacks ---
/**
* Callback to check if code generation from strings is allowed. See
* Context::AllowCodeGenerationFromStrings.
*/
typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> conte
xt);
// --- Garbage Collection Callbacks ---
/** /**
* Applications can register callback functions which will be called * Applications can register callback functions which will be called
* before and after a garbage collection. Allocations are not * before and after a garbage collection. Allocations are not
* allowed in the callback functions, you therefore cannot manipulate * allowed in the callback functions, you therefore cannot manipulate
* objects (set or delete properties for example) since it is possible * objects (set or delete properties for example) since it is possible
* such operations will result in the allocation of objects. * such operations will result in the allocation of objects.
*/ */
enum GCType { enum GCType {
kGCTypeScavenge = 1 << 0, kGCTypeScavenge = 1 << 0,
skipping to change at line 2598 skipping to change at line 2606
/** /**
* Container class for static utility functions. * Container class for static utility functions.
*/ */
class V8EXPORT V8 { class V8EXPORT V8 {
public: public:
/** Set the callback to invoke in case of fatal errors. */ /** Set the callback to invoke in case of fatal errors. */
static void SetFatalErrorHandler(FatalErrorCallback that); static void SetFatalErrorHandler(FatalErrorCallback that);
/** /**
* Set the callback to invoke to check if code generation from
* strings should be allowed.
*/
static void SetAllowCodeGenerationFromStringsCallback(
AllowCodeGenerationFromStringsCallback 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.
* *
* IgnoreOutOfMemoryException can be used to not treat a * IgnoreOutOfMemoryException can be used to not treat a
* out-of-memory situation as a fatal error. This way, the contexts * out-of-memory situation as a fatal error. This way, the contexts
* that did not cause the out of memory problem might be able to * that did not cause the out of memory problem might be able to
* continue execution. * continue execution.
skipping to change at line 3123 skipping to change at line 3138
void* exception_; void* exception_;
void* message_; void* message_;
bool is_verbose_ : 1; bool is_verbose_ : 1;
bool can_continue_ : 1; bool can_continue_ : 1;
bool capture_message_ : 1; bool capture_message_ : 1;
bool rethrow_ : 1; bool rethrow_ : 1;
friend class v8::internal::Isolate; friend class v8::internal::Isolate;
}; };
// --- C o n t e x t --- // --- Context ---
/** /**
* Ignore * Ignore
*/ */
class V8EXPORT 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;
skipping to change at line 3257 skipping to change at line 3272
/** /**
* Associate an additional data object with the context. This is mainly u sed * Associate an additional data object with the context. This is mainly u sed
* with the debugger to provide additional information on the context thr ough * with the debugger to provide additional information on the context thr ough
* the debugger API. * the debugger API.
*/ */
void SetData(Handle<String> data); void SetData(Handle<String> data);
Local<Value> GetData(); Local<Value> GetData();
/** /**
* Control whether code generation from strings is allowed. Calling
* this method with false will disable 'eval' and the 'Function'
* constructor for code running in this context. If 'eval' or the
* 'Function' constructor are used an exception will be thrown.
*
* If code generation from strings is not allowed the
* V8::AllowCodeGenerationFromStrings callback will be invoked if
* set before blocking the call to 'eval' or the 'Function'
* constructor. If that callback returns true, the call will be
* allowed, otherwise an exception will be thrown. If no callback is
* set an exception will be thrown.
*/
void AllowCodeGenerationFromStrings(bool allow);
/**
* 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 Scope { class Scope {
public: public:
explicit inline Scope(Handle<Context> context) : context_(context) { explicit inline Scope(Handle<Context> context) : context_(context) {
context_->Enter(); context_->Enter();
} }
inline ~Scope() { context_->Exit(); } inline ~Scope() { context_->Exit(); }
private: private:
skipping to change at line 3447 skipping to change at line 3477
kAbort = 1 kAbort = 1
}; };
virtual ~ActivityControl() {} virtual ~ActivityControl() {}
/** /**
* Notify about current progress. The activity can be stopped by * Notify about current progress. The activity can be stopped by
* returning kAbort as the callback result. * returning kAbort as the callback result.
*/ */
virtual ControlOption ReportProgressValue(int done, int total) = 0; virtual ControlOption ReportProgressValue(int done, int total) = 0;
}; };
// --- I m p l e m e n t a t i o n --- // --- Implementation ---
namespace internal { namespace internal {
static const int kApiPointerSize = sizeof(void*); // NOLINT static const int kApiPointerSize = sizeof(void*); // NOLINT
static const int kApiIntSize = sizeof(int); // NOLINT static const int kApiIntSize = sizeof(int); // NOLINT
// Tag information for HeapObject. // Tag information for HeapObject.
const int kHeapObjectTag = 1; const int kHeapObjectTag = 1;
const int kHeapObjectTagSize = 2; const int kHeapObjectTagSize = 2;
const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1; const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1;
 End of changes. 18 change blocks. 
93 lines changed or deleted 124 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/