Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: src/compiler/instruction.h

Issue 1287383003: Re-reland: Remove register index/code indirection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix MIPS tests again Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/greedy-allocator.cc ('k') | src/compiler/instruction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « src/compiler/greedy-allocator.cc ('k') | src/compiler/instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698