Chromium Code Reviews| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 return {PeepholeAction::kTransformLdaStarToLdrLdarAction, | 99 return {PeepholeAction::kTransformLdaStarToLdrLdarAction, |
| 100 Bytecode::kLdrContextSlot}; | 100 Bytecode::kLdrContextSlot}; |
| 101 case Bytecode::kLdaUndefined: | 101 case Bytecode::kLdaUndefined: |
| 102 return {PeepholeAction::kTransformLdaStarToLdrLdarAction, | 102 return {PeepholeAction::kTransformLdaStarToLdrLdarAction, |
| 103 Bytecode::kLdrUndefined}; | 103 Bytecode::kLdrUndefined}; |
| 104 default: | 104 default: |
| 105 break; | 105 break; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 // ToName optimizations: remove unnecessary ToName bytecodes. | 109 // ToName optimizations: remove unnecessary ToName bytecodes. |
|
oth
2016/07/22 11:13:10
Can this comment be updated to reflect the new sem
klaasb
2016/07/25 12:25:08
Done.
| |
| 110 if (current == Bytecode::kToName) { | 110 if (current == Bytecode::kToName) { |
| 111 if (last == Bytecode::kLdaConstant) { | 111 if (last == Bytecode::kLdaConstant) { |
| 112 return {PeepholeAction::kElideCurrentIfLoadingNameConstantAction, | 112 return {PeepholeAction::kTransformToStarIfLoadingNameConstantAction, |
| 113 Bytecode::kIllegal}; | 113 Bytecode::kIllegal}; |
| 114 } else if (Bytecodes::PutsNameInAccumulator(last)) { | 114 } else if (Bytecodes::PutsNameInAccumulator(last)) { |
| 115 return {PeepholeAction::kElideCurrentAction, Bytecode::kIllegal}; | 115 return {PeepholeAction::kChangeBytecodeAction, Bytecode::kStar}; |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 // Nop are placeholders for holding source position information and can be | 119 // Nop are placeholders for holding source position information and can be |
| 120 // elided if there is no source information. | 120 // elided if there is no source information. |
| 121 if (last == Bytecode::kNop) { | 121 if (last == Bytecode::kNop) { |
| 122 if (Bytecodes::IsJump(current)) { | 122 if (Bytecodes::IsJump(current)) { |
| 123 return {PeepholeAction::kElideLastBeforeJumpAction, Bytecode::kIllegal}; | 123 return {PeepholeAction::kElideLastBeforeJumpAction, Bytecode::kIllegal}; |
| 124 } else { | 124 } else { |
| 125 return {PeepholeAction::kElideLastAction, Bytecode::kIllegal}; | 125 return {PeepholeAction::kElideLastAction, Bytecode::kIllegal}; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 | 378 |
| 379 std::ofstream ofs(argv[1], std::ofstream::trunc); | 379 std::ofstream ofs(argv[1], std::ofstream::trunc); |
| 380 v8::internal::interpreter::PeepholeActionTableWriter writer; | 380 v8::internal::interpreter::PeepholeActionTableWriter writer; |
| 381 writer.BuildTable(); | 381 writer.BuildTable(); |
| 382 writer.Write(ofs); | 382 writer.Write(ofs); |
| 383 ofs.flush(); | 383 ofs.flush(); |
| 384 ofs.close(); | 384 ofs.close(); |
| 385 | 385 |
| 386 return 0; | 386 return 0; |
| 387 } | 387 } |
| OLD | NEW |