Reviewers: Hannes Payer,
Description:
Fix escape analysis for redefining operators.
This recognizes escape paths that flow through informative definitions
as an escaping use. This only applies to HCheckMaps so far.
[email protected]
Please review this at https://codereview.chromium.org/23514009/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/hydrogen-escape-analysis.h
M src/hydrogen-escape-analysis.cc
Index: src/hydrogen-escape-analysis.cc
diff --git a/src/hydrogen-escape-analysis.cc
b/src/hydrogen-escape-analysis.cc
index
145a779968b9e7b3499f8ea838d2386e59d1180e..0e70bcdba5f67b2e184fa9f51fb360781717c408
100644
--- a/src/hydrogen-escape-analysis.cc
+++ b/src/hydrogen-escape-analysis.cc
@@ -31,21 +31,25 @@ namespace v8 {
namespace internal {
-void HEscapeAnalysisPhase::CollectIfNoEscapingUses(HInstruction* instr) {
- for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) {
+bool HEscapeAnalysisPhase::HasNoEscapingUses(HValue* value) {
+ for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) {
HValue* use = it.value();
if (use->HasEscapingOperandAt(it.index())) {
if (FLAG_trace_escape_analysis) {
- PrintF("#%d (%s) escapes through #%d (%s) @%d\n", instr->id(),
- instr->Mnemonic(), use->id(), use->Mnemonic(), it.index());
+ PrintF("#%d (%s) escapes through #%d (%s) @%d\n", value->id(),
+ value->Mnemonic(), use->id(), use->Mnemonic(), it.index());
}
- return;
+ return false;
+ }
+ if (use->RedefinedOperandIndex() == it.index()
&& !HasNoEscapingUses(use)) {
+ if (FLAG_trace_escape_analysis) {
+ PrintF("#%d (%s) escapes redefinition #%d (%s) @%d\n", value->id(),
+ value->Mnemonic(), use->id(), use->Mnemonic(), it.index());
+ }
+ return false;
}
}
- if (FLAG_trace_escape_analysis) {
- PrintF("#%d (%s) is being captured\n", instr->id(), instr->Mnemonic());
- }
- captured_.Add(instr, zone());
+ return true;
}
@@ -55,8 +59,12 @@ void HEscapeAnalysisPhase::CollectCapturedValues() {
HBasicBlock* block = graph()->blocks()->at(i);
for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
HInstruction* instr = it.Current();
- if (instr->IsAllocate()) {
- CollectIfNoEscapingUses(instr);
+ if (instr->IsAllocate() && HasNoEscapingUses(instr)) {
+ if (FLAG_trace_escape_analysis) {
+ PrintF("#%d (%s) is being captured\n", instr->id(),
+ instr->Mnemonic());
+ }
+ captured_.Add(instr, zone());
}
}
}
Index: src/hydrogen-escape-analysis.h
diff --git a/src/hydrogen-escape-analysis.h b/src/hydrogen-escape-analysis.h
index
9db46cbbe877006f1d55418e37224abeace9e2f6..639f5a939609f38e43bf3cff82f75bc25cf7331c
100644
--- a/src/hydrogen-escape-analysis.h
+++ b/src/hydrogen-escape-analysis.h
@@ -52,7 +52,7 @@ class HEscapeAnalysisPhase : public HPhase {
private:
void CollectCapturedValues();
- void CollectIfNoEscapingUses(HInstruction* instr);
+ bool HasNoEscapingUses(HValue* value);
void PerformScalarReplacement();
void AnalyzeDataFlow(HInstruction* instr);
--
--
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/groups/opt_out.