Bug 1500467 - Mark stack labels for JS built-ins as RELEVANT_FOR_JS. r=njn
authorMarkus Stange <mstange@themasta.com>
Wed, 14 Nov 2018 18:55:38 +0000
changeset 446427 a7df15c51806e92f48a3ce5f1b8ce80eb52f707f
parent 446426 74eb2570702555623f1367440f1e5b14a8ab925e
child 446428 43251725e5db3e6610a04c0c7fd492e25b175b5c
push id35041
push useraiakab@mozilla.com
push dateThu, 15 Nov 2018 09:52:43 +0000
treeherdermozilla-central@48720735b142 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1500467
milestone65.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 1500467 - Mark stack labels for JS built-ins as RELEVANT_FOR_JS. r=njn Depends on D9302 Differential Revision: https://phabricator.services.mozilla.com/D11333
js/src/builtin/Array.cpp
js/src/vm/GeckoProfiler-inl.h
js/src/vm/GeckoProfiler.h
--- a/js/src/builtin/Array.cpp
+++ b/js/src/builtin/Array.cpp
@@ -1443,17 +1443,19 @@ ArrayJoinKernel(JSContext* cx, Separator
 // 22.1.3.13 Array.prototype.join ( separator )
 bool
 js::array_join(JSContext* cx, unsigned argc, Value* vp)
 {
     if (!CheckRecursionLimit(cx)) {
         return false;
     }
 
-    AutoGeckoProfilerEntry pseudoFrame(cx, "Array.prototype.join");
+    AutoGeckoProfilerEntry pseudoFrame(
+        cx, "Array.prototype.join", ProfilingStackFrame::Category::JS,
+        uint32_t(ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
     CallArgs args = CallArgsFromVp(argc, vp);
 
     // Step 1.
     RootedObject obj(cx, ToObject(cx, args.thisv()));
     if (!obj) {
         return false;
     }
 
@@ -1721,17 +1723,19 @@ ArrayReverseDenseKernel(JSContext* cx, H
     return DenseElementResult::Success;
 }
 
 // ES2017 draft rev 1b0184bc17fc09a8ddcf4aeec9b6d9fcac4eafce
 // 22.1.3.21 Array.prototype.reverse ( )
 bool
 js::array_reverse(JSContext* cx, unsigned argc, Value* vp)
 {
-    AutoGeckoProfilerEntry pseudoFrame(cx, "Array.prototype.reverse");
+    AutoGeckoProfilerEntry pseudoFrame(
+        cx, "Array.prototype.reverse", ProfilingStackFrame::Category::JS,
+        uint32_t(ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
     CallArgs args = CallArgsFromVp(argc, vp);
 
     // Step 1.
     RootedObject obj(cx, ToObject(cx, args.thisv()));
     if (!obj) {
         return false;
     }
 
@@ -2470,17 +2474,19 @@ js::NewbornArrayPush(JSContext* cx, Hand
     return true;
 }
 
 // ES2017 draft rev 1b0184bc17fc09a8ddcf4aeec9b6d9fcac4eafce
 // 22.1.3.18 Array.prototype.push ( ...items )
 bool
 js::array_push(JSContext* cx, unsigned argc, Value* vp)
 {
-    AutoGeckoProfilerEntry pseudoFrame(cx, "Array.prototype.push");
+    AutoGeckoProfilerEntry pseudoFrame(
+        cx, "Array.prototype.push", ProfilingStackFrame::Category::JS,
+        uint32_t(ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
     CallArgs args = CallArgsFromVp(argc, vp);
 
     // Step 1.
     RootedObject obj(cx, ToObject(cx, args.thisv()));
     if (!obj) {
         return false;
     }
 
@@ -2530,17 +2536,19 @@ js::array_push(JSContext* cx, unsigned a
     return SetLengthProperty(cx, obj, newlength);
 }
 
 // ES2017 draft rev 1b0184bc17fc09a8ddcf4aeec9b6d9fcac4eafce
 // 22.1.3.17 Array.prototype.pop ( )
 bool
 js::array_pop(JSContext* cx, unsigned argc, Value* vp)
 {
-    AutoGeckoProfilerEntry pseudoFrame(cx, "Array.prototype.pop");
+    AutoGeckoProfilerEntry pseudoFrame(
+        cx, "Array.prototype.pop", ProfilingStackFrame::Category::JS,
+        uint32_t(ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
     CallArgs args = CallArgsFromVp(argc, vp);
 
     // Step 1.
     RootedObject obj(cx, ToObject(cx, args.thisv()));
     if (!obj) {
         return false;
     }
 
@@ -2652,17 +2660,19 @@ ArrayShiftDenseKernel(JSContext* cx, Han
     return DenseElementResult::Success;
 }
 
 // ES2017 draft rev 1b0184bc17fc09a8ddcf4aeec9b6d9fcac4eafce
 // 22.1.3.22 Array.prototype.shift ( )
 bool
 js::array_shift(JSContext* cx, unsigned argc, Value* vp)
 {
-    AutoGeckoProfilerEntry pseudoFrame(cx, "Array.prototype.shift");
+    AutoGeckoProfilerEntry pseudoFrame(
+        cx, "Array.prototype.shift", ProfilingStackFrame::Category::JS,
+        uint32_t(ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
     CallArgs args = CallArgsFromVp(argc, vp);
 
     // Step 1.
     RootedObject obj(cx, ToObject(cx, args.thisv()));
     if (!obj) {
         return false;
     }
 
@@ -2738,17 +2748,19 @@ js::array_shift(JSContext* cx, unsigned 
     return SetLengthProperty(cx, obj, newlen);
 }
 
 // ES2017 draft rev 1b0184bc17fc09a8ddcf4aeec9b6d9fcac4eafce
 // 22.1.3.29 Array.prototype.unshift ( ...items )
 bool
 js::array_unshift(JSContext* cx, unsigned argc, Value* vp)
 {
-    AutoGeckoProfilerEntry pseudoFrame(cx, "Array.prototype.unshift");
+    AutoGeckoProfilerEntry pseudoFrame(
+        cx, "Array.prototype.unshift", ProfilingStackFrame::Category::JS,
+        uint32_t(ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
     CallArgs args = CallArgsFromVp(argc, vp);
 
     // Step 1.
     RootedObject obj(cx, ToObject(cx, args.thisv()));
     if (!obj) {
         return false;
     }
 
@@ -2998,17 +3010,19 @@ CopyArrayElements(JSContext* cx, HandleO
         }
     }
     return true;
 }
 
 static bool
 array_splice_impl(JSContext* cx, unsigned argc, Value* vp, bool returnValueIsUsed)
 {
-    AutoGeckoProfilerEntry pseudoFrame(cx, "Array.prototype.splice");
+    AutoGeckoProfilerEntry pseudoFrame(
+        cx, "Array.prototype.splice", ProfilingStackFrame::Category::JS,
+        uint32_t(ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
     CallArgs args = CallArgsFromVp(argc, vp);
 
     /* Step 1. */
     RootedObject obj(cx, ToObject(cx, args.thisv()));
     if (!obj) {
         return false;
     }
 
@@ -3593,17 +3607,19 @@ ArraySliceOrdinary(JSContext* cx, Handle
     rval.setObject(*narr);
     return true;
 }
 
 /* ES 2016 draft Mar 25, 2016 22.1.3.23. */
 bool
 js::array_slice(JSContext* cx, unsigned argc, Value* vp)
 {
-    AutoGeckoProfilerEntry pseudoFrame(cx, "Array.prototype.slice");
+    AutoGeckoProfilerEntry pseudoFrame(
+        cx, "Array.prototype.slice", ProfilingStackFrame::Category::JS,
+        uint32_t(ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
     CallArgs args = CallArgsFromVp(argc, vp);
 
     /* Step 1. */
     RootedObject obj(cx, ToObject(cx, args.thisv()));
     if (!obj) {
         return false;
     }
 
--- a/js/src/vm/GeckoProfiler-inl.h
+++ b/js/src/vm/GeckoProfiler-inl.h
@@ -78,32 +78,33 @@ GeckoProfilerEntryMarker::~GeckoProfiler
 
     profiler_->profilingStack_->pop();    // the JS frame
     profiler_->profilingStack_->pop();    // the SP_MARKER frame
     MOZ_ASSERT(spBefore_ == profiler_->stackPointer());
 }
 
 MOZ_ALWAYS_INLINE
 AutoGeckoProfilerEntry::AutoGeckoProfilerEntry(JSContext* cx, const char* label,
-                                               ProfilingStackFrame::Category category
+                                               ProfilingStackFrame::Category category,
+                                               uint32_t flags
                                                MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
   : profiler_(&cx->geckoProfiler())
 {
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     if (MOZ_LIKELY(!profiler_->infraInstalled())) {
         profiler_ = nullptr;
         return;
     }
 #ifdef DEBUG
     spBefore_ = profiler_->stackPointer();
 #endif
     profiler_->profilingStack_->pushLabelFrame(label,
-                                            /* dynamicString = */ nullptr,
-                                            /* sp = */ this,
-                                            category);
+                                               /* dynamicString = */ nullptr,
+                                               /* sp = */ this,
+                                               category, flags);
 }
 
 MOZ_ALWAYS_INLINE
 AutoGeckoProfilerEntry::~AutoGeckoProfilerEntry()
 {
     if (MOZ_LIKELY(!profiler_)) {
         return;
     }
--- a/js/src/vm/GeckoProfiler.h
+++ b/js/src/vm/GeckoProfiler.h
@@ -187,17 +187,18 @@ class MOZ_RAII GeckoProfilerEntryMarker
  *
  * NB: The `label` string must be statically allocated.
  */
 class MOZ_NONHEAP_CLASS AutoGeckoProfilerEntry
 {
   public:
     explicit MOZ_ALWAYS_INLINE
     AutoGeckoProfilerEntry(JSContext* cx, const char* label,
-                           ProfilingStackFrame::Category category = ProfilingStackFrame::Category::JS
+                           ProfilingStackFrame::Category category = ProfilingStackFrame::Category::JS,
+                           uint32_t flags = 0
                            MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
     MOZ_ALWAYS_INLINE ~AutoGeckoProfilerEntry();
 
   private:
     GeckoProfilerThread* profiler_;
 #ifdef DEBUG
     uint32_t spBefore_;
 #endif