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

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

Issue 2547043002: [Interpreter] Optimize equality check with null/undefined with a check on the map. (Closed)
Patch Set: Address comments from Ross. Created 4 years 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 Bytecode::kShiftLeftSmi}; 185 Bytecode::kShiftLeftSmi};
186 case Bytecode::kShiftRight: 186 case Bytecode::kShiftRight:
187 return { 187 return {
188 PeepholeAction::kTransformLdaZeroBinaryOpToBinaryOpWithZeroAction, 188 PeepholeAction::kTransformLdaZeroBinaryOpToBinaryOpWithZeroAction,
189 Bytecode::kShiftRightSmi}; 189 Bytecode::kShiftRightSmi};
190 default: 190 default:
191 break; 191 break;
192 } 192 }
193 } 193 }
194 194
195 // Fuse LdaNull/LdaUndefined followed by a equality comparison with test
196 // undetectable. Testing undetectable is a simple check on the map which is
197 // more efficient than the full comparison operation.
198 // Note: StrictEquals cannot use this, they need to compare it with the
199 // Null/undefined map.
200 if (last == Bytecode::kLdaNull || last == Bytecode::kLdaUndefined) {
201 if (current == Bytecode::kTestEqual) {
202 return {PeepholeAction::
203 kTransformEqualityWithNullOrUndefinedToTestUndetectableAction,
204 Bytecode::kIllegal};
205 }
206 }
207
195 // If there is no last bytecode to optimize against, store the incoming 208 // If there is no last bytecode to optimize against, store the incoming
196 // bytecode or for jumps emit incoming bytecode immediately. 209 // bytecode or for jumps emit incoming bytecode immediately.
197 if (last == Bytecode::kIllegal) { 210 if (last == Bytecode::kIllegal) {
198 if (Bytecodes::IsJump(current)) { 211 if (Bytecodes::IsJump(current)) {
199 return {PeepholeAction::kUpdateLastJumpAction, Bytecode::kIllegal}; 212 return {PeepholeAction::kUpdateLastJumpAction, Bytecode::kIllegal};
200 } else if (current == Bytecode::kNop) { 213 } else if (current == Bytecode::kNop) {
201 return {PeepholeAction::kUpdateLastIfSourceInfoPresentAction, 214 return {PeepholeAction::kUpdateLastIfSourceInfoPresentAction,
202 Bytecode::kIllegal}; 215 Bytecode::kIllegal};
203 } else { 216 } else {
204 return {PeepholeAction::kUpdateLastAction, Bytecode::kIllegal}; 217 return {PeepholeAction::kUpdateLastAction, Bytecode::kIllegal};
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 363
351 std::ofstream ofs(argv[1], std::ofstream::trunc); 364 std::ofstream ofs(argv[1], std::ofstream::trunc);
352 v8::internal::interpreter::PeepholeActionTableWriter writer; 365 v8::internal::interpreter::PeepholeActionTableWriter writer;
353 writer.BuildTable(); 366 writer.BuildTable();
354 writer.Write(ofs); 367 writer.Write(ofs);
355 ofs.flush(); 368 ofs.flush();
356 ofs.close(); 369 ofs.close();
357 370
358 return 0; 371 return 0;
359 } 372 }
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/interpreter/bytecode_expectations/ForOf.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698