Revision: 22816
Author:   [email protected]
Date:     Mon Aug  4 12:46:43 2014 UTC
Log:      ARM64: Use ARRAY_SIZE where possible.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/437813004
http://code.google.com/p/v8/source/detail?r=22816

Modified:
 /branches/bleeding_edge/src/arm64/assembler-arm64.cc
 /branches/bleeding_edge/src/arm64/instrument-arm64.cc
 /branches/bleeding_edge/src/arm64/simulator-arm64.cc

=======================================
--- /branches/bleeding_edge/src/arm64/assembler-arm64.cc Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/arm64/assembler-arm64.cc Mon Aug 4 12:46:43 2014 UTC
@@ -227,7 +227,7 @@

const CPURegister regs[] = {reg1, reg2, reg3, reg4, reg5, reg6, reg7, reg8};

-  for (unsigned i = 0; i < sizeof(regs) / sizeof(regs[0]); i++) {
+  for (unsigned i = 0; i < ARRAY_SIZE(regs); i++) {
     if (regs[i].IsRegister()) {
       number_of_valid_regs++;
       unique_regs |= regs[i].Bit();
@@ -2658,8 +2658,7 @@
   int multiplier_idx = CountLeadingZeros(d, kXRegSizeInBits) - 57;
   // Ensure that the index to the multipliers array is within bounds.
   DCHECK((multiplier_idx >= 0) &&
-         (static_cast<size_t>(multiplier_idx) <
-          (sizeof(multipliers) / sizeof(multipliers[0]))));
+         (static_cast<size_t>(multiplier_idx) < ARRAY_SIZE(multipliers)));
   uint64_t multiplier = multipliers[multiplier_idx];
   uint64_t candidate = (b - a) * multiplier;

=======================================
--- /branches/bleeding_edge/src/arm64/instrument-arm64.cc Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/arm64/instrument-arm64.cc Mon Aug 4 12:46:43 2014 UTC
@@ -107,8 +107,7 @@
     }
   }

-  static const int num_counters =
-    sizeof(kCounterList) / sizeof(CounterDescriptor);
+  static const int num_counters = ARRAY_SIZE(kCounterList);

   // Dump an instrumentation description comment at the top of the file.
   fprintf(output_stream_, "# counters=%d\n", num_counters);
=======================================
--- /branches/bleeding_edge/src/arm64/simulator-arm64.cc Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/arm64/simulator-arm64.cc Mon Aug 4 12:46:43 2014 UTC
@@ -1065,7 +1065,7 @@
       "0b10 (Round towards Minus Infinity)",
       "0b11 (Round towards Zero)"
     };
-    DCHECK(fpcr().RMode() <= (sizeof(rmode) / sizeof(rmode[0])));
+    DCHECK(fpcr().RMode() < ARRAY_SIZE(rmode));
     fprintf(stream_, "# %sFPCR: %sAHP:%d DN:%d FZ:%d RMode:%s%s\n",
             clr_flag_name,
             clr_flag_value,

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to