Reviewers: svenpanne, Benedikt Meurer,

Message:
As noted here: https://codereview.chromium.org/436653002/#msg4

Description:
ARM64: Use ARRAY_SIZE where possible.

BUG=

Please review this at https://codereview.chromium.org/437813004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+4, -6 lines):
  M src/arm64/assembler-arm64.cc
  M src/arm64/instrument-arm64.cc
  M src/arm64/simulator-arm64.cc


Index: src/arm64/assembler-arm64.cc
diff --git a/src/arm64/assembler-arm64.cc b/src/arm64/assembler-arm64.cc
index 240dc9c3572a2dfd4d84cdc6dd6ecb9b8f79bcfc..68bc67934e42bcd8c8e0b6f51331e4412a2d7737 100644
--- a/src/arm64/assembler-arm64.cc
+++ b/src/arm64/assembler-arm64.cc
@@ -227,7 +227,7 @@ bool AreAliased(const CPURegister& reg1, const CPURegister& reg2,

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 @@ bool Assembler::IsImmLogical(uint64_t value,
   int multiplier_idx = CountLeadingZeros(d, kXRegSizeInBits) - 57;
   // Ensure that the index to the multipliers array is within bounds.
   ASSERT((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;

Index: src/arm64/instrument-arm64.cc
diff --git a/src/arm64/instrument-arm64.cc b/src/arm64/instrument-arm64.cc
index 631556f72411dcee8af869b23e94a7691889b56a..d3a2fee95ef56350105dd0a121720dfcc0ca8bcd 100644
--- a/src/arm64/instrument-arm64.cc
+++ b/src/arm64/instrument-arm64.cc
@@ -107,8 +107,7 @@ Instrument::Instrument(const char* datafile, uint64_t sample_period)
     }
   }

-  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);
Index: src/arm64/simulator-arm64.cc
diff --git a/src/arm64/simulator-arm64.cc b/src/arm64/simulator-arm64.cc
index 0d2ba3a2978f0790f3cdcc1ac98b627cda1d8c6c..06fd634d2281634c4d1231c94d794917982dcd86 100644
--- a/src/arm64/simulator-arm64.cc
+++ b/src/arm64/simulator-arm64.cc
@@ -1065,7 +1065,7 @@ void Simulator::PrintSystemRegisters(bool print_all) {
       "0b10 (Round towards Minus Infinity)",
       "0b11 (Round towards Zero)"
     };
-    ASSERT(fpcr().RMode() <= (sizeof(rmode) / sizeof(rmode[0])));
+    ASSERT(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