Commit a835641d authored by ager@chromium.org's avatar ager@chromium.org

Landing for victorw@chromium.org.

Fix issues so v8 could be built as a DLL.

-. get rid of all the compiler warning by moving dllexport/dllimport
to the individual members for classes which have inline members.

-. update v8 gyp to build v8.dll for chromium multi-dll version (win
and component==shared_library)

Note: most of the code are contributed by sjesse.

Code review URL: http://codereview.chromium.org/2882009/show

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5006 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8afef876
......@@ -61,10 +61,6 @@ typedef unsigned __int64 uint64_t;
// 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 neither
// BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
// The reason for having both V8EXPORT and V8EXPORT_INLINE is that classes which
// have their code inside this header file need to have __declspec(dllexport)
// when building the DLL but cannot have __declspec(dllimport) when building
// a program which uses the DLL.
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
build configuration to ensure that at most one of these is set
......@@ -72,13 +68,10 @@ typedef unsigned __int64 uint64_t;
#ifdef BUILDING_V8_SHARED
#define V8EXPORT __declspec(dllexport)
#define V8EXPORT_INLINE __declspec(dllexport)
#elif USING_V8_SHARED
#define V8EXPORT __declspec(dllimport)
#define V8EXPORT_INLINE
#else
#define V8EXPORT
#define V8EXPORT_INLINE
#endif // BUILDING_V8_SHARED
#else // _WIN32
......@@ -90,10 +83,8 @@ typedef unsigned __int64 uint64_t;
// export symbols when we are building a static library.
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED)
#define V8EXPORT __attribute__ ((visibility("default")))
#define V8EXPORT_INLINE __attribute__ ((visibility("default")))
#else // defined(__GNUC__) && (__GNUC__ >= 4)
#define V8EXPORT
#define V8EXPORT_INLINE
#endif // defined(__GNUC__) && (__GNUC__ >= 4)
#endif // _WIN32
......@@ -185,7 +176,7 @@ typedef void (*WeakReferenceCallback)(Persistent<Value> object,
* behind the scenes and the same rules apply to these values as to
* their handles.
*/
template <class T> class V8EXPORT_INLINE Handle {
template <class T> class Handle {
public:
/**
......@@ -196,7 +187,7 @@ template <class T> class V8EXPORT_INLINE Handle {
/**
* Creates a new handle for the specified value.
*/
explicit Handle(T* val) : val_(val) { }
inline explicit Handle(T* val) : val_(val) { }
/**
* Creates a handle for the contents of the specified handle. This
......@@ -221,16 +212,16 @@ template <class T> class V8EXPORT_INLINE Handle {
/**
* Returns true if the handle is empty.
*/
bool IsEmpty() const { return val_ == 0; }
inline bool IsEmpty() const { return val_ == 0; }
T* operator->() const { return val_; }
inline T* operator->() const { return val_; }
T* operator*() const { return val_; }
inline T* operator*() const { return val_; }
/**
* Sets the handle to be empty. IsEmpty() will then return true.
*/
void Clear() { this->val_ = 0; }
inline void Clear() { this->val_ = 0; }
/**
* Checks whether two handles are the same.
......@@ -238,7 +229,7 @@ template <class T> class V8EXPORT_INLINE Handle {
* to which they refer are identical.
* The handles' references are not checked.
*/
template <class S> bool operator==(Handle<S> that) const {
template <class S> inline bool operator==(Handle<S> that) const {
internal::Object** a = reinterpret_cast<internal::Object**>(**this);
internal::Object** b = reinterpret_cast<internal::Object**>(*that);
if (a == 0) return b == 0;
......@@ -252,7 +243,7 @@ template <class T> class V8EXPORT_INLINE Handle {
* the objects to which they refer are different.
* The handles' references are not checked.
*/
template <class S> bool operator!=(Handle<S> that) const {
template <class S> inline bool operator!=(Handle<S> that) const {
return !operator==(that);
}
......@@ -281,7 +272,7 @@ template <class T> class V8EXPORT_INLINE Handle {
* handle scope are destroyed when the handle scope is destroyed. Hence it
* is not necessary to explicitly deallocate local handles.
*/
template <class T> class V8EXPORT_INLINE Local : public Handle<T> {
template <class T> class Local : public Handle<T> {
public:
inline Local();
template <class S> inline Local(Local<S> that)
......@@ -332,7 +323,7 @@ template <class T> class V8EXPORT_INLINE Local : public Handle<T> {
* different storage cells but rather two references to the same
* storage cell.
*/
template <class T> class V8EXPORT_INLINE Persistent : public Handle<T> {
template <class T> class Persistent : public Handle<T> {
public:
/**
......@@ -563,11 +554,12 @@ class V8EXPORT ScriptData { // NOLINT
/**
* The origin, within a file, of a script.
*/
class V8EXPORT ScriptOrigin {
class ScriptOrigin {
public:
ScriptOrigin(Handle<Value> resource_name,
Handle<Integer> resource_line_offset = Handle<Integer>(),
Handle<Integer> resource_column_offset = Handle<Integer>())
inline ScriptOrigin(
Handle<Value> resource_name,
Handle<Integer> resource_line_offset = Handle<Integer>(),
Handle<Integer> resource_column_offset = Handle<Integer>())
: resource_name_(resource_name),
resource_line_offset_(resource_line_offset),
resource_column_offset_(resource_column_offset) { }
......@@ -841,30 +833,30 @@ class V8EXPORT StackFrame {
/**
* The superclass of all JavaScript values and objects.
*/
class V8EXPORT Value : public Data {
class Value : public Data {
public:
/**
* Returns true if this value is the undefined value. See ECMA-262
* 4.3.10.
*/
bool IsUndefined() const;
V8EXPORT bool IsUndefined() const;
/**
* Returns true if this value is the null value. See ECMA-262
* 4.3.11.
*/
bool IsNull() const;
V8EXPORT bool IsNull() const;
/**
* Returns true if this value is true.
*/
bool IsTrue() const;
V8EXPORT bool IsTrue() const;
/**
* Returns true if this value is false.
*/
bool IsFalse() const;
V8EXPORT bool IsFalse() const;
/**
* Returns true if this value is an instance of the String type.
......@@ -875,92 +867,92 @@ class V8EXPORT Value : public Data {
/**
* Returns true if this value is a function.
*/
bool IsFunction() const;
V8EXPORT bool IsFunction() const;
/**
* Returns true if this value is an array.
*/
bool IsArray() const;
V8EXPORT bool IsArray() const;
/**
* Returns true if this value is an object.
*/
bool IsObject() const;
V8EXPORT bool IsObject() const;
/**
* Returns true if this value is boolean.
*/
bool IsBoolean() const;
V8EXPORT bool IsBoolean() const;
/**
* Returns true if this value is a number.
*/
bool IsNumber() const;
V8EXPORT bool IsNumber() const;
/**
* Returns true if this value is external.
*/
bool IsExternal() const;
V8EXPORT bool IsExternal() const;
/**
* Returns true if this value is a 32-bit signed integer.
*/
bool IsInt32() const;
V8EXPORT bool IsInt32() const;
/**
* Returns true if this value is a 32-bit unsigned integer.
*/
bool IsUint32() const;
V8EXPORT bool IsUint32() const;
/**
* Returns true if this value is a Date.
*/
bool IsDate() const;
V8EXPORT bool IsDate() const;
Local<Boolean> ToBoolean() const;
Local<Number> ToNumber() const;
Local<String> ToString() const;
Local<String> ToDetailString() const;
Local<Object> ToObject() const;
Local<Integer> ToInteger() const;
Local<Uint32> ToUint32() const;
Local<Int32> ToInt32() const;
V8EXPORT Local<Boolean> ToBoolean() const;
V8EXPORT Local<Number> ToNumber() const;
V8EXPORT Local<String> ToString() const;
V8EXPORT Local<String> ToDetailString() const;
V8EXPORT Local<Object> ToObject() const;
V8EXPORT Local<Integer> ToInteger() const;
V8EXPORT Local<Uint32> ToUint32() const;
V8EXPORT Local<Int32> ToInt32() const;
/**
* Attempts to convert a string to an array index.
* Returns an empty handle if the conversion fails.
*/
Local<Uint32> ToArrayIndex() const;
V8EXPORT Local<Uint32> ToArrayIndex() const;
bool BooleanValue() const;
double NumberValue() const;
int64_t IntegerValue() const;
uint32_t Uint32Value() const;
int32_t Int32Value() const;
V8EXPORT bool BooleanValue() const;
V8EXPORT double NumberValue() const;
V8EXPORT int64_t IntegerValue() const;
V8EXPORT uint32_t Uint32Value() const;
V8EXPORT int32_t Int32Value() const;
/** JS == */
bool Equals(Handle<Value> that) const;
bool StrictEquals(Handle<Value> that) const;
V8EXPORT bool Equals(Handle<Value> that) const;
V8EXPORT bool StrictEquals(Handle<Value> that) const;
private:
inline bool QuickIsString() const;
bool FullIsString() const;
V8EXPORT bool FullIsString() const;
};
/**
* The superclass of primitive values. See ECMA-262 4.3.2.
*/
class V8EXPORT Primitive : public Value { };
class Primitive : public Value { };
/**
* A primitive boolean value (ECMA-262, 4.3.14). Either the true
* or false value.
*/
class V8EXPORT Boolean : public Primitive {
class Boolean : public Primitive {
public:
bool Value() const;
V8EXPORT bool Value() const;
static inline Handle<Boolean> New(bool value);
};
......@@ -968,19 +960,19 @@ class V8EXPORT Boolean : public Primitive {
/**
* A JavaScript string value (ECMA-262, 4.3.17).
*/
class V8EXPORT String : public Primitive {
class String : public Primitive {
public:
/**
* Returns the number of characters in this string.
*/
int Length() const;
V8EXPORT int Length() const;
/**
* Returns the number of bytes in the UTF-8 encoded
* representation of this string.
*/
int Utf8Length() const;
V8EXPORT int Utf8Length() const;
/**
* Write the contents of the string to an external buffer.
......@@ -1007,33 +999,33 @@ class V8EXPORT String : public Primitive {
HINT_MANY_WRITES_EXPECTED = 1
};
int Write(uint16_t* buffer,
int start = 0,
int length = -1,
WriteHints hints = NO_HINTS) const; // UTF-16
int WriteAscii(char* buffer,
int start = 0,
int length = -1,
WriteHints hints = NO_HINTS) const; // ASCII
int WriteUtf8(char* buffer,
int length = -1,
int* nchars_ref = NULL,
WriteHints hints = NO_HINTS) const; // UTF-8
V8EXPORT int Write(uint16_t* buffer,
int start = 0,
int length = -1,
WriteHints hints = NO_HINTS) const; // UTF-16
V8EXPORT int WriteAscii(char* buffer,
int start = 0,
int length = -1,
WriteHints hints = NO_HINTS) const; // ASCII
V8EXPORT int WriteUtf8(char* buffer,
int length = -1,
int* nchars_ref = NULL,
WriteHints hints = NO_HINTS) const; // UTF-8
/**
* A zero length string.
*/
static v8::Local<v8::String> Empty();
V8EXPORT static v8::Local<v8::String> Empty();
/**
* Returns true if the string is external
*/
bool IsExternal() const;
V8EXPORT bool IsExternal() const;
/**
* Returns true if the string is both external and ascii
*/
bool IsExternalAscii() const;
V8EXPORT bool IsExternalAscii() const;
class V8EXPORT ExternalStringResourceBase {
public:
......@@ -1124,7 +1116,7 @@ class V8EXPORT String : public Primitive {
* Get the ExternalAsciiStringResource for an external ascii string.
* Returns NULL if IsExternalAscii() doesn't return true.
*/
ExternalAsciiStringResource* GetExternalAsciiStringResource() const;
V8EXPORT ExternalAsciiStringResource* GetExternalAsciiStringResource() const;
static inline String* Cast(v8::Value* obj);
......@@ -1137,19 +1129,20 @@ class V8EXPORT String : public Primitive {
* 'strlen' to determine the buffer length, it might be
* wrong if 'data' contains a null character.
*/
static Local<String> New(const char* data, int length = -1);
V8EXPORT static Local<String> New(const char* data, int length = -1);
/** Allocates a new string from utf16 data.*/
static Local<String> New(const uint16_t* data, int length = -1);
V8EXPORT static Local<String> New(const uint16_t* data, int length = -1);
/** Creates a symbol. Returns one if it exists already.*/
static Local<String> NewSymbol(const char* data, int length = -1);
V8EXPORT static Local<String> NewSymbol(const char* data, int length = -1);
/**
* Creates a new string by concatenating the left and the right strings
* passed in as parameters.
*/
static Local<String> Concat(Handle<String> left, Handle<String>right);
V8EXPORT static Local<String> Concat(Handle<String> left,
Handle<String>right);
/**
* Creates a new external string using the data defined in the given
......@@ -1159,7 +1152,7 @@ class V8EXPORT String : public Primitive {
* should the underlying buffer be deallocated or modified except through the
* destructor of the external string resource.
*/
static Local<String> NewExternal(ExternalStringResource* resource);
V8EXPORT static Local<String> NewExternal(ExternalStringResource* resource);
/**
* Associate an external string resource with this string by transforming it
......@@ -1170,7 +1163,7 @@ class V8EXPORT String : public Primitive {
* The string is not modified if the operation fails. See NewExternal for
* information on the lifetime of the resource.
*/
bool MakeExternal(ExternalStringResource* resource);
V8EXPORT bool MakeExternal(ExternalStringResource* resource);
/**
* Creates a new external string using the ascii data defined in the given
......@@ -1180,7 +1173,8 @@ class V8EXPORT String : public Primitive {
* should the underlying buffer be deallocated or modified except through the
* destructor of the external string resource.
*/
static Local<String> NewExternal(ExternalAsciiStringResource* resource);
V8EXPORT static Local<String> NewExternal(
ExternalAsciiStringResource* resource);
/**
* Associate an external string resource with this string by transforming it
......@@ -1191,18 +1185,20 @@ class V8EXPORT String : public Primitive {
* The string is not modified if the operation fails. See NewExternal for
* information on the lifetime of the resource.
*/
bool MakeExternal(ExternalAsciiStringResource* resource);
V8EXPORT bool MakeExternal(ExternalAsciiStringResource* resource);
/**
* Returns true if this string can be made external.
*/
bool CanMakeExternal();
V8EXPORT bool CanMakeExternal();
/** Creates an undetectable string from the supplied ascii or utf-8 data.*/
static Local<String> NewUndetectable(const char* data, int length = -1);
V8EXPORT static Local<String> NewUndetectable(const char* data,
int length = -1);
/** Creates an undetectable string from the supplied utf-16 data.*/
static Local<String> NewUndetectable(const uint16_t* data, int length = -1);
V8EXPORT static Local<String> NewUndetectable(const uint16_t* data,
int length = -1);
/**
* Converts an object to a utf8-encoded character array. Useful if
......@@ -1273,21 +1269,21 @@ class V8EXPORT String : public Primitive {
};
private:
void VerifyExternalStringResource(ExternalStringResource* val) const;
static void CheckCast(v8::Value* obj);
V8EXPORT void VerifyExternalStringResource(ExternalStringResource* val) const;
V8EXPORT static void CheckCast(v8::Value* obj);
};
/**
* A JavaScript number value (ECMA-262, 4.3.20)
*/
class V8EXPORT Number : public Primitive {
class Number : public Primitive {
public:
double Value() const;
static Local<Number> New(double value);
V8EXPORT double Value() const;
V8EXPORT static Local<Number> New(double value);
static inline Number* Cast(v8::Value* obj);
private:
Number();
V8EXPORT Number();
static void CheckCast(v8::Value* obj);
};
......@@ -1295,56 +1291,56 @@ class V8EXPORT Number : public Primitive {
/**
* A JavaScript value representing a signed integer.
*/
class V8EXPORT Integer : public Number {
class Integer : public Number {
public:
static Local<Integer> New(int32_t value);
static Local<Integer> NewFromUnsigned(uint32_t value);
int64_t Value() const;
V8EXPORT static Local<Integer> New(int32_t value);
V8EXPORT static Local<Integer> NewFromUnsigned(uint32_t value);
V8EXPORT int64_t Value() const;
static inline Integer* Cast(v8::Value* obj);
private:
Integer();
static void CheckCast(v8::Value* obj);
V8EXPORT Integer();
V8EXPORT static void CheckCast(v8::Value* obj);
};
/**
* A JavaScript value representing a 32-bit signed integer.
*/
class V8EXPORT Int32 : public Integer {
class Int32 : public Integer {
public:
int32_t Value() const;
V8EXPORT int32_t Value() const;
private:
Int32();
V8EXPORT Int32();
};
/**
* A JavaScript value representing a 32-bit unsigned integer.
*/
class V8EXPORT Uint32 : public Integer {
class Uint32 : public Integer {
public:
uint32_t Value() const;
V8EXPORT uint32_t Value() const;
private:
Uint32();
V8EXPORT Uint32();
};
/**
* An instance of the built-in Date constructor (ECMA-262, 15.9).
*/
class V8EXPORT Date : public Value {
class Date : public Value {
public:
static Local<Value> New(double time);
V8EXPORT static Local<Value> New(double time);
/**
* A specialization of Value::NumberValue that is more efficient
* because we know the structure of this object.
*/
double NumberValue() const;
V8EXPORT double NumberValue() const;
static inline Date* Cast(v8::Value* obj);
private:
static void CheckCast(v8::Value* obj);
V8EXPORT static void CheckCast(v8::Value* obj);
};
......@@ -1403,14 +1399,14 @@ enum AccessControl {
/**
* A JavaScript object (ECMA-262, 4.3.3)
*/
class V8EXPORT Object : public Value {
class Object : public Value {
public:
bool Set(Handle<Value> key,
Handle<Value> value,
PropertyAttribute attribs = None);
V8EXPORT bool Set(Handle<Value> key,
Handle<Value> value,
PropertyAttribute attribs = None);
bool Set(uint32_t index,
Handle<Value> value);
V8EXPORT bool Set(uint32_t index,
Handle<Value> value);
// Sets a local property on this object bypassing interceptors and
// overriding accessors or read-only properties.
......@@ -1420,34 +1416,34 @@ class V8EXPORT Object : public Value {
// will only be returned if the interceptor doesn't return a value.
//
// Note also that this only works for named properties.
bool ForceSet(Handle<Value> key,
Handle<Value> value,
PropertyAttribute attribs = None);
V8EXPORT bool ForceSet(Handle<Value> key,
Handle<Value> value,
PropertyAttribute attribs = None);
Local<Value> Get(Handle<Value> key);
V8EXPORT Local<Value> Get(Handle<Value> key);
Local<Value> Get(uint32_t index);
V8EXPORT Local<Value> Get(uint32_t index);
// TODO(1245389): Replace the type-specific versions of these
// functions with generic ones that accept a Handle<Value> key.
bool Has(Handle<String> key);
V8EXPORT bool Has(Handle<String> key);
bool Delete(Handle<String> key);
V8EXPORT bool Delete(Handle<String> key);
// Delete a property on this object bypassing interceptors and
// ignoring dont-delete attributes.
bool ForceDelete(Handle<Value> key);
V8EXPORT bool ForceDelete(Handle<Value> key);
bool Has(uint32_t index);
V8EXPORT bool Has(uint32_t index);
bool Delete(uint32_t index);
V8EXPORT bool Delete(uint32_t index);
bool SetAccessor(Handle<String> name,
AccessorGetter getter,
AccessorSetter setter = 0,
Handle<Value> data = Handle<Value>(),
AccessControl settings = DEFAULT,
PropertyAttribute attribute = None);
V8EXPORT bool SetAccessor(Handle<String> name,
AccessorGetter getter,
AccessorSetter setter = 0,
Handle<Value> data = Handle<Value>(),
AccessControl settings = DEFAULT,
PropertyAttribute attribute = None);
/**
* Returns an array containing the names of the enumerable properties
......@@ -1455,78 +1451,80 @@ class V8EXPORT Object : public Value {
* array returned by this method contains the same values as would
* be enumerated by a for-in statement over this object.
*/
Local<Array> GetPropertyNames();
V8EXPORT Local<Array> GetPropertyNames();
/**
* Get the prototype object. This does not skip objects marked to
* be skipped by __proto__ and it does not consult the security
* handler.
*/
Local<Value> GetPrototype();
V8EXPORT Local<Value> GetPrototype();
/**
* Set the prototype object. This does not skip objects marked to
* be skipped by __proto__ and it does not consult the security
* handler.
*/
bool SetPrototype(Handle<Value> prototype);
V8EXPORT bool SetPrototype(Handle<Value> prototype);
/**
* Finds an instance of the given function template in the prototype
* chain.
*/
Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl);
V8EXPORT Local<Object> FindInstanceInPrototypeChain(
Handle<FunctionTemplate> tmpl);
/**
* Call builtin Object.prototype.toString on this object.
* This is different from Value::ToString() that may call
* user-defined toString function. This one does not.
*/
Local<String> ObjectProtoToString();
V8EXPORT Local<String> ObjectProtoToString();
/** Gets the number of internal fields for this Object. */
int InternalFieldCount();
V8EXPORT int InternalFieldCount();
/** Gets the value in an internal field. */
inline Local<Value> GetInternalField(int index);
/** Sets the value in an internal field. */
void SetInternalField(int index, Handle<Value> value);
V8EXPORT void SetInternalField(int index, Handle<Value> value);
/** Gets a native pointer from an internal field. */
inline void* GetPointerFromInternalField(int index);
/** Sets a native pointer in an internal field. */
void SetPointerInInternalField(int index, void* value);
V8EXPORT void SetPointerInInternalField(int index, void* value);
// Testers for local properties.
bool HasRealNamedProperty(Handle<String> key);
bool HasRealIndexedProperty(uint32_t index);
bool HasRealNamedCallbackProperty(Handle<String> key);
V8EXPORT bool HasRealNamedProperty(Handle<String> key);
V8EXPORT bool HasRealIndexedProperty(uint32_t index);
V8EXPORT bool HasRealNamedCallbackProperty(Handle<String> key);
/**
* If result.IsEmpty() no real property was located in the prototype chain.
* This means interceptors in the prototype chain are not called.
*/
Local<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key);
V8EXPORT Local<Value> GetRealNamedPropertyInPrototypeChain(
Handle<String> key);
/**
* If result.IsEmpty() no real property was located on the object or
* in the prototype chain.
* This means interceptors in the prototype chain are not called.
*/
Local<Value> GetRealNamedProperty(Handle<String> key);
V8EXPORT Local<Value> GetRealNamedProperty(Handle<String> key);
/** Tests for a named lookup interceptor.*/
bool HasNamedLookupInterceptor();
V8EXPORT bool HasNamedLookupInterceptor();
/** Tests for an index lookup interceptor.*/
bool HasIndexedLookupInterceptor();
V8EXPORT bool HasIndexedLookupInterceptor();
/**
* 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
* access check info, the object cannot be accessed by anyone.
*/
void TurnOnAccessCheck();
V8EXPORT void TurnOnAccessCheck();
/**
* Returns the identity hash for this object. The current implemenation uses
......@@ -1535,7 +1533,7 @@ class V8EXPORT Object : public Value {
* The return value will never be 0. Also, it is not guaranteed to be
* unique.
*/
int GetIdentityHash();
V8EXPORT int GetIdentityHash();
/**
* Access hidden properties on JavaScript objects. These properties are
......@@ -1543,9 +1541,9 @@ class V8EXPORT Object : public Value {
* C++ API. Hidden properties introduced by V8 internally (for example the
* 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);
V8EXPORT bool SetHiddenValue(Handle<String> key, Handle<Value> value);
V8EXPORT Local<Value> GetHiddenValue(Handle<String> key);
V8EXPORT bool DeleteHiddenValue(Handle<String> key);
/**
* Returns true if this is an instance of an api function (one
......@@ -1554,13 +1552,13 @@ class V8EXPORT Object : public Value {
* conservative and may return true for objects that haven't actually
* been modified.
*/
bool IsDirty();
V8EXPORT bool IsDirty();
/**
* Clone this object with a fast but shallow copy. Values will point
* to the same values as the original object.
*/
Local<Object> Clone();
V8EXPORT Local<Object> Clone();
/**
* Set the backing store of the indexed properties to be managed by the
......@@ -1569,7 +1567,7 @@ class V8EXPORT Object : public Value {
* Note: The embedding program still owns the data and needs to ensure that
* the backing store is preserved while V8 has a reference.
*/
void SetIndexedPropertiesToPixelData(uint8_t* data, int length);
V8EXPORT void SetIndexedPropertiesToPixelData(uint8_t* data, int length);
bool HasIndexedPropertiesInPixelData();
uint8_t* GetIndexedPropertiesPixelData();
int GetIndexedPropertiesPixelDataLength();
......@@ -1581,21 +1579,22 @@ class V8EXPORT Object : public Value {
* Note: The embedding program still owns the data and needs to ensure that
* the backing store is preserved while V8 has a reference.
*/
void SetIndexedPropertiesToExternalArrayData(void* data,
ExternalArrayType array_type,
int number_of_elements);
V8EXPORT void SetIndexedPropertiesToExternalArrayData(
void* data,
ExternalArrayType array_type,
int number_of_elements);
bool HasIndexedPropertiesInExternalArrayData();
void* GetIndexedPropertiesExternalArrayData();
ExternalArrayType GetIndexedPropertiesExternalArrayDataType();
int GetIndexedPropertiesExternalArrayDataLength();
static Local<Object> New();
V8EXPORT static Local<Object> New();
static inline Object* Cast(Value* obj);
private:
Object();
static void CheckCast(Value* obj);
Local<Value> CheckedGetInternalField(int index);
void* SlowGetPointerFromInternalField(int index);
V8EXPORT Object();
V8EXPORT static void CheckCast(Value* obj);
V8EXPORT Local<Value> CheckedGetInternalField(int index);
V8EXPORT void* SlowGetPointerFromInternalField(int index);
/**
* If quick access to the internal field is possible this method
......@@ -1608,20 +1607,20 @@ class V8EXPORT Object : public Value {
/**
* An instance of the built-in array constructor (ECMA-262, 15.4.2).
*/
class V8EXPORT Array : public Object {
class Array : public Object {
public:
uint32_t Length() const;
V8EXPORT uint32_t Length() const;
/**
* Clones an element at index |index|. Returns an empty
* handle if cloning fails (for any reason).
*/
Local<Object> CloneElementAt(uint32_t index);
V8EXPORT Local<Object> CloneElementAt(uint32_t index);
static Local<Array> New(int length = 0);
V8EXPORT static Local<Array> New(int length = 0);
static inline Array* Cast(Value* obj);
private:
Array();
V8EXPORT Array();
static void CheckCast(Value* obj);
};
......@@ -1629,25 +1628,27 @@ class V8EXPORT Array : public Object {
/**
* A JavaScript function object (ECMA-262, 15.3).
*/
class V8EXPORT Function : public Object {
class Function : public Object {
public:
Local<Object> NewInstance() const;
Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]);
void SetName(Handle<String> name);
Handle<Value> GetName() const;
V8EXPORT Local<Object> NewInstance() const;
V8EXPORT Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
V8EXPORT Local<Value> Call(Handle<Object> recv,
int argc,
Handle<Value> argv[]);
V8EXPORT void SetName(Handle<String> name);
V8EXPORT Handle<Value> GetName() const;
/**
* Returns zero based line number of function body and
* kLineOffsetNotFound if no information available.
*/
int GetScriptLineNumber() const;
ScriptOrigin GetScriptOrigin() const;
V8EXPORT int GetScriptLineNumber() const;
V8EXPORT ScriptOrigin GetScriptOrigin() const;
static inline Function* Cast(Value* obj);
static const int kLineOffsetNotFound;
V8EXPORT static const int kLineOffsetNotFound;
private:
Function();
static void CheckCast(Value* obj);
V8EXPORT Function();
V8EXPORT static void CheckCast(Value* obj);
};
......@@ -1662,19 +1663,19 @@ class V8EXPORT Function : public Object {
* value Unwrap should be used, all other operations on that object will lead
* to unpredictable results.
*/
class V8EXPORT External : public Value {
class External : public Value {
public:
static Local<Value> Wrap(void* data);
V8EXPORT static Local<Value> Wrap(void* data);
static inline void* Unwrap(Handle<Value> obj);
static Local<External> New(void* value);
V8EXPORT static Local<External> New(void* value);
static inline External* Cast(Value* obj);
void* Value() const;
V8EXPORT void* Value() const;
private:
External();
static void CheckCast(v8::Value* obj);
V8EXPORT External();
V8EXPORT static void CheckCast(v8::Value* obj);
static inline void* QuickUnwrap(Handle<v8::Value> obj);
static void* FullUnwrap(Handle<v8::Value> obj);
V8EXPORT static void* FullUnwrap(Handle<v8::Value> obj);
};
......@@ -1704,7 +1705,7 @@ class V8EXPORT Template : public Data {
* including the receiver, the number and values of arguments, and
* the holder of the function.
*/
class V8EXPORT Arguments {
class Arguments {
public:
inline int Length() const;
inline Local<Value> operator[](int i) const;
......@@ -1714,7 +1715,6 @@ class V8EXPORT Arguments {
inline bool IsConstructCall() const;
inline Local<Value> Data() const;
private:
Arguments();
friend class ImplementationUtilities;
inline Arguments(Local<Value> data,
Local<Object> holder,
......@@ -3001,7 +3001,7 @@ class V8EXPORT Context {
* Stack-allocated class which sets the execution context for all
* operations executed within a local scope.
*/
class V8EXPORT Scope {
class Scope {
public:
inline Scope(Handle<Context> context) : context_(context) {
context_->Enter();
......@@ -3320,6 +3320,17 @@ void Persistent<T>::ClearWeak() {
V8::ClearWeak(reinterpret_cast<internal::Object**>(**this));
}
Arguments::Arguments(v8::Local<v8::Value> data,
v8::Local<v8::Object> holder,
v8::Local<v8::Function> callee,
bool is_construct_call,
void** values, int length)
: data_(data), holder_(holder), callee_(callee),
is_construct_call_(is_construct_call),
values_(values), length_(length) { }
Local<Value> Arguments::operator[](int i) const {
if (i < 0 || length_ <= i) return Local<Value>(*Undefined());
return Local<Value>(reinterpret_cast<Value*>(values_ - i));
......@@ -3580,7 +3591,6 @@ Local<Object> AccessorInfo::Holder() const {
#undef V8EXPORT
#undef V8EXPORT_INLINE
#undef TYPE_CHECK
......
......@@ -134,16 +134,6 @@ class ApiFunction {
};
v8::Arguments::Arguments(v8::Local<v8::Value> data,
v8::Local<v8::Object> holder,
v8::Local<v8::Function> callee,
bool is_construct_call,
void** values, int length)
: data_(data), holder_(holder), callee_(callee),
is_construct_call_(is_construct_call),
values_(values), length_(length) { }
enum ExtensionTraversalState {
UNVISITED, VISITED, INSTALLED
};
......
// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <windows.h>
#include "../include/v8.h"
extern "C" {
BOOL WINAPI DllMain(HANDLE hinstDLL,
DWORD dwReason,
LPVOID lpvReserved) {
// Do nothing.
return TRUE;
}
}
......@@ -75,7 +75,14 @@
'msvs_settings': {
'VCCLCompilerTool': {
'Optimizations': '0',
'RuntimeLibrary': '1',
'conditions': [
['OS=="win" and component=="shared_library"', {
'RuntimeLibrary': '3', # /MDd
}, {
'RuntimeLibrary': '1', # /MTd
}],
],
},
'VCLinkerTool': {
'LinkIncremental': '2',
......@@ -129,13 +136,20 @@
},
'msvs_settings': {
'VCCLCompilerTool': {
'RuntimeLibrary': '0',
'Optimizations': '2',
'InlineFunctionExpansion': '2',
'EnableIntrinsicFunctions': 'true',
'FavorSizeOrSpeed': '0',
'OmitFramePointers': 'true',
'StringPooling': 'true',
'conditions': [
['OS=="win" and component=="shared_library"', {
'RuntimeLibrary': '2', #/MD
}, {
'RuntimeLibrary': '0', #/MT
}],
],
},
'VCLinkerTool': {
'LinkIncremental': '1',
......@@ -152,7 +166,6 @@
'targets': [
{
'target_name': 'v8',
'type': 'none',
'conditions': [
['v8_use_snapshot=="true"', {
'dependencies': ['v8_snapshot'],
......@@ -160,6 +173,18 @@
{
'dependencies': ['v8_nosnapshot'],
}],
['OS=="win" and component=="shared_library"', {
'type': '<(component)',
'sources': [
'../../src/v8dll-main.cc',
],
'defines': [
'BUILDING_V8_SHARED'
],
},
{
'type': 'none',
}],
],
'direct_dependent_settings': {
'include_dirs': [
......@@ -170,6 +195,13 @@
{
'target_name': 'v8_snapshot',
'type': '<(library)',
'conditions': [
['OS=="win" and component=="shared_library"', {
'defines': [
'BUILDING_V8_SHARED',
],
}],
],
'dependencies': [
'mksnapshot#host',
'js2c#host',
......@@ -216,7 +248,12 @@
['v8_target_arch=="arm" and host_arch=="x64" and _toolset=="host"', {
'cflags': ['-m32'],
'ldflags': ['-m32'],
}]
}],
['OS=="win" and component=="shared_library"', {
'defines': [
'BUILDING_V8_SHARED',
],
}],
]
},
{
......@@ -614,6 +651,11 @@
'libraries': [ '-lwinmm.lib' ],
},
}],
['OS=="win" and component=="shared_library"', {
'defines': [
'BUILDING_V8_SHARED'
],
}],
],
},
{
......@@ -692,10 +734,15 @@
'../../samples/shell.cc',
],
'conditions': [
[ 'OS=="win"', {
['OS=="win"', {
# This could be gotten by not setting chromium_code, if that's OK.
'defines': ['_CRT_SECURE_NO_WARNINGS'],
}],
['OS=="win" and component=="shared_library"', {
'defines': [
'USING_V8_SHARED',
],
}],
],
},
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment