v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 138 | skipping to change at line 138 | |||
class ObjectTemplate; | class ObjectTemplate; | |||
class Data; | class Data; | |||
template<typename T> class PropertyCallbackInfo; | template<typename T> class PropertyCallbackInfo; | |||
class StackTrace; | class StackTrace; | |||
class StackFrame; | class StackFrame; | |||
class Isolate; | class Isolate; | |||
class DeclaredAccessorDescriptor; | class DeclaredAccessorDescriptor; | |||
class ObjectOperationDescriptor; | class ObjectOperationDescriptor; | |||
class RawOperationDescriptor; | class RawOperationDescriptor; | |||
class CallHandlerHelper; | class CallHandlerHelper; | |||
class EscapableHandleScope; | ||||
namespace internal { | namespace internal { | |||
class Arguments; | class Arguments; | |||
class Heap; | class Heap; | |||
class HeapObject; | class HeapObject; | |||
class Isolate; | class Isolate; | |||
class Object; | class Object; | |||
template<typename T> class CustomArguments; | template<typename T> class CustomArguments; | |||
class PropertyCallbackArguments; | class PropertyCallbackArguments; | |||
class FunctionCallbackArguments; | class FunctionCallbackArguments; | |||
skipping to change at line 376 | skipping to change at line 377 | |||
template <class S> V8_INLINE Local<S> As() { | template <class S> V8_INLINE Local<S> As() { | |||
return Local<S>::Cast(*this); | return Local<S>::Cast(*this); | |||
} | } | |||
/** | /** | |||
* Create a local handle for the content of another handle. | * Create a local handle for the content of another handle. | |||
* The referee is kept alive by the local handle even when | * The referee is kept alive by the local handle even when | |||
* the original handle is destroyed/disposed. | * the original handle is destroyed/disposed. | |||
*/ | */ | |||
V8_INLINE static Local<T> New(Handle<T> that); | ||||
V8_INLINE static Local<T> New(Isolate* isolate, Handle<T> that); | V8_INLINE static Local<T> New(Isolate* isolate, Handle<T> that); | |||
template<class M> | template<class M> | |||
V8_INLINE static Local<T> New(Isolate* isolate, | V8_INLINE static Local<T> New(Isolate* isolate, | |||
const Persistent<T, M>& that); | const Persistent<T, M>& that); | |||
#ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR | #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR | |||
private: | private: | |||
#endif | #endif | |||
template <class S> V8_INLINE Local(S* that) : Handle<T>(that) { } | template <class S> V8_INLINE Local(S* that) : Handle<T>(that) { } | |||
skipping to change at line 400 | skipping to change at line 400 | |||
template<class F> friend class Eternal; | template<class F> friend class Eternal; | |||
template<class F, class M> friend class Persistent; | template<class F, class M> friend class Persistent; | |||
template<class F> friend class Handle; | template<class F> friend class Handle; | |||
template<class F> friend class FunctionCallbackInfo; | template<class F> friend class FunctionCallbackInfo; | |||
template<class F> friend class PropertyCallbackInfo; | template<class F> friend class PropertyCallbackInfo; | |||
friend class String; | friend class String; | |||
friend class Object; | friend class Object; | |||
friend class Context; | friend class Context; | |||
template<class F> friend class internal::CustomArguments; | template<class F> friend class internal::CustomArguments; | |||
friend class HandleScope; | friend class HandleScope; | |||
friend class EscapableHandleScope; | ||||
V8_INLINE static Local<T> New(Isolate* isolate, T* that); | V8_INLINE static Local<T> New(Isolate* isolate, T* that); | |||
}; | }; | |||
// Eternal handles are set-once handles that live for the life of the isola te. | // Eternal handles are set-once handles that live for the life of the isola te. | |||
template <class T> class Eternal { | template <class T> class Eternal { | |||
public: | public: | |||
V8_INLINE Eternal() : index_(kInitialValue) { } | V8_INLINE Eternal() : index_(kInitialValue) { } | |||
template<class S> | template<class S> | |||
V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : index_(kInitialVal ue) { | V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : index_(kInitialVal ue) { | |||
skipping to change at line 766 | skipping to change at line 767 | |||
* garbage collector will no longer track the object stored in the | * garbage collector will no longer track the object stored in the | |||
* handle and may deallocate it. The behavior of accessing a handle | * handle and may deallocate it. The behavior of accessing a handle | |||
* for which the handle scope has been deleted is undefined. | * for which the handle scope has been deleted is undefined. | |||
*/ | */ | |||
class V8_EXPORT HandleScope { | class V8_EXPORT HandleScope { | |||
public: | public: | |||
HandleScope(Isolate* isolate); | HandleScope(Isolate* isolate); | |||
~HandleScope(); | ~HandleScope(); | |||
/** | // TODO(dcarney): deprecated - use EscapableHandleScope::Escape. | |||
* Closes the handle scope and returns the value as a handle in the | ||||
* previous scope, which is the new current scope after the call. | ||||
*/ | ||||
template <class T> Local<T> Close(Handle<T> value); | template <class T> Local<T> Close(Handle<T> value); | |||
/** | /** | |||
* Counts the number of allocated handles. | * Counts the number of allocated handles. | |||
*/ | */ | |||
static int NumberOfHandles(); | static int NumberOfHandles(); | |||
private: | ||||
/** | /** | |||
* Creates a new handle with the given value. | * Creates a new handle with the given value. | |||
*/ | */ | |||
static internal::Object** CreateHandle(internal::Object* value); | ||||
static internal::Object** CreateHandle(internal::Isolate* isolate, | static internal::Object** CreateHandle(internal::Isolate* isolate, | |||
internal::Object* value); | internal::Object* value); | |||
// Faster version, uses HeapObject to obtain the current Isolate. | // Uses HeapObject to obtain the current Isolate. | |||
static internal::Object** CreateHandle(internal::HeapObject* value); | static internal::Object** CreateHandle(internal::HeapObject* heap_object, | |||
internal::Object* value); | ||||
V8_INLINE HandleScope() {} | ||||
void Initialize(Isolate* isolate); | ||||
private: | ||||
// Make it hard to create heap-allocated or illegal handle scopes by | // Make it hard to create heap-allocated or illegal handle scopes by | |||
// disallowing certain operations. | // 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 as HandleScopeData through a | // This Data class is accessible internally as HandleScopeData through a | |||
// typedef in the ImplementationUtilities class. | // typedef in the ImplementationUtilities class. | |||
class V8_EXPORT Data { | class V8_EXPORT Data { | |||
public: | public: | |||
internal::Object** next; | internal::Object** next; | |||
internal::Object** limit; | internal::Object** limit; | |||
int level; | int level; | |||
V8_INLINE void Initialize() { | V8_INLINE void Initialize() { | |||
next = limit = NULL; | next = limit = NULL; | |||
level = 0; | level = 0; | |||
} | } | |||
}; | }; | |||
void Initialize(Isolate* isolate); | ||||
void Leave(); | void Leave(); | |||
internal::Isolate* isolate_; | internal::Isolate* isolate_; | |||
internal::Object** prev_next_; | internal::Object** prev_next_; | |||
internal::Object** prev_limit_; | internal::Object** prev_limit_; | |||
// TODO(dcarney): remove this field | ||||
// Allow for the active closing of HandleScopes which allows to pass a ha ndle | // Allow for the active closing of HandleScopes which allows to pass a ha ndle | |||
// from the HandleScope being closed to the next top most HandleScope. | // from the HandleScope being closed to the next top most HandleScope. | |||
bool is_closed_; | bool is_closed_; | |||
internal::Object** RawClose(internal::Object** value); | internal::Object** RawClose(internal::Object** value); | |||
friend class ImplementationUtilities; | friend class ImplementationUtilities; | |||
friend class EscapableHandleScope; | ||||
template<class F> friend class Handle; | ||||
template<class F> friend class Local; | ||||
friend class Object; | ||||
friend class Context; | ||||
}; | ||||
/** | ||||
* A HandleScope which first allocates a handle in the current scope | ||||
* which will be later filled with the escape value. | ||||
*/ | ||||
class V8_EXPORT EscapableHandleScope : public HandleScope { | ||||
public: | ||||
EscapableHandleScope(Isolate* isolate); | ||||
V8_INLINE ~EscapableHandleScope() {} | ||||
/** | ||||
* Pushes the value into the previous scope and returns a handle to it. | ||||
* Cannot be called twice. | ||||
*/ | ||||
template <class T> | ||||
V8_INLINE Local<T> Escape(Local<T> value) { | ||||
internal::Object** slot = | ||||
Escape(reinterpret_cast<internal::Object**>(*value)); | ||||
return Local<T>(reinterpret_cast<T*>(slot)); | ||||
} | ||||
private: | ||||
internal::Object** Escape(internal::Object** escape_value); | ||||
internal::Object** escape_slot_; | ||||
}; | }; | |||
/** | /** | |||
* A simple Maybe type, representing an object which may or may not have a | * A simple Maybe type, representing an object which may or may not have a | |||
* value. | * value. | |||
*/ | */ | |||
template<class T> | template<class T> | |||
struct V8_EXPORT Maybe { | struct V8_EXPORT Maybe { | |||
Maybe() : has_value(false) {} | Maybe() : has_value(false) {} | |||
explicit Maybe(T t) : has_value(true), value(t) {} | explicit Maybe(T t) : has_value(true), value(t) {} | |||
skipping to change at line 2351 | skipping to change at line 2383 | |||
V8_INLINE bool IsConstructCall() const; | V8_INLINE bool IsConstructCall() const; | |||
V8_INLINE Local<Value> Data() const; | V8_INLINE Local<Value> Data() const; | |||
V8_INLINE Isolate* GetIsolate() const; | V8_INLINE Isolate* GetIsolate() const; | |||
V8_INLINE ReturnValue<T> GetReturnValue() const; | V8_INLINE ReturnValue<T> GetReturnValue() const; | |||
// This shouldn't be public, but the arm compiler needs it. | // This shouldn't be public, but the arm compiler needs it. | |||
static const int kArgsLength = 7; | static const int kArgsLength = 7; | |||
protected: | protected: | |||
friend class internal::FunctionCallbackArguments; | friend class internal::FunctionCallbackArguments; | |||
friend class internal::CustomArguments<FunctionCallbackInfo>; | friend class internal::CustomArguments<FunctionCallbackInfo>; | |||
static const int kReturnValueIndex = 0; | static const int kContextSaveIndex = 0; | |||
static const int kReturnValueDefaultValueIndex = -1; | static const int kCalleeIndex = -1; | |||
static const int kIsolateIndex = -2; | static const int kDataIndex = -2; | |||
static const int kDataIndex = -3; | static const int kReturnValueIndex = -3; | |||
static const int kCalleeIndex = -4; | static const int kReturnValueDefaultValueIndex = -4; | |||
static const int kHolderIndex = -5; | static const int kIsolateIndex = -5; | |||
static const int kContextSaveIndex = -6; | static const int kHolderIndex = -6; | |||
V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args, | V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args, | |||
internal::Object** values, | internal::Object** values, | |||
int length, | int length, | |||
bool is_construct_call); | bool is_construct_call); | |||
internal::Object** implicit_args_; | internal::Object** implicit_args_; | |||
internal::Object** values_; | internal::Object** values_; | |||
int length_; | int length_; | |||
bool is_construct_call_; | bool is_construct_call_; | |||
}; | }; | |||
skipping to change at line 3674 | skipping to change at line 3706 | |||
ResourceConstraints(); | ResourceConstraints(); | |||
int max_young_space_size() const { return max_young_space_size_; } | int max_young_space_size() const { return max_young_space_size_; } | |||
void set_max_young_space_size(int value) { max_young_space_size_ = value; } | void set_max_young_space_size(int value) { max_young_space_size_ = value; } | |||
int max_old_space_size() const { return max_old_space_size_; } | int max_old_space_size() const { return max_old_space_size_; } | |||
void set_max_old_space_size(int value) { max_old_space_size_ = value; } | void set_max_old_space_size(int value) { max_old_space_size_ = value; } | |||
int max_executable_size() { return max_executable_size_; } | int max_executable_size() { return max_executable_size_; } | |||
void set_max_executable_size(int value) { max_executable_size_ = value; } | void set_max_executable_size(int value) { max_executable_size_ = value; } | |||
uint32_t* stack_limit() const { return stack_limit_; } | uint32_t* stack_limit() const { return stack_limit_; } | |||
// Sets an address beyond which the VM's stack may not grow. | // Sets an address beyond which the VM's stack may not grow. | |||
void set_stack_limit(uint32_t* value) { stack_limit_ = value; } | void set_stack_limit(uint32_t* value) { stack_limit_ = value; } | |||
Maybe<bool> is_memory_constrained() const { return is_memory_constrained_ | ||||
; } | ||||
// If set to true, V8 will limit it's memory usage, at the potential cost | ||||
of | ||||
// lower performance. Note, this option is a tentative addition to the A | ||||
PI | ||||
// and may be removed or modified without warning. | ||||
void set_memory_constrained(bool value) { | ||||
is_memory_constrained_ = Maybe<bool>(value); | ||||
} | ||||
private: | private: | |||
int max_young_space_size_; | int max_young_space_size_; | |||
int max_old_space_size_; | int max_old_space_size_; | |||
int max_executable_size_; | int max_executable_size_; | |||
uint32_t* stack_limit_; | uint32_t* stack_limit_; | |||
Maybe<bool> is_memory_constrained_; | ||||
}; | }; | |||
/** | ||||
* Sets the given ResourceConstraints on the current isolate. | ||||
*/ | ||||
bool V8_EXPORT SetResourceConstraints(ResourceConstraints* constraints); | bool V8_EXPORT SetResourceConstraints(ResourceConstraints* constraints); | |||
// --- Exceptions --- | // --- Exceptions --- | |||
typedef void (*FatalErrorCallback)(const char* location, const char* messag e); | typedef void (*FatalErrorCallback)(const char* location, const char* messag e); | |||
typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> erro r); | typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> erro r); | |||
/** | // TODO(dcarney): remove. Use Isolate::ThrowException instead. | |||
* Schedules an exception to be thrown when returning to JavaScript. When | ||||
an | ||||
* exception has been scheduled it is illegal to invoke any JavaScript | ||||
* operation; the caller must return immediately and only after the excepti | ||||
on | ||||
* has been handled does it become legal to invoke JavaScript operations. | ||||
*/ | ||||
Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception); | Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception); | |||
/** | /** | |||
* Create new error objects by calling the corresponding error object | * Create new error objects by calling the corresponding error object | |||
* constructor with the message. | * constructor with the message. | |||
*/ | */ | |||
class V8_EXPORT Exception { | class V8_EXPORT Exception { | |||
public: | public: | |||
static Local<Value> RangeError(Handle<String> message); | static Local<Value> RangeError(Handle<String> message); | |||
static Local<Value> ReferenceError(Handle<String> message); | static Local<Value> ReferenceError(Handle<String> message); | |||
skipping to change at line 3956 | skipping to change at line 3978 | |||
* Returns the context of the calling JavaScript code. That is the | * Returns the context of the calling JavaScript code. That is the | |||
* context of the top-most JavaScript frame. If there are no | * context of the top-most JavaScript frame. If there are no | |||
* JavaScript frames an empty handle is returned. | * JavaScript frames an empty handle is returned. | |||
*/ | */ | |||
Local<Context> GetCallingContext(); | Local<Context> GetCallingContext(); | |||
/** Returns the last entered context. */ | /** Returns the last entered context. */ | |||
Local<Context> GetEnteredContext(); | Local<Context> GetEnteredContext(); | |||
/** | /** | |||
* Schedules an exception to be thrown when returning to JavaScript. Whe | ||||
n an | ||||
* exception has been scheduled it is illegal to invoke any JavaScript | ||||
* operation; the caller must return immediately and only after the excep | ||||
tion | ||||
* has been handled does it become legal to invoke JavaScript operations. | ||||
*/ | ||||
Local<Value> ThrowException(Local<Value> exception); | ||||
/** | ||||
* Allows the host application to group objects together. If one | * Allows the host application to group objects together. If one | |||
* object in the group is alive, all objects in the group are alive. | * object in the group is alive, all objects in the group are alive. | |||
* After each garbage collection, object groups are removed. It is | * After each garbage collection, object groups are removed. It is | |||
* intended to be used in the before-garbage-collection callback | * intended to be used in the before-garbage-collection callback | |||
* function, for instance to simulate DOM tree connections among JS | * function, for instance to simulate DOM tree connections among JS | |||
* wrapper objects. Object groups for all dependent handles need to | * wrapper objects. Object groups for all dependent handles need to | |||
* be provided for kGCTypeMarkSweepCompact collections, for all other | * be provided for kGCTypeMarkSweepCompact collections, for all other | |||
* garbage collection types it is sufficient to provide object groups | * garbage collection types it is sufficient to provide object groups | |||
* for partially dependent handles only. | * for partially dependent handles only. | |||
*/ | */ | |||
skipping to change at line 5307 | skipping to change at line 5337 | |||
static const int kNodeIsPartiallyDependentShift = 5; | static const int kNodeIsPartiallyDependentShift = 5; | |||
static const int kJSObjectType = 0xb1; | static const int kJSObjectType = 0xb1; | |||
static const int kFirstNonstringType = 0x80; | static const int kFirstNonstringType = 0x80; | |||
static const int kOddballType = 0x83; | static const int kOddballType = 0x83; | |||
static const int kForeignType = 0x87; | 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; | |||
static void CheckInitializedImpl(v8::Isolate* isolate); | V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate); | |||
V8_INLINE static void CheckInitialized(v8::Isolate* isolate) { | V8_INLINE static void CheckInitialized(v8::Isolate* isolate) { | |||
#ifdef V8_ENABLE_CHECKS | #ifdef V8_ENABLE_CHECKS | |||
CheckInitializedImpl(isolate); | CheckInitializedImpl(isolate); | |||
#endif | #endif | |||
} | } | |||
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); | |||
} | } | |||
skipping to change at line 5421 | skipping to change at line 5451 | |||
V8_INLINE static bool CanCastToHeapObject(StackTrace* o) { return true; } | V8_INLINE static bool CanCastToHeapObject(StackTrace* o) { return true; } | |||
V8_INLINE static bool CanCastToHeapObject(StackFrame* o) { return true; } | V8_INLINE static bool CanCastToHeapObject(StackFrame* o) { return true; } | |||
}; | }; | |||
} // namespace internal | } // namespace internal | |||
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) { | ||||
if (that.IsEmpty()) return Local<T>(); | ||||
T* that_ptr = *that; | ||||
internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr); | ||||
if (internal::Internals::CanCastToHeapObject(that_ptr)) { | ||||
return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle( | ||||
reinterpret_cast<internal::HeapObject*>(*p)))); | ||||
} | ||||
return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(*p))); | ||||
} | ||||
template <class T> | ||||
Local<T> Local<T>::New(Isolate* isolate, Handle<T> that) { | Local<T> Local<T>::New(Isolate* isolate, Handle<T> that) { | |||
return New(isolate, that.val_); | return New(isolate, that.val_); | |||
} | } | |||
template <class T> | template <class T> | |||
template <class M> | template <class M> | |||
Local<T> Local<T>::New(Isolate* isolate, const Persistent<T, M>& that) { | Local<T> Local<T>::New(Isolate* isolate, const Persistent<T, M>& that) { | |||
return New(isolate, that.val_); | return New(isolate, that.val_); | |||
} | } | |||
skipping to change at line 5749 | skipping to change at line 5767 | |||
internal::Object** values, | internal::Object** values, | |||
int length, | int length, | |||
bool is_construct_call) | bool is_construct_call) | |||
: implicit_args_(implicit_args), | : implicit_args_(implicit_args), | |||
values_(values), | values_(values), | |||
length_(length), | length_(length), | |||
is_construct_call_(is_construct_call) { } | is_construct_call_(is_construct_call) { } | |||
template<typename T> | template<typename T> | |||
Local<Value> FunctionCallbackInfo<T>::operator[](int i) const { | Local<Value> FunctionCallbackInfo<T>::operator[](int i) const { | |||
if (i < 0 || length_ <= i) return Local<Value>(*Undefined()); | if (i < 0 || length_ <= i) return Local<Value>(*Undefined(GetIsolate())); | |||
return Local<Value>(reinterpret_cast<Value*>(values_ - i)); | return Local<Value>(reinterpret_cast<Value*>(values_ - i)); | |||
} | } | |||
template<typename T> | template<typename T> | |||
Local<Function> FunctionCallbackInfo<T>::Callee() const { | Local<Function> FunctionCallbackInfo<T>::Callee() const { | |||
return Local<Function>(reinterpret_cast<Function*>( | return Local<Function>(reinterpret_cast<Function*>( | |||
&implicit_args_[kCalleeIndex])); | &implicit_args_[kCalleeIndex])); | |||
} | } | |||
template<typename T> | template<typename T> | |||
skipping to change at line 5819 | skipping to change at line 5837 | |||
Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { | Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { | |||
return resource_column_offset_; | return resource_column_offset_; | |||
} | } | |||
Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const { | Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const { | |||
return resource_is_shared_cross_origin_; | return resource_is_shared_cross_origin_; | |||
} | } | |||
Handle<Boolean> Boolean::New(bool value) { | Handle<Boolean> Boolean::New(bool value) { | |||
return value ? True() : False(); | Isolate* isolate = Isolate::GetCurrent(); | |||
return value ? True(isolate) : False(isolate); | ||||
} | } | |||
void Template::Set(const char* name, v8::Handle<Data> value) { | void Template::Set(const char* name, v8::Handle<Data> value) { | |||
Set(v8::String::New(name), value); | Set(v8::String::New(name), value); | |||
} | } | |||
Local<Value> Object::GetInternalField(int index) { | Local<Value> Object::GetInternalField(int index) { | |||
#ifndef V8_ENABLE_CHECKS | #ifndef V8_ENABLE_CHECKS | |||
typedef internal::Object O; | typedef internal::Object O; | |||
typedef internal::HeapObject HO; | ||||
typedef internal::Internals I; | typedef internal::Internals I; | |||
O* obj = *reinterpret_cast<O**>(this); | O* obj = *reinterpret_cast<O**>(this); | |||
// Fast path: If the object is a plain JSObject, which is the common case , we | // Fast path: If the object is a plain JSObject, which is the common case , we | |||
// know where to find the internal fields and can return the value direct ly. | // know where to find the internal fields and can return the value direct ly. | |||
if (I::GetInstanceType(obj) == I::kJSObjectType) { | if (I::GetInstanceType(obj) == I::kJSObjectType) { | |||
int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * inde x); | int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * inde x); | |||
O* value = I::ReadField<O*>(obj, offset); | O* value = I::ReadField<O*>(obj, offset); | |||
O** result = HandleScope::CreateHandle(value); | O** result = HandleScope::CreateHandle(reinterpret_cast<HO*>(obj), valu e); | |||
return Local<Value>(reinterpret_cast<Value*>(result)); | return Local<Value>(reinterpret_cast<Value*>(result)); | |||
} | } | |||
#endif | #endif | |||
return SlowGetInternalField(index); | return SlowGetInternalField(index); | |||
} | } | |||
void* Object::GetAlignedPointerFromInternalField(int index) { | void* Object::GetAlignedPointerFromInternalField(int index) { | |||
#ifndef V8_ENABLE_CHECKS | #ifndef V8_ENABLE_CHECKS | |||
typedef internal::Object O; | typedef internal::Object O; | |||
typedef internal::Internals I; | typedef internal::Internals I; | |||
skipping to change at line 6236 | skipping to change at line 6256 | |||
} | } | |||
void* Isolate::GetData() { | void* Isolate::GetData() { | |||
typedef internal::Internals I; | typedef internal::Internals I; | |||
return I::GetEmbedderData(this); | return I::GetEmbedderData(this); | |||
} | } | |||
Local<Value> Context::GetEmbedderData(int index) { | Local<Value> Context::GetEmbedderData(int index) { | |||
#ifndef V8_ENABLE_CHECKS | #ifndef V8_ENABLE_CHECKS | |||
typedef internal::Object O; | typedef internal::Object O; | |||
typedef internal::HeapObject HO; | ||||
typedef internal::Internals I; | typedef internal::Internals I; | |||
O** result = HandleScope::CreateHandle(I::ReadEmbedderData<O*>(this, inde | HO* context = *reinterpret_cast<HO**>(this); | |||
x)); | O** result = | |||
HandleScope::CreateHandle(context, I::ReadEmbedderData<O*>(this, inde | ||||
x)); | ||||
return Local<Value>(reinterpret_cast<Value*>(result)); | return Local<Value>(reinterpret_cast<Value*>(result)); | |||
#else | #else | |||
return SlowGetEmbedderData(index); | return SlowGetEmbedderData(index); | |||
#endif | #endif | |||
} | } | |||
void* Context::GetAlignedPointerFromEmbedderData(int index) { | void* Context::GetAlignedPointerFromEmbedderData(int index) { | |||
#ifndef V8_ENABLE_CHECKS | #ifndef V8_ENABLE_CHECKS | |||
typedef internal::Internals I; | typedef internal::Internals I; | |||
return I::ReadEmbedderData<void*>(this, index); | return I::ReadEmbedderData<void*>(this, index); | |||
End of changes. 25 change blocks. | ||||
54 lines changed or deleted | 74 lines changed or added | |||