Revert "Revert "Upgrade to 5.0.71.48"" DO NOT MERGE
This reverts commit f2e3994fa5148cc3d9946666f0b0596290192b0e,
and updates the x64 makefile properly so it doesn't break that
build.
FPIIM-449
Change-Id: Ib83e35bfbae6af627451c926a9650ec57c045605
(cherry picked from commit 109988c7ccb6f3fd1a58574fa3dfb88beaef6632)
diff --git a/src/compiler/bytecode-branch-analysis.cc b/src/compiler/bytecode-branch-analysis.cc
index 27699a1..4e96a53 100644
--- a/src/compiler/bytecode-branch-analysis.cc
+++ b/src/compiler/bytecode-branch-analysis.cc
@@ -11,115 +11,33 @@
namespace internal {
namespace compiler {
-// The class contains all of the sites that contain
-// branches to a particular target (bytecode offset).
-class BytecodeBranchInfo final : public ZoneObject {
- public:
- explicit BytecodeBranchInfo(Zone* zone)
- : back_edge_offsets_(zone), fore_edge_offsets_(zone) {}
-
- void AddBranch(int source_offset, int target_offset);
-
- // The offsets of bytecodes that refer to this bytecode as
- // a back-edge predecessor.
- const ZoneVector<int>* back_edge_offsets() { return &back_edge_offsets_; }
-
- // The offsets of bytecodes that refer to this bytecode as
- // a forwards-edge predecessor.
- const ZoneVector<int>* fore_edge_offsets() { return &fore_edge_offsets_; }
-
- private:
- ZoneVector<int> back_edge_offsets_;
- ZoneVector<int> fore_edge_offsets_;
-
- DISALLOW_COPY_AND_ASSIGN(BytecodeBranchInfo);
-};
-
-
-void BytecodeBranchInfo::AddBranch(int source_offset, int target_offset) {
- if (source_offset < target_offset) {
- fore_edge_offsets_.push_back(source_offset);
- } else {
- back_edge_offsets_.push_back(source_offset);
- }
-}
-
-
BytecodeBranchAnalysis::BytecodeBranchAnalysis(
Handle<BytecodeArray> bytecode_array, Zone* zone)
- : branch_infos_(zone),
- bytecode_array_(bytecode_array),
- reachable_(bytecode_array->length(), zone),
+ : bytecode_array_(bytecode_array),
+ is_backward_target_(bytecode_array->length(), zone),
+ is_forward_target_(bytecode_array->length(), zone),
zone_(zone) {}
-
void BytecodeBranchAnalysis::Analyze() {
interpreter::BytecodeArrayIterator iterator(bytecode_array());
- 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);
- 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();
}
}
-
-const ZoneVector<int>* BytecodeBranchAnalysis::BackwardBranchesTargetting(
- int offset) const {
- auto iterator = branch_infos_.find(offset);
- if (branch_infos_.end() != iterator) {
- return iterator->second->back_edge_offsets();
- } else {
- return nullptr;
- }
-}
-
-
-const ZoneVector<int>* BytecodeBranchAnalysis::ForwardBranchesTargetting(
- int offset) const {
- auto iterator = branch_infos_.find(offset);
- if (branch_infos_.end() != iterator) {
- return iterator->second->fore_edge_offsets();
- } else {
- return nullptr;
- }
-}
-
-
void BytecodeBranchAnalysis::AddBranch(int source_offset, int target_offset) {
- BytecodeBranchInfo* branch_info = nullptr;
- auto iterator = branch_infos_.find(target_offset);
- if (branch_infos_.end() == iterator) {
- branch_info = new (zone()) BytecodeBranchInfo(zone());
- branch_infos_.insert(std::make_pair(target_offset, branch_info));
+ if (source_offset < target_offset) {
+ is_forward_target_.Add(target_offset);
} else {
- branch_info = iterator->second;
+ is_backward_target_.Add(target_offset);
}
- branch_info->AddBranch(source_offset, target_offset);
}
-
} // namespace compiler
} // namespace internal
} // namespace v8