Bug 1338828 part 2 - Add CacheIR SetProp/SetElem stubs for shadowing DOM proxies. r=h4writer
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 21 Feb 2017 13:49:05 +0100
changeset 373088 8f7c7758fda8b7df58b796a747b2c73810bfc7f0
parent 373087 23120d7bc4d6e113d940e800ac1227dfba06d437
child 373089 eb661732bcdec7e929eee1cbfb7f3fbab915ff1e
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs1338828
milestone54.0a1
Bug 1338828 part 2 - Add CacheIR SetProp/SetElem stubs for shadowing DOM proxies. r=h4writer
js/src/jit/CacheIR.cpp
js/src/jit/CacheIR.h
--- a/js/src/jit/CacheIR.cpp
+++ b/js/src/jit/CacheIR.cpp
@@ -2534,24 +2534,44 @@ SetPropIRGenerator::tryAttachGenericProx
 
     writer.returnFromIC();
 
     trackAttached("GenericProxy");
     return true;
 }
 
 bool
+SetPropIRGenerator::tryAttachDOMProxyShadowed(HandleObject obj, ObjOperandId objId, HandleId id,
+                                              ValOperandId rhsId)
+{
+    MOZ_ASSERT(IsCacheableDOMProxy(obj));
+
+    maybeEmitIdGuard(id);
+    writer.guardShape(objId, obj->maybeShape());
+
+    // No need for more guards: we know this is a DOM proxy, since the shape
+    // guard enforces a given JSClass, so just go ahead and emit the call to
+    // ProxySet.
+    writer.callProxySet(objId, id, rhsId, IsStrictSetPC(pc_));
+    writer.returnFromIC();
+
+    trackAttached("DOMProxyShadowed");
+    return true;
+}
+
+bool
 SetPropIRGenerator::tryAttachProxy(HandleObject obj, ObjOperandId objId, HandleId id,
                                    ValOperandId rhsId)
 {
     switch (GetProxyStubType(cx_, obj, id)) {
       case ProxyStubType::None:
         return false;
       case ProxyStubType::DOMExpando:
       case ProxyStubType::DOMShadowed:
+        return tryAttachDOMProxyShadowed(obj, objId, id, rhsId);
       case ProxyStubType::DOMUnshadowed:
       case ProxyStubType::Generic:
         return tryAttachGenericProxy(obj, objId, id, rhsId);
     }
 
     MOZ_CRASH("Unexpected ProxyStubType");
 }
 
--- a/js/src/jit/CacheIR.h
+++ b/js/src/jit/CacheIR.h
@@ -1088,16 +1088,18 @@ class MOZ_RAII SetPropIRGenerator : publ
 
     bool tryAttachSetDenseElementHole(HandleObject obj, ObjOperandId objId, uint32_t index,
                                       Int32OperandId indexId, ValOperandId rhsId);
     bool tryAttachSetUnboxedArrayElementHole(HandleObject obj, ObjOperandId objId, uint32_t index,
                                              Int32OperandId indexId, ValOperandId rhsId);
 
     bool tryAttachGenericProxy(HandleObject obj, ObjOperandId objId, HandleId id,
                                ValOperandId rhsId);
+    bool tryAttachDOMProxyShadowed(HandleObject obj, ObjOperandId objId, HandleId id,
+                                   ValOperandId rhsId);
     bool tryAttachProxy(HandleObject obj, ObjOperandId objId, HandleId id, ValOperandId rhsId);
     bool tryAttachProxyElement(HandleObject obj, ObjOperandId objId, ValOperandId rhsId);
 
     void trackAttached(const char* name);
 
   public:
     SetPropIRGenerator(JSContext* cx, HandleScript script, jsbytecode* pc, CacheKind cacheKind,
                        bool* isTemporarilyUnoptimizable, HandleValue lhsVal, HandleValue idVal,