OLD | NEW |
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 HCapturedObject* state = NewState(previous); | 103 HCapturedObject* state = NewState(previous); |
104 for (int index = 0; index < number_of_values_; index++) { | 104 for (int index = 0; index < number_of_values_; index++) { |
105 HValue* operand = old_state->OperandAt(index); | 105 HValue* operand = old_state->OperandAt(index); |
106 state->SetOperandAt(index, operand); | 106 state->SetOperandAt(index, operand); |
107 } | 107 } |
108 return state; | 108 return state; |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 // Insert a newly created phi into the given block and fill all incoming | 112 // Insert a newly created phi into the given block and fill all incoming |
113 // edges with the given value. The merge index is chosen so that it is | 113 // edges with the given value. |
114 // unique for this particular scalar replacement index. | |
115 HPhi* HEscapeAnalysisPhase::NewPhiAndInsert( | 114 HPhi* HEscapeAnalysisPhase::NewPhiAndInsert( |
116 HBasicBlock* block, HValue* incoming_value, int index) { | 115 HBasicBlock* block, HValue* incoming_value, int index) { |
117 Zone* zone = graph()->zone(); | 116 Zone* zone = graph()->zone(); |
118 HBasicBlock* pred = block->predecessors()->first(); | 117 HPhi* phi = new(zone) HPhi(HPhi::kInvalidMergedIndex, zone); |
119 int phi_index = pred->last_environment()->length() + cumulative_values_; | |
120 HPhi* phi = new(zone) HPhi(phi_index + index, zone); | |
121 for (int i = 0; i < block->predecessors()->length(); i++) { | 118 for (int i = 0; i < block->predecessors()->length(); i++) { |
122 phi->AddInput(incoming_value); | 119 phi->AddInput(incoming_value); |
123 } | 120 } |
124 block->AddPhi(phi); | 121 block->AddPhi(phi); |
125 return phi; | 122 return phi; |
126 } | 123 } |
127 | 124 |
128 | 125 |
129 // Performs a forward data-flow analysis of all loads and stores on the | 126 // Performs a forward data-flow analysis of all loads and stores on the |
130 // given captured allocation. This uses a reverse post-order iteration | 127 // given captured allocation. This uses a reverse post-order iteration |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 AnalyzeDataFlow(allocate); | 280 AnalyzeDataFlow(allocate); |
284 | 281 |
285 cumulative_values_ += number_of_values_; | 282 cumulative_values_ += number_of_values_; |
286 ASSERT(allocate->HasNoUses()); | 283 ASSERT(allocate->HasNoUses()); |
287 ASSERT(!allocate->IsLinked()); | 284 ASSERT(!allocate->IsLinked()); |
288 } | 285 } |
289 } | 286 } |
290 | 287 |
291 | 288 |
292 } } // namespace v8::internal | 289 } } // namespace v8::internal |
OLD | NEW |