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

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

Issue 2519983002: [ignition] Replace branch+loop analysis with a single pass (Closed)
Patch Set: Update comments Created 4 years 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
« no previous file with comments | « src/compiler/bytecode-analysis.cc ('k') | src/compiler/bytecode-branch-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
(Empty)
1 // Copyright 2015 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_BRANCH_ANALYSIS_H_
6 #define V8_COMPILER_BYTECODE_BRANCH_ANALYSIS_H_
7
8 #include "src/bit-vector.h"
9 #include "src/handles.h"
10
11 namespace v8 {
12 namespace internal {
13
14 class BytecodeArray;
15
16 namespace compiler {
17
18 // A class for identifying branch targets within a bytecode array.
19 // This information can be used to construct the local control flow
20 // logic for high-level IR graphs built from bytecode.
21 //
22 // N.B. If this class is used to determine loop headers, then such a
23 // usage relies on the only backwards branches in bytecode being jumps
24 // back to loop headers.
25 class BytecodeBranchAnalysis BASE_EMBEDDED {
26 public:
27 BytecodeBranchAnalysis(Handle<BytecodeArray> bytecode_array, Zone* zone);
28
29 // Analyze the bytecodes to find the branch sites and their
30 // targets. No other methods in this class return valid information
31 // until this has been called.
32 void Analyze();
33
34 // Returns true if there are any forward branches to the bytecode at
35 // |offset|.
36 bool forward_branches_target(int offset) const {
37 return is_forward_target_.Contains(offset);
38 }
39
40 // Returns true if there are any backward branches to the bytecode
41 // at |offset|.
42 bool backward_branches_target(int offset) const {
43 return is_backward_target_.Contains(offset);
44 }
45
46 private:
47 void AddBranch(int origin_offset, int target_offset);
48
49 Zone* zone() const { return zone_; }
50 Handle<BytecodeArray> bytecode_array() const { return bytecode_array_; }
51
52 Handle<BytecodeArray> bytecode_array_;
53 BitVector is_backward_target_;
54 BitVector is_forward_target_;
55 Zone* zone_;
56
57 DISALLOW_COPY_AND_ASSIGN(BytecodeBranchAnalysis);
58 };
59
60
61 } // namespace compiler
62 } // namespace internal
63 } // namespace v8
64
65 #endif // V8_COMPILER_BYTECODE_BRANCH_ANALYSIS_H_
OLDNEW
« no previous file with comments | « src/compiler/bytecode-analysis.cc ('k') | src/compiler/bytecode-branch-analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698