Remove unnecessary %UnwrapGlobalProxy calls from object-observe.js
authoradamk@chromium.org <adamk@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 14 Apr 2014 20:52:20 +0000 (20:52 +0000)
committeradamk@chromium.org <adamk@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 14 Apr 2014 20:52:20 +0000 (20:52 +0000)
The intent of these calls was to properly key the WeakMap get/set calls
on the underlying global object, not the proxy, since that is the object
actually being observed. But unwrapping at this layer is unnecessary
since GetIdentityHash will already do the unwrapping (via its call to
GetHiddenProperty).

Also remove the runtime function itself, as these were the only callers,
and remove the now-redundant IS_SPEC_OBJECT() checks from object-observe.js's
MapWrapper type.

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/234143002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20740 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/object-observe.js
src/runtime.cc
src/runtime.h

index e822f0b..c4ddd18 100644 (file)
@@ -80,13 +80,9 @@ function GetWeakMapWrapper() {
 
   MapWrapper.prototype = {
     get: function(key) {
-      key = %UnwrapGlobalProxy(key);
-      if (!IS_SPEC_OBJECT(key)) return UNDEFINED;
       return %WeakCollectionGet(this.map_, key);
     },
     set: function(key, value) {
-      key = %UnwrapGlobalProxy(key);
-      if (!IS_SPEC_OBJECT(key)) return UNDEFINED;
       %WeakCollectionSet(this.map_, key, value);
     },
     has: function(key) {
index e2dcd89..5bcf5a5 100644 (file)
@@ -14840,18 +14840,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ObservationWeakMapCreate) {
 }
 
 
-RUNTIME_FUNCTION(MaybeObject*, Runtime_UnwrapGlobalProxy) {
-  SealHandleScope shs(isolate);
-  ASSERT(args.length() == 1);
-  Object* object = args[0];
-  if (object->IsJSGlobalProxy()) {
-    object = object->GetPrototype(isolate);
-    if (object->IsNull()) return isolate->heap()->undefined_value();
-  }
-  return object;
-}
-
-
 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsAccessAllowedForObserver) {
   HandleScope scope(isolate);
   ASSERT(args.length() == 3);
index c1c563a..1ae4972 100644 (file)
@@ -324,7 +324,6 @@ namespace internal {
   F(SetIsObserved, 1, 1) \
   F(GetObservationState, 0, 1) \
   F(ObservationWeakMapCreate, 0, 1) \
-  F(UnwrapGlobalProxy, 1, 1) \
   F(IsAccessAllowedForObserver, 3, 1) \
   \
   /* Harmony typed arrays */ \