Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: src/hydrogen-escape-analysis.cc

Issue 23514009: Fix escape analysis for redefining operators. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-escape-analysis.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "hydrogen-escape-analysis.h" 28 #include "hydrogen-escape-analysis.h"
29 29
30 namespace v8 { 30 namespace v8 {
31 namespace internal { 31 namespace internal {
32 32
33 33
34 void HEscapeAnalysisPhase::CollectIfNoEscapingUses(HInstruction* instr) { 34 bool HEscapeAnalysisPhase::HasNoEscapingUses(HValue* value) {
35 for (HUseIterator it(instr->uses()); !it.Done(); it.Advance()) { 35 for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) {
36 HValue* use = it.value(); 36 HValue* use = it.value();
37 if (use->HasEscapingOperandAt(it.index())) { 37 if (use->HasEscapingOperandAt(it.index())) {
38 if (FLAG_trace_escape_analysis) { 38 if (FLAG_trace_escape_analysis) {
39 PrintF("#%d (%s) escapes through #%d (%s) @%d\n", instr->id(), 39 PrintF("#%d (%s) escapes through #%d (%s) @%d\n", value->id(),
40 instr->Mnemonic(), use->id(), use->Mnemonic(), it.index()); 40 value->Mnemonic(), use->id(), use->Mnemonic(), it.index());
41 } 41 }
42 return; 42 return false;
43 }
44 if (use->RedefinedOperandIndex() == it.index() && !HasNoEscapingUses(use)) {
45 if (FLAG_trace_escape_analysis) {
46 PrintF("#%d (%s) escapes redefinition #%d (%s) @%d\n", value->id(),
47 value->Mnemonic(), use->id(), use->Mnemonic(), it.index());
48 }
49 return false;
43 } 50 }
44 } 51 }
45 if (FLAG_trace_escape_analysis) { 52 return true;
46 PrintF("#%d (%s) is being captured\n", instr->id(), instr->Mnemonic());
47 }
48 captured_.Add(instr, zone());
49 } 53 }
50 54
51 55
52 void HEscapeAnalysisPhase::CollectCapturedValues() { 56 void HEscapeAnalysisPhase::CollectCapturedValues() {
53 int block_count = graph()->blocks()->length(); 57 int block_count = graph()->blocks()->length();
54 for (int i = 0; i < block_count; ++i) { 58 for (int i = 0; i < block_count; ++i) {
55 HBasicBlock* block = graph()->blocks()->at(i); 59 HBasicBlock* block = graph()->blocks()->at(i);
56 for (HInstructionIterator it(block); !it.Done(); it.Advance()) { 60 for (HInstructionIterator it(block); !it.Done(); it.Advance()) {
57 HInstruction* instr = it.Current(); 61 HInstruction* instr = it.Current();
58 if (instr->IsAllocate()) { 62 if (instr->IsAllocate() && HasNoEscapingUses(instr)) {
59 CollectIfNoEscapingUses(instr); 63 if (FLAG_trace_escape_analysis) {
64 PrintF("#%d (%s) is being captured\n", instr->id(),
Hannes Payer (out of office) 2013/08/29 11:53:29 may fit into one line
Michael Starzinger 2013/08/29 11:54:39 Nope, exactly 81 characters, hate-o-rade.
65 instr->Mnemonic());
66 }
67 captured_.Add(instr, zone());
60 } 68 }
61 } 69 }
62 } 70 }
63 } 71 }
64 72
65 73
66 HCapturedObject* HEscapeAnalysisPhase::NewState(HInstruction* previous) { 74 HCapturedObject* HEscapeAnalysisPhase::NewState(HInstruction* previous) {
67 Zone* zone = graph()->zone(); 75 Zone* zone = graph()->zone();
68 HCapturedObject* state = 76 HCapturedObject* state =
69 new(zone) HCapturedObject(number_of_values_, number_of_objects_, zone); 77 new(zone) HCapturedObject(number_of_values_, number_of_objects_, zone);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 AnalyzeDataFlow(allocate); 300 AnalyzeDataFlow(allocate);
293 301
294 cumulative_values_ += number_of_values_; 302 cumulative_values_ += number_of_values_;
295 ASSERT(allocate->HasNoUses()); 303 ASSERT(allocate->HasNoUses());
296 ASSERT(!allocate->IsLinked()); 304 ASSERT(!allocate->IsLinked());
297 } 305 }
298 } 306 }
299 307
300 308
301 } } // namespace v8::internal 309 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-escape-analysis.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698