| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 next_stage()->Write(last()); | 262 next_stage()->Write(last()); |
| 263 InvalidateLast(); | 263 InvalidateLast(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void BytecodePeepholeOptimizer::UpdateLastJumpAction( | 266 void BytecodePeepholeOptimizer::UpdateLastJumpAction( |
| 267 BytecodeNode* const node, const PeepholeActionAndData* action_data) { | 267 BytecodeNode* const node, const PeepholeActionAndData* action_data) { |
| 268 DCHECK(!LastIsValid()); | 268 DCHECK(!LastIsValid()); |
| 269 DCHECK(Bytecodes::IsJump(node->bytecode())); | 269 DCHECK(Bytecodes::IsJump(node->bytecode())); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void BytecodePeepholeOptimizer::ChangeJumpBytecodeAction( | |
| 273 BytecodeNode* const node, const PeepholeActionAndData* action_data) { | |
| 274 DCHECK(LastIsValid()); | |
| 275 DCHECK(Bytecodes::IsJump(node->bytecode())); | |
| 276 | |
| 277 next_stage()->Write(last()); | |
| 278 InvalidateLast(); | |
| 279 node->replace_bytecode(action_data->bytecode); | |
| 280 } | |
| 281 | |
| 282 void BytecodePeepholeOptimizer::ElideLastBeforeJumpAction( | 272 void BytecodePeepholeOptimizer::ElideLastBeforeJumpAction( |
| 283 BytecodeNode* const node, const PeepholeActionAndData* action_data) { | 273 BytecodeNode* const node, const PeepholeActionAndData* action_data) { |
| 284 DCHECK(LastIsValid()); | 274 DCHECK(LastIsValid()); |
| 285 DCHECK(Bytecodes::IsJump(node->bytecode())); | 275 DCHECK(Bytecodes::IsJump(node->bytecode())); |
| 286 | 276 |
| 287 if (!CanElideLastBasedOnSourcePosition(node)) { | 277 if (!CanElideLastBasedOnSourcePosition(node)) { |
| 288 next_stage()->Write(last()); | 278 next_stage()->Write(last()); |
| 289 } else if (!node->source_info().is_valid()) { | 279 } else if (!node->source_info().is_valid()) { |
| 290 node->set_source_info(last()->source_info()); | 280 node->set_source_info(last()->source_info()); |
| 291 } | 281 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 309 #undef CASE | 299 #undef CASE |
| 310 default: | 300 default: |
| 311 UNREACHABLE(); | 301 UNREACHABLE(); |
| 312 break; | 302 break; |
| 313 } | 303 } |
| 314 } | 304 } |
| 315 | 305 |
| 316 } // namespace interpreter | 306 } // namespace interpreter |
| 317 } // namespace internal | 307 } // namespace internal |
| 318 } // namespace v8 | 308 } // namespace v8 |
| OLD | NEW |