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 (auto block : instruction_blocks()) { | 22 for (auto block : instruction_blocks()) { |
| 23 if (block->needs_frame()) continue; |
23 for (auto i = block->code_start(); i < block->code_end(); ++i) { | 24 for (auto i = block->code_start(); i < block->code_end(); ++i) { |
24 if (InstructionAt(i)->IsCall()) { | 25 if (InstructionAt(i)->IsCall()) { |
25 block->mark_needs_frame(); | 26 block->mark_needs_frame(); |
26 break; | 27 break; |
27 } | 28 } |
28 } | 29 } |
29 } | 30 } |
30 } | 31 } |
31 | 32 |
32 | 33 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 121 } |
121 | 122 |
122 | 123 |
123 Instruction* FrameElider::InstructionAt(int index) const { | 124 Instruction* FrameElider::InstructionAt(int index) const { |
124 return code_->InstructionAt(index); | 125 return code_->InstructionAt(index); |
125 } | 126 } |
126 | 127 |
127 } // namespace compiler | 128 } // namespace compiler |
128 } // namespace internal | 129 } // namespace internal |
129 } // namespace v8 | 130 } // namespace v8 |
OLD | NEW |