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

Side by Side Diff: test/unittests/interpreter/bytecode-peephole-optimizer-unittest.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
« no previous file with comments | « test/unittests/interpreter/bytecode-array-builder-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/factory.h" 7 #include "src/factory.h"
8 #include "src/interpreter/bytecode-label.h" 8 #include "src/interpreter/bytecode-label.h"
9 #include "src/interpreter/bytecode-peephole-optimizer.h" 9 #include "src/interpreter/bytecode-peephole-optimizer.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 CHECK_EQ(write_count(), 1); 396 CHECK_EQ(write_count(), 1);
397 CHECK_EQ(last_written().bytecode(), operator_replacement[1]); 397 CHECK_EQ(last_written().bytecode(), operator_replacement[1]);
398 CHECK_EQ(last_written().operand_count(), 3); 398 CHECK_EQ(last_written().operand_count(), 3);
399 CHECK_EQ(last_written().operand(0), 0u); 399 CHECK_EQ(last_written().operand(0), 0u);
400 CHECK_EQ(last_written().operand(1), reg_operand); 400 CHECK_EQ(last_written().operand(1), reg_operand);
401 CHECK_EQ(last_written().operand(2), idx_operand); 401 CHECK_EQ(last_written().operand(2), idx_operand);
402 Reset(); 402 Reset();
403 } 403 }
404 } 404 }
405 405
406 TEST_F(BytecodePeepholeOptimizerTest, MergeLdaNullOrUndefinedWithCompareOp) {
407 Bytecode first_bytecodes[] = {Bytecode::kLdaUndefined, Bytecode::kLdaNull};
408
409 for (auto first_bytecode : first_bytecodes) {
410 uint32_t reg_operand = Register(0).ToOperand();
411 uint32_t idx_operand = 1;
412 BytecodeNode first(first_bytecode);
413 BytecodeNode second(Bytecode::kTestEqual, reg_operand, idx_operand);
414 optimizer()->Write(&first);
415 optimizer()->Write(&second);
416 Flush();
417 CHECK_EQ(write_count(), 1);
418 CHECK_EQ(last_written().bytecode(), Bytecode::kTestUndetectable);
419 CHECK_EQ(last_written().operand_count(), 1);
420 CHECK_EQ(last_written().operand(0), reg_operand);
421 Reset();
422 }
423 }
424
406 } // namespace interpreter 425 } // namespace interpreter
407 } // namespace internal 426 } // namespace internal
408 } // namespace v8 427 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/interpreter/bytecode-array-builder-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698