OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 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 | 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 #ifndef V8_COMPILER_BYTECODE_BRANCH_ANALYSIS_H_ | 5 #ifndef V8_COMPILER_BYTECODE_BRANCH_ANALYSIS_H_ |
6 #define V8_COMPILER_BYTECODE_BRANCH_ANALYSIS_H_ | 6 #define V8_COMPILER_BYTECODE_BRANCH_ANALYSIS_H_ |
7 | 7 |
8 #include "src/bit-vector.h" | 8 #include "src/bit-vector.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/zone-containers.h" | 10 #include "src/zone-containers.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return sites != nullptr && sites->size() > 0; | 50 return sites != nullptr && sites->size() > 0; |
51 } | 51 } |
52 | 52 |
53 // Returns true if there are any backward branches to the bytecode | 53 // Returns true if there are any backward branches to the bytecode |
54 // at |offset|. | 54 // at |offset|. |
55 bool backward_branches_target(int offset) const { | 55 bool backward_branches_target(int offset) const { |
56 const ZoneVector<int>* sites = BackwardBranchesTargetting(offset); | 56 const ZoneVector<int>* sites = BackwardBranchesTargetting(offset); |
57 return sites != nullptr && sites->size() > 0; | 57 return sites != nullptr && sites->size() > 0; |
58 } | 58 } |
59 | 59 |
| 60 // Adds an additional implicit branch from a throw-site at {throw_offset} to |
| 61 // the corresponding exception handler at {handler_offset}. Note that such a |
| 62 // branch must be a forward branch and has to target a known handler. |
| 63 void AddExceptionalBranch(int throw_offset, int handler_offset); |
| 64 |
60 private: | 65 private: |
61 void AddBranch(int origin_offset, int target_offset); | 66 void AddBranch(int origin_offset, int target_offset); |
| 67 void AnalyzeExceptionHandlers(); |
62 | 68 |
63 Zone* zone() const { return zone_; } | 69 Zone* zone() const { return zone_; } |
64 Handle<BytecodeArray> bytecode_array() const { return bytecode_array_; } | 70 Handle<BytecodeArray> bytecode_array() const { return bytecode_array_; } |
65 | 71 |
66 ZoneMap<int, BytecodeBranchInfo*> branch_infos_; | 72 ZoneMap<int, BytecodeBranchInfo*> branch_infos_; |
67 Handle<BytecodeArray> bytecode_array_; | 73 Handle<BytecodeArray> bytecode_array_; |
68 BitVector reachable_; | 74 BitVector reachable_; |
69 Zone* zone_; | 75 Zone* zone_; |
70 | 76 |
71 DISALLOW_COPY_AND_ASSIGN(BytecodeBranchAnalysis); | 77 DISALLOW_COPY_AND_ASSIGN(BytecodeBranchAnalysis); |
72 }; | 78 }; |
73 | 79 |
74 | 80 |
75 } // namespace compiler | 81 } // namespace compiler |
76 } // namespace internal | 82 } // namespace internal |
77 } // namespace v8 | 83 } // namespace v8 |
78 | 84 |
79 #endif // V8_COMPILER_BYTECODE_BRANCH_ANALYSIS_H_ | 85 #endif // V8_COMPILER_BYTECODE_BRANCH_ANALYSIS_H_ |
OLD | NEW |