v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 2297 | skipping to change at line 2297 | |||
ScriptOrigin GetScriptOrigin() const; | ScriptOrigin GetScriptOrigin() const; | |||
V8_INLINE(static Function* Cast(Value* obj)); | V8_INLINE(static Function* Cast(Value* obj)); | |||
static const int kLineOffsetNotFound; | static const int kLineOffsetNotFound; | |||
private: | private: | |||
Function(); | Function(); | |||
static void CheckCast(Value* obj); | static void CheckCast(Value* obj); | |||
}; | }; | |||
/** | /** | |||
* The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| | ||||
* populates an instance of this class with a pointer to data and byte leng | ||||
th. | ||||
* | ||||
* |ArrayBufferContents| is the owner of its data. When an instance of | ||||
* this class is destructed, the |Data| is freed. | ||||
* | ||||
* This API is experimental and may change significantly. | ||||
*/ | ||||
class V8EXPORT ArrayBufferContents { | ||||
public: | ||||
ArrayBufferContents() : data_(NULL), byte_length_(0) {} | ||||
~ArrayBufferContents(); | ||||
void* Data() const { return data_; } | ||||
size_t ByteLength() const { return byte_length_; } | ||||
private: | ||||
void* data_; | ||||
size_t byte_length_; | ||||
friend class ArrayBuffer; | ||||
}; | ||||
#ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT | ||||
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 | ||||
#endif | ||||
/** | ||||
* An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). | * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). | |||
* This API is experimental and may change significantly. | * This API is experimental and may change significantly. | |||
*/ | */ | |||
class V8EXPORT ArrayBuffer : public Object { | class V8EXPORT ArrayBuffer : public Object { | |||
public: | public: | |||
/** | /** | |||
* Data length in bytes. | * Data length in bytes. | |||
*/ | */ | |||
size_t ByteLength() const; | size_t ByteLength() const; | |||
/** | ||||
* Raw pointer to the array buffer data | ||||
*/ | ||||
void* Data() const; | ||||
/** | /** | |||
* Create a new ArrayBuffer. Allocate |byte_length| bytes. | * Create a new ArrayBuffer. Allocate |byte_length| bytes. | |||
* Allocated memory will be owned by a created ArrayBuffer and | * Allocated memory will be owned by a created ArrayBuffer and | |||
* will be deallocated when it is garbage-collected. | * will be deallocated when it is garbage-collected, | |||
* unless the object is externalized. | ||||
*/ | */ | |||
static Local<ArrayBuffer> New(size_t byte_length); | static Local<ArrayBuffer> New(size_t byte_length); | |||
/** | /** | |||
* Create a new ArrayBuffer over an existing memory block. | * Create a new ArrayBuffer over an existing memory block. | |||
* The created array buffer is immediately in externalized state. | ||||
* The memory block will not be reclaimed when a created ArrayBuffer | * The memory block will not be reclaimed when a created ArrayBuffer | |||
* is garbage-collected. | * is garbage-collected. | |||
*/ | */ | |||
static Local<ArrayBuffer> New(void* data, size_t byte_length); | static Local<ArrayBuffer> New(void* data, size_t byte_length); | |||
/** | ||||
* Returns true if ArrayBuffer is extrenalized, that is, does not | ||||
* own its memory block. | ||||
*/ | ||||
bool IsExternal() const; | ||||
/** | ||||
* Pass the ownership of this ArrayBuffer's backing store to | ||||
* a given ArrayBufferContents. | ||||
*/ | ||||
void Externalize(ArrayBufferContents* contents); | ||||
V8_INLINE(static ArrayBuffer* Cast(Value* obj)); | V8_INLINE(static ArrayBuffer* Cast(Value* obj)); | |||
static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COU | ||||
NT; | ||||
private: | private: | |||
ArrayBuffer(); | ArrayBuffer(); | |||
static void CheckCast(Value* obj); | static void CheckCast(Value* obj); | |||
}; | }; | |||
/** | /** | |||
* A base class for an instance of TypedArray series of constructors | * A base class for an instance of TypedArray series of constructors | |||
* (ES6 draft 15.13.6). | * (ES6 draft 15.13.6). | |||
* This API is experimental and may change significantly. | * This API is experimental and may change significantly. | |||
*/ | */ | |||
skipping to change at line 4442 | skipping to change at line 4482 | |||
* of context disposals - including this one - since the last time | * of context disposals - including this one - since the last time | |||
* V8 had a chance to clean up. | * V8 had a chance to clean up. | |||
*/ | */ | |||
static int ContextDisposedNotification(); | static int ContextDisposedNotification(); | |||
private: | private: | |||
V8(); | V8(); | |||
static internal::Object** GlobalizeReference(internal::Isolate* isolate, | static internal::Object** GlobalizeReference(internal::Isolate* isolate, | |||
internal::Object** handle); | internal::Object** handle); | |||
static void DisposeGlobal(internal::Isolate* isolate, | static void DisposeGlobal(internal::Object** global_handle); | |||
internal::Object** global_handle); | ||||
typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback; | typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback; | |||
static void MakeWeak(internal::Isolate* isolate, | static void MakeWeak(internal::Isolate* isolate, | |||
internal::Object** global_handle, | internal::Object** global_handle, | |||
void* data, | void* data, | |||
RevivableCallback weak_reference_callback, | RevivableCallback weak_reference_callback, | |||
NearDeathCallback near_death_callback); | NearDeathCallback near_death_callback); | |||
static void ClearWeak(internal::Isolate* isolate, | static void ClearWeak(internal::Isolate* isolate, | |||
internal::Object** global_handle); | internal::Object** global_handle); | |||
template <class T> friend class Handle; | template <class T> friend class Handle; | |||
skipping to change at line 5121 | skipping to change at line 5160 | |||
static const int kExternalTwoByteRepresentationTag = 0x02; | static const int kExternalTwoByteRepresentationTag = 0x02; | |||
static const int kExternalAsciiRepresentationTag = 0x06; | static const int kExternalAsciiRepresentationTag = 0x06; | |||
static const int kIsolateStateOffset = 0; | static const int kIsolateStateOffset = 0; | |||
static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; | static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; | |||
static const int kIsolateRootsOffset = 3 * kApiPointerSize; | static const int kIsolateRootsOffset = 3 * kApiPointerSize; | |||
static const int kUndefinedValueRootIndex = 5; | static const int kUndefinedValueRootIndex = 5; | |||
static const int kNullValueRootIndex = 7; | static const int kNullValueRootIndex = 7; | |||
static const int kTrueValueRootIndex = 8; | static const int kTrueValueRootIndex = 8; | |||
static const int kFalseValueRootIndex = 9; | static const int kFalseValueRootIndex = 9; | |||
static const int kEmptyStringRootIndex = 127; | static const int kEmptyStringRootIndex = 129; | |||
static const int kNodeClassIdOffset = 1 * kApiPointerSize; | static const int kNodeClassIdOffset = 1 * kApiPointerSize; | |||
static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; | static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; | |||
static const int kNodeStateMask = 0xf; | static const int kNodeStateMask = 0xf; | |||
static const int kNodeStateIsWeakValue = 2; | static const int kNodeStateIsWeakValue = 2; | |||
static const int kNodeStateIsNearDeathValue = 4; | static const int kNodeStateIsNearDeathValue = 4; | |||
static const int kNodeIsIndependentShift = 4; | static const int kNodeIsIndependentShift = 4; | |||
static const int kNodeIsPartiallyDependentShift = 5; | static const int kNodeIsPartiallyDependentShift = 5; | |||
static const int kJSObjectType = 0xae; | static const int kJSObjectType = 0xae; | |||
skipping to change at line 5363 | skipping to change at line 5402 | |||
bool Persistent<T>::IsWeak(Isolate* isolate) const { | bool Persistent<T>::IsWeak(Isolate* isolate) const { | |||
typedef internal::Internals I; | typedef internal::Internals I; | |||
if (this->IsEmpty()) return false; | if (this->IsEmpty()) return false; | |||
if (!I::IsInitialized(isolate)) return false; | if (!I::IsInitialized(isolate)) return false; | |||
return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) == | return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) == | |||
I::kNodeStateIsWeakValue; | I::kNodeStateIsWeakValue; | |||
} | } | |||
template <class T> | template <class T> | |||
void Persistent<T>::Dispose() { | void Persistent<T>::Dispose() { | |||
Dispose(Isolate::GetCurrent()); | ||||
} | ||||
template <class T> | ||||
void Persistent<T>::Dispose(Isolate* isolate) { | ||||
if (this->IsEmpty()) return; | if (this->IsEmpty()) return; | |||
V8::DisposeGlobal(reinterpret_cast<internal::Isolate*>(isolate), | V8::DisposeGlobal(reinterpret_cast<internal::Object**>(this->val_)); | |||
reinterpret_cast<internal::Object**>(this->val_)); | ||||
#ifndef V8_USE_UNSAFE_HANDLES | #ifndef V8_USE_UNSAFE_HANDLES | |||
val_ = 0; | val_ = 0; | |||
#endif | #endif | |||
} | } | |||
template <class T> | template <class T> | |||
void Persistent<T>::Dispose(Isolate* isolate) { | ||||
Dispose(); | ||||
} | ||||
template <class T> | ||||
template <typename S, typename P> | template <typename S, typename P> | |||
void Persistent<T>::MakeWeak( | void Persistent<T>::MakeWeak( | |||
Isolate* isolate, | Isolate* isolate, | |||
P* parameters, | P* parameters, | |||
typename WeakReferenceCallbacks<S, P>::Revivable callback) { | typename WeakReferenceCallbacks<S, P>::Revivable callback) { | |||
TYPE_CHECK(S, T); | TYPE_CHECK(S, T); | |||
typedef typename WeakReferenceCallbacks<Value, void>::Revivable Revivable ; | typedef typename WeakReferenceCallbacks<Value, void>::Revivable Revivable ; | |||
V8::MakeWeak(reinterpret_cast<internal::Isolate*>(isolate), | V8::MakeWeak(reinterpret_cast<internal::Isolate*>(isolate), | |||
reinterpret_cast<internal::Object**>(this->val_), | reinterpret_cast<internal::Object**>(this->val_), | |||
parameters, | parameters, | |||
End of changes. 11 change blocks. | ||||
15 lines changed or deleted | 55 lines changed or added | |||