v8.h | v8.h | |||
---|---|---|---|---|
// Copyright 2007-2009 the V8 project authors. All rights reserved. | // Copyright 2011 the V8 project authors. All rights reserved. | |||
// Redistribution and use in source and binary forms, with or without | // Redistribution and use in source and binary forms, with or without | |||
// modification, are permitted provided that the following conditions are | // modification, are permitted provided that the following conditions are | |||
// met: | // met: | |||
// | // | |||
// * Redistributions of source code must retain the above copyright | // * Redistributions of source code must retain the above copyright | |||
// notice, this list of conditions and the following disclaimer. | // notice, this list of conditions and the following disclaimer. | |||
// * Redistributions in binary form must reproduce the above | // * Redistributions in binary form must reproduce the above | |||
// copyright notice, this list of conditions and the following | // copyright notice, this list of conditions and the following | |||
// disclaimer in the documentation and/or other materials provided | // disclaimer in the documentation and/or other materials provided | |||
// with the distribution. | // with the distribution. | |||
skipping to change at line 1422 | skipping to change at line 1422 | |||
}; | }; | |||
enum ExternalArrayType { | enum ExternalArrayType { | |||
kExternalByteArray = 1, | kExternalByteArray = 1, | |||
kExternalUnsignedByteArray, | kExternalUnsignedByteArray, | |||
kExternalShortArray, | kExternalShortArray, | |||
kExternalUnsignedShortArray, | kExternalUnsignedShortArray, | |||
kExternalIntArray, | kExternalIntArray, | |||
kExternalUnsignedIntArray, | kExternalUnsignedIntArray, | |||
kExternalFloatArray, | kExternalFloatArray, | |||
kExternalDoubleArray, | ||||
kExternalPixelArray | kExternalPixelArray | |||
}; | }; | |||
/** | /** | |||
* Accessor[Getter|Setter] are used as callback functions when | * Accessor[Getter|Setter] are used as callback functions when | |||
* setting|getting a particular property. See Object and ObjectTemplate's | * setting|getting a particular property. See Object and ObjectTemplate's | |||
* method SetAccessor. | * method SetAccessor. | |||
*/ | */ | |||
typedef Handle<Value> (*AccessorGetter)(Local<String> property, | typedef Handle<Value> (*AccessorGetter)(Local<String> property, | |||
const AccessorInfo& info); | const AccessorInfo& info); | |||
skipping to change at line 1561 | skipping to change at line 1562 | |||
/** Sets the value in an internal field. */ | /** Sets the value in an internal field. */ | |||
V8EXPORT void SetInternalField(int index, Handle<Value> value); | V8EXPORT void SetInternalField(int index, Handle<Value> value); | |||
/** Gets a native pointer from an internal field. */ | /** Gets a native pointer from an internal field. */ | |||
inline void* GetPointerFromInternalField(int index); | inline void* GetPointerFromInternalField(int index); | |||
/** Sets a native pointer in an internal field. */ | /** Sets a native pointer in an internal field. */ | |||
V8EXPORT void SetPointerInInternalField(int index, void* value); | V8EXPORT void SetPointerInInternalField(int index, void* value); | |||
// Testers for local properties. | // Testers for local properties. | |||
V8EXPORT bool HasOwnProperty(Handle<String> key); | ||||
V8EXPORT bool HasRealNamedProperty(Handle<String> key); | V8EXPORT bool HasRealNamedProperty(Handle<String> key); | |||
V8EXPORT bool HasRealIndexedProperty(uint32_t index); | V8EXPORT bool HasRealIndexedProperty(uint32_t index); | |||
V8EXPORT bool HasRealNamedCallbackProperty(Handle<String> key); | V8EXPORT bool HasRealNamedCallbackProperty(Handle<String> key); | |||
/** | /** | |||
* If result.IsEmpty() no real property was located in the prototype chai n. | * If result.IsEmpty() no real property was located in the prototype chai n. | |||
* This means interceptors in the prototype chain are not called. | * This means interceptors in the prototype chain are not called. | |||
*/ | */ | |||
V8EXPORT Local<Value> GetRealNamedPropertyInPrototypeChain( | V8EXPORT Local<Value> GetRealNamedPropertyInPrototypeChain( | |||
Handle<String> key); | Handle<String> key); | |||
skipping to change at line 2575 | skipping to change at line 2577 | |||
private: | private: | |||
Isolate(); | Isolate(); | |||
Isolate(const Isolate&); | Isolate(const Isolate&); | |||
~Isolate(); | ~Isolate(); | |||
Isolate& operator=(const Isolate&); | Isolate& operator=(const Isolate&); | |||
void* operator new(size_t size); | void* operator new(size_t size); | |||
void operator delete(void*, size_t); | void operator delete(void*, size_t); | |||
}; | }; | |||
class StartupData { | ||||
public: | ||||
enum CompressionAlgorithm { | ||||
kUncompressed, | ||||
kBZip2 | ||||
}; | ||||
const char* data; | ||||
int compressed_size; | ||||
int raw_size; | ||||
}; | ||||
/** | /** | |||
* 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); | |||
/** | /** | |||
* Ignore out-of-memory exceptions. | * Ignore out-of-memory exceptions. | |||
skipping to change at line 2604 | skipping to change at line 2618 | |||
*/ | */ | |||
static void IgnoreOutOfMemoryException(); | static void IgnoreOutOfMemoryException(); | |||
/** | /** | |||
* Check if V8 is dead and therefore unusable. This is the case after | * Check if V8 is dead and therefore unusable. This is the case after | |||
* fatal errors such as out-of-memory situations. | * fatal errors such as out-of-memory situations. | |||
*/ | */ | |||
static bool IsDead(); | static bool IsDead(); | |||
/** | /** | |||
* The following 4 functions are to be used when V8 is built with | ||||
* the 'compress_startup_data' flag enabled. In this case, the | ||||
* embedder must decompress startup data prior to initializing V8. | ||||
* | ||||
* This is how interaction with V8 should look like: | ||||
* int compressed_data_count = v8::V8::GetCompressedStartupDataCount(); | ||||
* v8::StartupData* compressed_data = | ||||
* new v8::StartupData[compressed_data_count]; | ||||
* v8::V8::GetCompressedStartupData(compressed_data); | ||||
* ... decompress data (compressed_data can be updated in-place) ... | ||||
* v8::V8::SetDecompressedStartupData(compressed_data); | ||||
* ... now V8 can be initialized | ||||
* ... make sure the decompressed data stays valid until V8 shutdown | ||||
*/ | ||||
static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorith | ||||
m(); | ||||
static int GetCompressedStartupDataCount(); | ||||
static void GetCompressedStartupData(StartupData* compressed_data); | ||||
static void SetDecompressedStartupData(StartupData* decompressed_data); | ||||
/** | ||||
* Adds a message listener. | * Adds a message listener. | |||
* | * | |||
* The same message listener can be added more than once and it that | * The same message listener can be added more than once and it that | |||
* case it will be called more than once for each message. | * case it will be called more than once for each message. | |||
*/ | */ | |||
static bool AddMessageListener(MessageCallback that, | static bool AddMessageListener(MessageCallback that, | |||
Handle<Value> data = Handle<Value>()); | Handle<Value> data = Handle<Value>()); | |||
/** | /** | |||
* Remove all message listeners from the specified callback function. | * Remove all message listeners from the specified callback function. | |||
skipping to change at line 3510 | skipping to change at line 3544 | |||
static const int kHeapObjectMapOffset = 0; | static const int kHeapObjectMapOffset = 0; | |||
static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSi ze; | static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSi ze; | |||
static const int kStringResourceOffset = | static const int kStringResourceOffset = | |||
InternalConstants<kApiPointerSize>::kStringResourceOffset; | InternalConstants<kApiPointerSize>::kStringResourceOffset; | |||
static const int kProxyProxyOffset = kApiPointerSize; | static const int kProxyProxyOffset = kApiPointerSize; | |||
static const int kJSObjectHeaderSize = 3 * kApiPointerSize; | static const int kJSObjectHeaderSize = 3 * kApiPointerSize; | |||
static const int kFullStringRepresentationMask = 0x07; | static const int kFullStringRepresentationMask = 0x07; | |||
static const int kExternalTwoByteRepresentationTag = 0x02; | static const int kExternalTwoByteRepresentationTag = 0x02; | |||
static const int kJSObjectType = 0xa0; | static const int kJSObjectType = 0xa1; | |||
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); | |||
End of changes. 6 change blocks. | ||||
2 lines changed or deleted | 37 lines changed or added | |||