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

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

Issue 2542903003: [Interpreter] Templatize AccumulatorUsage and OperandType for bytecode creation. (Closed)
Patch Set: Rebase 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 "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"
11 #include "src/objects.h" 11 #include "src/objects.h"
12 #include "test/unittests/test-utils.h" 12 #include "test/unittests/test-utils.h"
13 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 namespace interpreter { 16 namespace interpreter {
17 17
18 class BytecodePeepholeOptimizerTest : public BytecodePipelineStage, 18 class BytecodePeepholeOptimizerTest : public BytecodePipelineStage,
19 public TestWithIsolateAndZone { 19 public TestWithIsolateAndZone {
20 public: 20 public:
21 BytecodePeepholeOptimizerTest() 21 BytecodePeepholeOptimizerTest()
22 : peephole_optimizer_(this), last_written_(Bytecode::kIllegal) {} 22 : peephole_optimizer_(this), last_written_(Bytecode::kIllegal) {}
23 ~BytecodePeepholeOptimizerTest() override {} 23 ~BytecodePeepholeOptimizerTest() override {}
24 24
25 void Reset() { 25 void Reset() {
26 last_written_.set_bytecode(Bytecode::kIllegal); 26 last_written_ = BytecodeNode::Create<Bytecode::kIllegal>();
27 write_count_ = 0; 27 write_count_ = 0;
28 } 28 }
29 29
30 void Write(BytecodeNode* node) override { 30 void Write(BytecodeNode* node) override {
31 write_count_++; 31 write_count_++;
32 last_written_ = *node; 32 last_written_ = *node;
33 } 33 }
34 34
35 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override { 35 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override {
36 write_count_++; 36 write_count_++;
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 } // namespace interpreter 406 } // namespace interpreter
407 } // namespace internal 407 } // namespace internal
408 } // namespace v8 408 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698