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-register-optimizer.h" | 5 #include "src/interpreter/bytecode-register-optimizer.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace interpreter { | 9 namespace interpreter { |
10 | 10 |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 // | 526 // |
527 // For each output register about to be clobbered, materialize an | 527 // For each output register about to be clobbered, materialize an |
528 // equivalent if it exists. Put each register in it's own equivalence set. | 528 // equivalent if it exists. Put each register in it's own equivalence set. |
529 // | 529 // |
530 const uint32_t* operands = node->operands(); | 530 const uint32_t* operands = node->operands(); |
531 int operand_count = node->operand_count(); | 531 int operand_count = node->operand_count(); |
532 const OperandType* operand_types = | 532 const OperandType* operand_types = |
533 Bytecodes::GetOperandTypes(node->bytecode()); | 533 Bytecodes::GetOperandTypes(node->bytecode()); |
534 for (int i = 0; i < operand_count; ++i) { | 534 for (int i = 0; i < operand_count; ++i) { |
535 int count; | 535 int count; |
536 // operand_types is terminated by OperandType::kNone so this does not | 536 if (operand_types[i] == OperandType::kRegList) { |
537 // go out of bounds. | 537 DCHECK_LT(i, operand_count - 1); |
538 if (operand_types[i + 1] == OperandType::kRegCount) { | 538 DCHECK(operand_types[i + 1] == OperandType::kRegCount); |
539 count = static_cast<int>(operands[i + 1]); | 539 count = static_cast<int>(operands[i + 1]); |
540 } else { | 540 } else { |
541 count = Bytecodes::GetNumberOfRegistersRepresentedBy(operand_types[i]); | 541 count = Bytecodes::GetNumberOfRegistersRepresentedBy(operand_types[i]); |
542 } | 542 } |
543 | 543 |
544 if (count == 0) { | 544 if (count == 0) { |
545 continue; | 545 continue; |
546 } | 546 } |
547 | 547 |
548 Register reg = Register::FromOperand(static_cast<int32_t>(operands[i])); | 548 Register reg = Register::FromOperand(static_cast<int32_t>(operands[i])); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 void BytecodeRegisterOptimizer::RegisterListFreeEvent(RegisterList reg_list) { | 652 void BytecodeRegisterOptimizer::RegisterListFreeEvent(RegisterList reg_list) { |
653 int first_index = reg_list.first_register().index(); | 653 int first_index = reg_list.first_register().index(); |
654 for (int i = 0; i < reg_list.register_count(); i++) { | 654 for (int i = 0; i < reg_list.register_count(); i++) { |
655 GetRegisterInfo(Register(first_index + i))->set_allocated(false); | 655 GetRegisterInfo(Register(first_index + i))->set_allocated(false); |
656 } | 656 } |
657 } | 657 } |
658 | 658 |
659 } // namespace interpreter | 659 } // namespace interpreter |
660 } // namespace internal | 660 } // namespace internal |
661 } // namespace v8 | 661 } // namespace v8 |
OLD | NEW |