v8.h   v8.h 
skipping to change at line 41 skipping to change at line 41
* *
* This set of documents provides reference material generated from the * This set of documents provides reference material generated from the
* V8 header file, include/v8.h. * V8 header file, include/v8.h.
* *
* For other documentation see http://code.google.com/apis/v8/ * For other documentation see http://code.google.com/apis/v8/
*/ */
#ifndef V8_H_ #ifndef V8_H_
#define V8_H_ #define V8_H_
#include <stdio.h> #include "v8stdint.h"
#ifdef _WIN32 #ifdef _WIN32
// When compiling on MinGW stdint.h is available.
#ifdef __MINGW32__
#include <stdint.h>
#else // __MINGW32__
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t; // NOLINT
typedef unsigned short uint16_t; // NOLINT
typedef int int32_t;
typedef unsigned int uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
// intptr_t and friends are defined in crtdefs.h through stdio.h.
#endif // __MINGW32__
// 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.
#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
skipping to change at line 79 skipping to change at line 65
#ifdef BUILDING_V8_SHARED #ifdef BUILDING_V8_SHARED
#define V8EXPORT __declspec(dllexport) #define V8EXPORT __declspec(dllexport)
#elif USING_V8_SHARED #elif USING_V8_SHARED
#define V8EXPORT __declspec(dllimport) #define V8EXPORT __declspec(dllimport)
#else #else
#define V8EXPORT #define V8EXPORT
#endif // BUILDING_V8_SHARED #endif // BUILDING_V8_SHARED
#else // _WIN32 #else // _WIN32
#include <stdint.h>
// Setup for Linux shared library export. There is no need to distinguish // Setup for Linux shared library export. There is no need to distinguish
// between building or using the V8 shared library, but we should not // between building or using the V8 shared library, but we should not
// export symbols when we are building a static library. // export symbols when we are building a static library.
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED) #if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED)
#define V8EXPORT __attribute__ ((visibility("default"))) #define V8EXPORT __attribute__ ((visibility("default")))
#else // defined(__GNUC__) && (__GNUC__ >= 4) #else // defined(__GNUC__) && (__GNUC__ >= 4)
#define V8EXPORT #define V8EXPORT
#endif // defined(__GNUC__) && (__GNUC__ >= 4) #endif // defined(__GNUC__) && (__GNUC__ >= 4)
#endif // _WIN32 #endif // _WIN32
skipping to change at line 130 skipping to change at line 114
class AccessorInfo; class AccessorInfo;
class StackTrace; class StackTrace;
class StackFrame; class StackFrame;
namespace internal { namespace internal {
class Arguments; class Arguments;
class Object; class Object;
class Heap; class Heap;
class Top; class Top;
} }
// --- W e a k H a n d l e s // --- W e a k H a n d l e s
/** /**
* A weak reference callback function. * A weak reference callback function.
* *
* 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.
* *
skipping to change at line 1038 skipping to change at line 1021
/** /**
* Returns true if the string is external * Returns true if the string is external
*/ */
V8EXPORT bool IsExternal() const; V8EXPORT bool IsExternal() const;
/** /**
* Returns true if the string is both external and ascii * Returns true if the string is both external and ascii
*/ */
V8EXPORT bool IsExternalAscii() const; V8EXPORT bool IsExternalAscii() const;
class V8EXPORT ExternalStringResourceBase { class V8EXPORT ExternalStringResourceBase { // NOLINT
public: public:
virtual ~ExternalStringResourceBase() {} virtual ~ExternalStringResourceBase() {}
protected: protected:
ExternalStringResourceBase() {} ExternalStringResourceBase() {}
/** /**
* Internally V8 will call this Dispose method when the external string * Internally V8 will call this Dispose method when the external string
* resource is no longer needed. The default implementation will use th e * resource is no longer needed. The default implementation will use th e
* delete operator. This method can be overridden in subclasses to * delete operator. This method can be overridden in subclasses to
skipping to change at line 3189 skipping to change at line 3172
static bool active_; static bool active_;
// Disallow copying and assigning. // Disallow copying and assigning.
Locker(const Locker&); Locker(const Locker&);
void operator=(const Locker&); void operator=(const Locker&);
}; };
/** /**
* An interface for exporting data from V8, using "push" model. * An interface for exporting data from V8, using "push" model.
*/ */
class V8EXPORT OutputStream { class V8EXPORT OutputStream { // NOLINT
public: public:
enum OutputEncoding { enum OutputEncoding {
kAscii = 0 // 7-bit ASCII. kAscii = 0 // 7-bit ASCII.
}; };
enum WriteResult { enum WriteResult {
kContinue = 0, kContinue = 0,
kAbort = 1 kAbort = 1
}; };
virtual ~OutputStream() {} virtual ~OutputStream() {}
/** Notify about the end of stream. */ /** Notify about the end of stream. */
virtual void EndOfStream() = 0; virtual void EndOfStream() = 0;
skipping to change at line 3217 skipping to change at line 3200
* can be stopped by returning kAbort as function result. EndOfStream * can be stopped by returning kAbort as function result. EndOfStream
* will not be called in case writing was aborted. * will not be called in case writing was aborted.
*/ */
virtual WriteResult WriteAsciiChunk(char* data, int size) = 0; virtual WriteResult WriteAsciiChunk(char* data, int size) = 0;
}; };
// --- I m p l e m e n t a t i o n --- // --- I m p l e m e n t a t i o n ---
namespace internal { namespace internal {
const int kPointerSize = sizeof(void*); // NOLINT
const int kIntSize = 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;
// Tag information for Smi. // Tag information for Smi.
const int kSmiTag = 0; const int kSmiTag = 0;
const int kSmiTagSize = 1; const int kSmiTagSize = 1;
const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1; const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
skipping to change at line 3251 skipping to change at line 3237
template <> struct SmiConstants<8> { template <> struct SmiConstants<8> {
static const int kSmiShiftSize = 31; static const int kSmiShiftSize = 31;
static const int kSmiValueSize = 32; static const int kSmiValueSize = 32;
static inline int SmiToInt(internal::Object* value) { static inline int SmiToInt(internal::Object* value) {
int shift_bits = kSmiTagSize + kSmiShiftSize; int shift_bits = kSmiTagSize + kSmiShiftSize;
// Shift down and throw away top 32 bits. // Shift down and throw away top 32 bits.
return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits ); return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits );
} }
}; };
const int kSmiShiftSize = SmiConstants<sizeof(void*)>::kSmiShiftSize; const int kSmiShiftSize = SmiConstants<kPointerSize>::kSmiShiftSize;
const int kSmiValueSize = SmiConstants<sizeof(void*)>::kSmiValueSize; const int kSmiValueSize = SmiConstants<kPointerSize>::kSmiValueSize;
template <size_t ptr_size> struct InternalConstants; template <size_t ptr_size> struct InternalConstants;
// Internal constants for 32-bit systems. // Internal constants for 32-bit systems.
template <> struct InternalConstants<4> { template <> struct InternalConstants<4> {
static const int kStringResourceOffset = 3 * sizeof(void*); static const int kStringResourceOffset = 3 * kPointerSize;
}; };
// Internal constants for 64-bit systems. // Internal constants for 64-bit systems.
template <> struct InternalConstants<8> { template <> struct InternalConstants<8> {
static const int kStringResourceOffset = 3 * sizeof(void*); static const int kStringResourceOffset = 3 * kPointerSize;
}; };
/** /**
* This class exports constants and functionality from within v8 that * This class exports constants and functionality from within v8 that
* is necessary to implement inline functions in the v8 api. Don't * is necessary to implement inline functions in the v8 api. Don't
* depend on functions and constants defined here. * depend on functions and constants defined here.
*/ */
class Internals { class Internals {
public: public:
// These values match non-compiler-dependent values defined within // These values match non-compiler-dependent values defined within
// the implementation of v8. // the implementation of v8.
static const int kHeapObjectMapOffset = 0; static const int kHeapObjectMapOffset = 0;
static const int kMapInstanceTypeOffset = sizeof(void*) + sizeof(int); static const int kMapInstanceTypeOffset = kPointerSize + kIntSize;
static const int kStringResourceOffset = static const int kStringResourceOffset =
InternalConstants<sizeof(void*)>::kStringResourceOffset; InternalConstants<kPointerSize>::kStringResourceOffset;
static const int kProxyProxyOffset = sizeof(void*); static const int kProxyProxyOffset = kPointerSize;
static const int kJSObjectHeaderSize = 3 * sizeof(void*); static const int kJSObjectHeaderSize = 3 * kPointerSize;
static const int kFullStringRepresentationMask = 0x07; static const int kFullStringRepresentationMask = 0x07;
static const int kExternalTwoByteRepresentationTag = 0x02; static const int kExternalTwoByteRepresentationTag = 0x02;
static const int kJSObjectType = 0x9f; static const int kJSObjectType = 0x9f;
static const int kFirstNonstringType = 0x80; static const int kFirstNonstringType = 0x80;
static const int kProxyType = 0x85; static const int kProxyType = 0x85;
static inline bool HasHeapObjectTag(internal::Object* value) { static inline bool HasHeapObjectTag(internal::Object* value) {
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
kHeapObjectTag); kHeapObjectTag);
} }
static inline bool HasSmiTag(internal::Object* value) { static inline bool HasSmiTag(internal::Object* value) {
return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag); return ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag);
} }
static inline int SmiValue(internal::Object* value) { static inline int SmiValue(internal::Object* value) {
return SmiConstants<sizeof(void*)>::SmiToInt(value); return SmiConstants<kPointerSize>::SmiToInt(value);
} }
static inline int GetInstanceType(internal::Object* obj) { static inline int GetInstanceType(internal::Object* obj) {
typedef internal::Object O; typedef internal::Object O;
O* map = ReadField<O*>(obj, kHeapObjectMapOffset); O* map = ReadField<O*>(obj, kHeapObjectMapOffset);
return ReadField<uint8_t>(map, kMapInstanceTypeOffset); return ReadField<uint8_t>(map, kMapInstanceTypeOffset);
} }
static inline void* GetExternalPointer(internal::Object* obj) { static inline void* GetExternalPointer(internal::Object* obj) {
if (HasSmiTag(obj)) { if (HasSmiTag(obj)) {
skipping to change at line 3329 skipping to change at line 3315
static inline bool IsExternalTwoByteString(int instance_type) { static inline bool IsExternalTwoByteString(int instance_type) {
int representation = (instance_type & kFullStringRepresentationMask); int representation = (instance_type & kFullStringRepresentationMask);
return representation == kExternalTwoByteRepresentationTag; return representation == kExternalTwoByteRepresentationTag;
} }
template <typename T> template <typename T>
static inline T ReadField(Object* ptr, int offset) { static inline T ReadField(Object* ptr, int offset) {
uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectT ag; uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectT ag;
return *reinterpret_cast<T*>(addr); return *reinterpret_cast<T*>(addr);
} }
}; };
} } // namespace internal
template <class T> template <class T>
Handle<T>::Handle() : val_(0) { } Handle<T>::Handle() : val_(0) { }
template <class T> template <class T>
Local<T>::Local() : Handle<T>() { } Local<T>::Local() : Handle<T>() { }
template <class T> template <class T>
Local<T> Local<T>::New(Handle<T> that) { Local<T> Local<T>::New(Handle<T> that) {
if (that.IsEmpty()) return Local<T>(); if (that.IsEmpty()) return Local<T>();
skipping to change at line 3469 skipping to change at line 3454
} }
Local<Value> Object::UncheckedGetInternalField(int index) { Local<Value> Object::UncheckedGetInternalField(int index) {
typedef internal::Object O; typedef internal::Object O;
typedef internal::Internals I; typedef internal::Internals I;
O* obj = *reinterpret_cast<O**>(this); O* obj = *reinterpret_cast<O**>(this);
if (I::GetInstanceType(obj) == I::kJSObjectType) { if (I::GetInstanceType(obj) == I::kJSObjectType) {
// If the object is a plain JSObject, which is the common case, // If the object is a plain JSObject, which is the common case,
// we know where to find the internal fields and can return the // we know where to find the internal fields and can return the
// value directly. // value directly.
int offset = I::kJSObjectHeaderSize + (sizeof(void*) * index); int offset = I::kJSObjectHeaderSize + (internal::kPointerSize * index);
O* value = I::ReadField<O*>(obj, offset); O* value = I::ReadField<O*>(obj, offset);
O** result = HandleScope::CreateHandle(value); O** result = HandleScope::CreateHandle(value);
return Local<Value>(reinterpret_cast<Value*>(result)); return Local<Value>(reinterpret_cast<Value*>(result));
} else { } else {
return Local<Value>(); return Local<Value>();
} }
} }
void* External::Unwrap(Handle<v8::Value> obj) { void* External::Unwrap(Handle<v8::Value> obj) {
#ifdef V8_ENABLE_CHECKS #ifdef V8_ENABLE_CHECKS
skipping to change at line 3502 skipping to change at line 3487
void* Object::GetPointerFromInternalField(int index) { void* Object::GetPointerFromInternalField(int index) {
typedef internal::Object O; typedef internal::Object O;
typedef internal::Internals I; typedef internal::Internals I;
O* obj = *reinterpret_cast<O**>(this); O* obj = *reinterpret_cast<O**>(this);
if (I::GetInstanceType(obj) == I::kJSObjectType) { if (I::GetInstanceType(obj) == I::kJSObjectType) {
// If the object is a plain JSObject, which is the common case, // If the object is a plain JSObject, which is the common case,
// we know where to find the internal fields and can return the // we know where to find the internal fields and can return the
// value directly. // value directly.
int offset = I::kJSObjectHeaderSize + (sizeof(void*) * index); int offset = I::kJSObjectHeaderSize + (internal::kPointerSize * index);
O* value = I::ReadField<O*>(obj, offset); O* value = I::ReadField<O*>(obj, offset);
return I::GetExternalPointer(value); return I::GetExternalPointer(value);
} }
return SlowGetPointerFromInternalField(index); return SlowGetPointerFromInternalField(index);
} }
String* String::Cast(v8::Value* value) { String* String::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS #ifdef V8_ENABLE_CHECKS
CheckCast(value); CheckCast(value);
 End of changes. 18 change blocks. 
34 lines changed or deleted 19 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/