From: svenpanne@chromium.org Date: Wed, 14 May 2014 08:34:05 +0000 (+0000) Subject: Revert PropertyCallbackInfo::This() signature change from r21022. X-Git-Tag: upstream/4.7.83~9140 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=72fcd0dd051bc2948b2009bf57a564654bb69143;p=platform%2Fupstream%2Fv8.git Revert PropertyCallbackInfo::This() signature change from r21022. This exposed an internal implementation detail, which could be handled differently. BUG=v8:3274 LOG=y R=yangguo@chromium.org Review URL: https://codereview.chromium.org/285643008 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21297 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/include/v8.h b/include/v8.h index e089b41..8da01a8 100644 --- a/include/v8.h +++ b/include/v8.h @@ -2497,7 +2497,7 @@ class PropertyCallbackInfo { public: V8_INLINE Isolate* GetIsolate() const; V8_INLINE Local Data() const; - V8_INLINE Local This() const; + V8_INLINE Local This() const; V8_INLINE Local Holder() const; V8_INLINE ReturnValue GetReturnValue() const; // This shouldn't be public, but the arm compiler needs it. @@ -6483,8 +6483,8 @@ Local PropertyCallbackInfo::Data() const { template -Local PropertyCallbackInfo::This() const { - return Local(reinterpret_cast(&args_[kThisIndex])); +Local PropertyCallbackInfo::This() const { + return Local(reinterpret_cast(&args_[kThisIndex])); } diff --git a/src/accessors.cc b/src/accessors.cc index 8c8fcdd..f219bed 100644 --- a/src/accessors.cc +++ b/src/accessors.cc @@ -20,6 +20,16 @@ namespace v8 { namespace internal { +// We have a slight impedance mismatch between the external API and the way we +// use callbacks internally: Externally, callbacks can only be used with +// v8::Object, but internally we even have callbacks on entities which are +// higher in the hierarchy, so we can only return i::Object here, not +// i::JSObject. +Handle GetThisFrom(const v8::PropertyCallbackInfo& info) { + return Utils::OpenHandle(*v8::Local(info.This())); +} + + Handle Accessors::MakeAccessor( Isolate* isolate, Handle name, @@ -146,7 +156,7 @@ void Accessors::ArrayLengthGetter( i::Isolate* isolate = reinterpret_cast(info.GetIsolate()); DisallowHeapAllocation no_allocation; HandleScope scope(isolate); - Object* object = *Utils::OpenHandle(*info.This()); + Object* object = *GetThisFrom(info); // Traverse the prototype chain until we reach an array. JSArray* holder = FindInstanceOf(isolate, object); Object* result; @@ -229,7 +239,7 @@ void Accessors::StringLengthGetter( i::Isolate* isolate = reinterpret_cast(info.GetIsolate()); DisallowHeapAllocation no_allocation; HandleScope scope(isolate); - Object* value = *Utils::OpenHandle(*info.This()); + Object* value = *GetThisFrom(info); Object* result; if (value->IsJSValue()) value = JSValue::cast(value)->value(); if (value->IsString()) { @@ -824,7 +834,7 @@ void Accessors::FunctionPrototypeGetter( const v8::PropertyCallbackInfo& info) { i::Isolate* isolate = reinterpret_cast(info.GetIsolate()); HandleScope scope(isolate); - Handle object = Utils::OpenHandle(*info.This()); + Handle object = GetThisFrom(info); Handle result = GetFunctionPrototype(isolate, object); info.GetReturnValue().Set(Utils::ToLocal(result)); } @@ -864,7 +874,7 @@ void Accessors::FunctionLengthGetter( const v8::PropertyCallbackInfo& info) { i::Isolate* isolate = reinterpret_cast(info.GetIsolate()); HandleScope scope(isolate); - Handle object = Utils::OpenHandle(*info.This()); + Handle object = GetThisFrom(info); MaybeHandle maybe_function; { @@ -922,7 +932,7 @@ void Accessors::FunctionNameGetter( const v8::PropertyCallbackInfo& info) { i::Isolate* isolate = reinterpret_cast(info.GetIsolate()); HandleScope scope(isolate); - Handle object = Utils::OpenHandle(*info.This()); + Handle object = GetThisFrom(info); MaybeHandle maybe_function; { @@ -1071,7 +1081,7 @@ void Accessors::FunctionArgumentsGetter( const v8::PropertyCallbackInfo& info) { i::Isolate* isolate = reinterpret_cast(info.GetIsolate()); HandleScope scope(isolate); - Handle object = Utils::OpenHandle(*info.This()); + Handle object = GetThisFrom(info); MaybeHandle maybe_function; { @@ -1210,7 +1220,7 @@ void Accessors::FunctionCallerGetter( const v8::PropertyCallbackInfo& info) { i::Isolate* isolate = reinterpret_cast(info.GetIsolate()); HandleScope scope(isolate); - Handle object = Utils::OpenHandle(*info.This()); + Handle object = GetThisFrom(info); MaybeHandle maybe_function; { DisallowHeapAllocation no_allocation;