#include "v8stdint.h"
+// We reserve the V8_* prefix for macros defined in V8 public API and
+// assume there are no name conflicts with the embedder's code.
+
#ifdef _WIN32
// Setup for Windows DLL export/import. When building the V8 DLL the
#endif
#ifdef BUILDING_V8_SHARED
-#define V8EXPORT __declspec(dllexport)
+#define V8_EXPORT __declspec(dllexport)
#elif USING_V8_SHARED
-#define V8EXPORT __declspec(dllimport)
+#define V8_EXPORT __declspec(dllimport)
#else
-#define V8EXPORT
+#define V8_EXPORT
#endif // BUILDING_V8_SHARED
#else // _WIN32
#if defined(__GNUC__) && ((__GNUC__ >= 4) || \
(__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED)
#ifdef BUILDING_V8_SHARED
-#define V8EXPORT __attribute__ ((visibility("default")))
+#define V8_EXPORT __attribute__ ((visibility("default")))
#else
-#define V8EXPORT
+#define V8_EXPORT
#endif
#else
-#define V8EXPORT
+#define V8_EXPORT
#endif
#endif // _WIN32
* handle and may deallocate it. The behavior of accessing a handle
* for which the handle scope has been deleted is undefined.
*/
-class V8EXPORT HandleScope {
+class V8_EXPORT HandleScope {
public:
// TODO(svenpanne) Deprecate me when Chrome is fixed!
HandleScope();
// This Data class is accessible internally as HandleScopeData through a
// typedef in the ImplementationUtilities class.
- class V8EXPORT Data {
+ class V8_EXPORT Data {
public:
internal::Object** next;
internal::Object** limit;
/**
* The superclass of values and API object templates.
*/
-class V8EXPORT Data {
+class V8_EXPORT Data {
private:
Data();
};
* compiling it, and can be stored between compilations. When script
* data is given to the compile method compilation will be faster.
*/
-class V8EXPORT ScriptData { // NOLINT
+class V8_EXPORT ScriptData { // NOLINT
public:
virtual ~ScriptData() { }
/**
* A compiled JavaScript script.
*/
-class V8EXPORT Script {
+class V8_EXPORT Script {
public:
/**
* Compiles the specified script (context-independent).
/**
* An error message.
*/
-class V8EXPORT Message {
+class V8_EXPORT Message {
public:
Local<String> Get() const;
Local<String> GetSourceLine() const;
* snapshot of the execution stack and the information remains valid after
* execution continues.
*/
-class V8EXPORT StackTrace {
+class V8_EXPORT StackTrace {
public:
/**
* Flags that determine what information is placed captured for each
/**
* A single JavaScript stack frame.
*/
-class V8EXPORT StackFrame {
+class V8_EXPORT StackFrame {
public:
/**
* Returns the number, 1-based, of the line for the associate function call.
/**
* A JSON Parser.
*/
-class V8EXPORT JSON {
+class V8_EXPORT JSON {
public:
/**
* Tries to parse the string |json_string| and returns it as object if
/**
* The superclass of all JavaScript values and objects.
*/
-class V8EXPORT Value : public Data {
+class V8_EXPORT Value : public Data {
public:
/**
* Returns true if this value is the undefined value. See ECMA-262
/**
* The superclass of primitive values. See ECMA-262 4.3.2.
*/
-class V8EXPORT Primitive : public Value { };
+class V8_EXPORT Primitive : public Value { };
/**
* A primitive boolean value (ECMA-262, 4.3.14). Either the true
* or false value.
*/
-class V8EXPORT Boolean : public Primitive {
+class V8_EXPORT Boolean : public Primitive {
public:
bool Value() const;
V8_INLINE(static Handle<Boolean> New(bool value));
/**
* A JavaScript string value (ECMA-262, 4.3.17).
*/
-class V8EXPORT String : public Primitive {
+class V8_EXPORT String : public Primitive {
public:
enum Encoding {
UNKNOWN_ENCODING = 0x1,
*/
bool IsExternalAscii() const;
- class V8EXPORT ExternalStringResourceBase { // NOLINT
+ class V8_EXPORT ExternalStringResourceBase { // NOLINT
public:
virtual ~ExternalStringResourceBase() {}
* ExternalStringResource to manage the life cycle of the underlying
* buffer. Note that the string data must be immutable.
*/
- class V8EXPORT ExternalStringResource
+ class V8_EXPORT ExternalStringResource
: public ExternalStringResourceBase {
public:
/**
* Use String::New or convert to 16 bit data for non-ASCII.
*/
- class V8EXPORT ExternalAsciiStringResource
+ class V8_EXPORT ExternalAsciiStringResource
: public ExternalStringResourceBase {
public:
/**
* then the length() method returns 0 and the * operator returns
* NULL.
*/
- class V8EXPORT Utf8Value {
+ class V8_EXPORT Utf8Value {
public:
explicit Utf8Value(Handle<v8::Value> obj);
~Utf8Value();
* method of the object) then the length() method returns 0 and the * operator
* returns NULL.
*/
- class V8EXPORT AsciiValue {
+ class V8_EXPORT AsciiValue {
public:
// TODO(dcarney): deprecate
explicit AsciiValue(Handle<v8::Value> obj);
* method of the object) then the length() method returns 0 and the * operator
* returns NULL.
*/
- class V8EXPORT Value {
+ class V8_EXPORT Value {
public:
explicit Value(Handle<v8::Value> obj);
~Value();
*
* This is an experimental feature. Use at your own risk.
*/
-class V8EXPORT Symbol : public Primitive {
+class V8_EXPORT Symbol : public Primitive {
public:
// Returns the print name string of the symbol, or undefined if none.
Local<Value> Name() const;
/**
* A JavaScript number value (ECMA-262, 4.3.20)
*/
-class V8EXPORT Number : public Primitive {
+class V8_EXPORT Number : public Primitive {
public:
double Value() const;
static Local<Number> New(double value);
/**
* A JavaScript value representing a signed integer.
*/
-class V8EXPORT Integer : public Number {
+class V8_EXPORT Integer : public Number {
public:
static Local<Integer> New(int32_t value);
static Local<Integer> NewFromUnsigned(uint32_t value);
/**
* A JavaScript value representing a 32-bit signed integer.
*/
-class V8EXPORT Int32 : public Integer {
+class V8_EXPORT Int32 : public Integer {
public:
int32_t Value() const;
private:
/**
* A JavaScript value representing a 32-bit unsigned integer.
*/
-class V8EXPORT Uint32 : public Integer {
+class V8_EXPORT Uint32 : public Integer {
public:
uint32_t Value() const;
private:
/**
* A JavaScript object (ECMA-262, 4.3.3)
*/
-class V8EXPORT Object : public Value {
+class V8_EXPORT Object : public Value {
public:
bool Set(Handle<Value> key,
Handle<Value> value,
/**
* An instance of the built-in array constructor (ECMA-262, 15.4.2).
*/
-class V8EXPORT Array : public Object {
+class V8_EXPORT Array : public Object {
public:
uint32_t Length() const;
/**
* A JavaScript function object (ECMA-262, 15.3).
*/
-class V8EXPORT Function : public Object {
+class V8_EXPORT Function : public Object {
public:
Local<Object> NewInstance() const;
Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
* An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5).
* This API is experimental and may change significantly.
*/
-class V8EXPORT ArrayBuffer : public Object {
+class V8_EXPORT ArrayBuffer : public Object {
public:
/**
* Allocator that V8 uses to allocate |ArrayBuffer|'s memory.
*
* This API is experimental and may change significantly.
*/
- class V8EXPORT Allocator { // NOLINT
+ class V8_EXPORT Allocator { // NOLINT
public:
virtual ~Allocator() {}
*
* This API is experimental and may change significantly.
*/
- class V8EXPORT Contents { // NOLINT
+ class V8_EXPORT Contents { // NOLINT
public:
Contents() : data_(NULL), byte_length_(0) {}
*
* This API is experimental and may change significantly.
*/
-class V8EXPORT ArrayBufferView : public Object {
+class V8_EXPORT ArrayBufferView : public Object {
public:
/**
* Returns underlying ArrayBuffer.
* (ES6 draft 15.13.6).
* This API is experimental and may change significantly.
*/
-class V8EXPORT TypedArray : public ArrayBufferView {
+class V8_EXPORT TypedArray : public ArrayBufferView {
public:
/**
* Number of elements in this typed array
* An instance of Uint8Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly.
*/
-class V8EXPORT Uint8Array : public TypedArray {
+class V8_EXPORT Uint8Array : public TypedArray {
public:
static Local<Uint8Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
* An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly.
*/
-class V8EXPORT Uint8ClampedArray : public TypedArray {
+class V8_EXPORT Uint8ClampedArray : public TypedArray {
public:
static Local<Uint8ClampedArray> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
* An instance of Int8Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly.
*/
-class V8EXPORT Int8Array : public TypedArray {
+class V8_EXPORT Int8Array : public TypedArray {
public:
static Local<Int8Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
* An instance of Uint16Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly.
*/
-class V8EXPORT Uint16Array : public TypedArray {
+class V8_EXPORT Uint16Array : public TypedArray {
public:
static Local<Uint16Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
* An instance of Int16Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly.
*/
-class V8EXPORT Int16Array : public TypedArray {
+class V8_EXPORT Int16Array : public TypedArray {
public:
static Local<Int16Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
* An instance of Uint32Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly.
*/
-class V8EXPORT Uint32Array : public TypedArray {
+class V8_EXPORT Uint32Array : public TypedArray {
public:
static Local<Uint32Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
* An instance of Int32Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly.
*/
-class V8EXPORT Int32Array : public TypedArray {
+class V8_EXPORT Int32Array : public TypedArray {
public:
static Local<Int32Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
* An instance of Float32Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly.
*/
-class V8EXPORT Float32Array : public TypedArray {
+class V8_EXPORT Float32Array : public TypedArray {
public:
static Local<Float32Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
* An instance of Float64Array constructor (ES6 draft 15.13.6).
* This API is experimental and may change significantly.
*/
-class V8EXPORT Float64Array : public TypedArray {
+class V8_EXPORT Float64Array : public TypedArray {
public:
static Local<Float64Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
* An instance of DataView constructor (ES6 draft 15.13.7).
* This API is experimental and may change significantly.
*/
-class V8EXPORT DataView : public ArrayBufferView {
+class V8_EXPORT DataView : public ArrayBufferView {
public:
static Local<DataView> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
/**
* An instance of the built-in Date constructor (ECMA-262, 15.9).
*/
-class V8EXPORT Date : public Object {
+class V8_EXPORT Date : public Object {
public:
static Local<Value> New(double time);
/**
* A Number object (ECMA-262, 4.3.21).
*/
-class V8EXPORT NumberObject : public Object {
+class V8_EXPORT NumberObject : public Object {
public:
static Local<Value> New(double value);
/**
* A Boolean object (ECMA-262, 4.3.15).
*/
-class V8EXPORT BooleanObject : public Object {
+class V8_EXPORT BooleanObject : public Object {
public:
static Local<Value> New(bool value);
/**
* A String object (ECMA-262, 4.3.18).
*/
-class V8EXPORT StringObject : public Object {
+class V8_EXPORT StringObject : public Object {
public:
static Local<Value> New(Handle<String> value);
*
* This is an experimental feature. Use at your own risk.
*/
-class V8EXPORT SymbolObject : public Object {
+class V8_EXPORT SymbolObject : public Object {
public:
static Local<Value> New(Isolate* isolate, Handle<Symbol> value);
/**
* An instance of the built-in RegExp constructor (ECMA-262, 15.10).
*/
-class V8EXPORT RegExp : public Object {
+class V8_EXPORT RegExp : public Object {
public:
/**
* Regular expression flag bits. They can be or'ed to enable a set
* A JavaScript value that wraps a C++ void*. This type of value is mainly used
* to associate C++ data structures with JavaScript objects.
*/
-class V8EXPORT External : public Value {
+class V8_EXPORT External : public Value {
public:
static Local<External> New(void* value);
V8_INLINE(static External* Cast(Value* obj));
/**
* The superclass of object and function templates.
*/
-class V8EXPORT Template : public Data {
+class V8_EXPORT Template : public Data {
public:
/** Adds a property to each instance created by this template.*/
void Set(Handle<String> name, Handle<Data> value,
};
-class V8EXPORT Arguments : public FunctionCallbackInfo<Value> {
+class V8_EXPORT Arguments : public FunctionCallbackInfo<Value> {
private:
friend class internal::FunctionCallbackArguments;
V8_INLINE(Arguments(internal::Object** implicit_args,
};
-class V8EXPORT AccessorInfo : public PropertyCallbackInfo<Value> {
+class V8_EXPORT AccessorInfo : public PropertyCallbackInfo<Value> {
private:
friend class internal::PropertyCallbackArguments;
V8_INLINE(AccessorInfo(internal::Object** args))
* child_instance.instance_property == 3;
* \endcode
*/
-class V8EXPORT FunctionTemplate : public Template {
+class V8_EXPORT FunctionTemplate : public Template {
public:
/** Creates a function template.*/
V8_DEPRECATED(static Local<FunctionTemplate> New(
* Properties added to an ObjectTemplate are added to each object
* created from the ObjectTemplate.
*/
-class V8EXPORT ObjectTemplate : public Template {
+class V8_EXPORT ObjectTemplate : public Template {
public:
/** Creates an ObjectTemplate. */
static Local<ObjectTemplate> New();
* A Signature specifies which receivers and arguments are valid
* parameters to a function.
*/
-class V8EXPORT Signature : public Data {
+class V8_EXPORT Signature : public Data {
public:
static Local<Signature> New(Handle<FunctionTemplate> receiver =
Handle<FunctionTemplate>(),
* An AccessorSignature specifies which receivers are valid parameters
* to an accessor callback.
*/
-class V8EXPORT AccessorSignature : public Data {
+class V8_EXPORT AccessorSignature : public Data {
public:
static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver =
Handle<FunctionTemplate>());
};
-class V8EXPORT DeclaredAccessorDescriptor : public Data {
+class V8_EXPORT DeclaredAccessorDescriptor : public Data {
private:
DeclaredAccessorDescriptor();
};
-class V8EXPORT ObjectOperationDescriptor : public Data {
+class V8_EXPORT ObjectOperationDescriptor : public Data {
public:
// This function is not yet stable and should not be used at this time.
static Local<RawOperationDescriptor> NewInternalFieldDereference(
};
-class V8EXPORT RawOperationDescriptor : public Data {
+class V8_EXPORT RawOperationDescriptor : public Data {
public:
Local<DeclaredAccessorDescriptor> NewHandleDereference(Isolate* isolate);
Local<RawOperationDescriptor> NewRawDereference(Isolate* isolate);
* A utility for determining the type of objects based on the template
* they were constructed from.
*/
-class V8EXPORT TypeSwitch : public Data {
+class V8_EXPORT TypeSwitch : public Data {
public:
static Local<TypeSwitch> New(Handle<FunctionTemplate> type);
static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]);
// --- Extensions ---
-class V8EXPORT ExternalAsciiStringResourceImpl
+class V8_EXPORT ExternalAsciiStringResourceImpl
: public String::ExternalAsciiStringResource {
public:
ExternalAsciiStringResourceImpl() : data_(0), length_(0) {}
/**
* Ignore
*/
-class V8EXPORT Extension { // NOLINT
+class V8_EXPORT Extension { // NOLINT
public:
// Note that the strings passed into this constructor must live as long
// as the Extension itself.
};
-void V8EXPORT RegisterExtension(Extension* extension);
+void V8_EXPORT RegisterExtension(Extension* extension);
/**
* Ignore
*/
-class V8EXPORT DeclareExtension {
+class V8_EXPORT DeclareExtension {
public:
V8_INLINE(DeclareExtension(Extension* extension)) {
RegisterExtension(extension);
// --- Statics ---
-Handle<Primitive> V8EXPORT Undefined();
-Handle<Primitive> V8EXPORT Null();
-Handle<Boolean> V8EXPORT True();
-Handle<Boolean> V8EXPORT False();
+Handle<Primitive> V8_EXPORT Undefined();
+Handle<Primitive> V8_EXPORT Null();
+Handle<Boolean> V8_EXPORT True();
+Handle<Boolean> V8_EXPORT False();
V8_INLINE(Handle<Primitive> Undefined(Isolate* isolate));
V8_INLINE(Handle<Primitive> Null(Isolate* isolate));
* setting the stack limit and you must set a non-default stack limit separately
* for each thread.
*/
-class V8EXPORT ResourceConstraints {
+class V8_EXPORT ResourceConstraints {
public:
ResourceConstraints();
int max_young_space_size() const { return max_young_space_size_; }
};
-bool V8EXPORT SetResourceConstraints(ResourceConstraints* constraints);
+bool V8_EXPORT SetResourceConstraints(ResourceConstraints* constraints);
// --- Exceptions ---
* operation; the caller must return immediately and only after the exception
* has been handled does it become legal to invoke JavaScript operations.
*/
-Handle<Value> V8EXPORT ThrowException(Handle<Value> exception);
+Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception);
/**
* Create new error objects by calling the corresponding error object
* constructor with the message.
*/
-class V8EXPORT Exception {
+class V8_EXPORT Exception {
public:
static Local<Value> RangeError(Handle<String> message);
static Local<Value> ReferenceError(Handle<String> message);
* Instances of this class can be passed to v8::V8::HeapStatistics to
* get heap statistics from V8.
*/
-class V8EXPORT HeapStatistics {
+class V8_EXPORT HeapStatistics {
public:
HeapStatistics();
size_t total_heap_size() { return total_heap_size_; }
* threads. An isolate can be entered by at most one thread at any
* given time. The Locker/Unlocker API must be used to synchronize.
*/
-class V8EXPORT Isolate {
+class V8_EXPORT Isolate {
public:
/**
* Stack-allocated class which sets the isolate for all operations
* executed within a local scope.
*/
- class V8EXPORT Scope {
+ class V8_EXPORT Scope {
public:
explicit Scope(Isolate* isolate) : isolate_(isolate) {
isolate->Enter();
};
-class V8EXPORT StartupData {
+class V8_EXPORT StartupData {
public:
enum CompressionAlgorithm {
kUncompressed,
*
* For an example of the class usage, see the "shell.cc" sample application.
*/
-class V8EXPORT StartupDataDecompressor { // NOLINT
+class V8_EXPORT StartupDataDecompressor { // NOLINT
public:
StartupDataDecompressor();
virtual ~StartupDataDecompressor();
/**
* Interface for iterating through all external resources in the heap.
*/
-class V8EXPORT ExternalResourceVisitor { // NOLINT
+class V8_EXPORT ExternalResourceVisitor { // NOLINT
public:
virtual ~ExternalResourceVisitor() {}
virtual void VisitExternalString(Handle<String> string) {}
/**
* Interface for iterating through all the persistent handles in the heap.
*/
-class V8EXPORT PersistentHandleVisitor { // NOLINT
+class V8_EXPORT PersistentHandleVisitor { // NOLINT
public:
virtual ~PersistentHandleVisitor() {}
virtual void VisitPersistentHandle(Persistent<Value>* value,
* to be modified. Useful when otherwise unsafe handle operations need to
* be performed.
*/
-class V8EXPORT AssertNoGCScope {
+class V8_EXPORT AssertNoGCScope {
#ifndef DEBUG
// TODO(yangguo): remove isolate argument.
V8_INLINE(AssertNoGCScope(Isolate* isolate)) { }
/**
* Container class for static utility functions.
*/
-class V8EXPORT V8 {
+class V8_EXPORT V8 {
public:
/** Set the callback to invoke in case of fatal errors. */
static void SetFatalErrorHandler(FatalErrorCallback that);
/**
* An external exception handler.
*/
-class V8EXPORT TryCatch {
+class V8_EXPORT TryCatch {
public:
/**
* Creates a new try/catch block and registers it with v8. Note that
/**
* Ignore
*/
-class V8EXPORT ExtensionConfiguration {
+class V8_EXPORT ExtensionConfiguration {
public:
ExtensionConfiguration(int name_count, const char* names[])
: name_count_(name_count), names_(names) { }
* A sandboxed execution context with its own set of built-in objects
* and functions.
*/
-class V8EXPORT Context {
+class V8_EXPORT Context {
public:
/**
* Returns the global proxy object or global object itself for
* // V8 Now no longer locked.
* \endcode
*/
-class V8EXPORT Unlocker {
+class V8_EXPORT Unlocker {
public:
/**
* Initialize Unlocker for a given Isolate.
};
-class V8EXPORT Locker {
+class V8_EXPORT Locker {
public:
/**
* Initialize Locker for a given Isolate.
/**
* An interface for exporting data from V8, using "push" model.
*/
-class V8EXPORT OutputStream { // NOLINT
+class V8_EXPORT OutputStream { // NOLINT
public:
enum OutputEncoding {
kAscii = 0 // 7-bit ASCII.
* An interface for reporting progress and controlling long-running
* activities.
*/
-class V8EXPORT ActivityControl { // NOLINT
+class V8_EXPORT ActivityControl { // NOLINT
public:
enum ControlOption {
kContinue = 0,
} // namespace v8
-#undef V8EXPORT
#undef TYPE_CHECK