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

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

Issue 23533003: Implement fixpoint iteration for escape analysis. (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/deoptimizer.cc ('k') | src/hydrogen-escape-analysis.cc » ('j') | 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 22 matching lines...) Expand all
33 33
34 namespace v8 { 34 namespace v8 {
35 namespace internal { 35 namespace internal {
36 36
37 37
38 class HEscapeAnalysisPhase : public HPhase { 38 class HEscapeAnalysisPhase : public HPhase {
39 public: 39 public:
40 explicit HEscapeAnalysisPhase(HGraph* graph) 40 explicit HEscapeAnalysisPhase(HGraph* graph)
41 : HPhase("H_Escape analysis", graph), 41 : HPhase("H_Escape analysis", graph),
42 captured_(0, zone()), 42 captured_(0, zone()),
43 maybe_more_work_(true),
43 number_of_objects_(0), 44 number_of_objects_(0),
44 number_of_values_(0), 45 number_of_values_(0),
45 cumulative_values_(0), 46 cumulative_values_(0),
46 block_states_(graph->blocks()->length(), zone()) { } 47 block_states_(graph->blocks()->length(), zone()) { }
47 48
48 void Run() { 49 void Run() {
titzer 2013/08/30 11:19:29 I would move this method into the .cc file and mak
Michael Starzinger 2013/09/17 13:47:13 Done. After rebasing I can just check for "capture
49 CollectCapturedValues(); 50 for (int i = 0; i < kMaxFixpointIterationCount && maybe_more_work_; i++) {
50 PerformScalarReplacement(); 51 CollectCapturedValues();
52 PerformScalarReplacement();
53 }
51 } 54 }
52 55
53 private: 56 private:
54 void CollectCapturedValues(); 57 void CollectCapturedValues();
55 void CollectIfNoEscapingUses(HInstruction* instr); 58 void CollectIfNoEscapingUses(HInstruction* instr);
56 void PerformScalarReplacement(); 59 void PerformScalarReplacement();
57 void AnalyzeDataFlow(HInstruction* instr); 60 void AnalyzeDataFlow(HInstruction* instr);
58 61
59 HCapturedObject* NewState(HInstruction* prev); 62 HCapturedObject* NewState(HInstruction* prev);
60 HCapturedObject* NewStateForAllocation(HInstruction* prev); 63 HCapturedObject* NewStateForAllocation(HInstruction* prev);
61 HCapturedObject* NewStateForLoopHeader(HInstruction* prev, HCapturedObject*); 64 HCapturedObject* NewStateForLoopHeader(HInstruction* prev, HCapturedObject*);
62 HCapturedObject* NewStateCopy(HInstruction* prev, HCapturedObject* state); 65 HCapturedObject* NewStateCopy(HInstruction* prev, HCapturedObject* state);
63 66
64 HPhi* NewPhiAndInsert(HBasicBlock* block, HValue* incoming_value, int index); 67 HPhi* NewPhiAndInsert(HBasicBlock* block, HValue* incoming_value, int index);
65 68
66 HCapturedObject* StateAt(HBasicBlock* block) { 69 HCapturedObject* StateAt(HBasicBlock* block) {
67 return block_states_.at(block->block_id()); 70 return block_states_.at(block->block_id());
68 } 71 }
69 72
70 void SetStateAt(HBasicBlock* block, HCapturedObject* state) { 73 void SetStateAt(HBasicBlock* block, HCapturedObject* state) {
71 block_states_.Set(block->block_id(), state); 74 block_states_.Set(block->block_id(), state);
72 } 75 }
73 76
77 // Maximum number of escape analysis iterations.
78 static const int kMaxFixpointIterationCount = 2;
79
74 // List of allocations captured during collection phase. 80 // List of allocations captured during collection phase.
75 ZoneList<HInstruction*> captured_; 81 ZoneList<HInstruction*> captured_;
76 82
83 // Indicates another iteration might discover new captured objects.
84 bool maybe_more_work_;
85
77 // Number of captured objects on which scalar replacement was done. 86 // Number of captured objects on which scalar replacement was done.
78 int number_of_objects_; 87 int number_of_objects_;
79 88
80 // Number of scalar values tracked during scalar replacement phase. 89 // Number of scalar values tracked during scalar replacement phase.
81 int number_of_values_; 90 int number_of_values_;
82 int cumulative_values_; 91 int cumulative_values_;
83 92
84 // Map of block IDs to the data-flow state at block entry during the 93 // Map of block IDs to the data-flow state at block entry during the
85 // scalar replacement phase. 94 // scalar replacement phase.
86 ZoneList<HCapturedObject*> block_states_; 95 ZoneList<HCapturedObject*> block_states_;
87 }; 96 };
88 97
89 98
90 } } // namespace v8::internal 99 } } // namespace v8::internal
91 100
92 #endif // V8_HYDROGEN_ESCAPE_ANALYSIS_H_ 101 #endif // V8_HYDROGEN_ESCAPE_ANALYSIS_H_
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/hydrogen-escape-analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698