OLD | NEW |
---|---|
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/bytecode-analysis.h" | 5 #include "src/compiler/bytecode-analysis.h" |
6 | 6 |
7 #include "src/interpreter/bytecode-array-iterator.h" | 7 #include "src/interpreter/bytecode-array-iterator.h" |
8 #include "src/interpreter/bytecode-array-reverse-iterator.h" | 8 #include "src/interpreter/bytecode-array-reverse-iterator.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 | 10 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 // The last JumpLoop that we haven't done a guaranteed valid liveness pass | 154 // The last JumpLoop that we haven't done a guaranteed valid liveness pass |
155 // over. See the below wall of text for a more thorough explanation. | 155 // over. See the below wall of text for a more thorough explanation. |
156 int last_invalid_jumploop_offset = -1; | 156 int last_invalid_jumploop_offset = -1; |
157 | 157 |
158 BytecodeArrayReverseIterator iterator(bytecode_array(), zone()); | 158 BytecodeArrayReverseIterator iterator(bytecode_array(), zone()); |
159 for (; !iterator.done(); iterator.Advance()) { | 159 for (; !iterator.done(); iterator.Advance()) { |
160 Bytecode bytecode = iterator.current_bytecode(); | 160 Bytecode bytecode = iterator.current_bytecode(); |
161 int current_offset = iterator.current_offset(); | 161 int current_offset = iterator.current_offset(); |
162 | 162 |
163 if (bytecode == Bytecode::kJumpLoop) { | 163 if (bytecode == Bytecode::kJumpLoop) { |
164 PushLoop(iterator.GetJumpTargetOffset(), current_offset); | 164 // Every byte up to and including the last byte within the backwards jump |
165 // instruction is considered part of the loop, set loop end accordingly. | |
166 int loop_end = current_offset + iterator.current_bytecode_size() - 1; | |
Michael Starzinger
2016/12/01 12:49:56
Jaro & Leszek: Please confirm that you are fine wi
Jarin
2016/12/01 13:49:29
lgtm.
Leszek Swirski
2016/12/01 13:50:00
Fine with me. You can remove the -1 if you change
Michael Starzinger
2016/12/01 13:57:44
Done.
| |
167 PushLoop(iterator.GetJumpTargetOffset(), loop_end); | |
165 | 168 |
166 // Save the last offset so that we can do another pass later. | 169 // Save the last offset so that we can do another pass later. |
167 if (last_invalid_jumploop_offset == -1) { | 170 if (last_invalid_jumploop_offset == -1) { |
168 last_invalid_jumploop_offset = current_offset; | 171 last_invalid_jumploop_offset = current_offset; |
169 } | 172 } |
170 } else if (current_offset == loop_stack_.top()) { | 173 } else if (current_offset == loop_stack_.top()) { |
171 loop_stack_.pop(); | 174 loop_stack_.pop(); |
172 } | 175 } |
173 | 176 |
174 if (do_liveness_analysis_) { | 177 if (do_liveness_analysis_) { |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 } | 495 } |
493 } | 496 } |
494 | 497 |
495 return invalid_offset == -1; | 498 return invalid_offset == -1; |
496 } | 499 } |
497 #endif | 500 #endif |
498 | 501 |
499 } // namespace compiler | 502 } // namespace compiler |
500 } // namespace internal | 503 } // namespace internal |
501 } // namespace v8 | 504 } // namespace v8 |
OLD | NEW |