Bug 1240453 - enable shared memory in xpconnect. r=bz
authorLars T Hansen <lhansen@mozilla.com>
Mon, 18 Jan 2016 09:50:05 +0100
changeset 280823 ad02cf82f514564d66604300b5d3b43b4f3df9d2
parent 280822 6f84c75a07067e48c7fe4062cdd04b55ac48eb30
child 280824 56c5187a2c6445b3419719e14a27c2406cdc3e6c
push id29922
push usercbook@mozilla.com
push dateThu, 21 Jan 2016 10:51:00 +0000
treeherdermozilla-central@977d78a8dd78 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1240453
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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);