v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 449 | skipping to change at line 449 | |||
static internal::Object** CreateHandle(internal::Object* value); | static internal::Object** CreateHandle(internal::Object* value); | |||
private: | private: | |||
// Make it impossible to create heap-allocated or illegal handle | // Make it impossible to create heap-allocated or illegal handle | |||
// scopes by disallowing certain operations. | // scopes by disallowing certain operations. | |||
HandleScope(const HandleScope&); | HandleScope(const HandleScope&); | |||
void operator=(const HandleScope&); | void operator=(const HandleScope&); | |||
void* operator new(size_t size); | void* operator new(size_t size); | |||
void operator delete(void*, size_t); | void operator delete(void*, size_t); | |||
// This Data class is accessible internally through a typedef in the | // This Data class is accessible internally as HandleScopeData through a | |||
// ImplementationUtilities class. | // typedef in the ImplementationUtilities class. | |||
class V8EXPORT Data { | class V8EXPORT Data { | |||
public: | public: | |||
int extensions; | int extensions; | |||
internal::Object** next; | internal::Object** next; | |||
internal::Object** limit; | internal::Object** limit; | |||
inline void Initialize() { | inline void Initialize() { | |||
extensions = -1; | extensions = -1; | |||
next = limit = NULL; | next = limit = NULL; | |||
} | } | |||
}; | }; | |||
skipping to change at line 1053 | skipping to change at line 1053 | |||
Number(); | Number(); | |||
static void CheckCast(v8::Value* obj); | static void CheckCast(v8::Value* obj); | |||
}; | }; | |||
/** | /** | |||
* A JavaScript value representing a signed integer. | * A JavaScript value representing a signed integer. | |||
*/ | */ | |||
class V8EXPORT Integer : public Number { | class V8EXPORT Integer : public Number { | |||
public: | public: | |||
static Local<Integer> New(int32_t value); | static Local<Integer> New(int32_t value); | |||
static inline Local<Integer> NewFromUnsigned(uint32_t value); | static Local<Integer> NewFromUnsigned(uint32_t value); | |||
int64_t Value() const; | int64_t Value() const; | |||
static inline Integer* Cast(v8::Value* obj); | static inline Integer* Cast(v8::Value* obj); | |||
private: | private: | |||
Integer(); | Integer(); | |||
static void CheckCast(v8::Value* obj); | static void CheckCast(v8::Value* obj); | |||
}; | }; | |||
/** | /** | |||
* A JavaScript value representing a 32-bit signed integer. | * A JavaScript value representing a 32-bit signed integer. | |||
*/ | */ | |||
skipping to change at line 1106 | skipping to change at line 1106 | |||
static void CheckCast(v8::Value* obj); | 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 { | ||||
kExternalByteArray = 1, | ||||
kExternalUnsignedByteArray, | ||||
kExternalShortArray, | ||||
kExternalUnsignedShortArray, | ||||
kExternalIntArray, | ||||
kExternalUnsignedIntArray, | ||||
kExternalFloatArray | ||||
}; | ||||
/** | /** | |||
* A JavaScript object (ECMA-262, 4.3.3) | * A JavaScript object (ECMA-262, 4.3.3) | |||
*/ | */ | |||
class V8EXPORT Object : public Value { | class V8EXPORT Object : public Value { | |||
public: | public: | |||
bool Set(Handle<Value> key, | bool Set(Handle<Value> key, | |||
Handle<Value> value, | Handle<Value> value, | |||
PropertyAttribute attribs = None); | PropertyAttribute attribs = None); | |||
// Sets a local property on this object bypassing interceptors and | // Sets a local property on this object bypassing interceptors and | |||
skipping to change at line 1258 | skipping to change at line 1268 | |||
/** | /** | |||
* Set the backing store of the indexed properties to be managed by the | * Set the backing store of the indexed properties to be managed by the | |||
* embedding layer. Access to the indexed properties will follow the rule s | * embedding layer. Access to the indexed properties will follow the rule s | |||
* spelled out in CanvasPixelArray. | * spelled out in CanvasPixelArray. | |||
* Note: The embedding program still owns the data and needs to ensure th at | * Note: The embedding program still owns the data and needs to ensure th at | |||
* the backing store is preserved while V8 has a reference. | * the backing store is preserved while V8 has a reference. | |||
*/ | */ | |||
void SetIndexedPropertiesToPixelData(uint8_t* data, int length); | void SetIndexedPropertiesToPixelData(uint8_t* data, int length); | |||
/** | ||||
* Set the backing store of the indexed properties to be managed by the | ||||
* embedding layer. Access to the indexed properties will follow the rule | ||||
s | ||||
* spelled out for the CanvasArray subtypes in the WebGL specification. | ||||
* Note: The embedding program still owns the data and needs to ensure th | ||||
at | ||||
* the backing store is preserved while V8 has a reference. | ||||
*/ | ||||
void SetIndexedPropertiesToExternalArrayData(void* data, | ||||
ExternalArrayType array_type | ||||
, | ||||
int number_of_elements); | ||||
static Local<Object> New(); | static Local<Object> New(); | |||
static inline Object* Cast(Value* obj); | static inline Object* Cast(Value* obj); | |||
private: | private: | |||
Object(); | Object(); | |||
static void CheckCast(Value* obj); | static void CheckCast(Value* obj); | |||
Local<Value> CheckedGetInternalField(int index); | Local<Value> CheckedGetInternalField(int index); | |||
void* SlowGetPointerFromInternalField(int index); | void* SlowGetPointerFromInternalField(int index); | |||
/** | /** | |||
* If quick access to the internal field is possible this method | * If quick access to the internal field is possible this method | |||
skipping to change at line 2042 | skipping to change at line 2063 | |||
*/ | */ | |||
enum ProfilerModules { | enum ProfilerModules { | |||
PROFILER_MODULE_NONE = 0, | PROFILER_MODULE_NONE = 0, | |||
PROFILER_MODULE_CPU = 1, | PROFILER_MODULE_CPU = 1, | |||
PROFILER_MODULE_HEAP_STATS = 1 << 1, | PROFILER_MODULE_HEAP_STATS = 1 << 1, | |||
PROFILER_MODULE_JS_CONSTRUCTORS = 1 << 2, | PROFILER_MODULE_JS_CONSTRUCTORS = 1 << 2, | |||
PROFILER_MODULE_HEAP_SNAPSHOT = 1 << 16 | PROFILER_MODULE_HEAP_SNAPSHOT = 1 << 16 | |||
}; | }; | |||
/** | /** | |||
* Collection of V8 heap information. | ||||
* | ||||
* Instances of this class can be passed to v8::V8::HeapStatistics to | ||||
* get heap statistics from V8. | ||||
*/ | ||||
class V8EXPORT HeapStatistics { | ||||
public: | ||||
HeapStatistics(); | ||||
size_t total_heap_size() { return total_heap_size_; } | ||||
size_t used_heap_size() { return used_heap_size_; } | ||||
private: | ||||
void set_total_heap_size(size_t size) { total_heap_size_ = size; } | ||||
void set_used_heap_size(size_t size) { used_heap_size_ = size; } | ||||
size_t total_heap_size_; | ||||
size_t used_heap_size_; | ||||
friend class V8; | ||||
}; | ||||
/** | ||||
* 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 2292 | skipping to change at line 2335 | |||
* that may be running. Note that disposing v8 is permanent, it | * that may be running. Note that disposing v8 is permanent, it | |||
* cannot be reinitialized. | * cannot be reinitialized. | |||
* | * | |||
* It should generally not be necessary to dispose v8 before exiting | * It should generally not be necessary to dispose v8 before exiting | |||
* a process, this should happen automatically. It is only necessary | * a process, this should happen automatically. It is only necessary | |||
* to use if the process needs the resources taken up by v8. | * to use if the process needs the resources taken up by v8. | |||
*/ | */ | |||
static bool Dispose(); | static bool Dispose(); | |||
/** | /** | |||
* Get statistics about the heap memory usage. | ||||
*/ | ||||
static void GetHeapStatistics(HeapStatistics* heap_statistics); | ||||
/** | ||||
* Optional notification that the embedder is idle. | * Optional notification that the embedder is idle. | |||
* V8 uses the notification to reduce memory footprint. | * V8 uses the notification to reduce memory footprint. | |||
* This call can be used repeatedly if the embedder remains idle. | * This call can be used repeatedly if the embedder remains idle. | |||
* Returns true if the embedder should stop calling IdleNotification | * Returns true if the embedder should stop calling IdleNotification | |||
* until real work has been done. This indicates that V8 has done | * until real work has been done. This indicates that V8 has done | |||
* as much cleanup as it will be able to do. | * as much cleanup as it will be able to do. | |||
*/ | */ | |||
static bool IdleNotification(); | static bool IdleNotification(); | |||
/** | /** | |||
skipping to change at line 2968 | skipping to change at line 3016 | |||
return (I::GetInstanceType(obj) < I::kFirstNonstringType); | return (I::GetInstanceType(obj) < I::kFirstNonstringType); | |||
} | } | |||
Number* Number::Cast(v8::Value* value) { | Number* Number::Cast(v8::Value* value) { | |||
#ifdef V8_ENABLE_CHECKS | #ifdef V8_ENABLE_CHECKS | |||
CheckCast(value); | CheckCast(value); | |||
#endif | #endif | |||
return static_cast<Number*>(value); | return static_cast<Number*>(value); | |||
} | } | |||
Local<Integer> Integer::NewFromUnsigned(uint32_t value) { | ||||
bool fits_into_int32_t = (value & (1 << 31)) == 0; | ||||
if (fits_into_int32_t) { | ||||
return Integer::New(static_cast<int32_t>(value)); | ||||
} | ||||
return Local<Integer>::Cast(Number::New(value)); | ||||
} | ||||
Integer* Integer::Cast(v8::Value* value) { | Integer* Integer::Cast(v8::Value* value) { | |||
#ifdef V8_ENABLE_CHECKS | #ifdef V8_ENABLE_CHECKS | |||
CheckCast(value); | CheckCast(value); | |||
#endif | #endif | |||
return static_cast<Integer*>(value); | return static_cast<Integer*>(value); | |||
} | } | |||
Date* Date::Cast(v8::Value* value) { | Date* Date::Cast(v8::Value* value) { | |||
#ifdef V8_ENABLE_CHECKS | #ifdef V8_ENABLE_CHECKS | |||
CheckCast(value); | CheckCast(value); | |||
End of changes. 7 change blocks. | ||||
11 lines changed or deleted | 54 lines changed or added | |||