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

Side by Side Diff: src/compiler/mips/code-generator-mips.cc

Issue 948843002: MIPS: [turbofan] Fix several int vs size_t issues. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | src/compiler/mips64/code-generator-mips64.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 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 #include "src/compiler/code-generator-impl.h" 6 #include "src/compiler/code-generator-impl.h"
7 #include "src/compiler/gap-resolver.h" 7 #include "src/compiler/gap-resolver.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/mips/macro-assembler-mips.h" 9 #include "src/mips/macro-assembler-mips.h"
10 #include "src/scopes.h" 10 #include "src/scopes.h"
(...skipping 21 matching lines...) Expand all
32 PrintF("UNIMPLEMENTED code_generator_mips: %s at line %d\n", __FUNCTION__, \ 32 PrintF("UNIMPLEMENTED code_generator_mips: %s at line %d\n", __FUNCTION__, \
33 __LINE__) 33 __LINE__)
34 34
35 35
36 // Adds Mips-specific methods to convert InstructionOperands. 36 // Adds Mips-specific methods to convert InstructionOperands.
37 class MipsOperandConverter FINAL : public InstructionOperandConverter { 37 class MipsOperandConverter FINAL : public InstructionOperandConverter {
38 public: 38 public:
39 MipsOperandConverter(CodeGenerator* gen, Instruction* instr) 39 MipsOperandConverter(CodeGenerator* gen, Instruction* instr)
40 : InstructionOperandConverter(gen, instr) {} 40 : InstructionOperandConverter(gen, instr) {}
41 41
42 FloatRegister OutputSingleRegister(int index = 0) { 42 FloatRegister OutputSingleRegister(size_t index = 0) {
43 return ToSingleRegister(instr_->OutputAt(index)); 43 return ToSingleRegister(instr_->OutputAt(index));
44 } 44 }
45 45
46 FloatRegister InputSingleRegister(int index) { 46 FloatRegister InputSingleRegister(size_t index) {
47 return ToSingleRegister(instr_->InputAt(index)); 47 return ToSingleRegister(instr_->InputAt(index));
48 } 48 }
49 49
50 FloatRegister ToSingleRegister(InstructionOperand* op) { 50 FloatRegister ToSingleRegister(InstructionOperand* op) {
51 // Single (Float) and Double register namespace is same on MIPS, 51 // Single (Float) and Double register namespace is same on MIPS,
52 // both are typedefs of FPURegister. 52 // both are typedefs of FPURegister.
53 return ToDoubleRegister(op); 53 return ToDoubleRegister(op);
54 } 54 }
55 55
56 Operand InputImmediate(int index) { 56 Operand InputImmediate(size_t index) {
57 Constant constant = ToConstant(instr_->InputAt(index)); 57 Constant constant = ToConstant(instr_->InputAt(index));
58 switch (constant.type()) { 58 switch (constant.type()) {
59 case Constant::kInt32: 59 case Constant::kInt32:
60 return Operand(constant.ToInt32()); 60 return Operand(constant.ToInt32());
61 case Constant::kFloat32: 61 case Constant::kFloat32:
62 return Operand( 62 return Operand(
63 isolate()->factory()->NewNumber(constant.ToFloat32(), TENURED)); 63 isolate()->factory()->NewNumber(constant.ToFloat32(), TENURED));
64 case Constant::kFloat64: 64 case Constant::kFloat64:
65 return Operand( 65 return Operand(
66 isolate()->factory()->NewNumber(constant.ToFloat64(), TENURED)); 66 isolate()->factory()->NewNumber(constant.ToFloat64(), TENURED));
67 case Constant::kInt64: 67 case Constant::kInt64:
68 case Constant::kExternalReference: 68 case Constant::kExternalReference:
69 case Constant::kHeapObject: 69 case Constant::kHeapObject:
70 // TODO(plind): Maybe we should handle ExtRef & HeapObj here? 70 // TODO(plind): Maybe we should handle ExtRef & HeapObj here?
71 // maybe not done on arm due to const pool ?? 71 // maybe not done on arm due to const pool ??
72 break; 72 break;
73 case Constant::kRpoNumber: 73 case Constant::kRpoNumber:
74 UNREACHABLE(); // TODO(titzer): RPO immediates on mips? 74 UNREACHABLE(); // TODO(titzer): RPO immediates on mips?
75 break; 75 break;
76 } 76 }
77 UNREACHABLE(); 77 UNREACHABLE();
78 return Operand(zero_reg); 78 return Operand(zero_reg);
79 } 79 }
80 80
81 Operand InputOperand(int index) { 81 Operand InputOperand(size_t index) {
82 InstructionOperand* op = instr_->InputAt(index); 82 InstructionOperand* op = instr_->InputAt(index);
83 if (op->IsRegister()) { 83 if (op->IsRegister()) {
84 return Operand(ToRegister(op)); 84 return Operand(ToRegister(op));
85 } 85 }
86 return InputImmediate(index); 86 return InputImmediate(index);
87 } 87 }
88 88
89 MemOperand MemoryOperand(int* first_index) { 89 MemOperand MemoryOperand(size_t* first_index) {
90 const int index = *first_index; 90 const size_t index = *first_index;
91 switch (AddressingModeField::decode(instr_->opcode())) { 91 switch (AddressingModeField::decode(instr_->opcode())) {
92 case kMode_None: 92 case kMode_None:
93 break; 93 break;
94 case kMode_MRI: 94 case kMode_MRI:
95 *first_index += 2; 95 *first_index += 2;
96 return MemOperand(InputRegister(index + 0), InputInt32(index + 1)); 96 return MemOperand(InputRegister(index + 0), InputInt32(index + 1));
97 case kMode_MRR: 97 case kMode_MRR:
98 // TODO(plind): r6 address mode, to be implemented ... 98 // TODO(plind): r6 address mode, to be implemented ...
99 UNREACHABLE(); 99 UNREACHABLE();
100 } 100 }
101 UNREACHABLE(); 101 UNREACHABLE();
102 return MemOperand(no_reg); 102 return MemOperand(no_reg);
103 } 103 }
104 104
105 MemOperand MemoryOperand(int index = 0) { return MemoryOperand(&index); } 105 MemOperand MemoryOperand(size_t index = 0) { return MemoryOperand(&index); }
106 106
107 MemOperand ToMemOperand(InstructionOperand* op) const { 107 MemOperand ToMemOperand(InstructionOperand* op) const {
108 DCHECK(op != NULL); 108 DCHECK(op != NULL);
109 DCHECK(!op->IsRegister()); 109 DCHECK(!op->IsRegister());
110 DCHECK(!op->IsDoubleRegister()); 110 DCHECK(!op->IsDoubleRegister());
111 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); 111 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
112 // The linkage computes where all spill slots are located. 112 // The linkage computes where all spill slots are located.
113 FrameOffset offset = linkage()->GetFrameOffset(op->index(), frame(), 0); 113 FrameOffset offset = linkage()->GetFrameOffset(op->index(), frame(), 0);
114 return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset()); 114 return MemOperand(offset.from_stack_pointer() ? sp : fp, offset.offset());
115 } 115 }
116 }; 116 };
117 117
118 118
119 static inline bool HasRegisterInput(Instruction* instr, int index) { 119 static inline bool HasRegisterInput(Instruction* instr, size_t index) {
120 return instr->InputAt(index)->IsRegister(); 120 return instr->InputAt(index)->IsRegister();
121 } 121 }
122 122
123 123
124 namespace { 124 namespace {
125 125
126 class OutOfLineLoadSingle FINAL : public OutOfLineCode { 126 class OutOfLineLoadSingle FINAL : public OutOfLineCode {
127 public: 127 public:
128 OutOfLineLoadSingle(CodeGenerator* gen, FloatRegister result) 128 OutOfLineLoadSingle(CodeGenerator* gen, FloatRegister result)
129 : OutOfLineCode(gen), result_(result) {} 129 : OutOfLineCode(gen), result_(result) {}
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 __ lw(i.OutputRegister(), i.MemoryOperand()); 639 __ lw(i.OutputRegister(), i.MemoryOperand());
640 break; 640 break;
641 case kMipsSw: 641 case kMipsSw:
642 __ sw(i.InputRegister(2), i.MemoryOperand()); 642 __ sw(i.InputRegister(2), i.MemoryOperand());
643 break; 643 break;
644 case kMipsLwc1: { 644 case kMipsLwc1: {
645 __ lwc1(i.OutputSingleRegister(), i.MemoryOperand()); 645 __ lwc1(i.OutputSingleRegister(), i.MemoryOperand());
646 break; 646 break;
647 } 647 }
648 case kMipsSwc1: { 648 case kMipsSwc1: {
649 int index = 0; 649 size_t index = 0;
650 MemOperand operand = i.MemoryOperand(&index); 650 MemOperand operand = i.MemoryOperand(&index);
651 __ swc1(i.InputSingleRegister(index), operand); 651 __ swc1(i.InputSingleRegister(index), operand);
652 break; 652 break;
653 } 653 }
654 case kMipsLdc1: 654 case kMipsLdc1:
655 __ ldc1(i.OutputDoubleRegister(), i.MemoryOperand()); 655 __ ldc1(i.OutputDoubleRegister(), i.MemoryOperand());
656 break; 656 break;
657 case kMipsSdc1: 657 case kMipsSdc1:
658 __ sdc1(i.InputDoubleRegister(2), i.MemoryOperand()); 658 __ sdc1(i.InputDoubleRegister(2), i.MemoryOperand());
659 break; 659 break;
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 } 1198 }
1199 } 1199 }
1200 MarkLazyDeoptSite(); 1200 MarkLazyDeoptSite();
1201 } 1201 }
1202 1202
1203 #undef __ 1203 #undef __
1204 1204
1205 } // namespace compiler 1205 } // namespace compiler
1206 } // namespace internal 1206 } // namespace internal
1207 } // namespace v8 1207 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698