| 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 <array> | 5 #include <array> |
| 6 #include <fstream> | 6 #include <fstream> |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 | 140 |
| 141 // Ldar and Star make the accumulator and register hold equivalent | 141 // Ldar and Star make the accumulator and register hold equivalent |
| 142 // values. Only the first bytecode is needed if there's a sequence | 142 // values. Only the first bytecode is needed if there's a sequence |
| 143 // of back-to-back Ldar and Star bytecodes with the same operand. | 143 // of back-to-back Ldar and Star bytecodes with the same operand. |
| 144 if (Bytecodes::IsLdarOrStar(last) && Bytecodes::IsLdarOrStar(current)) { | 144 if (Bytecodes::IsLdarOrStar(last) && Bytecodes::IsLdarOrStar(current)) { |
| 145 return {PeepholeAction::kElideCurrentIfOperand0MatchesAction, | 145 return {PeepholeAction::kElideCurrentIfOperand0MatchesAction, |
| 146 Bytecode::kIllegal}; | 146 Bytecode::kIllegal}; |
| 147 } | 147 } |
| 148 | 148 |
| 149 // TODO(rmcilroy): Add elide for consecutive mov to and from the same |
| 150 // register. |
| 151 |
| 149 // Remove ToBoolean coercion from conditional jumps where possible. | 152 // Remove ToBoolean coercion from conditional jumps where possible. |
| 150 if (Bytecodes::WritesBooleanToAccumulator(last)) { | 153 if (Bytecodes::WritesBooleanToAccumulator(last)) { |
| 151 if (Bytecodes::IsJumpIfToBoolean(current)) { | 154 if (Bytecodes::IsJumpIfToBoolean(current)) { |
| 152 return {PeepholeAction::kChangeJumpBytecodeAction, | 155 return {PeepholeAction::kChangeJumpBytecodeAction, |
| 153 Bytecodes::GetJumpWithoutToBoolean(current)}; | 156 Bytecodes::GetJumpWithoutToBoolean(current)}; |
| 154 } else if (current == Bytecode::kToBooleanLogicalNot) { | 157 } else if (current == Bytecode::kToBooleanLogicalNot) { |
| 155 return {PeepholeAction::kChangeBytecodeAction, Bytecode::kLogicalNot}; | 158 return {PeepholeAction::kChangeBytecodeAction, Bytecode::kLogicalNot}; |
| 156 } | 159 } |
| 157 } | 160 } |
| 158 | 161 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 377 |
| 375 std::ofstream ofs(argv[1], std::ofstream::trunc); | 378 std::ofstream ofs(argv[1], std::ofstream::trunc); |
| 376 v8::internal::interpreter::PeepholeActionTableWriter writer; | 379 v8::internal::interpreter::PeepholeActionTableWriter writer; |
| 377 writer.BuildTable(); | 380 writer.BuildTable(); |
| 378 writer.Write(ofs); | 381 writer.Write(ofs); |
| 379 ofs.flush(); | 382 ofs.flush(); |
| 380 ofs.close(); | 383 ofs.close(); |
| 381 | 384 |
| 382 return 0; | 385 return 0; |
| 383 } | 386 } |
| OLD | NEW |