Bug 1189750 - Fix JSScript::getPCCounts to return a reference instead of a copy. r=bhackett
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Tue, 04 Aug 2015 11:03:03 +0200
changeset 287753 538add9f7b34bad3d58a885e4ea1cdd197989bd4
parent 287752 3f700e2cebbcc625c2f2aa6d6d857609e8afd8be
child 287754 01576b408ea703f6abba09d8e38628723df18c75
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs1189750
milestone42.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 1189750 - Fix JSScript::getPCCounts to return a reference instead of a copy. r=bhackett
js/src/jsscript.cpp
js/src/jsscript.h
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -1319,17 +1319,17 @@ static inline ScriptCountsMap::Ptr GetSc
 {
     MOZ_ASSERT(script->hasScriptCounts());
     ScriptCountsMap* map = script->compartment()->scriptCountsMap;
     ScriptCountsMap::Ptr p = map->lookup(script);
     MOZ_ASSERT(p);
     return p;
 }
 
-js::PCCounts
+js::PCCounts&
 JSScript::getPCCounts(jsbytecode* pc) {
     MOZ_ASSERT(containsPC(pc));
     ScriptCountsMap::Ptr p = GetScriptCountsMapEntry(this);
     return p->value().pcCountsVector[pcToOffset(pc)];
 }
 
 void
 JSScript::addIonCounts(jit::IonScriptCounts* ionCounts)
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -1624,17 +1624,17 @@ class JSScript : public js::gc::TenuredC
     void resetWarmUpCounter() { incWarmUpResetCounter(); warmUpCount = 0; }
 
     uint16_t getWarmUpResetCount() const { return warmUpResetCount; }
     uint16_t incWarmUpResetCounter(uint16_t amount = 1) { return warmUpResetCount += amount; }
     void resetWarmUpResetCounter() { warmUpResetCount = 0; }
 
   public:
     bool initScriptCounts(JSContext* cx);
-    js::PCCounts getPCCounts(jsbytecode* pc);
+    js::PCCounts& getPCCounts(jsbytecode* pc);
     void addIonCounts(js::jit::IonScriptCounts* ionCounts);
     js::jit::IonScriptCounts* getIonCounts();
     js::ScriptCounts releaseScriptCounts();
     void destroyScriptCounts(js::FreeOp* fop);
 
     jsbytecode* main() {
         return code() + mainOffset();
     }