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

Side by Side Diff: test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc

Issue 2336643002: [Interpreter] Move context chain search loop to handler (Closed)
Patch Set: Fix documentation nits Created 4 years, 3 months 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 CHECK_EQ(write_count(), 2); 391 CHECK_EQ(write_count(), 2);
392 CHECK_EQ(last_written().bytecode(), Bytecode::kLdar); 392 CHECK_EQ(last_written().bytecode(), Bytecode::kLdar);
393 CHECK_EQ(last_written().operand(0), operands[expected_operand_count - 1]); 393 CHECK_EQ(last_written().operand(0), operands[expected_operand_count - 1]);
394 Flush(); 394 Flush();
395 CHECK_EQ(last_written().bytecode(), third.bytecode()); 395 CHECK_EQ(last_written().bytecode(), third.bytecode());
396 } 396 }
397 397
398 TEST_F(BytecodePeepholeOptimizerTest, MergeLdaContextSlotStar) { 398 TEST_F(BytecodePeepholeOptimizerTest, MergeLdaContextSlotStar) {
399 const uint32_t operands[] = { 399 const uint32_t operands[] = {
400 static_cast<uint32_t>(Register(200000).ToOperand()), 55005500, 400 static_cast<uint32_t>(Register(200000).ToOperand()), 55005500,
401 static_cast<uint32_t>(Register(0).ToOperand()),
401 static_cast<uint32_t>(Register(1).ToOperand())}; 402 static_cast<uint32_t>(Register(1).ToOperand())};
402 const int expected_operand_count = static_cast<int>(arraysize(operands)); 403 const int expected_operand_count = static_cast<int>(arraysize(operands));
403 404
404 BytecodeNode first(Bytecode::kLdaContextSlot, operands[0], operands[1]); 405 BytecodeNode first(Bytecode::kLdaContextSlot, operands[0], operands[1],
405 BytecodeNode second(Bytecode::kStar, operands[2]); 406 operands[2]);
407 BytecodeNode second(Bytecode::kStar, operands[3]);
406 BytecodeNode third(Bytecode::kReturn); 408 BytecodeNode third(Bytecode::kReturn);
407 optimizer()->Write(&first); 409 optimizer()->Write(&first);
408 optimizer()->Write(&second); 410 optimizer()->Write(&second);
409 CHECK_EQ(write_count(), 1); 411 CHECK_EQ(write_count(), 1);
410 CHECK_EQ(last_written().bytecode(), Bytecode::kLdrContextSlot); 412 CHECK_EQ(last_written().bytecode(), Bytecode::kLdrContextSlot);
411 CHECK_EQ(last_written().operand_count(), expected_operand_count); 413 CHECK_EQ(last_written().operand_count(), expected_operand_count);
412 for (int i = 0; i < expected_operand_count; ++i) { 414 for (int i = 0; i < expected_operand_count; ++i) {
413 CHECK_EQ(last_written().operand(i), operands[i]); 415 CHECK_EQ(last_written().operand(i), operands[i]);
414 } 416 }
415 optimizer()->Write(&third); 417 optimizer()->Write(&third);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 CHECK_EQ(last_written().operand(0), 0); 524 CHECK_EQ(last_written().operand(0), 0);
523 CHECK_EQ(last_written().operand(1), reg_operand); 525 CHECK_EQ(last_written().operand(1), reg_operand);
524 CHECK_EQ(last_written().operand(2), idx_operand); 526 CHECK_EQ(last_written().operand(2), idx_operand);
525 Reset(); 527 Reset();
526 } 528 }
527 } 529 }
528 530
529 } // namespace interpreter 531 } // namespace interpreter
530 } // namespace internal 532 } // namespace internal
531 } // namespace v8 533 } // 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