Bug 1240453 - enable shared memory in xpconnect. r=bz
authorLars T Hansen <lhansen@mozilla.com>
Mon, 18 Jan 2016 09:50:05 +0100
changeset 303038 ad02cf82f514564d66604300b5d3b43b4f3df9d2
parent 303037 6f84c75a07067e48c7fe4062cdd04b55ac48eb30
child 303039 56c5187a2c6445b3419719e14a27c2406cdc3e6c
push id8978
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 14:05:32 +0000
treeherdermozilla-aurora@b9a803752a2c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1240453
milestone46.0a1
Bug 1240453 - enable shared memory in xpconnect. r=bz
js/xpconnect/src/Sandbox.cpp
js/xpconnect/src/XPCWrappedNative.cpp
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -989,16 +989,19 @@ xpc::CreateSandboxObject(JSContext* cx, 
         }
     }
     MOZ_ASSERT(principal);
 
     JS::CompartmentOptions compartmentOptions;
 
     auto& creationOptions = compartmentOptions.creationOptions();
 
+    if (xpc::SharedMemoryEnabled())
+        creationOptions.setSharedMemoryAndAtomicsEnabled(true);
+
     if (options.sameZoneAs)
         creationOptions.setSameZoneAs(js::UncheckedUnwrap(options.sameZoneAs));
     else if (options.freshZone)
         creationOptions.setZone(JS::FreshZone);
     else
         creationOptions.setZone(JS::SystemZone);
 
     creationOptions.setInvisibleToDebugger(options.invisibleToDebugger)
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -178,16 +178,18 @@ XPCWrappedNative::WrapNewGlobal(xpcObjec
     MOZ_ASSERT(si.get());
 
     // Finally, we get to the JSClass.
     const JSClass* clasp = si->GetJSClass();
     MOZ_ASSERT(clasp->flags & JSCLASS_IS_GLOBAL);
 
     // Create the global.
     aOptions.creationOptions().setTrace(XPCWrappedNative::Trace);
+    if (xpc::SharedMemoryEnabled())
+        aOptions.creationOptions().setSharedMemoryAndAtomicsEnabled(true);
     RootedObject global(cx, xpc::CreateGlobalObject(cx, clasp, principal, aOptions));
     if (!global)
         return NS_ERROR_FAILURE;
     XPCWrappedNativeScope* scope = CompartmentPrivate::Get(global)->scope;
 
     // Immediately enter the global's compartment, so that everything else we
     // create ends up there.
     JSAutoCompartment ac(cx, global);