Bug 1258302 - Create a categories module instead of placing everything in global.js, r=jsantell
authorVictor Porof <vporof@mozilla.com>
Tue, 22 Mar 2016 10:17:20 +0100
changeset 289873 cd48f1c046341fd93c1e396644bfc4ae2d732f75
parent 289872 034378ebabfcfd219f5671209cbd2d83b87e7831
child 289874 cc08584692775437121919c69adcd4fc0cfb97f7
push id74027
push userkwierso@gmail.com
push dateTue, 22 Mar 2016 23:57:42 +0000
treeherdermozilla-inbound@eb528d042c85 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjsantell
bugs1258302
milestone48.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 1258302 - Create a categories module instead of placing everything in global.js, r=jsantell
devtools/client/performance/modules/categories.js
devtools/client/performance/modules/global.js
devtools/client/performance/modules/logic/frame-utils.js
devtools/client/performance/modules/moz.build
devtools/client/performance/test/browser_perf-tree-view-08.js
devtools/client/performance/test/browser_perf-tree-view-11.js
devtools/client/performance/test/helpers/synth-utils.js
devtools/client/performance/test/unit/test_profiler-categories.js
devtools/client/performance/test/unit/test_tree-model-07.js
devtools/client/performance/test/unit/test_tree-model-08.js
devtools/client/performance/test/unit/test_tree-model-09.js
devtools/client/shared/widgets/FlameGraph.js
js/public/ProfilingStack.h
new file mode 100644
--- /dev/null
+++ b/devtools/client/performance/modules/categories.js
@@ -0,0 +1,121 @@
+/* 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/. */
+"use strict";
+
+const { L10N } = require("devtools/client/performance/modules/global");
+
+/**
+ * Details about each profile pseudo-stack entry cateogry.
+ * @see CATEGORY_MAPPINGS.
+ */
+const CATEGORIES = [{
+  color: "#5e88b0",
+  abbrev: "other",
+  label: L10N.getStr("category.other")
+}, {
+  color: "#46afe3",
+  abbrev: "css",
+  label: L10N.getStr("category.css")
+}, {
+  color: "#d96629",
+  abbrev: "js",
+  label: L10N.getStr("category.js")
+}, {
+  color: "#eb5368",
+  abbrev: "gc",
+  label: L10N.getStr("category.gc")
+}, {
+  color: "#df80ff",
+  abbrev: "network",
+  label: L10N.getStr("category.network")
+}, {
+  color: "#70bf53",
+  abbrev: "graphics",
+  label: L10N.getStr("category.graphics")
+}, {
+  color: "#8fa1b2",
+  abbrev: "storage",
+  label: L10N.getStr("category.storage")
+}, {
+  color: "#d99b28",
+  abbrev: "events",
+  label: L10N.getStr("category.events")
+}, {
+  color: "#8fa1b2",
+  abbrev: "tools",
+  label: L10N.getStr("category.tools")
+}];
+
+/**
+ * Mapping from category bitmasks in the profiler data to additional details.
+ * To be kept in sync with the js::ProfileEntry::Category in ProfilingStack.h
+ */
+const CATEGORY_MAPPINGS = {
+  "16": CATEGORIES[0],    // js::ProfileEntry::Category::OTHER
+  "32": CATEGORIES[1],    // js::ProfileEntry::Category::CSS
+  "64": CATEGORIES[2],    // js::ProfileEntry::Category::JS
+  "128": CATEGORIES[3],   // js::ProfileEntry::Category::GC
+  "256": CATEGORIES[3],   // js::ProfileEntry::Category::CC
+  "512": CATEGORIES[4],   // js::ProfileEntry::Category::NETWORK
+  "1024": CATEGORIES[5],  // js::ProfileEntry::Category::GRAPHICS
+  "2048": CATEGORIES[6],  // js::ProfileEntry::Category::STORAGE
+  "4096": CATEGORIES[7],  // js::ProfileEntry::Category::EVENTS
+
+  // non-bitmasks for specially-assigned categories
+  "9000": CATEGORIES[8],
+};
+
+/**
+ * Get the numeric bitmask (or set of masks) for the given category
+ * abbreviation. See `CATEGORIES` and `CATEGORY_MAPPINGS` above.
+ *
+ * CATEGORY_MASK can be called with just a name if it is expected that the
+ * category is mapped to by exactly one bitmask. If the category is mapped
+ * to by multiple masks, CATEGORY_MASK for that name must be called with
+ * an additional argument specifying the desired id (in ascending order).
+ */
+const [CATEGORY_MASK, CATEGORY_MASK_LIST] = (() => {
+  let bitmasksForCategory = {};
+  let all = Object.keys(CATEGORY_MAPPINGS);
+
+  for (let category of CATEGORIES) {
+    bitmasksForCategory[category.abbrev] = all
+      .filter(mask => CATEGORY_MAPPINGS[mask] == category)
+      .map(mask => +mask)
+      .sort();
+  }
+
+  return [
+    function (name, index) {
+      if (!(name in bitmasksForCategory)) {
+        throw new Error(`Category abbreviation "${name}" does not exist.`);
+      }
+      if (arguments.length == 1) {
+        if (bitmasksForCategory[name].length != 1) {
+          throw new Error(`Expected exactly one category number for "${name}".`);
+        } else {
+          return bitmasksForCategory[name][0];
+        }
+      } else {
+        if (index > bitmasksForCategory[name].length) {
+          throw new Error(`Index "${index}" too high for category "${name}".`);
+        } else {
+          return bitmasksForCategory[name][index - 1];
+        }
+      }
+    },
+
+    function (name) {
+      if (!(name in bitmasksForCategory)) {
+        throw new Error(`Category abbreviation "${name}" does not exist.`);
+      }
+      return bitmasksForCategory[name];
+    }
+  ];
+})();
+
+exports.CATEGORIES = CATEGORIES;
+exports.CATEGORY_MAPPINGS = CATEGORY_MAPPINGS;
+exports.CATEGORY_MASK = CATEGORY_MASK;
+exports.CATEGORY_MASK_LIST = CATEGORY_MASK_LIST;
--- a/devtools/client/performance/modules/global.js
+++ b/devtools/client/performance/modules/global.js
@@ -12,157 +12,27 @@ const L10N = new ViewHelpers.MultiL10N([
   "chrome://devtools/locale/markers.properties",
   "chrome://devtools/locale/performance.properties"
 ]);
 
 /**
  * A list of preferences for this tool. The values automatically update
  * if somebody edits edits about:config or the prefs change somewhere else.
  *
- * This needs to be registered and unregistered when used; the PerformanceController
- * handles this automatically, but if you just use this module in a test independently,
- * ensure you call `registerObserver()` and `unregisterUnobserver()`.
+ * This needs to be registered and unregistered when used for the auto-update
+ * functionality to work. The PerformanceController handles this, but if you
+ * just use this module in a test independently, ensure you call
+ * `registerObserver()` and `unregisterUnobserver()`.
  */
 const PREFS = new ViewHelpers.Prefs("devtools.performance", {
   "show-triggers-for-gc-types": ["Char", "ui.show-triggers-for-gc-types"],
   "show-platform-data": ["Bool", "ui.show-platform-data"],
   "hidden-markers": ["Json", "timeline.hidden-markers"],
   "memory-sample-probability": ["Float", "memory.sample-probability"],
   "memory-max-log-length": ["Int", "memory.max-log-length"],
   "profiler-buffer-size": ["Int", "profiler.buffer-size"],
   "profiler-sample-frequency": ["Int", "profiler.sample-frequency-khz"],
-  // TODO re-enable once we flame charts via bug 1148663
+  // TODO: re-enable once we flame charts via bug 1148663.
   "enable-memory-flame": ["Bool", "ui.enable-memory-flame"],
 });
 
-/**
- * Details about each profile entry cateogry.
- * @see CATEGORY_MAPPINGS.
- */
-const CATEGORIES = [{
-  color: "#5e88b0",
-  abbrev: "other",
-  label: L10N.getStr("category.other")
-}, {
-  color: "#46afe3",
-  abbrev: "css",
-  label: L10N.getStr("category.css")
-}, {
-  color: "#d96629",
-  abbrev: "js",
-  label: L10N.getStr("category.js")
-}, {
-  color: "#eb5368",
-  abbrev: "gc",
-  label: L10N.getStr("category.gc")
-}, {
-  color: "#df80ff",
-  abbrev: "network",
-  label: L10N.getStr("category.network")
-}, {
-  color: "#70bf53",
-  abbrev: "graphics",
-  label: L10N.getStr("category.graphics")
-}, {
-  color: "#8fa1b2",
-  abbrev: "storage",
-  label: L10N.getStr("category.storage")
-}, {
-  color: "#d99b28",
-  abbrev: "events",
-  label: L10N.getStr("category.events")
-}, {
-  color: "#8fa1b2",
-  abbrev: "tools",
-  label: L10N.getStr("category.tools")
-}];
-
-/**
- * Mapping from category bitmasks in the profiler data to additional details.
- * To be kept in sync with the js::ProfileEntry::Category in ProfilingStack.h
- */
-const CATEGORY_MAPPINGS = {
-  "16": CATEGORIES[0],    // js::ProfileEntry::Category::OTHER
-  "32": CATEGORIES[1],    // js::ProfileEntry::Category::CSS
-  "64": CATEGORIES[2],    // js::ProfileEntry::Category::JS
-  "128": CATEGORIES[3],   // js::ProfileEntry::Category::GC
-  "256": CATEGORIES[3],   // js::ProfileEntry::Category::CC
-  "512": CATEGORIES[4],   // js::ProfileEntry::Category::NETWORK
-  "1024": CATEGORIES[5],  // js::ProfileEntry::Category::GRAPHICS
-  "2048": CATEGORIES[6],  // js::ProfileEntry::Category::STORAGE
-  "4096": CATEGORIES[7],  // js::ProfileEntry::Category::EVENTS
-
-  // non-bitmasks for specially-assigned categories
-  "9000": CATEGORIES[8],
-};
-
-/**
- * Get the numeric bitmask (or set of masks) for the given category
- * abbreviation. See CATEGORIES and CATEGORY_MAPPINGS above.
- *
- * CATEGORY_MASK can be called with just a name if it is expected that the
- * category is mapped to by exactly one bitmask.  If the category is mapped
- * to by multiple masks, CATEGORY_MASK for that name must be called with
- * an additional argument specifying the desired id (in ascending order).
- */
-const [CATEGORY_MASK, CATEGORY_MASK_LIST] = (function () {
-  let bitmasksForCategory = {};
-  let all = Object.keys(CATEGORY_MAPPINGS);
-
-  for (let category of CATEGORIES) {
-    bitmasksForCategory[category.abbrev] = all
-      .filter(mask => CATEGORY_MAPPINGS[mask] == category)
-      .map(mask => +mask)
-      .sort();
-  }
-
-  return [
-    function (name, index) {
-      if (!(name in bitmasksForCategory)) {
-        throw new Error(`Category abbreviation "${name}" does not exist.`);
-      }
-      if (arguments.length == 1) {
-        if (bitmasksForCategory[name].length != 1) {
-          throw new Error(`Expected exactly one category number for "${name}".`);
-        } else {
-          return bitmasksForCategory[name][0];
-        }
-      } else {
-        if (index > bitmasksForCategory[name].length) {
-          throw new Error(`Index "${index}" too high for category "${name}".`);
-        } else {
-          return bitmasksForCategory[name][index - 1];
-        }
-      }
-    },
-
-    function (name) {
-      if (!(name in bitmasksForCategory)) {
-        throw new Error(`Category abbreviation "${name}" does not exist.`);
-      }
-      return bitmasksForCategory[name];
-    }
-  ];
-})();
-
-// Human-readable "other" category bitmask. Older Geckos don't have all the
-// necessary instrumentation in the sampling profiler backend for creating
-// a categories graph, in which case we default to the "other" category.
-const CATEGORY_OTHER = CATEGORY_MASK("other");
-
-// Human-readable JIT category bitmask. Certain pseudo-frames in a sample,
-// like "EnterJIT", don't have any associated `category` information.
-const CATEGORY_JIT = CATEGORY_MASK("js");
-
-// Human-readable "devtools" category bitmask. Not emitted from frames themselves,
-// but used manually in the client.
-const CATEGORY_DEVTOOLS = CATEGORY_MASK("tools");
-
-// Exported symbols.
 exports.L10N = L10N;
 exports.PREFS = PREFS;
-exports.CATEGORIES = CATEGORIES;
-exports.CATEGORY_MAPPINGS = CATEGORY_MAPPINGS;
-exports.CATEGORY_MASK = CATEGORY_MASK;
-exports.CATEGORY_MASK_LIST = CATEGORY_MASK_LIST;
-exports.CATEGORY_OTHER = CATEGORY_OTHER;
-exports.CATEGORY_JIT = CATEGORY_JIT;
-exports.CATEGORY_DEVTOOLS = CATEGORY_DEVTOOLS;
--- a/devtools/client/performance/modules/logic/frame-utils.js
+++ b/devtools/client/performance/modules/logic/frame-utils.js
@@ -4,16 +4,18 @@
 "use strict";
 
 const global = require("devtools/client/performance/modules/global");
 const demangle = require("devtools/client/shared/demangle");
 const { assert } = require("devtools/shared/DevToolsUtils");
 const { isChromeScheme, isContentScheme, parseURL } =
   require("devtools/client/shared/source-utils");
 
+const { CATEGORY_MASK, CATEGORY_MAPPINGS } = require("devtools/client/performance/modules/categories");
+
 // Character codes used in various parsing helper functions.
 const CHAR_CODE_R = "r".charCodeAt(0);
 const CHAR_CODE_0 = "0".charCodeAt(0);
 const CHAR_CODE_9 = "9".charCodeAt(0);
 const CHAR_CODE_CAP_Z = "Z".charCodeAt(0);
 
 const CHAR_CODE_LPAREN = "(".charCodeAt(0);
 const CHAR_CODE_RPAREN = ")".charCodeAt(0);
@@ -224,28 +226,28 @@ function computeIsContentAndCategory(fra
   }
 
   if (schemeStartIndex !== 0) {
     for (let j = schemeStartIndex; j < location.length; j++) {
       if (location.charCodeAt(j) === CHAR_CODE_R &&
           isChromeScheme(location, j) &&
           (location.indexOf("resource://devtools") !== -1 ||
            location.indexOf("resource://devtools") !== -1)) {
-        frame.category = global.CATEGORY_DEVTOOLS;
+        frame.category = CATEGORY_MASK("tools");
         return;
       }
     }
   }
 
   if (location === "EnterJIT") {
-    frame.category = global.CATEGORY_JIT;
+    frame.category = CATEGORY_MASK("js");
     return;
   }
 
-  frame.category = global.CATEGORY_OTHER;
+  frame.category = CATEGORY_MASK("other");
 }
 
 /**
  * Get caches to cache inflated frames and computed frame keys of a frame
  * table.
  *
  * @param object framesTable
  * @return object
@@ -323,18 +325,17 @@ function InflatedFrame(index, frameTable
 InflatedFrame.prototype.getFrameKey = function getFrameKey(options) {
   if (this.isContent || !options.contentOnly || options.isRoot) {
     options.isMetaCategoryOut = false;
     return this.location;
   }
 
   if (options.isLeaf) {
     // We only care about leaf platform frames if we are displaying content
-    // only. If no category is present, give the default category of
-    // CATEGORY_OTHER.
+    // only. If no category is present, give the default category of "other".
     //
     // 1. The leaf is where time is _actually_ being spent, so we _need_ to
     // show it to developers in some way to give them accurate profiling
     // data. We decide to split the platform into various category buckets
     // and just show time spent in each bucket.
     //
     // 2. The calls leading to the leaf _aren't_ where we are spending time,
     // but _do_ give the developer context for how they got to the leaf
@@ -384,17 +385,17 @@ function getFrameInfo (node, options) {
       data.functionName = global.L10N.getStr("table.root");
     } else {
       data = parseLocation(node.location, node.line, node.column);
       data.hasOptimizations = node.hasOptimizations();
       data.isContent = node.isContent;
       data.isMetaCategory = node.isMetaCategory;
     }
     data.samples = node.youngestFrameSamples;
-    data.categoryData = global.CATEGORY_MAPPINGS[node.category] || {};
+    data.categoryData = CATEGORY_MAPPINGS[node.category] || {};
     data.nodeType = node.nodeType;
 
     // Frame name (function location or some meta information)
     data.name = data.isMetaCategory ? data.categoryData.label :
                 shouldDemangle(data.functionName) ? demangle(data.functionName) : data.functionName;
 
     data.tooltiptext = data.isMetaCategory ? data.categoryData.label : node.location || "";
 
--- a/devtools/client/performance/modules/moz.build
+++ b/devtools/client/performance/modules/moz.build
@@ -4,13 +4,14 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += [
     'logic',
     'widgets',
 ]
 
 DevToolsModules(
+    'categories.js',
     'constants.js',
     'global.js',
     'io.js',
     'markers.js',
 )
--- a/devtools/client/performance/test/browser_perf-tree-view-08.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-08.js
@@ -4,17 +4,17 @@
 
 /**
  * Tests that the profiler's tree view renders generalized platform data
  * when `contentOnly` is on correctly.
  */
 
 const { ThreadNode } = require("devtools/client/performance/modules/logic/tree-model");
 const { CallView } = require("devtools/client/performance/modules/widgets/tree-view");
-const { CATEGORY_MASK } = require("devtools/client/performance/modules/global");
+const { CATEGORY_MASK } = require("devtools/client/performance/modules/categories");
 const RecordingUtils = require("devtools/shared/performance/recording-utils");
 
 add_task(function() {
   let threadNode = new ThreadNode(gProfile.threads[0], { startTime: 0, endTime: 20, contentOnly: true });
 
   // Don't display the synthesized (root) and the real (root) node twice.
   threadNode.calls = threadNode.calls[0].calls;
 
--- a/devtools/client/performance/test/browser_perf-tree-view-11.js
+++ b/devtools/client/performance/test/browser_perf-tree-view-11.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests that if `show-jit-optimizations` is true, then an
  * icon is next to the frame with optimizations
  */
 
-var { CATEGORY_MASK } = require("devtools/client/performance/modules/global");
+var { CATEGORY_MASK } = require("devtools/client/performance/modules/categories");
 
 function* spawnTest() {
   let { panel } = yield initPerformance(SIMPLE_URL);
   let { EVENTS, $, $$, window, PerformanceController } = panel.panelWin;
   let { OverviewView, DetailsView, JsCallTreeView, RecordingsView } = panel.panelWin;
 
   let profilerData = { threads: [gThread] };
 
--- a/devtools/client/performance/test/helpers/synth-utils.js
+++ b/devtools/client/performance/test/helpers/synth-utils.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 "use strict";
 
 /**
  * Generates a generalized profile with some samples.
  */
 exports.synthesizeProfile = () => {
-  const { CATEGORY_MASK } = require("devtools/client/performance/modules/global");
+  const { CATEGORY_MASK } = require("devtools/client/performance/modules/categories");
   const RecordingUtils = require("devtools/shared/performance/recording-utils");
 
   return RecordingUtils.deflateProfile({
     meta: { version: 2 },
     threads: [{
       samples: [{
         time: 1,
         frames: [
--- a/devtools/client/performance/test/unit/test_profiler-categories.js
+++ b/devtools/client/performance/test/unit/test_profiler-categories.js
@@ -5,32 +5,30 @@
  * Tests if the profiler categories are mapped correctly.
  */
 
 function run_test() {
   run_next_test();
 }
 
 add_task(function () {
-  let global = require("devtools/client/performance/modules/global");
-  let l10n = global.L10N;
-  let categories = global.CATEGORIES;
-  let mappings = global.CATEGORY_MAPPINGS;
-  let count = categories.length;
+  let { CATEGORIES, CATEGORY_MAPPINGS } = require("devtools/client/performance/modules/categories");
+  let { L10N } = require("devtools/client/performance/modules/global");
+  let count = CATEGORIES.length;
 
   ok(count,
     "Should have a non-empty list of categories available.");
 
-  ok(categories.some(e => e.color),
+  ok(CATEGORIES.some(e => e.color),
     "All categories have an associated color.");
 
-  ok(categories.every(e => e.label),
+  ok(CATEGORIES.every(e => e.label),
     "All categories have an associated label.");
 
-  ok(categories.every(e => e.label === l10n.getStr("category." + e.abbrev)),
+  ok(CATEGORIES.every(e => e.label === L10N.getStr("category." + e.abbrev)),
     "All categories have a correctly localized label.");
 
-  ok(Object.keys(mappings).every(e => (Number(e) >= 9000 && Number(e) <= 9999) || Number.isInteger(Math.log2(e))),
+  ok(Object.keys(CATEGORY_MAPPINGS).every(e => (Number(e) >= 9000 && Number(e) <= 9999) || Number.isInteger(Math.log2(e))),
     "All bitmask mappings keys are powers of 2, or between 9000-9999 for special categories.");
 
-  ok(Object.keys(mappings).every(e => categories.indexOf(mappings[e]) !== -1),
+  ok(Object.keys(CATEGORY_MAPPINGS).every(e => CATEGORIES.indexOf(CATEGORY_MAPPINGS[e]) !== -1),
     "All bitmask mappings point to a category.");
 });
--- a/devtools/client/performance/test/unit/test_tree-model-07.js
+++ b/devtools/client/performance/test/unit/test_tree-model-07.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests that when displaying only content nodes, platform nodes are generalized.
  */
 
-var { CATEGORY_MASK } = require("devtools/client/performance/modules/global");
+var { CATEGORY_MASK } = require("devtools/client/performance/modules/categories");
 
 function run_test() {
   run_next_test();
 }
 
 add_task(function test() {
   let { ThreadNode } = require("devtools/client/performance/modules/logic/tree-model");
   let url = (n) => `http://content/${n}`;
--- a/devtools/client/performance/test/unit/test_tree-model-08.js
+++ b/devtools/client/performance/test/unit/test_tree-model-08.js
@@ -7,17 +7,17 @@
 
 function run_test() {
   run_next_test();
 }
 
 add_task(function test() {
   let FrameUtils = require("devtools/client/performance/modules/logic/frame-utils");
   let { FrameNode } = require("devtools/client/performance/modules/logic/tree-model");
-  let { CATEGORY_OTHER } = require("devtools/client/performance/modules/global");
+  let { CATEGORY_MASK } = require("devtools/client/performance/modules/categories");
   let compute = frame => {
     FrameUtils.computeIsContentAndCategory(frame);
     return frame;
   };
 
   let frames = [
     new FrameNode("hello/<.world (http://foo/bar.js:123:987)", compute({
       location: "hello/<.world (http://foo/bar.js:123:987)",
@@ -37,17 +37,17 @@ add_task(function test() {
     }), false),
     new FrameNode("hello/<.world (resource://foo.js -> http://bar/baz.js:123:987)", compute({
       location: "hello/<.world (resource://foo.js -> http://bar/baz.js:123:987)",
       line: 456,
     }), false),
     new FrameNode("Foo::Bar::Baz", compute({
       location: "Foo::Bar::Baz",
       line: 456,
-      category: CATEGORY_OTHER,
+      category: CATEGORY_MASK("other"),
     }), false),
     new FrameNode("EnterJIT", compute({
       location: "EnterJIT",
     }), false),
     new FrameNode("chrome://browser/content/content.js", compute({
       location: "chrome://browser/content/content.js",
       line: 456,
       column: 123
--- a/devtools/client/performance/test/unit/test_tree-model-09.js
+++ b/devtools/client/performance/test/unit/test_tree-model-09.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * Tests that when displaying only content nodes, platform nodes are generalized.
  */
 
-var { CATEGORY_MASK } = require("devtools/client/performance/modules/global");
+var { CATEGORY_MASK } = require("devtools/client/performance/modules/categories");
 
 function run_test() {
   run_next_test();
 }
 
 add_task(function test() {
   let { ThreadNode } = require("devtools/client/performance/modules/logic/tree-model");
   let url = (n) => `http://content/${n}`;
--- a/devtools/client/shared/widgets/FlameGraph.js
+++ b/devtools/client/shared/widgets/FlameGraph.js
@@ -10,17 +10,17 @@ const { setNamedTimeout, clearNamedTimeo
 loader.lazyRequireGetter(this, "promise");
 loader.lazyRequireGetter(this, "EventEmitter",
   "devtools/shared/event-emitter");
 
 loader.lazyRequireGetter(this, "getColor",
   "devtools/client/shared/theme", true);
 
 loader.lazyRequireGetter(this, "CATEGORY_MAPPINGS",
-  "devtools/client/performance/modules/global", true);
+  "devtools/client/performance/modules/categories", true);
 loader.lazyRequireGetter(this, "FrameUtils",
   "devtools/client/performance/modules/logic/frame-utils");
 loader.lazyRequireGetter(this, "demangle",
   "devtools/client/shared/demangle");
 
 loader.lazyRequireGetter(this, "AbstractCanvasGraph",
   "devtools/client/shared/widgets/Graphs", true);
 loader.lazyRequireGetter(this, "GraphArea",
--- a/js/public/ProfilingStack.h
+++ b/js/public/ProfilingStack.h
@@ -70,17 +70,17 @@ class ProfileEntry
 
         // Union of all flags.
         ALL = IS_CPP_ENTRY|FRAME_LABEL_COPY|BEGIN_PSEUDO_JS|OSR,
 
         // Mask for removing all flags except the category information.
         CATEGORY_MASK = ~ALL
     };
 
-    // Keep these in sync with devtools/client/performance/modules/global.js
+    // Keep these in sync with devtools/client/performance/modules/categories.js
     enum class Category : uint32_t {
         OTHER    = 0x10,
         CSS      = 0x20,
         JS       = 0x40,
         GC       = 0x80,
         CC       = 0x100,
         NETWORK  = 0x200,
         GRAPHICS = 0x400,