| 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-register-optimizer.h" | 9 #include "src/interpreter/bytecode-register-optimizer.h" |
| 10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 Initialize(1, 1); | 68 Initialize(1, 1); |
| 69 BytecodeNode node(Bytecode::kNop); | 69 BytecodeNode node(Bytecode::kNop); |
| 70 optimizer()->Write(&node); | 70 optimizer()->Write(&node); |
| 71 CHECK_EQ(write_count(), 1); | 71 CHECK_EQ(write_count(), 1); |
| 72 CHECK_EQ(node, last_written()); | 72 CHECK_EQ(node, last_written()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 TEST_F(BytecodeRegisterOptimizerTest, WriteNopExpression) { | 75 TEST_F(BytecodeRegisterOptimizerTest, WriteNopExpression) { |
| 76 Initialize(1, 1); | 76 Initialize(1, 1); |
| 77 BytecodeNode node(Bytecode::kNop); | 77 BytecodeNode node(Bytecode::kNop); |
| 78 node.source_info().Update({3, false}); | 78 node.source_info().MakeExpressionPosition(3); |
| 79 optimizer()->Write(&node); | 79 optimizer()->Write(&node); |
| 80 CHECK_EQ(write_count(), 1); | 80 CHECK_EQ(write_count(), 1); |
| 81 CHECK_EQ(node, last_written()); | 81 CHECK_EQ(node, last_written()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 TEST_F(BytecodeRegisterOptimizerTest, WriteNopStatement) { | 84 TEST_F(BytecodeRegisterOptimizerTest, WriteNopStatement) { |
| 85 Initialize(1, 1); | 85 Initialize(1, 1); |
| 86 BytecodeNode node(Bytecode::kNop); | 86 BytecodeNode node(Bytecode::kNop); |
| 87 node.source_info().Update({3, true}); | 87 node.source_info().MakeStatementPosition(3); |
| 88 optimizer()->Write(&node); | 88 optimizer()->Write(&node); |
| 89 CHECK_EQ(write_count(), 1); | 89 CHECK_EQ(write_count(), 1); |
| 90 CHECK_EQ(node, last_written()); | 90 CHECK_EQ(node, last_written()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 TEST_F(BytecodeRegisterOptimizerTest, TemporaryMaterializedForJump) { | 93 TEST_F(BytecodeRegisterOptimizerTest, TemporaryMaterializedForJump) { |
| 94 Initialize(1, 1); | 94 Initialize(1, 1); |
| 95 Register temp = NewTemporary(); | 95 Register temp = NewTemporary(); |
| 96 BytecodeNode node(Bytecode::kStar, temp.ToOperand()); | 96 BytecodeNode node(Bytecode::kStar, temp.ToOperand()); |
| 97 optimizer()->Write(&node); | 97 optimizer()->Write(&node); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 CHECK_EQ(output()->at(3).bytecode(), Bytecode::kCallJSRuntime); | 211 CHECK_EQ(output()->at(3).bytecode(), Bytecode::kCallJSRuntime); |
| 212 CHECK_EQ(output()->at(3).operand(0), 0); | 212 CHECK_EQ(output()->at(3).operand(0), 0); |
| 213 CHECK_EQ(output()->at(3).operand(1), temp0.ToOperand()); | 213 CHECK_EQ(output()->at(3).operand(1), temp0.ToOperand()); |
| 214 CHECK_EQ(output()->at(3).operand(2), 2); | 214 CHECK_EQ(output()->at(3).operand(2), 2); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace interpreter | 217 } // namespace interpreter |
| 218 } // namespace internal | 218 } // namespace internal |
| 219 } // namespace v8 | 219 } // namespace v8 |
| OLD | NEW |