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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // static | 79 // static |
80 PeepholeActionAndData PeepholeActionTableWriter::LookupActionAndData( | 80 PeepholeActionAndData PeepholeActionTableWriter::LookupActionAndData( |
81 Bytecode last, Bytecode current) { | 81 Bytecode last, Bytecode current) { |
82 // Optimize various accumulator loads followed by store accumulator | 82 // Optimize various accumulator loads followed by store accumulator |
83 // to an equivalent register load and loading the accumulator with | 83 // to an equivalent register load and loading the accumulator with |
84 // the register. The latter accumulator load can often be elided as | 84 // the register. The latter accumulator load can often be elided as |
85 // it is side-effect free and often followed by another accumulator | 85 // it is side-effect free and often followed by another accumulator |
86 // load so can be elided. | 86 // load so can be elided. |
87 if (current == Bytecode::kStar) { | 87 if (current == Bytecode::kStar) { |
88 switch (last) { | 88 switch (last) { |
89 case Bytecode::kLdaNamedProperty: | |
90 return {PeepholeAction::kTransformLdaStarToLdrLdarAction, | |
91 Bytecode::kLdrNamedProperty}; | |
92 case Bytecode::kLdaKeyedProperty: | |
93 return {PeepholeAction::kTransformLdaStarToLdrLdarAction, | |
94 Bytecode::kLdrKeyedProperty}; | |
95 case Bytecode::kLdaGlobal: | 89 case Bytecode::kLdaGlobal: |
96 return {PeepholeAction::kTransformLdaStarToLdrLdarAction, | 90 return {PeepholeAction::kTransformLdaStarToLdrLdarAction, |
97 Bytecode::kLdrGlobal}; | 91 Bytecode::kLdrGlobal}; |
98 case Bytecode::kLdaContextSlot: | 92 case Bytecode::kLdaContextSlot: |
99 return {PeepholeAction::kTransformLdaStarToLdrLdarAction, | 93 return {PeepholeAction::kTransformLdaStarToLdrLdarAction, |
100 Bytecode::kLdrContextSlot}; | 94 Bytecode::kLdrContextSlot}; |
101 case Bytecode::kLdaCurrentContextSlot: | 95 case Bytecode::kLdaCurrentContextSlot: |
102 return {PeepholeAction::kTransformLdaStarToLdrLdarAction, | 96 return {PeepholeAction::kTransformLdaStarToLdrLdarAction, |
103 Bytecode::kLdrCurrentContextSlot}; | 97 Bytecode::kLdrCurrentContextSlot}; |
104 case Bytecode::kLdaUndefined: | 98 case Bytecode::kLdaUndefined: |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 374 |
381 std::ofstream ofs(argv[1], std::ofstream::trunc); | 375 std::ofstream ofs(argv[1], std::ofstream::trunc); |
382 v8::internal::interpreter::PeepholeActionTableWriter writer; | 376 v8::internal::interpreter::PeepholeActionTableWriter writer; |
383 writer.BuildTable(); | 377 writer.BuildTable(); |
384 writer.Write(ofs); | 378 writer.Write(ofs); |
385 ofs.flush(); | 379 ofs.flush(); |
386 ofs.close(); | 380 ofs.close(); |
387 | 381 |
388 return 0; | 382 return 0; |
389 } | 383 } |
OLD | NEW |