Chromium Code Reviews| Index: test/unittests/interpreter/bytecode-array-builder-unittest.cc |
| diff --git a/test/unittests/interpreter/bytecode-array-builder-unittest.cc b/test/unittests/interpreter/bytecode-array-builder-unittest.cc |
| index 7bbef45ad34c6d6f429a799f0267063b24ffc8cf..6038e5667e1f600b829853338cb64f16cf6e1cf8 100644 |
| --- a/test/unittests/interpreter/bytecode-array-builder-unittest.cc |
| +++ b/test/unittests/interpreter/bytecode-array-builder-unittest.cc |
| @@ -42,6 +42,8 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { |
| builder.LoadLiteral(Smi::FromInt(0)) |
| .StoreAccumulatorInRegister(reg) |
| .LoadLiteral(Smi::FromInt(8)) |
| + .CompareOperation(Token::Value::NE, reg) // Prevent peephole optimization |
| + // LdaSmi, Star -> LdrSmi. |
| .StoreAccumulatorInRegister(reg) |
| .LoadLiteral(Smi::FromInt(10000000)) |
| .StoreAccumulatorInRegister(reg) |
| @@ -65,6 +67,12 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { |
| .StoreAccumulatorInRegister(reg) |
| .LoadNull(); |
| + // Force emission of AddSmi. |
|
rmcilroy
2016/07/04 12:35:32
nit - maybe just group these all together since th
oth
2016/07/04 14:56:24
Done.
|
| + builder.LoadLiteral(Smi::FromInt(1)).BinaryOperation(Token::Value::ADD, reg); |
| + |
| + // Force emission of SubSmi. |
| + builder.LoadLiteral(Smi::FromInt(1)).BinaryOperation(Token::Value::SUB, reg); |
| + |
| // Emit register-register transfer. |
| builder.MoveRegister(reg, other); |
| builder.MoveRegister(reg, wide); |
| @@ -131,11 +139,25 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { |
| .BinaryOperation(Token::Value::BIT_XOR, reg) |
| .BinaryOperation(Token::Value::BIT_AND, reg); |
| + // Emit bitwise AND with smi operand. |
| + builder.LoadLiteral(Smi::FromInt(8)) |
| + .BinaryOperation(Token::Value::BIT_AND, reg); |
| + |
| + // Emit bitwise OR with smi operand. |
| + builder.LoadLiteral(Smi::FromInt(8)) |
| + .BinaryOperation(Token::Value::BIT_OR, reg); |
| + |
| // Emit shift operator invocations |
| builder.BinaryOperation(Token::Value::SHL, reg) |
| .BinaryOperation(Token::Value::SAR, reg) |
| .BinaryOperation(Token::Value::SHR, reg); |
| + // Emit shift left with smi operand. |
| + builder.LoadLiteral(Smi::FromInt(8)).BinaryOperation(Token::Value::SHL, reg); |
| + |
| + // Emit shift right with smi operand. |
| + builder.LoadLiteral(Smi::FromInt(8)).BinaryOperation(Token::Value::SAR, reg); |
| + |
| // Emit count operatior invocations |
| builder.CountOperation(Token::Value::ADD).CountOperation(Token::Value::SUB); |
| @@ -360,6 +382,8 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { |
| CHECK_EQ(the_array->frame_size(), |
| builder.fixed_and_temporary_register_count() * kPointerSize); |
| + the_array->Print(); |
|
rmcilroy
2016/07/04 12:35:32
leftover debugging?
oth
2016/07/04 14:56:24
Yep, done. :-)
|
| + |
| // Build scorecard of bytecodes encountered in the BytecodeArray. |
| std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1); |
| @@ -399,6 +423,12 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { |
| scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalse)] = 1; |
| scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrueConstant)] = 1; |
| scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalseConstant)] = 1; |
| + scorecard[Bytecodes::ToByte(Bytecode::kAddSmi)] = 1; |
| + scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1; |
| + scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1; |
| + scorecard[Bytecodes::ToByte(Bytecode::kBitwiseOrSmi)] = 1; |
| + scorecard[Bytecodes::ToByte(Bytecode::kShiftLeftSmi)] = 1; |
| + scorecard[Bytecodes::ToByte(Bytecode::kShiftRightSmi)] = 1; |
| } |
| // Check return occurs at the end and only once in the BytecodeArray. |