Bug 1528028 - Remove obsolete Shark profiling support r=tcampbell
authorMatthew Gaudet <mgaudet@mozilla.com>
Tue, 19 Feb 2019 19:56:48 +0000
changeset 517824 ef3a903f83998034acb43924a423bf4d370ac382
parent 517823 2c28c2185a32187b043085bd9e162f90d87eb3c6
child 517825 254c51dcd9a828814777368744e7efa89dd67ea0
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1528028
milestone67.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 1528028 - Remove obsolete Shark profiling support r=tcampbell Differential Revision: https://phabricator.services.mozilla.com/D20323
config/check_spidermonkey_style.py
js/src/builtin/Profilers.h
js/src/devtools/sharkctl.cpp
js/src/devtools/sharkctl.h
js/src/moz.build
--- a/config/check_spidermonkey_style.py
+++ b/config/check_spidermonkey_style.py
@@ -51,17 +51,16 @@ ignored_js_src_dirs = [
     'js/src/editline/',          # imported code
     'js/src/gdb/',               # auxiliary stuff
     'js/src/vtune/'              # imported code
 ]
 
 # We ignore #includes of these files, because they don't follow the usual rules.
 included_inclnames_to_ignore = set([
     'ffi.h',                    # generated in ctypes/libffi/
-    'devtools/sharkctl.h',      # we ignore devtools/ in general
     'devtools/Instruments.h',   # we ignore devtools/ in general
     'double-conversion/double-conversion.h',  # strange MFBT case
     'javascript-trace.h',       # generated in $OBJDIR if HAVE_DTRACE is defined
     'frontend/ReservedWordsGenerated.h',  # generated in $OBJDIR
     'gc/StatsPhasesGenerated.h',         # generated in $OBJDIR
     'gc/StatsPhasesGenerated.cpp',       # generated in $OBJDIR
     'jit/LOpcodes.h',           # generated in $OBJDIR
     'jit/MOpcodes.h',           # generated in $OBJDIR
--- a/js/src/builtin/Profilers.h
+++ b/js/src/builtin/Profilers.h
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: set ts=8 sts=2 et sw=2 tw=80:
  * 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/. */
 
 /*
- * Functions for controlling profilers from within JS: Valgrind, Perf,
- * Shark, etc.
+ * Functions for controlling profilers from within JS: Valgrind, Perf, etc
  */
 #ifndef builtin_Profilers_h
 #define builtin_Profilers_h
 
 #include "jstypes.h"
 
 #ifdef _MSC_VER
 typedef int pid_t;
deleted file mode 100644
--- a/js/src/devtools/sharkctl.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: set ts=8 sts=2 et sw=2 tw=80:
- * 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/. */
-
-#ifdef __APPLE__
-
-#  include "sharkctl.h"
-#  include <stddef.h>
-#  include <stdio.h>
-#  include <stdlib.h>
-#  include <unistd.h>
-
-#  include "jsutil.h"
-
-#  define SHARK_MSG_ACQUIRE 0x29a
-#  define SHARK_MSG_RELEASE 0x29b
-#  define SHARK_MSG_STOP 0x29c
-#  define SHARK_MSG_START 0x29d
-
-#  define RECV_SIZEOF(ty) offsetof(ty, out)
-
-// Private API in libSystem.dylib
-extern "C" void bootstrap_look_up(mach_port_t special_port, const char* name,
-                                  mach_port_t* dest_port);
-
-struct chud_client_acquire_msg {
-  mach_msg_header_t hdr;
-  uint32_t unk0;  // always 0
-  uint32_t unk1;  // always 1
-  uint32_t pid;
-  uint32_t out[2];
-};
-
-struct chud_client_start_msg {
-  mach_msg_header_t hdr;
-  uint32_t unk0;  // always 1
-  uint32_t name0;
-  uint32_t arg2;   // always 6
-  uint8_t unk1;    // always 0
-  uint8_t unk2;    // always 1
-  uint8_t unk3;    // uninitialized
-  uint8_t unk4;    // always 1
-  uint32_t unk5;   // always 0
-  uint32_t unk6;   // always 1
-  uint32_t name1;  // same as name0
-};
-
-struct chud_client_stop_msg {
-  mach_msg_header_t hdr;
-  uint32_t out[5];
-};
-
-struct chud_client_release_msg {
-  mach_msg_header_t hdr;
-  uint32_t unk0;  // always 0
-  uint32_t unk1;  // always 1
-  uint32_t pid;
-  uint32_t out[2];
-};
-
-static mach_port_t CreatePort(void) {
-  mach_port_t bootstrap_port, shark_port = 0;
-  task_get_special_port(mach_task_self(), TASK_BOOTSTRAP_PORT, &bootstrap_port);
-  bootstrap_look_up(bootstrap_port, "CHUD_IPC", &shark_port);
-  return shark_port;
-}
-
-static mach_msg_return_t Connect(mach_port_t shark_port) {
-  mach_port_t reply_port = mig_get_reply_port();
-
-  struct chud_client_acquire_msg msg;
-  msg.hdr.msgh_bits = 0x1513;
-  msg.hdr.msgh_size = sizeof(mach_msg_header_t);
-  msg.hdr.msgh_remote_port = shark_port;
-  msg.hdr.msgh_local_port = reply_port;
-  msg.hdr.msgh_reserved = 0;
-  msg.hdr.msgh_id = SHARK_MSG_ACQUIRE;
-  msg.unk0 = 0;
-  msg.unk1 = 1;
-  msg.pid = getpid();
-
-  MOZ_ASSERT(RECV_SIZEOF(struct chud_client_acquire_msg) == 0x24);
-  MOZ_ASSERT(sizeof(msg) == 0x2c);
-  mach_msg_return_t result =
-      mach_msg(&msg.hdr, MACH_SEND_MSG | MACH_RCV_MSG,
-               RECV_SIZEOF(struct chud_client_acquire_msg), sizeof(msg),
-               reply_port, 0, 0);
-  mig_dealloc_reply_port(reply_port);
-  return result;
-}
-
-static mach_msg_return_t Start(mach_port_t shark_port, uint32_t name) {
-  mach_port_t reply_port = mig_get_reply_port();
-
-  struct chud_client_start_msg msg;
-  msg.hdr.msgh_bits = 0x80001513;
-  msg.hdr.msgh_size = sizeof(mach_msg_header_t);
-  msg.hdr.msgh_remote_port = shark_port;
-  msg.hdr.msgh_local_port = reply_port;
-  msg.hdr.msgh_reserved = 0;
-  msg.hdr.msgh_id = SHARK_MSG_START;
-  msg.unk0 = 1;
-  msg.name0 = name;
-  msg.arg2 = 6;
-  msg.unk1 = 0;
-  msg.unk2 = 1;
-  msg.unk3 = 0;
-  msg.unk4 = 1;
-  msg.unk5 = 0;
-  msg.unk6 = 1;
-  msg.name1 = name;
-
-  MOZ_ASSERT(sizeof(msg) == 0x34);
-  mach_msg_return_t result = mach_msg(&msg.hdr, MACH_SEND_MSG | MACH_RCV_MSG,
-                                      sizeof(msg), 0x30, reply_port, 0, 0);
-  mig_dealloc_reply_port(reply_port);
-  return result;
-}
-
-mach_msg_return_t Stop(mach_port_t shark_port) {
-  mach_port_t reply_port = mig_get_reply_port();
-
-  struct chud_client_stop_msg msg;
-  msg.hdr.msgh_bits = 0x1513;
-  msg.hdr.msgh_size = sizeof(mach_msg_header_t);
-  msg.hdr.msgh_remote_port = shark_port;
-  msg.hdr.msgh_local_port = reply_port;
-  msg.hdr.msgh_reserved = 0;
-  msg.hdr.msgh_id = SHARK_MSG_STOP;
-
-  MOZ_ASSERT(RECV_SIZEOF(struct chud_client_stop_msg) == 0x18);
-  MOZ_ASSERT(sizeof(msg) == 0x2c);
-  mach_msg_return_t result = mach_msg(&msg.hdr, MACH_SEND_MSG | MACH_RCV_MSG,
-                                      RECV_SIZEOF(struct chud_client_stop_msg),
-                                      sizeof(msg), reply_port, 0, 0);
-  mig_dealloc_reply_port(reply_port);
-  return result;
-}
-
-static mach_msg_return_t Disconnect(mach_port_t shark_port) {
-  mach_port_t reply_port = mig_get_reply_port();
-
-  struct chud_client_release_msg msg;
-  msg.hdr.msgh_bits = 0x1513;
-  msg.hdr.msgh_size = sizeof(mach_msg_header_t);
-  msg.hdr.msgh_remote_port = shark_port;
-  msg.hdr.msgh_local_port = reply_port;
-  msg.hdr.msgh_reserved = 0;
-  msg.hdr.msgh_id = SHARK_MSG_RELEASE;
-  msg.unk0 = 0;
-  msg.unk1 = 1;
-  msg.pid = getpid();
-
-  MOZ_ASSERT(RECV_SIZEOF(struct chud_client_release_msg) == 0x24);
-  MOZ_ASSERT(sizeof(msg) == 0x2c);
-  mach_msg_return_t result =
-      mach_msg(&msg.hdr, MACH_SEND_MSG | MACH_RCV_MSG,
-               RECV_SIZEOF(struct chud_client_release_msg), sizeof(msg),
-               reply_port, 0, 0);
-  mig_dealloc_reply_port(reply_port);
-  return result;
-}
-
-static mach_port_t shark_port = 0;
-static bool connected = false;
-static bool running = false;
-
-namespace Shark {
-
-bool Start() {
-  if (!shark_port && !(shark_port = CreatePort())) return false;
-  if (!connected && Connect(shark_port)) return false;
-  connected = true;
-  if (!running && ::Start(shark_port, 0xdeadbeef)) return false;
-  return running = true;
-}
-
-void Stop() {
-  if (!shark_port || !connected) return;
-  ::Stop(shark_port);
-  running = false;
-  Disconnect(shark_port);
-  connected = false;
-}
-
-}  // namespace Shark
-
-#endif
deleted file mode 100644
--- a/js/src/devtools/sharkctl.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: set ts=8 sts=2 et sw=2 tw=80:
- * 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 devtools_sharkctl_h
-#define devtools_sharkctl_h
-
-#ifdef __APPLE__
-
-#  include <mach/mach.h>
-#  include <stdint.h>
-
-namespace Shark {
-
-bool Start();
-void Stop();
-
-}  // namespace Shark
-
-#endif /* __APPLE__ */
-
-#endif /* devtools_sharkctl_h */
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -214,17 +214,16 @@ UNIFIED_SOURCES += [
     'builtin/ReflectParse.cpp',
     'builtin/Stream.cpp',
     'builtin/String.cpp',
     'builtin/Symbol.cpp',
     'builtin/TestingFunctions.cpp',
     'builtin/TypedObject.cpp',
     'builtin/WeakMapObject.cpp',
     'builtin/WeakSetObject.cpp',
-    'devtools/sharkctl.cpp',
     'ds/Bitmap.cpp',
     'ds/LifoAlloc.cpp',
     'ds/MemoryProtectionExceptionHandler.cpp',
     'irregexp/NativeRegExpMacroAssembler.cpp',
     'irregexp/RegExpAST.cpp',
     'irregexp/RegExpCharacters.cpp',
     'irregexp/RegExpEngine.cpp',
     'irregexp/RegExpInterpreter.cpp',