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

Side by Side Diff: src/compiler/bytecode-loop-analysis.h

Issue 2188533002: [turbofan] Generate loop exits in the bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix translation of int32 constants to allow smis. Created 4 years, 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef V8_COMPILER_BYTECODE_LOOP_ANALYSIS_H_
6 #define V8_COMPILER_BYTECODE_LOOP_ANALYSIS_H_
7
8 #include "src/bit-vector.h"
Michael Starzinger 2016/07/29 08:54:46 nit: Seems the BitVector is not needed in the head
Jarin 2016/07/29 11:36:46 Done.
9 #include "src/handles.h"
10 #include "src/zone-containers.h"
11
12 namespace v8 {
13 namespace internal {
14
15 class BytecodeArray;
16
17 namespace compiler {
18
19 class BytecodeBranchAnalysis;
20
21 class BytecodeLoopAnalysis BASE_EMBEDDED {
22 public:
23 BytecodeLoopAnalysis(Handle<BytecodeArray> bytecode_array,
24 const BytecodeBranchAnalysis* branch_analysis,
25 Zone* zone);
26
27 // Analyze the bytecodes to find the branch sites and their
28 // targets. No other methods in this class return valid information
29 // until this has been called.
30 void Analyze();
31
32 // Get the loop header offset of the containing loop for arbitrary
33 // {offset}, or -1 if the {offset} is not inside any loop.
34 int GetLoopOffsetFor(int offset) const;
35 // Gets the loop header offset of the parent loop of the loop header
36 // at {header_offset}, or -1 for outer-most loops.
37 int GetParentLoopFor(int header_offset) const;
38
39 private:
40 void AddLoopEntry(int entry_offset);
41 void AddBranch(int origin_offset, int target_offset);
42
43 Zone* zone() const { return zone_; }
44 Handle<BytecodeArray> bytecode_array() const { return bytecode_array_; }
45
46 Handle<BytecodeArray> bytecode_array_;
47 const BytecodeBranchAnalysis* branch_analysis_;
48 Zone* zone_;
49
50 int current_loop_offset_;
51
52 ZoneMap<int, int> backedge_to_header_;
Michael Starzinger 2016/07/29 08:54:46 nit: Can we leave a comment here that both of thes
Jarin 2016/07/29 11:36:46 Done.
53 ZoneMap<int, int> loop_header_to_parent_;
54
55 DISALLOW_COPY_AND_ASSIGN(BytecodeLoopAnalysis);
56 };
57
58 } // namespace compiler
59 } // namespace internal
60 } // namespace v8
61
62 #endif // V8_COMPILER_BYTECODE_LOOP_ANALYSIS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698