| 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 <iosfwd> | 9 #include <iosfwd> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 | 12 |
| 13 #include "src/compiler/common-operator.h" | 13 #include "src/compiler/common-operator.h" |
| 14 #include "src/compiler/frame.h" | 14 #include "src/compiler/frame.h" |
| 15 #include "src/compiler/instruction-codes.h" | 15 #include "src/compiler/instruction-codes.h" |
| 16 #include "src/compiler/opcodes.h" | 16 #include "src/compiler/opcodes.h" |
| 17 #include "src/compiler/register-configuration.h" | |
| 18 #include "src/compiler/source-position.h" | 17 #include "src/compiler/source-position.h" |
| 18 #include "src/macro-assembler.h" |
| 19 #include "src/register-configuration.h" |
| 19 #include "src/zone-allocator.h" | 20 #include "src/zone-allocator.h" |
| 20 | 21 |
| 21 namespace v8 { | 22 namespace v8 { |
| 22 namespace internal { | 23 namespace internal { |
| 23 namespace compiler { | 24 namespace compiler { |
| 24 | 25 |
| 25 class Schedule; | 26 class Schedule; |
| 26 | 27 |
| 27 class InstructionOperand { | 28 class InstructionOperand { |
| 28 public: | 29 public: |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 AllocatedOperand(AllocatedKind kind, MachineType machine_type, int index) | 367 AllocatedOperand(AllocatedKind kind, MachineType machine_type, int index) |
| 367 : InstructionOperand(ALLOCATED) { | 368 : InstructionOperand(ALLOCATED) { |
| 368 DCHECK_IMPLIES(kind == REGISTER || kind == DOUBLE_REGISTER, index >= 0); | 369 DCHECK_IMPLIES(kind == REGISTER || kind == DOUBLE_REGISTER, index >= 0); |
| 369 DCHECK(IsSupportedMachineType(machine_type)); | 370 DCHECK(IsSupportedMachineType(machine_type)); |
| 370 value_ |= AllocatedKindField::encode(kind); | 371 value_ |= AllocatedKindField::encode(kind); |
| 371 value_ |= MachineTypeField::encode(machine_type); | 372 value_ |= MachineTypeField::encode(machine_type); |
| 372 value_ |= static_cast<int64_t>(index) << IndexField::kShift; | 373 value_ |= static_cast<int64_t>(index) << IndexField::kShift; |
| 373 } | 374 } |
| 374 | 375 |
| 375 int index() const { | 376 int index() const { |
| 377 DCHECK(STACK_SLOT == allocated_kind() || |
| 378 DOUBLE_STACK_SLOT == allocated_kind()); |
| 376 return static_cast<int64_t>(value_) >> IndexField::kShift; | 379 return static_cast<int64_t>(value_) >> IndexField::kShift; |
| 377 } | 380 } |
| 378 | 381 |
| 382 Register GetRegister() const { |
| 383 DCHECK(REGISTER == allocated_kind() || DOUBLE_REGISTER == allocated_kind()); |
| 384 return Register::from_code(static_cast<int64_t>(value_) >> |
| 385 IndexField::kShift); |
| 386 } |
| 387 |
| 388 DoubleRegister GetDoubleRegister() const { |
| 389 DCHECK(REGISTER == allocated_kind() || DOUBLE_REGISTER == allocated_kind()); |
| 390 return DoubleRegister::from_code(static_cast<int64_t>(value_) >> |
| 391 IndexField::kShift); |
| 392 } |
| 393 |
| 379 AllocatedKind allocated_kind() const { | 394 AllocatedKind allocated_kind() const { |
| 380 return AllocatedKindField::decode(value_); | 395 return AllocatedKindField::decode(value_); |
| 381 } | 396 } |
| 382 | 397 |
| 383 MachineType machine_type() const { return MachineTypeField::decode(value_); } | 398 MachineType machine_type() const { return MachineTypeField::decode(value_); } |
| 384 | 399 |
| 385 static AllocatedOperand* New(Zone* zone, AllocatedKind kind, | 400 static AllocatedOperand* New(Zone* zone, AllocatedKind kind, |
| 386 MachineType machine_type, int index) { | 401 MachineType machine_type, int index) { |
| 387 return InstructionOperand::New(zone, | 402 return InstructionOperand::New(zone, |
| 388 AllocatedOperand(kind, machine_type, index)); | 403 AllocatedOperand(kind, machine_type, index)); |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 | 1228 |
| 1214 | 1229 |
| 1215 std::ostream& operator<<(std::ostream& os, | 1230 std::ostream& operator<<(std::ostream& os, |
| 1216 const PrintableInstructionSequence& code); | 1231 const PrintableInstructionSequence& code); |
| 1217 | 1232 |
| 1218 } // namespace compiler | 1233 } // namespace compiler |
| 1219 } // namespace internal | 1234 } // namespace internal |
| 1220 } // namespace v8 | 1235 } // namespace v8 |
| 1221 | 1236 |
| 1222 #endif // V8_COMPILER_INSTRUCTION_H_ | 1237 #endif // V8_COMPILER_INSTRUCTION_H_ |
| OLD | NEW |