| 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" | 
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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 | 
| OLD | NEW | 
|---|