OLD | NEW |
---|---|
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/compiler/bytecode-analysis.h" | 5 #include "src/compiler/bytecode-analysis.h" |
6 | 6 |
7 #include "src/interpreter/bytecode-array-iterator.h" | 7 #include "src/interpreter/bytecode-array-iterator.h" |
8 #include "src/interpreter/bytecode-array-random-iterator.h" | 8 #include "src/interpreter/bytecode-array-random-iterator.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 | 10 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 end_to_header_(zone), | 91 end_to_header_(zone), |
92 header_to_info_(zone), | 92 header_to_info_(zone), |
93 liveness_map_(bytecode_array->length(), zone) {} | 93 liveness_map_(bytecode_array->length(), zone) {} |
94 | 94 |
95 namespace { | 95 namespace { |
96 | 96 |
97 void UpdateInLiveness(Bytecode bytecode, BytecodeLivenessState& in_liveness, | 97 void UpdateInLiveness(Bytecode bytecode, BytecodeLivenessState& in_liveness, |
98 const BytecodeArrayAccessor& accessor) { | 98 const BytecodeArrayAccessor& accessor) { |
99 int num_operands = Bytecodes::NumberOfOperands(bytecode); | 99 int num_operands = Bytecodes::NumberOfOperands(bytecode); |
100 const OperandType* operand_types = Bytecodes::GetOperandTypes(bytecode); | 100 const OperandType* operand_types = Bytecodes::GetOperandTypes(bytecode); |
101 AccumulatorUse accumulator_use = Bytecodes::GetAccumulatorUse(bytecode); | |
102 | 101 |
103 if (accumulator_use == AccumulatorUse::kWrite) { | 102 if (Bytecodes::WritesAccumulator(bytecode)) { |
104 in_liveness.MarkAccumulatorDead(); | 103 in_liveness.MarkAccumulatorDead(); |
105 } | 104 } |
106 for (int i = 0; i < num_operands; ++i) { | 105 for (int i = 0; i < num_operands; ++i) { |
107 switch (operand_types[i]) { | 106 switch (operand_types[i]) { |
108 case OperandType::kRegOut: { | 107 case OperandType::kRegOut: { |
109 interpreter::Register r = accessor.GetRegisterOperand(i); | 108 interpreter::Register r = accessor.GetRegisterOperand(i); |
110 if (!r.is_parameter()) { | 109 if (!r.is_parameter()) { |
111 in_liveness.MarkRegisterDead(r.index()); | 110 in_liveness.MarkRegisterDead(r.index()); |
112 } | 111 } |
113 break; | 112 break; |
(...skipping 17 matching lines...) Expand all Loading... | |
131 in_liveness.MarkRegisterDead(r.index() + 2); | 130 in_liveness.MarkRegisterDead(r.index() + 2); |
132 } | 131 } |
133 break; | 132 break; |
134 } | 133 } |
135 default: | 134 default: |
136 DCHECK(!Bytecodes::IsRegisterOutputOperandType(operand_types[i])); | 135 DCHECK(!Bytecodes::IsRegisterOutputOperandType(operand_types[i])); |
137 break; | 136 break; |
138 } | 137 } |
139 } | 138 } |
140 | 139 |
141 if (accumulator_use == AccumulatorUse::kRead) { | 140 if (Bytecodes::ReadsAccumulator(bytecode)) { |
Leszek Swirski
2017/01/24 19:58:23
This is probably better for readability's sake, bu
| |
142 in_liveness.MarkAccumulatorLive(); | 141 in_liveness.MarkAccumulatorLive(); |
143 } | 142 } |
144 for (int i = 0; i < num_operands; ++i) { | 143 for (int i = 0; i < num_operands; ++i) { |
145 switch (operand_types[i]) { | 144 switch (operand_types[i]) { |
146 case OperandType::kReg: { | 145 case OperandType::kReg: { |
147 interpreter::Register r = accessor.GetRegisterOperand(i); | 146 interpreter::Register r = accessor.GetRegisterOperand(i); |
148 if (!r.is_parameter()) { | 147 if (!r.is_parameter()) { |
149 in_liveness.MarkRegisterLive(r.index()); | 148 in_liveness.MarkRegisterLive(r.index()); |
150 } | 149 } |
151 break; | 150 break; |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
613 } | 612 } |
614 } | 613 } |
615 | 614 |
616 return invalid_offset == -1; | 615 return invalid_offset == -1; |
617 } | 616 } |
618 #endif | 617 #endif |
619 | 618 |
620 } // namespace compiler | 619 } // namespace compiler |
621 } // namespace internal | 620 } // namespace internal |
622 } // namespace v8 | 621 } // namespace v8 |
OLD | NEW |