Merge V8 5.3.332.45. DO NOT MERGE
Test: Manual
FPIIM-449
Change-Id: Id3254828b068abdea3cb10442e0172a8c9a98e03
(cherry picked from commit 13e2dadd00298019ed862f2b2fc5068bba730bcf)
diff --git a/src/counters.cc b/src/counters.cc
index 0dd62a0..57dad3d 100644
--- a/src/counters.cc
+++ b/src/counters.cc
@@ -9,6 +9,7 @@
#include "src/base/platform/platform.h"
#include "src/isolate.h"
#include "src/log-inl.h"
+#include "src/log.h"
namespace v8 {
namespace internal {
@@ -200,14 +201,14 @@
void Print(std::ostream& os) {
if (total_call_count == 0) return;
std::sort(entries.rbegin(), entries.rend());
- os << std::setw(50) << "Runtime Function/C++ Builtin" << std::setw(10)
+ os << std::setw(50) << "Runtime Function/C++ Builtin" << std::setw(12)
<< "Time" << std::setw(18) << "Count" << std::endl
- << std::string(86, '=') << std::endl;
+ << std::string(88, '=') << std::endl;
for (Entry& entry : entries) {
entry.SetTotal(total_time, total_call_count);
entry.Print(os);
}
- os << std::string(86, '-') << std::endl;
+ os << std::string(88, '-') << std::endl;
Entry("Total", total_time, total_call_count).Print(os);
}
@@ -223,7 +224,7 @@
public:
Entry(const char* name, base::TimeDelta time, uint64_t count)
: name_(name),
- time_(time.InMilliseconds()),
+ time_(time.InMicroseconds()),
count_(count),
time_percent_(100),
count_percent_(100) {}
@@ -236,9 +237,9 @@
void Print(std::ostream& os) {
os.precision(2);
- os << std::fixed;
+ os << std::fixed << std::setprecision(2);
os << std::setw(50) << name_;
- os << std::setw(8) << time_ << "ms ";
+ os << std::setw(10) << static_cast<double>(time_) / 1000 << "ms ";
os << std::setw(6) << time_percent_ << "%";
os << std::setw(10) << count_ << " ";
os << std::setw(6) << count_percent_ << "%";
@@ -246,10 +247,10 @@
}
void SetTotal(base::TimeDelta total_time, uint64_t total_count) {
- if (total_time.InMilliseconds() == 0) {
+ if (total_time.InMicroseconds() == 0) {
time_percent_ = 0;
} else {
- time_percent_ = 100.0 * time_ / total_time.InMilliseconds();
+ time_percent_ = 100.0 * time_ / total_time.InMicroseconds();
}
count_percent_ = 100.0 * count_ / total_count;
}
@@ -284,8 +285,17 @@
// static
void RuntimeCallStats::Leave(Isolate* isolate, RuntimeCallTimer* timer) {
RuntimeCallStats* stats = isolate->counters()->runtime_call_stats();
- DCHECK_EQ(stats->current_timer_, timer);
- stats->current_timer_ = timer->Stop();
+
+ if (stats->current_timer_ == timer) {
+ stats->current_timer_ = timer->Stop();
+ } else {
+ // Must be a Threading cctest. Walk the chain of Timers to find the
+ // buried one that's leaving. We don't care about keeping nested timings
+ // accurate, just avoid crashing by keeping the chain intact.
+ RuntimeCallTimer* next = stats->current_timer_;
+ while (next->parent_ != timer) next = next->parent_;
+ next->parent_ = timer->Stop();
+ }
}
// static
@@ -308,7 +318,7 @@
FOR_EACH_INTRINSIC(PRINT_COUNTER)
#undef PRINT_COUNTER
-#define PRINT_COUNTER(name, type) entries.Add(&this->Builtin_##name);
+#define PRINT_COUNTER(name) entries.Add(&this->Builtin_##name);
BUILTIN_LIST_C(PRINT_COUNTER)
#undef PRINT_COUNTER
@@ -333,7 +343,7 @@
FOR_EACH_INTRINSIC(RESET_COUNTER)
#undef RESET_COUNTER
-#define RESET_COUNTER(name, type) this->Builtin_##name.Reset();
+#define RESET_COUNTER(name) this->Builtin_##name.Reset();
BUILTIN_LIST_C(RESET_COUNTER)
#undef RESET_COUNTER