Index: src/compiler/bytecode-analysis.h |
diff --git a/src/compiler/bytecode-loop-analysis.h b/src/compiler/bytecode-analysis.h |
similarity index 51% |
rename from src/compiler/bytecode-loop-analysis.h |
rename to src/compiler/bytecode-analysis.h |
index 1a86d7b81f06f252b67d16d674d64f1c3d88d825..21c3150fd659ce7a8ebacf56c34fcdcf215b2aba 100644 |
--- a/src/compiler/bytecode-loop-analysis.h |
+++ b/src/compiler/bytecode-analysis.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef V8_COMPILER_BYTECODE_LOOP_ANALYSIS_H_ |
-#define V8_COMPILER_BYTECODE_LOOP_ANALYSIS_H_ |
+#ifndef V8_COMPILER_BYTECODE_ANALYSIS_H_ |
+#define V8_COMPILER_BYTECODE_ANALYSIS_H_ |
#include "src/handles.h" |
#include "src/zone/zone-containers.h" |
@@ -15,19 +15,17 @@ class BytecodeArray; |
namespace compiler { |
-class BytecodeBranchAnalysis; |
- |
-class BytecodeLoopAnalysis BASE_EMBEDDED { |
+class BytecodeAnalysis BASE_EMBEDDED { |
public: |
- BytecodeLoopAnalysis(Handle<BytecodeArray> bytecode_array, |
- const BytecodeBranchAnalysis* branch_analysis, |
- Zone* zone); |
+ BytecodeAnalysis(Handle<BytecodeArray> bytecode_array, Zone* zone); |
// Analyze the bytecodes to find the branch sites and their |
rmcilroy
2016/11/22 11:02:07
nit - this comment should be updated to talk about
Leszek Swirski
2016/11/22 17:39:03
Done.
|
// targets. No other methods in this class return valid information |
// until this has been called. |
void Analyze(); |
+ // Return true if the given offset is a loop header |
+ bool IsLoopHeader(int offset) const; |
// Get the loop header offset of the containing loop for arbitrary |
// {offset}, or -1 if the {offset} is not inside any loop. |
int GetLoopOffsetFor(int offset) const; |
@@ -36,32 +34,24 @@ class BytecodeLoopAnalysis BASE_EMBEDDED { |
int GetParentLoopFor(int header_offset) const; |
private: |
- void AddLoopEntry(int entry_offset); |
- void AddBranch(int origin_offset, int target_offset); |
+ void PushLoop(int loop_header, int loop_end); |
Zone* zone() const { return zone_; } |
Handle<BytecodeArray> bytecode_array() const { return bytecode_array_; } |
Handle<BytecodeArray> bytecode_array_; |
- const BytecodeBranchAnalysis* branch_analysis_; |
Zone* zone_; |
- int current_loop_offset_; |
- bool found_current_backedge_; |
+ ZoneStack<int> loop_stack_; |
- // Map from the offset of a backedge jump to the offset of the corresponding |
- // loop header. There might be multiple backedges for do-while loops. |
- ZoneMap<int, int> backedge_to_header_; |
- // Map from the offset of a loop header to the offset of its parent's loop |
- // header. This map will have as many entries as there are loops in the |
- // function. |
- ZoneMap<int, int> loop_header_to_parent_; |
+ ZoneMap<int, int> end_to_header_; |
+ ZoneMap<int, int> header_to_parent_; |
- DISALLOW_COPY_AND_ASSIGN(BytecodeLoopAnalysis); |
+ DISALLOW_COPY_AND_ASSIGN(BytecodeAnalysis); |
}; |
} // namespace compiler |
} // namespace internal |
} // namespace v8 |
-#endif // V8_COMPILER_BYTECODE_LOOP_ANALYSIS_H_ |
+#endif // V8_COMPILER_BYTECODE_ANALYSIS_H_ |