v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 793 | skipping to change at line 793 | |||
private: | private: | |||
// TODO(dcarney): remove before cutover | // TODO(dcarney): remove before cutover | |||
V8_INLINE(T* operator->() const) { return val_; } | V8_INLINE(T* operator->() const) { return val_; } | |||
public: | public: | |||
#endif | #endif | |||
private: | private: | |||
template<class F> friend class Handle; | template<class F> friend class Handle; | |||
template<class F> friend class Local; | template<class F> friend class Local; | |||
template<class F> friend class ReturnValue; | ||||
friend class ImplementationUtilities; | friend class ImplementationUtilities; | |||
friend class ObjectTemplate; | friend class ObjectTemplate; | |||
friend class Context; | friend class Context; | |||
friend class InternalHandleHelper; | friend class InternalHandleHelper; | |||
friend class LocalContext; | friend class LocalContext; | |||
V8_INLINE(static Persistent<T> New(Isolate* isolate, T* that)); | V8_INLINE(static Persistent<T> New(Isolate* isolate, T* that)); | |||
#ifndef V8_USE_UNSAFE_HANDLES | #ifndef V8_USE_UNSAFE_HANDLES | |||
T* val_; | T* val_; | |||
skipping to change at line 1454 | skipping to change at line 1455 | |||
bool BooleanValue() const; | bool BooleanValue() const; | |||
double NumberValue() const; | double NumberValue() const; | |||
int64_t IntegerValue() const; | int64_t IntegerValue() const; | |||
uint32_t Uint32Value() const; | uint32_t Uint32Value() const; | |||
int32_t Int32Value() const; | int32_t Int32Value() const; | |||
/** JS == */ | /** JS == */ | |||
bool Equals(Handle<Value> that) const; | bool Equals(Handle<Value> that) const; | |||
bool StrictEquals(Handle<Value> that) const; | bool StrictEquals(Handle<Value> that) const; | |||
template <class T> V8_INLINE(static Value* Cast(T* value)); | ||||
private: | private: | |||
V8_INLINE(bool QuickIsUndefined() const); | V8_INLINE(bool QuickIsUndefined() const); | |||
V8_INLINE(bool QuickIsNull() const); | V8_INLINE(bool QuickIsNull() const); | |||
V8_INLINE(bool QuickIsString() const); | V8_INLINE(bool QuickIsString() const); | |||
bool FullIsUndefined() const; | bool FullIsUndefined() const; | |||
bool FullIsNull() const; | bool FullIsNull() const; | |||
bool FullIsString() const; | bool FullIsString() const; | |||
}; | }; | |||
/** | /** | |||
skipping to change at line 1506 | skipping to change at line 1509 | |||
* representation of this string. | * representation of this string. | |||
*/ | */ | |||
int Utf8Length() const; | int Utf8Length() const; | |||
/** | /** | |||
* This function is no longer useful. | * This function is no longer useful. | |||
*/ | */ | |||
V8_DEPRECATED(V8_INLINE(bool MayContainNonAscii()) const) { return true; } | V8_DEPRECATED(V8_INLINE(bool MayContainNonAscii()) const) { return true; } | |||
/** | /** | |||
* Returns whether this string contains only one byte data. | * Returns whether this string is known to contain only one byte data. | |||
* Does not read the string. | ||||
* False negatives are possible. | ||||
*/ | */ | |||
bool IsOneByte() const; | bool IsOneByte() const; | |||
/** | /** | |||
* Returns whether this string contain only one byte data. | ||||
* Will read the entire string in some cases. | ||||
*/ | ||||
bool ContainsOnlyOneByte() const; | ||||
/** | ||||
* Write the contents of the string to an external buffer. | * Write the contents of the string to an external buffer. | |||
* If no arguments are given, expects the buffer to be large | * If no arguments are given, expects the buffer to be large | |||
* enough to hold the entire string and NULL terminator. Copies | * enough to hold the entire string and NULL terminator. Copies | |||
* the contents of the string and the NULL terminator into the | * the contents of the string and the NULL terminator into the | |||
* buffer. | * buffer. | |||
* | * | |||
* WriteUtf8 will not write partial UTF-8 sequences, preferring to stop | * WriteUtf8 will not write partial UTF-8 sequences, preferring to stop | |||
* before the end of the buffer. | * before the end of the buffer. | |||
* | * | |||
* Copies up to length characters into the output buffer. | * Copies up to length characters into the output buffer. | |||
skipping to change at line 2392 | skipping to change at line 2403 | |||
*/ | */ | |||
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 | * Returns true if ArrayBuffer is extrenalized, that is, does not | |||
* own its memory block. | * own its memory block. | |||
*/ | */ | |||
bool IsExternal() const; | bool IsExternal() const; | |||
/** | /** | |||
* Neuters this ArrayBuffer and all its views (typed arrays). | ||||
* Neutering sets the byte length of the buffer and all typed arrays to z | ||||
ero, | ||||
* preventing JavaScript from ever accessing underlying backing store. | ||||
* ArrayBuffer should have been externalized. | ||||
*/ | ||||
void Neuter(); | ||||
/** | ||||
* Pass the ownership of this ArrayBuffer's backing store to | * Pass the ownership of this ArrayBuffer's backing store to | |||
* a given ArrayBufferContents. | * a given ArrayBufferContents. | |||
*/ | */ | |||
void Externalize(ArrayBufferContents* contents); | 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; | static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COU NT; | |||
private: | private: | |||
skipping to change at line 2762 | skipping to change at line 2781 | |||
private: | private: | |||
Template(); | Template(); | |||
friend class ObjectTemplate; | friend class ObjectTemplate; | |||
friend class FunctionTemplate; | friend class FunctionTemplate; | |||
}; | }; | |||
template<typename T> | template<typename T> | |||
class ReturnValue { | class ReturnValue { | |||
public: | public: | |||
V8_INLINE(explicit ReturnValue(internal::Object** slot)); | template <class S> V8_INLINE(ReturnValue(const ReturnValue<S>& that)) | |||
: value_(that.value_) { | ||||
TYPE_CHECK(T, S); | ||||
} | ||||
// Handle setters | // Handle setters | |||
template <typename S> V8_INLINE(void Set(const Persistent<S>& handle)); | template <typename S> V8_INLINE(void Set(const Persistent<S>& handle)); | |||
template <typename S> V8_INLINE(void Set(const Handle<S> handle)); | template <typename S> V8_INLINE(void Set(const Handle<S> handle)); | |||
// Fast primitive setters | // Fast primitive setters | |||
V8_INLINE(void Set(bool value)); | V8_INLINE(void Set(bool value)); | |||
V8_INLINE(void Set(double i)); | V8_INLINE(void Set(double i)); | |||
V8_INLINE(void Set(int32_t i)); | V8_INLINE(void Set(int32_t i)); | |||
V8_INLINE(void Set(uint32_t i)); | V8_INLINE(void Set(uint32_t i)); | |||
// Fast JS primitive setters | // Fast JS primitive setters | |||
V8_INLINE(void SetNull()); | V8_INLINE(void SetNull()); | |||
V8_INLINE(void SetUndefined()); | V8_INLINE(void SetUndefined()); | |||
// Convenience getter for Isolate | // Convenience getter for Isolate | |||
V8_INLINE(Isolate* GetIsolate()); | V8_INLINE(Isolate* GetIsolate()); | |||
private: | private: | |||
template<class F> friend class ReturnValue; | ||||
template<class F> friend class FunctionCallbackInfo; | ||||
template<class F> friend class PropertyCallbackInfo; | ||||
V8_INLINE(explicit ReturnValue(internal::Object** slot)); | ||||
internal::Object** value_; | internal::Object** value_; | |||
}; | }; | |||
/** | /** | |||
* The argument information given to function call callbacks. This | * The argument information given to function call callbacks. This | |||
* class provides access to information about the context of the call, | * class provides access to information about the context of the call, | |||
* including the receiver, the number and values of arguments, and | * including the receiver, the number and values of arguments, and | |||
* the holder of the function. | * the holder of the function. | |||
*/ | */ | |||
template<typename T> | template<typename T> | |||
skipping to change at line 5157 | skipping to change at line 5184 | |||
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 = 129; | static const int kEmptyStringRootIndex = 130; | |||
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 = 0xaf; | |||
static const int kFirstNonstringType = 0x80; | static const int kFirstNonstringType = 0x80; | |||
static const int kOddballType = 0x83; | static const int kOddballType = 0x83; | |||
static const int kForeignType = 0x86; | static const int kForeignType = 0x87; | |||
static const int kUndefinedOddballKind = 5; | static const int kUndefinedOddballKind = 5; | |||
static const int kNullOddballKind = 3; | static const int kNullOddballKind = 3; | |||
V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) { | V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) { | |||
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == | return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == | |||
kHeapObjectTag); | kHeapObjectTag); | |||
} | } | |||
V8_INLINE(static int SmiValue(internal::Object* value)) { | V8_INLINE(static int SmiValue(internal::Object* value)) { | |||
skipping to change at line 5535 | skipping to change at line 5562 | |||
if (V8_LIKELY(I::IsValidSmi(i))) { | if (V8_LIKELY(I::IsValidSmi(i))) { | |||
*value_ = I::IntToSmi(i); | *value_ = I::IntToSmi(i); | |||
return; | return; | |||
} | } | |||
Set(Integer::New(i, GetIsolate())); | Set(Integer::New(i, GetIsolate())); | |||
} | } | |||
template<typename T> | template<typename T> | |||
void ReturnValue<T>::Set(uint32_t i) { | void ReturnValue<T>::Set(uint32_t i) { | |||
typedef internal::Internals I; | typedef internal::Internals I; | |||
if (V8_LIKELY(I::IsValidSmi(i))) { | // Can't simply use INT32_MAX here for whatever reason. | |||
*value_ = I::IntToSmi(i); | bool fits_into_int32_t = (i & (1 << 31)) == 0; | |||
if (V8_LIKELY(fits_into_int32_t)) { | ||||
Set(static_cast<int32_t>(i)); | ||||
return; | return; | |||
} | } | |||
Set(Integer::NewFromUnsigned(i, GetIsolate())); | Set(Integer::NewFromUnsigned(i, GetIsolate())); | |||
} | } | |||
template<typename T> | template<typename T> | |||
void ReturnValue<T>::Set(bool value) { | void ReturnValue<T>::Set(bool value) { | |||
typedef internal::Internals I; | typedef internal::Internals I; | |||
int root_index; | int root_index; | |||
if (value) { | if (value) { | |||
skipping to change at line 5817 | skipping to change at line 5846 | |||
} | } | |||
bool Value::QuickIsString() const { | bool Value::QuickIsString() const { | |||
typedef internal::Object O; | typedef internal::Object O; | |||
typedef internal::Internals I; | typedef internal::Internals I; | |||
O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this)); | O* obj = *reinterpret_cast<O**>(const_cast<Value*>(this)); | |||
if (!I::HasHeapObjectTag(obj)) return false; | if (!I::HasHeapObjectTag(obj)) return false; | |||
return (I::GetInstanceType(obj) < I::kFirstNonstringType); | return (I::GetInstanceType(obj) < I::kFirstNonstringType); | |||
} | } | |||
template <class T> Value* Value::Cast(T* value) { | ||||
return static_cast<Value*>(value); | ||||
} | ||||
Symbol* Symbol::Cast(v8::Value* value) { | Symbol* Symbol::Cast(v8::Value* value) { | |||
#ifdef V8_ENABLE_CHECKS | #ifdef V8_ENABLE_CHECKS | |||
CheckCast(value); | CheckCast(value); | |||
#endif | #endif | |||
return static_cast<Symbol*>(value); | return static_cast<Symbol*>(value); | |||
} | } | |||
Number* Number::Cast(v8::Value* value) { | Number* Number::Cast(v8::Value* value) { | |||
#ifdef V8_ENABLE_CHECKS | #ifdef V8_ENABLE_CHECKS | |||
CheckCast(value); | CheckCast(value); | |||
skipping to change at line 5964 | skipping to change at line 5997 | |||
return static_cast<Float32Array*>(value); | return static_cast<Float32Array*>(value); | |||
} | } | |||
Float64Array* Float64Array::Cast(v8::Value* value) { | Float64Array* Float64Array::Cast(v8::Value* value) { | |||
#ifdef V8_ENABLE_CHECKS | #ifdef V8_ENABLE_CHECKS | |||
CheckCast(value); | CheckCast(value); | |||
#endif | #endif | |||
return static_cast<Float64Array*>(value); | return static_cast<Float64Array*>(value); | |||
} | } | |||
Uint8ClampedArray* Uint8ClampedArray::Cast(v8::Value* value) { | ||||
#ifdef V8_ENABLE_CHECKS | ||||
CheckCast(value); | ||||
#endif | ||||
return static_cast<Uint8ClampedArray*>(value); | ||||
} | ||||
Function* Function::Cast(v8::Value* value) { | Function* Function::Cast(v8::Value* value) { | |||
#ifdef V8_ENABLE_CHECKS | #ifdef V8_ENABLE_CHECKS | |||
CheckCast(value); | CheckCast(value); | |||
#endif | #endif | |||
return static_cast<Function*>(value); | return static_cast<Function*>(value); | |||
} | } | |||
External* External::Cast(v8::Value* value) { | External* External::Cast(v8::Value* value) { | |||
#ifdef V8_ENABLE_CHECKS | #ifdef V8_ENABLE_CHECKS | |||
CheckCast(value); | CheckCast(value); | |||
End of changes. 14 change blocks. | ||||
7 lines changed or deleted | 48 lines changed or added | |||