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

Unified Diff: src/compiler/bytecode-branch-analysis.cc

Issue 1645293003: [interpreter] Reachability is implied by live environment. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_interpreter-cleanup-graph-builder-control-flow
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/bytecode-branch-analysis.h ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/bytecode-branch-analysis.cc
diff --git a/src/compiler/bytecode-branch-analysis.cc b/src/compiler/bytecode-branch-analysis.cc
index d24d76826ce1df04a245cd9b535343ab0de9d443..3320ad7c0968a46e24c5ebdcc25fecadedf91600 100644
--- a/src/compiler/bytecode-branch-analysis.cc
+++ b/src/compiler/bytecode-branch-analysis.cc
@@ -49,41 +49,16 @@ BytecodeBranchAnalysis::BytecodeBranchAnalysis(
Handle<BytecodeArray> bytecode_array, Zone* zone)
: branch_infos_(zone),
bytecode_array_(bytecode_array),
- reachable_(bytecode_array->length(), zone),
zone_(zone) {}
void BytecodeBranchAnalysis::Analyze() {
interpreter::BytecodeArrayIterator iterator(bytecode_array());
- AnalyzeExceptionHandlers();
- bool reachable = true;
while (!iterator.done()) {
interpreter::Bytecode bytecode = iterator.current_bytecode();
int current_offset = iterator.current_offset();
- // All bytecode basic blocks are generated to be forward reachable
- // and may also be backward reachable. Hence if there's a forward
- // branch targetting here the code becomes reachable.
- reachable = reachable || forward_branches_target(current_offset);
- // Some bytecode basic blocks are reachable through a side-entry
- // (e.g. exception handler), which has been represented in the
- // bit-vector by a corresponding pre-pass.
- reachable = reachable || reachable_.Contains(current_offset);
- if (reachable) {
- reachable_.Add(current_offset);
- if (interpreter::Bytecodes::IsConditionalJump(bytecode)) {
- // Only the branch is recorded, the forward path falls through
- // and is handled as normal bytecode data flow.
- AddBranch(current_offset, iterator.GetJumpTargetOffset());
- } else if (interpreter::Bytecodes::IsJump(bytecode)) {
- // Unless the branch targets the next bytecode it's not
- // reachable. If it targets the next bytecode the check at the
- // start of the loop will set the reachable flag.
- AddBranch(current_offset, iterator.GetJumpTargetOffset());
- reachable = false;
- } else if (interpreter::Bytecodes::IsJumpOrReturn(bytecode)) {
- DCHECK_EQ(bytecode, interpreter::Bytecode::kReturn);
- reachable = false;
- }
+ if (interpreter::Bytecodes::IsJump(bytecode)) {
+ AddBranch(current_offset, iterator.GetJumpTargetOffset());
}
iterator.Advance();
}
@@ -123,13 +98,6 @@ void BytecodeBranchAnalysis::AddBranch(int source_offset, int target_offset) {
branch_info->AddBranch(source_offset, target_offset);
}
-void BytecodeBranchAnalysis::AnalyzeExceptionHandlers() {
- HandlerTable* table = HandlerTable::cast(bytecode_array()->handler_table());
- for (int i = 0; i < table->NumberOfRangeEntries(); ++i) {
- reachable_.Add(table->GetRangeHandler(i));
- }
-}
-
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/bytecode-branch-analysis.h ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698