Bug 792581 - part 10: Replace LL_SUB macro with mathematical minus operator. r=ehsan
authorAndrew Quartey <andrew.quartey@gmail.com>
Fri, 05 Oct 2012 01:05:27 -0400
changeset 109326 4c3f56cede8326179c22d22e7f4e5d11d3b80889
parent 109325 b7b805f35a69d4ec602a3cc577f656ff2769df0b
child 109327 05cd1044c8c7a3b710a7a61e74872dfb606fbe27
push id15971
push userandrew.quartey@gmail.com
push dateFri, 05 Oct 2012 05:05:49 +0000
treeherdermozilla-inbound@01ada5d631e7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs792581
milestone18.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 792581 - part 10: Replace LL_SUB macro with mathematical minus operator. r=ehsan
content/base/src/nsContentSink.cpp
content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsTextFrameThebes.cpp
layout/xul/base/src/nsListBoxBodyFrame.cpp
netwerk/base/src/nsProtocolProxyService.cpp
netwerk/test/TestPageLoad.cpp
security/manager/ssl/src/nsCRLManager.cpp
security/manager/ssl/src/nsNSSComponent.cpp
tools/trace-malloc/spacetrace.c
xpcom/tests/CvtURL.cpp
--- a/content/base/src/nsContentSink.cpp
+++ b/content/base/src/nsContentSink.cpp
@@ -1224,19 +1224,19 @@ nsContentSink::Notify(nsITimer *timer)
   
 #ifdef MOZ_DEBUG
   {
     PRTime now = PR_Now();
     int64_t diff, interval;
     int32_t delay;
 
     LL_I2L(interval, GetNotificationInterval());
-    LL_SUB(diff, now, mLastNotificationTime);
+    diff = now - mLastNotificationTime;
 
-    LL_SUB(diff, diff, interval);
+    diff -= interval;
     LL_L2I(delay, diff);
     delay /= PR_USEC_PER_MSEC;
 
     mBackoffCount--;
     SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_REFLOW,
                ("nsContentSink::Notify: reflow on a timer: %d milliseconds "
                 "late, backoff count: %d", delay, mBackoffCount));
   }
@@ -1268,17 +1268,17 @@ nsContentSink::IsTimeToNotify()
     mDeferredFlushTags = true;
     return false;
   }
 
   PRTime now = PR_Now();
   int64_t interval, diff;
 
   LL_I2L(interval, GetNotificationInterval());
-  LL_SUB(diff, now, mLastNotificationTime);
+  diff = now - mLastNotificationTime;
 
   if (diff > interval) {
     mBackoffCount--;
     return true;
   }
 
   return false;
 }
--- a/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp
+++ b/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp
@@ -686,19 +686,17 @@ nsXULTemplateQueryProcessorRDF::CompareR
         nsCOMPtr<nsIRDFDate> l = do_QueryInterface(leftNode);
         if (l) {
             nsCOMPtr<nsIRDFDate> r = do_QueryInterface(rightNode);
             if (r) {
                 PRTime ldate, rdate;
                 l->GetValue(&ldate);
                 r->GetValue(&rdate);
 
-                int64_t delta;
-                LL_SUB(delta, ldate, rdate);
-
+                int64_t delta = ldate - rdate;
                 if (delta == 0)
                     *aResult = 0;
                 else if (delta >= 0)
                     *aResult = 1;
                 else
                     *aResult = -1;
             }
 
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1232,17 +1232,17 @@ nsBlockFrame::Reflow(nsPresContext*     
   if (gLameReflowMetrics) {
     PRTime end = PR_Now();
 
     int32_t ectc = nsLineBox::GetCtorCount();
     int32_t numLines = mLines.size();
     if (!numLines) numLines = 1;
     PRTime delta, perLineDelta, lines;
     LL_I2L(lines, numLines);
-    LL_SUB(delta, end, start);
+    delta = end - start;
     LL_DIV(perLineDelta, delta, lines);
 
     ListTag(stdout);
     char buf[400];
     PR_snprintf(buf, sizeof(buf),
                 ": %lld elapsed (%lld per line) (%d lines; %d new lines)",
                 delta, perLineDelta, numLines, ectc - ctc);
     printf("%s\n", buf);
@@ -6203,17 +6203,17 @@ nsBlockFrame::BuildDisplayList(nsDisplay
 #ifdef DEBUG
   if (gLamePaintMetrics) {
     PRTime end = PR_Now();
 
     int32_t numLines = mLines.size();
     if (!numLines) numLines = 1;
     PRTime lines, deltaPerLine, delta;
     LL_I2L(lines, numLines);
-    LL_SUB(delta, end, start);
+    delta = end - start;
     LL_DIV(deltaPerLine, delta, lines);
 
     ListTag(stdout);
     char buf[400];
     PR_snprintf(buf, sizeof(buf),
                 ": %lld elapsed (%lld per line) lines=%d drawn=%d skip=%d",
                 delta, deltaPerLine,
                 numLines, drawnLines, numLines - drawnLines);
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -3366,17 +3366,17 @@ NS_IMETHODIMP nsBlinkTimer::Notify(nsITi
   if (sState == 1 || sState == 2)
     // States 0, 1, and 2 are all the same.
     return NS_OK;
 
 #ifdef NOISY_BLINK
   PRTime now = PR_Now();
   char buf[50];
   PRTime delta;
-  LL_SUB(delta, now, gLastTick);
+  delta = now - gLastTick;
   gLastTick = now;
   PR_snprintf(buf, sizeof(buf), "%lldusec", delta);
   printf("%s\n", buf);
 #endif
 
   uint32_t i, n = mFrames.Length();
   for (i = 0; i < n; i++) {
     FrameData& frameData = mFrames.ElementAt(i);
--- a/layout/xul/base/src/nsListBoxBodyFrame.cpp
+++ b/layout/xul/base/src/nsListBoxBodyFrame.cpp
@@ -902,18 +902,17 @@ nsListBoxBodyFrame::DoInternalPositionCh
   }
 
   mScrolling = false;
   
   VerticalScroll(mYPosition);
 
   PRTime end = PR_Now();
 
-  PRTime difTime;
-  LL_SUB(difTime, end, start);
+  PRTime difTime = end - start;
 
   int32_t newTime;
   LL_L2I(newTime, difTime);
   newTime /= aDelta;
 
   // average old and new
   mTimePerRow = (newTime + mTimePerRow)/2;
   
--- a/netwerk/base/src/nsProtocolProxyService.cpp
+++ b/netwerk/base/src/nsProtocolProxyService.cpp
@@ -774,18 +774,17 @@ nsProtocolProxyService::GetProxyKey(nsPr
 } 
 
 uint32_t
 nsProtocolProxyService::SecondsSinceSessionStart()
 {
     PRTime now = PR_Now();
 
     // get time elapsed since session start
-    int64_t diff;
-    LL_SUB(diff, now, mSessionStart);
+    int64_t diff = now - mSessionStart;
 
     // convert microseconds to seconds
     PRTime ups;
     LL_I2L(ups, PR_USEC_PER_SEC);
     LL_DIV(diff, diff, ups);
 
     // convert to 32 bit value
     uint32_t dsec;
--- a/netwerk/test/TestPageLoad.cpp
+++ b/netwerk/test/TestPageLoad.cpp
@@ -348,18 +348,17 @@ int main(int argc, char **argv)
         start = PR_Now();
         rv = chan->AsyncOpen(listener, nullptr);
         RETURN_IF_FAILED(rv, -1, "AsyncOpen");
 
         PumpEvents();
 
         finish = PR_Now();
         uint32_t totalTime32;
-        uint64_t totalTime64;
-        LL_SUB(totalTime64, finish, start);
+        uint64_t totalTime64 = finish - start;
         LL_L2UI(totalTime32, totalTime64);
 
         printf("\n\n--------------------\nAll done:\nnum found:%d\nnum start:%d\n", numFound, numStart);
 
         printf("\n\n>>PageLoadTime>>%u>>\n\n", totalTime32);
     } // this scopes the nsCOMPtrs
     // no nsCOMPtrs are allowed to be alive when you call NS_ShutdownXPCOM
     rv = NS_ShutdownXPCOM(nullptr);
--- a/security/manager/ssl/src/nsCRLManager.cpp
+++ b/security/manager/ssl/src/nsCRLManager.cpp
@@ -410,27 +410,27 @@ nsCRLManager::ComputeNextAutoUpdateTime(
     return rv;
 
   rv = info->GetNextUpdate(&nextUpdate);
   if (NS_FAILED(rv))
     return rv;
 
   switch (autoUpdateType) {
   case TYPE_AUTOUPDATE_FREQ_BASED:
-    LL_SUB(diff, now, lastUpdate);             //diff is the no of micro sec between now and last update
+    diff = now - lastUpdate;                    //diff is the no of micro sec between now and last update
     LL_DIV(cycleCnt, diff, microsecInDayCnt);   //temp is the number of full cycles from lst update
     LL_MOD(temp, diff, microsecInDayCnt);
     if(temp != 0) {
       ++cycleCnt;            //no of complete cycles till next autoupdate instant
     }
     LL_MUL(temp,cycleCnt,microsecInDayCnt);    //micro secs from last update
     tempTime = lastUpdate + temp;
     break;  
   case TYPE_AUTOUPDATE_TIME_BASED:
-    LL_SUB(tempTime, nextUpdate, microsecInDayCnt);
+    tempTime = nextUpdate - microsecInDayCnt;
     break;
   default:
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   //Now, a basic constraing is that the next auto update date can never be after
   //next update, if one is defined
   if(nextUpdate > 0) {
--- a/security/manager/ssl/src/nsNSSComponent.cpp
+++ b/security/manager/ssl/src/nsNSSComponent.cpp
@@ -1411,17 +1411,17 @@ nsNSSComponent::DefineNextTimer()
   //If there are no more crls to be updated any time in future
   if(NS_FAILED(rv)){
     // Return - no error - just implies nothing to schedule
     return NS_OK;
   }
      
   //Define the firing interval, from NOW
   if ( now < nextFiring) {
-    LL_SUB(diff,nextFiring,now);
+    diff = nextFiring - now;
     LL_L2UI(interval, diff);
     //Now, we are doing 32 operations - so, don't need LL_ functions...
     interval = interval/PR_USEC_PER_MSEC;
   }else {
     interval = primaryDelay;
   }
   
   mTimer->InitWithCallback(static_cast<nsITimerCallback*>(this), 
--- a/tools/trace-malloc/spacetrace.c
+++ b/tools/trace-malloc/spacetrace.c
@@ -4503,17 +4503,17 @@ graphWeight(STRequest * inRequest, STRun
 
                     cached =
                         ((globals.mMaxTimeval -
                           globals.mMinTimeval) * percents[traverse]) / 100;
                     PR_snprintf(timevals[traverse], 32, ST_TIMEVAL_FORMAT,
                                 ST_TIMEVAL_PRINTABLE(cached));
 
                     LL_UI2L(percent64, percents[traverse]);
-                    LL_SUB(result64, maxWeight64, minWeight64);
+                    result64 = maxWeight64 - minWeight64;
                     LL_MUL(result64, result64, percent64);
                     LL_DIV(result64, result64, hundred64);
                     PR_snprintf(bytes[traverse], 32, "%llu", result64);
                 }
 
                 red = gdImageColorAllocate(graph, 255, 0, 0);
                 legendColors[0] = red;
 
@@ -4534,17 +4534,17 @@ graphWeight(STRequest * inRequest, STRun
                     for (traverse = 0; traverse < STGD_SPACE_X; traverse++) {
                         x1 = traverse + STGD_MARGIN;
                         y1 = STGD_HEIGHT - STGD_MARGIN;
 
                         /*
                          ** Need to do this math in 64 bits.
                          */
                         LL_I2L(spacey64, STGD_SPACE_Y);
-                        LL_SUB(weight64, maxWeight64, minWeight64);
+                        weight64 = maxWeight64 - minWeight64;
 
                         LL_MUL(in64, YData64[traverse], spacey64);
                         LL_DIV(in64, in64, weight64);
                         LL_L2I(in32, in64);
 
                         x2 = x1;
                         y2 = y1 - in32;
 
--- a/xpcom/tests/CvtURL.cpp
+++ b/xpcom/tests/CvtURL.cpp
@@ -73,17 +73,17 @@ int main(int argc, char** argv)
       break;
     }
     if (nb == 0) break; // EOF
     count += nb;
   }
   PRTime end = PR_Now();
   PRTime conversion, ustoms;
   LL_I2L(ustoms, 1000);
-  LL_SUB(conversion, end, start);
+  conversion = end - start;
   LL_DIV(conversion, conversion, ustoms);
   char buf[500];
   PR_snprintf(buf, sizeof(buf),
               "converting and discarding %d bytes took %lldms",
               count, conversion);
   puts(buf);
 
   // Release the objects