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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 ZoneList<InstructionOperand*> untagged_operands_; | 398 ZoneList<InstructionOperand*> untagged_operands_; |
399 int instruction_position_; | 399 int instruction_position_; |
400 }; | 400 }; |
401 | 401 |
402 OStream& operator<<(OStream& os, const PointerMap& pm); | 402 OStream& operator<<(OStream& os, const PointerMap& pm); |
403 | 403 |
404 // TODO(titzer): s/PointerMap/ReferenceMap/ | 404 // TODO(titzer): s/PointerMap/ReferenceMap/ |
405 class Instruction : public ZoneObject { | 405 class Instruction : public ZoneObject { |
406 public: | 406 public: |
407 size_t OutputCount() const { return OutputCountField::decode(bit_field_); } | 407 size_t OutputCount() const { return OutputCountField::decode(bit_field_); } |
408 InstructionOperand* Output() const { return OutputAt(0); } | |
409 InstructionOperand* OutputAt(size_t i) const { | 408 InstructionOperand* OutputAt(size_t i) const { |
410 DCHECK(i < OutputCount()); | 409 DCHECK(i < OutputCount()); |
411 return operands_[i]; | 410 return operands_[i]; |
412 } | 411 } |
413 | 412 |
| 413 bool HasOutput() const { return OutputCount() == 1; } |
| 414 InstructionOperand* Output() const { return OutputAt(0); } |
| 415 |
414 size_t InputCount() const { return InputCountField::decode(bit_field_); } | 416 size_t InputCount() const { return InputCountField::decode(bit_field_); } |
415 InstructionOperand* InputAt(size_t i) const { | 417 InstructionOperand* InputAt(size_t i) const { |
416 DCHECK(i < InputCount()); | 418 DCHECK(i < InputCount()); |
417 return operands_[OutputCount() + i]; | 419 return operands_[OutputCount() + i]; |
418 } | 420 } |
419 | 421 |
420 size_t TempCount() const { return TempCountField::decode(bit_field_); } | 422 size_t TempCount() const { return TempCountField::decode(bit_field_); } |
421 InstructionOperand* TempAt(size_t i) const { | 423 InstructionOperand* TempAt(size_t i) const { |
422 DCHECK(i < TempCount()); | 424 DCHECK(i < TempCount()); |
423 return operands_[OutputCount() + InputCount() + i]; | 425 return operands_[OutputCount() + InputCount() + i]; |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 DeoptimizationVector deoptimization_entries_; | 867 DeoptimizationVector deoptimization_entries_; |
866 }; | 868 }; |
867 | 869 |
868 OStream& operator<<(OStream& os, const InstructionSequence& code); | 870 OStream& operator<<(OStream& os, const InstructionSequence& code); |
869 | 871 |
870 } // namespace compiler | 872 } // namespace compiler |
871 } // namespace internal | 873 } // namespace internal |
872 } // namespace v8 | 874 } // namespace v8 |
873 | 875 |
874 #endif // V8_COMPILER_INSTRUCTION_H_ | 876 #endif // V8_COMPILER_INSTRUCTION_H_ |
OLD | NEW |