Bug 836177 - Temporarily merge more JSMs to mitigate compartment overhead; r=rnewman
authorGregory Szorc <gps@mozilla.com>
Wed, 30 Jan 2013 07:07:22 -0800
changeset 120359 34a80b4e0acdaeb9c4d5c6e7741df0eadde874c6
parent 120358 bb8895c7f091e0cf64b200da9779d890badbcd0f
child 120360 20bbf73921f4a9092189efb8ecde905939551786
push id24249
push usergszorc@mozilla.com
push dateThu, 31 Jan 2013 00:12:11 +0000
treeherdermozilla-central@20bbf73921f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs836177, 834936
milestone21.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 836177 - Temporarily merge more JSMs to mitigate compartment overhead; r=rnewman As with bug 834936, this is meant to be temporary until zones land and we have decent JSM overhead levels.
services/common/Makefile.in
services/common/async.js
services/common/bagheeraclient.js
services/common/observers.js
services/common/rest.js
services/datareporting/DataReportingService.js
services/healthreport/HealthReport.jsm
services/healthreport/healthreporter.jsm
--- a/services/common/Makefile.in
+++ b/services/common/Makefile.in
@@ -5,27 +5,31 @@
 DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 modules := \
-  async.js \
   log4moz.js \
-  observers.js \
   preferences.js \
-  rest.js \
   storageservice.js \
   stringbundle.js \
   tokenserverclient.js \
   utils.js \
   $(NULL)
 
+pp_modules := \
+  async.js \
+  bagheeraclient.js \
+  observers.js \
+  rest.js \
+  $(NULL)
+
 testing_modules := \
   aitcserver.js \
   bagheeraserver.js \
   logging.js \
   storageserver.js \
   utils.js \
   $(NULL)
 
@@ -39,17 +43,17 @@ PREF_JS_EXPORTS = $(srcdir)/services-com
 
 MODULES_FILES := $(modules)
 MODULES_DEST = $(FINAL_TARGET)/modules/services-common
 INSTALL_TARGETS += MODULES
 
 TESTING_JS_MODULES := $(addprefix modules-testing/,$(testing_modules))
 TESTING_JS_MODULE_DIR := services-common
 
-PP_JS_MODULES := bagheeraclient.js
+PP_JS_MODULES := $(pp_modules)
 PP_JS_MODULES_PATH = $(FINAL_TARGET)/modules/services-common
 PP_TARGETS += PP_JS_MODULES
 
 include $(topsrcdir)/config/rules.mk
 
 # What follows is a helper to launch a standalone storage server instance.
 # Most of the code lives in a Python script in the tests directory. If we
 # ever consolidate our Python code, and/or have a supplemental driver for the
--- a/services/common/async.js
+++ b/services/common/async.js
@@ -1,16 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#ifndef MERGED_COMPARTMENT
+
 this.EXPORTED_SYMBOLS = ["Async"];
 
 const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
 
+#endif
+
 // Constants for makeSyncCallback, waitForSyncCallback.
 const CB_READY = {};
 const CB_COMPLETE = {};
 const CB_FAIL = {};
 
 const REASON_ERROR = Ci.mozIStorageStatementCallback.REASON_ERROR;
 
 Cu.import("resource://gre/modules/Services.jsm");
--- a/services/common/bagheeraclient.js
+++ b/services/common/bagheeraclient.js
@@ -15,21 +15,21 @@
 
 this.EXPORTED_SYMBOLS = [
   "BagheeraClient",
   "BagheeraClientRequestResult",
 ];
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
+Cu.import("resource://services-common/rest.js");
 #endif
 
 Cu.import("resource://gre/modules/commonjs/promise/core.js");
 Cu.import("resource://services-common/log4moz.js");
-Cu.import("resource://services-common/rest.js");
 Cu.import("resource://services-common/utils.js");
 
 
 /**
  * Represents the result of a Bagheera request.
  */
 this.BagheeraClientRequestResult = function BagheeraClientRequestResult() {
   this.transportSuccess = false;
--- a/services/common/observers.js
+++ b/services/common/observers.js
@@ -1,19 +1,23 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#ifndef MERGED_COMPARTMENT
+
 this.EXPORTED_SYMBOLS = ["Observers"];
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 
+#endif
+
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 /**
  * A service for adding, removing and notifying observers of notifications.
  * Wraps the nsIObserverService interface.
  *
  * @version 0.2
  */
--- a/services/common/rest.js
+++ b/services/common/rest.js
@@ -1,27 +1,33 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#ifndef MERGED_COMPARTMENT
+
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 this.EXPORTED_SYMBOLS = [
   "RESTRequest",
   "RESTResponse",
   "TokenAuthenticatedRESTRequest"
 ];
 
+#endif
+
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://services-crypto/utils.js");
 Cu.import("resource://services-common/log4moz.js");
 Cu.import("resource://services-common/preferences.js");
 Cu.import("resource://services-common/utils.js");
 
+XPCOMUtils.defineLazyModuleGetter(this, "CryptoUtils",
+                                  "resource://services-crypto/utils.js");
+
 const Prefs = new Preferences("services.common.rest.");
 
 /**
  * Single use HTTP requests to RESTish resources.
  *
  * @param uri
  *        URI for the request. This can be an nsIURI object or a string
  *        that can be used to create one. An exception will be thrown if
--- a/services/datareporting/DataReportingService.js
+++ b/services/datareporting/DataReportingService.js
@@ -2,17 +2,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://services-common/observers.js");
 Cu.import("resource://services-common/preferences.js");
 Cu.import("resource://services-common/utils.js");
 
 
 const ROOT_BRANCH = "datareporting.";
 const POLICY_BRANCH = ROOT_BRANCH + "policy.";
 const SESSIONS_BRANCH = ROOT_BRANCH + "sessions.";
 const HEALTHREPORT_BRANCH = ROOT_BRANCH + "healthreport.";
@@ -252,13 +251,15 @@ DataReportingService.prototype = Object.
                                                  this.sessionRecorder);
   },
 });
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DataReportingService]);
 
 #define MERGED_COMPARTMENT
 
+#include ../common/observers.js
+;
 #include policy.jsm
 ;
 #include sessions.jsm
 ;
 
--- a/services/healthreport/HealthReport.jsm
+++ b/services/healthreport/HealthReport.jsm
@@ -19,16 +19,18 @@ const {classes: Cc, interfaces: Ci, util
 
 const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
 
 // We concatenate the JSMs together to eliminate compartment overhead.
 // This is a giant hack until compartment overhead is no longer an
 // issue.
 #define MERGED_COMPARTMENT
 
+#include ../common/async.js
+;
 #include ../common/bagheeraclient.js
 ;
 #include ../metrics/Metrics.jsm
 ;
 #include healthreporter.jsm
 ;
 #include profile.jsm
 ;
--- a/services/healthreport/healthreporter.jsm
+++ b/services/healthreport/healthreporter.jsm
@@ -9,19 +9,19 @@
 this.EXPORTED_SYMBOLS = ["HealthReporter"];
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
 
 Cu.import("resource://gre/modules/Metrics.jsm");
 Cu.import("resource://services-common/bagheeraclient.js");
+Cu.import("resource://services-common/async.js");
 #endif
 
-Cu.import("resource://services-common/async.js");
 Cu.import("resource://services-common/log4moz.js");
 Cu.import("resource://services-common/preferences.js");
 Cu.import("resource://services-common/utils.js");
 Cu.import("resource://gre/modules/commonjs/promise/core.js");
 Cu.import("resource://gre/modules/osfile.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");