Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/interpreter/mkpeephole.cc

Issue 2489513005: [Interpreter] Remove all Ldr style bytecodes and replace with Star lookahead. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 std::array<size_t, kNumberOfBytecodes> row_map_; 72 std::array<size_t, kNumberOfBytecodes> row_map_;
73 }; 73 };
74 74
75 const char* PeepholeActionTableWriter::kIndent = " "; 75 const char* PeepholeActionTableWriter::kIndent = " ";
76 const char* PeepholeActionTableWriter::kNamespaceElements[] = {"v8", "internal", 76 const char* PeepholeActionTableWriter::kNamespaceElements[] = {"v8", "internal",
77 "interpreter"}; 77 "interpreter"};
78 78
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
83 // to an equivalent register load and loading the accumulator with
84 // the register. The latter accumulator load can often be elided as
85 // it is side-effect free and often followed by another accumulator
86 // load so can be elided.
87 if (current == Bytecode::kStar) {
88 switch (last) {
89 case Bytecode::kLdaGlobal:
90 return {PeepholeAction::kTransformLdaStarToLdrLdarAction,
91 Bytecode::kLdrGlobal};
92 case Bytecode::kLdaContextSlot:
93 return {PeepholeAction::kTransformLdaStarToLdrLdarAction,
94 Bytecode::kLdrContextSlot};
95 case Bytecode::kLdaCurrentContextSlot:
96 return {PeepholeAction::kTransformLdaStarToLdrLdarAction,
97 Bytecode::kLdrCurrentContextSlot};
98 case Bytecode::kLdaUndefined:
99 return {PeepholeAction::kTransformLdaStarToLdrLdarAction,
100 Bytecode::kLdrUndefined};
101 default:
102 break;
103 }
104 }
105
106 // ToName bytecodes can be replaced by Star with the same output register if 82 // ToName bytecodes can be replaced by Star with the same output register if
107 // the value in the accumulator is already a name. 83 // the value in the accumulator is already a name.
108 if (current == Bytecode::kToName && Bytecodes::PutsNameInAccumulator(last)) { 84 if (current == Bytecode::kToName && Bytecodes::PutsNameInAccumulator(last)) {
109 return {PeepholeAction::kChangeBytecodeAction, Bytecode::kStar}; 85 return {PeepholeAction::kChangeBytecodeAction, Bytecode::kStar};
110 } 86 }
111 87
112 // Nop are placeholders for holding source position information and can be 88 // Nop are placeholders for holding source position information and can be
113 // elided if there is no source information. 89 // elided if there is no source information.
114 if (last == Bytecode::kNop) { 90 if (last == Bytecode::kNop) {
115 if (Bytecodes::IsJump(current)) { 91 if (Bytecodes::IsJump(current)) {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 350
375 std::ofstream ofs(argv[1], std::ofstream::trunc); 351 std::ofstream ofs(argv[1], std::ofstream::trunc);
376 v8::internal::interpreter::PeepholeActionTableWriter writer; 352 v8::internal::interpreter::PeepholeActionTableWriter writer;
377 writer.BuildTable(); 353 writer.BuildTable();
378 writer.Write(ofs); 354 writer.Write(ofs);
379 ofs.flush(); 355 ofs.flush();
380 ofs.close(); 356 ofs.close();
381 357
382 return 0; 358 return 0;
383 } 359 }
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/interpreter/bytecode_expectations/CallGlobal.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698