| 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 #include "src/base/adapters.h" | 5 #include "src/base/adapters.h" |
| 6 #include "src/compiler/frame-elider.h" | 6 #include "src/compiler/frame-elider.h" |
| 7 | 7 |
| 8 namespace v8 { | 8 namespace v8 { |
| 9 namespace internal { | 9 namespace internal { |
| 10 namespace compiler { | 10 namespace compiler { |
| 11 | 11 |
| 12 FrameElider::FrameElider(InstructionSequence* code) : code_(code) {} | 12 FrameElider::FrameElider(InstructionSequence* code) : code_(code) {} |
| 13 | 13 |
| 14 void FrameElider::Run() { | 14 void FrameElider::Run() { |
| 15 MarkBlocks(); | 15 MarkBlocks(); |
| 16 PropagateMarks(); | 16 PropagateMarks(); |
| 17 MarkDeConstruction(); | 17 MarkDeConstruction(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 | 20 |
| 21 void FrameElider::MarkBlocks() { | 21 void FrameElider::MarkBlocks() { |
| 22 for (InstructionBlock* block : instruction_blocks()) { | 22 for (InstructionBlock* block : instruction_blocks()) { |
| 23 if (block->needs_frame()) continue; | 23 if (block->needs_frame()) continue; |
| 24 for (int i = block->code_start(); i < block->code_end(); ++i) { | 24 for (int i = block->code_start(); i < block->code_end(); ++i) { |
| 25 const Instruction* instr = InstructionAt(i); | 25 const Instruction* instr = InstructionAt(i); |
| 26 if (instr->IsCall() || instr->IsDeoptimizeCall() || | 26 if (instr->IsCall() || instr->IsDeoptimizeCall() || |
| 27 instr->arch_opcode() == ArchOpcode::kArchStackPointer) { | 27 instr->arch_opcode() == ArchOpcode::kArchStackPointer || |
| 28 instr->arch_opcode() == ArchOpcode::kArchFramePointer) { |
| 28 block->mark_needs_frame(); | 29 block->mark_needs_frame(); |
| 29 break; | 30 break; |
| 30 } | 31 } |
| 31 } | 32 } |
| 32 } | 33 } |
| 33 } | 34 } |
| 34 | 35 |
| 35 | 36 |
| 36 void FrameElider::PropagateMarks() { | 37 void FrameElider::PropagateMarks() { |
| 37 while (PropagateInOrder() || PropagateReversed()) { | 38 while (PropagateInOrder() || PropagateReversed()) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 134 } |
| 134 | 135 |
| 135 | 136 |
| 136 Instruction* FrameElider::InstructionAt(int index) const { | 137 Instruction* FrameElider::InstructionAt(int index) const { |
| 137 return code_->InstructionAt(index); | 138 return code_->InstructionAt(index); |
| 138 } | 139 } |
| 139 | 140 |
| 140 } // namespace compiler | 141 } // namespace compiler |
| 141 } // namespace internal | 142 } // namespace internal |
| 142 } // namespace v8 | 143 } // namespace v8 |
| OLD | NEW |