Revision: 21297
Author:   [email protected]
Date:     Wed May 14 08:34:05 2014 UTC
Log:      Revert PropertyCallbackInfo::This() signature change from r21022.

This exposed an internal implementation detail, which could be handled
differently.

BUG=v8:3274
LOG=y
[email protected]

Review URL: https://codereview.chromium.org/285643008
http://code.google.com/p/v8/source/detail?r=21297

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/accessors.cc

=======================================
--- /branches/bleeding_edge/include/v8.h        Mon May 12 20:10:47 2014 UTC
+++ /branches/bleeding_edge/include/v8.h        Wed May 14 08:34:05 2014 UTC
@@ -2497,7 +2497,7 @@
  public:
   V8_INLINE Isolate* GetIsolate() const;
   V8_INLINE Local<Value> Data() const;
-  V8_INLINE Local<Value> This() const;
+  V8_INLINE Local<Object> This() const;
   V8_INLINE Local<Object> Holder() const;
   V8_INLINE ReturnValue<T> GetReturnValue() const;
   // This shouldn't be public, but the arm compiler needs it.
@@ -6483,8 +6483,8 @@


 template<typename T>
-Local<Value> PropertyCallbackInfo<T>::This() const {
-  return Local<Value>(reinterpret_cast<Value*>(&args_[kThisIndex]));
+Local<Object> PropertyCallbackInfo<T>::This() const {
+  return Local<Object>(reinterpret_cast<Object*>(&args_[kThisIndex]));
 }


=======================================
--- /branches/bleeding_edge/src/accessors.cc    Tue Apr 29 12:52:42 2014 UTC
+++ /branches/bleeding_edge/src/accessors.cc    Wed May 14 08:34:05 2014 UTC
@@ -18,6 +18,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<Object> GetThisFrom(const v8::PropertyCallbackInfo<v8::Value>& info) {
+  return Utils::OpenHandle(*v8::Local<v8::Value>(info.This()));
+}


 Handle<AccessorInfo> Accessors::MakeAccessor(
@@ -146,7 +156,7 @@
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(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<JSArray>(isolate, object);
   Object* result;
@@ -229,7 +239,7 @@
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(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 @@
     const v8::PropertyCallbackInfo<v8::Value>& info) {
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
   HandleScope scope(isolate);
-  Handle<Object> object = Utils::OpenHandle(*info.This());
+  Handle<Object> object = GetThisFrom(info);
   Handle<Object> result = GetFunctionPrototype(isolate, object);
   info.GetReturnValue().Set(Utils::ToLocal(result));
 }
@@ -864,7 +874,7 @@
     const v8::PropertyCallbackInfo<v8::Value>& info) {
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
   HandleScope scope(isolate);
-  Handle<Object> object = Utils::OpenHandle(*info.This());
+  Handle<Object> object = GetThisFrom(info);
   MaybeHandle<JSFunction> maybe_function;

   {
@@ -922,7 +932,7 @@
     const v8::PropertyCallbackInfo<v8::Value>& info) {
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
   HandleScope scope(isolate);
-  Handle<Object> object = Utils::OpenHandle(*info.This());
+  Handle<Object> object = GetThisFrom(info);
   MaybeHandle<JSFunction> maybe_function;

   {
@@ -1071,7 +1081,7 @@
     const v8::PropertyCallbackInfo<v8::Value>& info) {
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
   HandleScope scope(isolate);
-  Handle<Object> object = Utils::OpenHandle(*info.This());
+  Handle<Object> object = GetThisFrom(info);
   MaybeHandle<JSFunction> maybe_function;

   {
@@ -1210,7 +1220,7 @@
     const v8::PropertyCallbackInfo<v8::Value>& info) {
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
   HandleScope scope(isolate);
-  Handle<Object> object = Utils::OpenHandle(*info.This());
+  Handle<Object> object = GetThisFrom(info);
   MaybeHandle<JSFunction> maybe_function;
   {
     DisallowHeapAllocation no_allocation;

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to