Bug 1510603 - Rename some members of CacheIRSpewer for consistency r=mgaudet
authorPeeyush Kushwaha <peeyush.p97@gmail.com>
Wed, 13 Feb 2019 14:17:30 +0000
changeset 458892 4f84802c6f0b
parent 458891 6c10cc59703a
child 458893 caab6cb81820
push id35551
push usershindli@mozilla.com
push dateWed, 13 Feb 2019 21:34:09 +0000
treeherdermozilla-central@08f794a4928e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmgaudet
bugs1510603
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 1510603 - Rename some members of CacheIRSpewer for consistency r=mgaudet Renamed outputLock, output, and json to add an underscore suffix Differential Revision: https://phabricator.services.mozilla.com/D19331
js/src/jit/CacheIRSpewer.cpp
js/src/jit/CacheIRSpewer.h
--- a/js/src/jit/CacheIRSpewer.cpp
+++ b/js/src/jit/CacheIRSpewer.cpp
@@ -26,33 +26,33 @@
 #  include "vm/Realm-inl.h"
 
 using namespace js;
 using namespace js::jit;
 
 CacheIRSpewer CacheIRSpewer::cacheIRspewer;
 
 CacheIRSpewer::CacheIRSpewer()
-    : outputLock(mutexid::CacheIRSpewer), guardCount_(0) {
+    : outputLock_(mutexid::CacheIRSpewer), guardCount_(0) {
   spewInterval_ =
       getenv("CACHEIR_LOG_FLUSH") ? atoi(getenv("CACHEIR_LOG_FLUSH")) : 10000;
 
   if (spewInterval_ < 1) {
     spewInterval_ = 1;
   }
 }
 
 CacheIRSpewer::~CacheIRSpewer() {
   if (!enabled()) {
     return;
   }
 
-  json.ref().endList();
-  output.flush();
-  output.finish();
+  json_.ref().endList();
+  output_.flush();
+  output_.finish();
 }
 
 #  ifndef JIT_SPEW_DIR
 #    if defined(_WIN32)
 #      define JIT_SPEW_DIR "."
 #    elif defined(__ANDROID__)
 #      define JIT_SPEW_DIR "/data/local/tmp"
 #    else
@@ -69,28 +69,28 @@ bool CacheIRSpewer::init(const char* fil
   uint32_t pid = getpid();
   // Default to JIT_SPEW_DIR/cacheir${pid}.json
   if (filename[0] == '1') {
     SprintfLiteral(name, JIT_SPEW_DIR "/cacheir%" PRIu32 ".json", pid);
   } else {
     SprintfLiteral(name, "%s%" PRIu32 ".json", filename, pid);
   }
 
-  if (!output.init(name)) {
+  if (!output_.init(name)) {
     return false;
   }
-  output.put("[");
+  output_.put("[");
 
-  json.emplace(output);
+  json_.emplace(output_);
   return true;
 }
 
 void CacheIRSpewer::beginCache(const IRGenerator& gen) {
   MOZ_ASSERT(enabled());
-  JSONPrinter& j = json.ref();
+  JSONPrinter& j = json_.ref();
   const char* filename = gen.script_->filename();
   j.beginObject();
   j.property("name", CacheKindNames[uint8_t(gen.cacheKind_)]);
   j.property("file", filename ? filename : "null");
   j.property("mode", int(gen.mode_));
   if (jsbytecode* pc = gen.pc_) {
     unsigned column;
     j.property("line", PCToLineNumber(gen.script_, pc, &column));
@@ -123,17 +123,17 @@ static void QuoteString(GenericPrinter& 
     QuoteString(out, str->latin1Chars(nogc), str->length());
   } else {
     QuoteString(out, str->twoByteChars(nogc), str->length());
   }
 }
 
 void CacheIRSpewer::valueProperty(const char* name, const Value& v) {
   MOZ_ASSERT(enabled());
-  JSONPrinter& j = json.ref();
+  JSONPrinter& j = json_.ref();
 
   j.beginObjectProperty(name);
 
   const char* type = InformalValueTypeName(v);
   if (v.isInt32()) {
     type = "int32";
   }
   j.property("type", type);
@@ -141,17 +141,17 @@ void CacheIRSpewer::valueProperty(const 
   if (v.isInt32()) {
     j.property("value", v.toInt32());
   } else if (v.isDouble()) {
     j.floatProperty("value", v.toDouble(), 3);
   } else if (v.isString() || v.isSymbol()) {
     JSString* str = v.isString() ? v.toString() : v.toSymbol()->description();
     if (str && str->isLinear()) {
       j.beginStringProperty("value");
-      QuoteString(output, &str->asLinear());
+      QuoteString(output_, &str->asLinear());
       j.endStringProperty();
     }
   } else if (v.isObject()) {
     JSObject& object = v.toObject();
     j.formatProperty("value", "%p (shape: %p)", &object, object.maybeShape());
     if (NativeObject* nobj =
             object.isNative() ? &object.as<NativeObject>() : nullptr) {
       j.beginListProperty("flags");
@@ -180,26 +180,26 @@ void CacheIRSpewer::valueProperty(const 
     }
   }
 
   j.endObject();
 }
 
 void CacheIRSpewer::opcodeProperty(const char* name, const JSOp op) {
   MOZ_ASSERT(enabled());
-  JSONPrinter& j = json.ref();
+  JSONPrinter& j = json_.ref();
 
   j.beginStringProperty(name);
-  output.put(CodeName[op]);
+  output_.put(CodeName[op]);
   j.endStringProperty();
 }
 
 void CacheIRSpewer::attached(const char* name) {
   MOZ_ASSERT(enabled());
-  json.ref().property("attached", name);
+  json_.ref().property("attached", name);
 }
 
 void CacheIRSpewer::endCache() {
   MOZ_ASSERT(enabled());
-  json.ref().endObject();
+  json_.ref().endObject();
 }
 
 #endif /* JS_CACHEIR_SPEW */
--- a/js/src/jit/CacheIRSpewer.h
+++ b/js/src/jit/CacheIRSpewer.h
@@ -16,40 +16,40 @@
 #  include "threading/LockGuard.h"
 #  include "vm/JSONPrinter.h"
 #  include "vm/MutexIDs.h"
 
 namespace js {
 namespace jit {
 
 class CacheIRSpewer {
-  Mutex outputLock;
-  Fprinter output;
-  mozilla::Maybe<JSONPrinter> json;
+  Mutex outputLock_;
+  Fprinter output_;
+  mozilla::Maybe<JSONPrinter> json_;
   static CacheIRSpewer cacheIRspewer;
 
   // Counter to record how many times Guard class is called. This is used to
   // determine when to flush outputs based on the given interval value.
   // For example, if |spewInterval_ = 2|, outputs will be flushed on
   // guardCount_ values 0,2,4,6,...
   uint32_t guardCount_;
 
   // Interval at which to flush output files. This value can be set with the
   // environment variable |CACHEIR_LOG_FLUSH|.
   uint32_t spewInterval_;
 
   CacheIRSpewer();
   ~CacheIRSpewer();
 
-  bool enabled() { return json.isSome(); }
+  bool enabled() { return json_.isSome(); }
 
   // These methods can only be called when enabled() is true.
   Mutex& lock() {
     MOZ_ASSERT(enabled());
-    return outputLock;
+    return outputLock_;
   }
 
   void beginCache(const IRGenerator& generator);
   void valueProperty(const char* name, const Value& v);
   void opcodeProperty(const char* name, const JSOp op);
   void attached(const char* name);
   void endCache();
 
@@ -73,17 +73,17 @@ class CacheIRSpewer {
 
     ~Guard() {
       if (sp_.enabled()) {
         if (name_ != nullptr) {
           sp_.attached(name_);
         }
         sp_.endCache();
         if (sp_.guardCount_++ % sp_.spewInterval_ == 0) {
-          sp_.output.flush();
+          sp_.output_.flush();
         }
         sp_.lock().unlock();
       }
     }
 
     void valueProperty(const char* name, const Value& v) const {
       sp_.valueProperty(name, v);
     }