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/interpreter/bytecode-peephole-optimizer.h" | 5 #include "src/interpreter/bytecode-peephole-optimizer.h" |
6 | 6 |
7 #include "src/objects-inl.h" | 7 #include "src/objects-inl.h" |
8 #include "src/objects.h" | 8 #include "src/objects.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // peephole optimized away unlike the Star in the first form. | 132 // peephole optimized away unlike the Star in the first form. |
133 // | 133 // |
134 last->Transform(new_bytecode, current->operand(0)); | 134 last->Transform(new_bytecode, current->operand(0)); |
135 current->set_bytecode(Bytecode::kLdar, current->operand(0)); | 135 current->set_bytecode(Bytecode::kLdar, current->operand(0)); |
136 } | 136 } |
137 | 137 |
138 void TransformLdaSmiBinaryOpToBinaryOpWithSmi(Bytecode new_bytecode, | 138 void TransformLdaSmiBinaryOpToBinaryOpWithSmi(Bytecode new_bytecode, |
139 BytecodeNode* const last, | 139 BytecodeNode* const last, |
140 BytecodeNode* const current) { | 140 BytecodeNode* const current) { |
141 DCHECK_EQ(last->bytecode(), Bytecode::kLdaSmi); | 141 DCHECK_EQ(last->bytecode(), Bytecode::kLdaSmi); |
142 current->set_bytecode(new_bytecode, last->operand(0), current->operand(0)); | 142 current->set_bytecode(new_bytecode, last->operand(0), current->operand(0), |
| 143 current->operand(1)); |
143 if (last->source_info().is_valid()) { | 144 if (last->source_info().is_valid()) { |
144 current->source_info().Clone(last->source_info()); | 145 current->source_info().Clone(last->source_info()); |
145 } | 146 } |
146 } | 147 } |
147 | 148 |
148 void TransformLdaZeroBinaryOpToBinaryOpWithZero(Bytecode new_bytecode, | 149 void TransformLdaZeroBinaryOpToBinaryOpWithZero(Bytecode new_bytecode, |
149 BytecodeNode* const last, | 150 BytecodeNode* const last, |
150 BytecodeNode* const current) { | 151 BytecodeNode* const current) { |
151 DCHECK_EQ(last->bytecode(), Bytecode::kLdaZero); | 152 DCHECK_EQ(last->bytecode(), Bytecode::kLdaZero); |
152 current->set_bytecode(new_bytecode, 0, current->operand(0)); | 153 current->set_bytecode(new_bytecode, 0, current->operand(0), |
| 154 current->operand(1)); |
153 if (last->source_info().is_valid()) { | 155 if (last->source_info().is_valid()) { |
154 current->source_info().Clone(last->source_info()); | 156 current->source_info().Clone(last->source_info()); |
155 } | 157 } |
156 } | 158 } |
157 | 159 |
158 } // namespace | 160 } // namespace |
159 | 161 |
160 void BytecodePeepholeOptimizer::DefaultAction( | 162 void BytecodePeepholeOptimizer::DefaultAction( |
161 BytecodeNode* const node, const PeepholeActionAndData* action_data) { | 163 BytecodeNode* const node, const PeepholeActionAndData* action_data) { |
162 DCHECK(LastIsValid()); | 164 DCHECK(LastIsValid()); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 #undef CASE | 336 #undef CASE |
335 default: | 337 default: |
336 UNREACHABLE(); | 338 UNREACHABLE(); |
337 break; | 339 break; |
338 } | 340 } |
339 } | 341 } |
340 | 342 |
341 } // namespace interpreter | 343 } // namespace interpreter |
342 } // namespace internal | 344 } // namespace internal |
343 } // namespace v8 | 345 } // namespace v8 |
OLD | NEW |