diff options
Diffstat (limited to 'deps/v8/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc')
-rw-r--r-- | deps/v8/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/deps/v8/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc index d1c570d421..7d139f4b56 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc @@ -19,11 +19,12 @@ class BytecodePeepholeOptimizerTest : public BytecodePipelineStage, public TestWithIsolateAndZone { public: BytecodePeepholeOptimizerTest() - : peephole_optimizer_(this), last_written_(Bytecode::kIllegal) {} + : peephole_optimizer_(this), + last_written_(BytecodeNode::Illegal(BytecodeSourceInfo())) {} ~BytecodePeepholeOptimizerTest() override {} void Reset() { - last_written_.set_bytecode(Bytecode::kIllegal); + last_written_ = BytecodeNode::Illegal(BytecodeSourceInfo()); write_count_ = 0; } @@ -403,6 +404,25 @@ TEST_F(BytecodePeepholeOptimizerTest, MergeLdaZeroWithBinaryOp) { } } +TEST_F(BytecodePeepholeOptimizerTest, MergeLdaNullOrUndefinedWithCompareOp) { + Bytecode first_bytecodes[] = {Bytecode::kLdaUndefined, Bytecode::kLdaNull}; + + for (auto first_bytecode : first_bytecodes) { + uint32_t reg_operand = Register(0).ToOperand(); + uint32_t idx_operand = 1; + BytecodeNode first(first_bytecode); + BytecodeNode second(Bytecode::kTestEqual, reg_operand, idx_operand); + optimizer()->Write(&first); + optimizer()->Write(&second); + Flush(); + CHECK_EQ(write_count(), 1); + CHECK_EQ(last_written().bytecode(), Bytecode::kTestUndetectable); + CHECK_EQ(last_written().operand_count(), 1); + CHECK_EQ(last_written().operand(0), reg_operand); + Reset(); + } +} + } // namespace interpreter } // namespace internal } // namespace v8 |