Revision: 25086
Author:   [email protected]
Date:     Mon Nov  3 19:44:46 2014 UTC
Log:      Fix a few nits found by PVS Studio

BUG=v8:3192
LOG=n
[email protected]

Review URL: https://codereview.chromium.org/185563004
https://code.google.com/p/v8/source/detail?r=25086

Modified:
 /branches/bleeding_edge/src/deoptimizer.cc
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/parser.cc
 /branches/bleeding_edge/test/cctest/test-api.cc
 /branches/bleeding_edge/test/cctest/test-strings.cc

=======================================
--- /branches/bleeding_edge/src/deoptimizer.cc  Tue Sep 30 10:29:32 2014 UTC
+++ /branches/bleeding_edge/src/deoptimizer.cc  Mon Nov  3 19:44:46 2014 UTC
@@ -693,8 +693,7 @@
   DeoptimizerData* data = isolate->deoptimizer_data();
   MemoryChunk* base = data->deopt_entry_code_[type];
   Address start = base->area_start();
-  if (base == NULL ||
-      addr < start ||
+  if (addr < start ||
       addr >= start + (kMaxNumberOfEntries * table_entry_size_)) {
     return kNotDeoptimizationEntry;
   }
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Fri Oct 31 09:21:54 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc     Mon Nov  3 19:44:46 2014 UTC
@@ -12643,9 +12643,10 @@
   double normalized_time =  source_size_in_kb > 0
       ? total.InMillisecondsF() / source_size_in_kb
       : 0;
-  double normalized_size_in_kb = source_size_in_kb > 0
-      ? total_size_ / 1024 / source_size_in_kb
-      : 0;
+  double normalized_size_in_kb =
+      source_size_in_kb > 0
+          ? static_cast<double>(total_size_) / 1024 / source_size_in_kb
+          : 0;
   PrintF("%33s %8.3f ms           %7.3f kB allocated\n",
          "Average per kB source", normalized_time, normalized_size_in_kb);
 }
=======================================
--- /branches/bleeding_edge/src/objects.cc      Mon Nov  3 16:44:58 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Mon Nov  3 19:44:46 2014 UTC
@@ -7197,7 +7197,7 @@
     int value = Smi::cast(*IteratorField())->value();
     int index = -value - 1;
     int number_of_transitions = transition_array_->number_of_transitions();
-    while (index < number_of_transitions) {
+    if (index < number_of_transitions) {
       *IteratorField() = Smi::FromInt(value - 1);
       return transition_array_->GetTarget(index);
     }
=======================================
--- /branches/bleeding_edge/src/parser.cc       Thu Oct 30 14:21:27 2014 UTC
+++ /branches/bleeding_edge/src/parser.cc       Mon Nov  3 19:44:46 2014 UTC
@@ -3203,7 +3203,7 @@
       Scanner::Location lhs_location = scanner()->peek_location();
       Expression* expression = ParseExpression(false, CHECK_OK);
       ForEachStatement::VisitMode mode;
-      bool accept_OF = expression->AsVariableProxy();
+      bool accept_OF = expression->IsVariableProxy();

       if (CheckInOrOf(accept_OF, &mode)) {
         expression = this->CheckAndRewriteReferenceExpression(
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Mon Nov 3 17:23:55 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Mon Nov 3 19:44:46 2014 UTC
@@ -15148,7 +15148,7 @@
   v8::Handle<v8::Array> props = val.As<v8::Object>()->GetPropertyNames();
   CHECK_EQ(0, props->Length());
   for (uint32_t i = 0; i < props->Length(); i++) {
-    printf("p[%d]\n", i);
+    printf("p[%u]\n", i);
   }
 }

=======================================
--- /branches/bleeding_edge/test/cctest/test-strings.cc Thu Oct 23 05:57:01 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-strings.cc Mon Nov 3 19:44:46 2014 UTC
@@ -630,14 +630,11 @@

 static inline void PrintStats(const ConsStringGenerationData& data) {
 #ifdef DEBUG
-printf(
-    "%s: [%d], %s: [%d], %s: [%d], %s: [%d], %s: [%d], %s: [%d]\n",
-    "leaves", data.stats_.leaves_,
-    "empty", data.stats_.empty_leaves_,
-    "chars", data.stats_.chars_,
-    "lefts", data.stats_.left_traversals_,
-    "rights", data.stats_.right_traversals_,
-    "early_terminations", data.early_terminations_);
+  printf("%s: [%u], %s: [%u], %s: [%u], %s: [%u], %s: [%u], %s: [%u]\n",
+         "leaves", data.stats_.leaves_, "empty", data.stats_.empty_leaves_,
+ "chars", data.stats_.chars_, "lefts", data.stats_.left_traversals_,
+         "rights", data.stats_.right_traversals_, "early_terminations",
+         data.early_terminations_);
 #endif
 }

--
--
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