Commit 89654538 authored by sigurds's avatar sigurds Committed by Commit bot

[turbofan] Add performance counters for escape analysis

R=bmeurer@chromium.org
BUG=v8:4586
LOG=n

Review URL: https://codereview.chromium.org/1559003002

Cr-Commit-Position: refs/heads/master@{#33107}
parent 3351ed4b
......@@ -5,7 +5,7 @@
#include "src/compiler/escape-analysis-reducer.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/js-operator.h"
#include "src/counters.h"
namespace v8 {
namespace internal {
......@@ -50,6 +50,7 @@ Reduction EscapeAnalysisReducer::ReduceLoad(Node* node) {
DCHECK(node->opcode() == IrOpcode::kLoadField ||
node->opcode() == IrOpcode::kLoadElement);
if (Node* rep = escape_analysis()->GetReplacement(node)) {
counters()->turbo_escape_loads_replaced()->Increment();
if (FLAG_trace_turbo_escape) {
PrintF("Replaced #%d (%s) with #%d (%s)\n", node->id(),
node->op()->mnemonic(), rep->id(), rep->op()->mnemonic());
......@@ -80,6 +81,7 @@ Reduction EscapeAnalysisReducer::ReduceAllocate(Node* node) {
DCHECK_EQ(node->opcode(), IrOpcode::kAllocate);
if (escape_analysis()->IsVirtual(node)) {
RelaxEffectsAndControls(node);
counters()->turbo_escape_allocs_replaced()->Increment();
if (FLAG_trace_turbo_escape) {
PrintF("Removed allocate #%d from effect chain\n", node->id());
}
......@@ -187,6 +189,10 @@ Reduction EscapeAnalysisReducer::ReplaceWithDeoptDummy(Node* node) {
}
Counters* EscapeAnalysisReducer::counters() const {
return jsgraph_->isolate()->counters();
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -10,6 +10,11 @@
namespace v8 {
namespace internal {
// Forward declarations.
class Counters;
namespace compiler {
// Forward declarations.
......@@ -36,6 +41,7 @@ class EscapeAnalysisReducer final : public AdvancedReducer {
JSGraph* jsgraph() const { return jsgraph_; }
EscapeAnalysis* escape_analysis() const { return escape_analysis_; }
Zone* zone() const { return zone_; }
Counters* counters() const;
JSGraph* const jsgraph_;
EscapeAnalysis* escape_analysis_;
......
......@@ -714,7 +714,11 @@ double AggregatedMemoryHistogram<Histogram>::Aggregate(double current_ms,
SC(map_space_bytes_used, V8.MemoryMapSpaceBytesUsed) \
SC(lo_space_bytes_available, V8.MemoryLoSpaceBytesAvailable) \
SC(lo_space_bytes_committed, V8.MemoryLoSpaceBytesCommitted) \
SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed)
SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed) \
SC(turbo_escape_allocs_replaced, V8.TurboEscapeAllocsReplaced) \
SC(crankshaft_escape_allocs_replaced, V8.CrankshaftEscapeAllocsReplaced) \
SC(turbo_escape_loads_replaced, V8.TurboEscapeLoadsReplaced) \
SC(crankshaft_escape_loads_replaced, V8.CrankshaftEscapeLoadsReplaced)
// This file contains all the v8 counters that are in use.
......
......@@ -142,6 +142,7 @@ HValue* HEscapeAnalysisPhase::NewMapCheckAndInsert(HCapturedObject* state,
// necessary.
HValue* HEscapeAnalysisPhase::NewLoadReplacement(
HLoadNamedField* load, HValue* load_value) {
isolate()->counters()->crankshaft_escape_loads_replaced()->Increment();
HValue* replacement = load_value;
Representation representation = load->representation();
if (representation.IsSmiOrInteger32() || representation.IsDouble()) {
......@@ -319,6 +320,8 @@ void HEscapeAnalysisPhase::Run() {
for (int i = 0; i < max_fixpoint_iteration_count; i++) {
CollectCapturedValues();
if (captured_.is_empty()) break;
isolate()->counters()->crankshaft_escape_allocs_replaced()->Increment(
captured_.length());
PerformScalarReplacement();
captured_.Rewind(0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment