OLD | NEW |
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), |
| 23 last_written_(BytecodeNode::Illegal(BytecodeSourceInfo())) {} |
23 ~BytecodePeepholeOptimizerTest() override {} | 24 ~BytecodePeepholeOptimizerTest() override {} |
24 | 25 |
25 void Reset() { | 26 void Reset() { |
26 last_written_.set_bytecode(Bytecode::kIllegal); | 27 last_written_ = BytecodeNode::Illegal(BytecodeSourceInfo()); |
27 write_count_ = 0; | 28 write_count_ = 0; |
28 } | 29 } |
29 | 30 |
30 void Write(BytecodeNode* node) override { | 31 void Write(BytecodeNode* node) override { |
31 write_count_++; | 32 write_count_++; |
32 last_written_ = *node; | 33 last_written_ = *node; |
33 } | 34 } |
34 | 35 |
35 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override { | 36 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override { |
36 write_count_++; | 37 write_count_++; |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 CHECK_EQ(last_written().bytecode(), Bytecode::kTestUndetectable); | 419 CHECK_EQ(last_written().bytecode(), Bytecode::kTestUndetectable); |
419 CHECK_EQ(last_written().operand_count(), 1); | 420 CHECK_EQ(last_written().operand_count(), 1); |
420 CHECK_EQ(last_written().operand(0), reg_operand); | 421 CHECK_EQ(last_written().operand(0), reg_operand); |
421 Reset(); | 422 Reset(); |
422 } | 423 } |
423 } | 424 } |
424 | 425 |
425 } // namespace interpreter | 426 } // namespace interpreter |
426 } // namespace internal | 427 } // namespace internal |
427 } // namespace v8 | 428 } // namespace v8 |
OLD | NEW |