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