| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef V8_COMPILER_INSTRUCTION_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_H_ |
| 6 #define V8_COMPILER_INSTRUCTION_H_ | 6 #define V8_COMPILER_INSTRUCTION_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 static Instruction* New(Zone* zone, InstructionCode opcode, | 438 static Instruction* New(Zone* zone, InstructionCode opcode, |
| 439 size_t output_count, InstructionOperand** outputs, | 439 size_t output_count, InstructionOperand** outputs, |
| 440 size_t input_count, InstructionOperand** inputs, | 440 size_t input_count, InstructionOperand** inputs, |
| 441 size_t temp_count, InstructionOperand** temps) { | 441 size_t temp_count, InstructionOperand** temps) { |
| 442 ASSERT(opcode >= 0); | 442 ASSERT(opcode >= 0); |
| 443 ASSERT(output_count == 0 || outputs != NULL); | 443 ASSERT(output_count == 0 || outputs != NULL); |
| 444 ASSERT(input_count == 0 || inputs != NULL); | 444 ASSERT(input_count == 0 || inputs != NULL); |
| 445 ASSERT(temp_count == 0 || temps != NULL); | 445 ASSERT(temp_count == 0 || temps != NULL); |
| 446 InstructionOperand* none = NULL; | 446 InstructionOperand* none = NULL; |
| 447 USE(none); | 447 USE(none); |
| 448 size_t size = RoundUp(sizeof(Instruction), kPointerSize) + | 448 int size = static_cast<int>(RoundUp(sizeof(Instruction), kPointerSize) + |
| 449 (output_count + input_count + temp_count - 1) * sizeof(none); | 449 (output_count + input_count + temp_count - 1) * |
| 450 sizeof(none)); |
| 450 return new (zone->New(size)) Instruction( | 451 return new (zone->New(size)) Instruction( |
| 451 opcode, output_count, outputs, input_count, inputs, temp_count, temps); | 452 opcode, output_count, outputs, input_count, inputs, temp_count, temps); |
| 452 } | 453 } |
| 453 | 454 |
| 454 // TODO(titzer): another holdover from lithium days; register allocator | 455 // TODO(titzer): another holdover from lithium days; register allocator |
| 455 // should not need to know about control instructions. | 456 // should not need to know about control instructions. |
| 456 Instruction* MarkAsControl() { | 457 Instruction* MarkAsControl() { |
| 457 bit_field_ = IsControlField::update(bit_field_, true); | 458 bit_field_ = IsControlField::update(bit_field_, true); |
| 458 return this; | 459 return this; |
| 459 } | 460 } |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 ConstantMap::const_iterator it = constants_.find(virtual_register); | 797 ConstantMap::const_iterator it = constants_.find(virtual_register); |
| 797 ASSERT(it != constants_.end()); | 798 ASSERT(it != constants_.end()); |
| 798 ASSERT_EQ(virtual_register, it->first); | 799 ASSERT_EQ(virtual_register, it->first); |
| 799 return it->second; | 800 return it->second; |
| 800 } | 801 } |
| 801 | 802 |
| 802 typedef ConstantDeque Immediates; | 803 typedef ConstantDeque Immediates; |
| 803 const Immediates& immediates() const { return immediates_; } | 804 const Immediates& immediates() const { return immediates_; } |
| 804 | 805 |
| 805 int AddImmediate(Constant constant) { | 806 int AddImmediate(Constant constant) { |
| 806 int index = immediates_.size(); | 807 int index = static_cast<int>(immediates_.size()); |
| 807 immediates_.push_back(constant); | 808 immediates_.push_back(constant); |
| 808 return index; | 809 return index; |
| 809 } | 810 } |
| 810 Constant GetImmediate(int index) const { | 811 Constant GetImmediate(int index) const { |
| 811 ASSERT(index >= 0); | 812 ASSERT(index >= 0); |
| 812 ASSERT(index < static_cast<int>(immediates_.size())); | 813 ASSERT(index < static_cast<int>(immediates_.size())); |
| 813 return immediates_[index]; | 814 return immediates_[index]; |
| 814 } | 815 } |
| 815 | 816 |
| 816 int AddDeoptimizationEntry(const FrameStateDescriptor& descriptor); | 817 int AddDeoptimizationEntry(const FrameStateDescriptor& descriptor); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 836 DeoptimizationVector deoptimization_entries_; | 837 DeoptimizationVector deoptimization_entries_; |
| 837 }; | 838 }; |
| 838 | 839 |
| 839 OStream& operator<<(OStream& os, const InstructionSequence& code); | 840 OStream& operator<<(OStream& os, const InstructionSequence& code); |
| 840 | 841 |
| 841 } // namespace compiler | 842 } // namespace compiler |
| 842 } // namespace internal | 843 } // namespace internal |
| 843 } // namespace v8 | 844 } // namespace v8 |
| 844 | 845 |
| 845 #endif // V8_COMPILER_INSTRUCTION_H_ | 846 #endif // V8_COMPILER_INSTRUCTION_H_ |
| OLD | NEW |