Index: src/hydrogen-escape-analysis.cc |
diff --git a/src/hydrogen-escape-analysis.cc b/src/hydrogen-escape-analysis.cc |
index 00cfe278012265804fee661dfe33c971ea0d0c05..997e4f9445f79ab3f7ba079acb54be1f6e25deb8 100644 |
--- a/src/hydrogen-escape-analysis.cc |
+++ b/src/hydrogen-escape-analysis.cc |
@@ -31,7 +31,7 @@ namespace v8 { |
namespace internal { |
-bool HEscapeAnalysisPhase::HasNoEscapingUses(HValue* value) { |
+bool HEscapeAnalysisPhase::HasNoEscapingUses(HValue* value, int size) { |
for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) { |
HValue* use = it.value(); |
if (use->HasEscapingOperandAt(it.index())) { |
@@ -41,7 +41,15 @@ bool HEscapeAnalysisPhase::HasNoEscapingUses(HValue* value) { |
} |
return false; |
} |
- if (use->RedefinedOperandIndex() == it.index() && !HasNoEscapingUses(use)) { |
+ if (use->HasOutOfBoundsAccess(size)) { |
+ if (FLAG_trace_escape_analysis) { |
+ PrintF("#%d (%s) out of bounds at #%d (%s) @%d\n", value->id(), |
+ value->Mnemonic(), use->id(), use->Mnemonic(), it.index()); |
+ } |
+ return false; |
+ } |
+ int redefined_index = use->RedefinedOperandIndex(); |
+ if (redefined_index == it.index() && !HasNoEscapingUses(use, size)) { |
if (FLAG_trace_escape_analysis) { |
PrintF("#%d (%s) escapes redefinition #%d (%s) @%d\n", value->id(), |
value->Mnemonic(), use->id(), use->Mnemonic(), it.index()); |
@@ -59,7 +67,11 @@ void HEscapeAnalysisPhase::CollectCapturedValues() { |
HBasicBlock* block = graph()->blocks()->at(i); |
for (HInstructionIterator it(block); !it.Done(); it.Advance()) { |
HInstruction* instr = it.Current(); |
- if (instr->IsAllocate() && HasNoEscapingUses(instr)) { |
+ if (!instr->IsAllocate()) continue; |
+ HAllocate* allocate = HAllocate::cast(instr); |
+ if (!allocate->size()->IsInteger32Constant()) continue; |
+ int size_in_bytes = allocate->size()->GetInteger32Constant(); |
+ if (HasNoEscapingUses(instr, size_in_bytes)) { |
if (FLAG_trace_escape_analysis) { |
PrintF("#%d (%s) is being captured\n", instr->id(), |
instr->Mnemonic()); |
@@ -290,7 +302,6 @@ void HEscapeAnalysisPhase::PerformScalarReplacement() { |
HAllocate* allocate = HAllocate::cast(captured_.at(i)); |
// Compute number of scalar values and start with clean slate. |
- if (!allocate->size()->IsInteger32Constant()) continue; |
int size_in_bytes = allocate->size()->GetInteger32Constant(); |
number_of_values_ = size_in_bytes / kPointerSize; |
number_of_objects_++; |