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 #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 16 matching lines...) Expand all Loading... |
27 #define TRACE_MSG(msg) \ | 27 #define TRACE_MSG(msg) \ |
28 PrintF("code_gen: \'%s\' in function %s at line %d\n", msg, __FUNCTION__, \ | 28 PrintF("code_gen: \'%s\' in function %s at line %d\n", msg, __FUNCTION__, \ |
29 __LINE__) | 29 __LINE__) |
30 | 30 |
31 #define TRACE_UNIMPL() \ | 31 #define TRACE_UNIMPL() \ |
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(size_t 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(size_t index) { | 46 FloatRegister InputSingleRegister(size_t index) { |
47 return ToSingleRegister(instr_->InputAt(index)); | 47 return ToSingleRegister(instr_->InputAt(index)); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 }; | 117 }; |
118 | 118 |
119 | 119 |
120 static inline bool HasRegisterInput(Instruction* instr, size_t index) { | 120 static inline bool HasRegisterInput(Instruction* instr, size_t index) { |
121 return instr->InputAt(index)->IsRegister(); | 121 return instr->InputAt(index)->IsRegister(); |
122 } | 122 } |
123 | 123 |
124 | 124 |
125 namespace { | 125 namespace { |
126 | 126 |
127 class OutOfLineLoadSingle FINAL : public OutOfLineCode { | 127 class OutOfLineLoadSingle final : public OutOfLineCode { |
128 public: | 128 public: |
129 OutOfLineLoadSingle(CodeGenerator* gen, FloatRegister result) | 129 OutOfLineLoadSingle(CodeGenerator* gen, FloatRegister result) |
130 : OutOfLineCode(gen), result_(result) {} | 130 : OutOfLineCode(gen), result_(result) {} |
131 | 131 |
132 void Generate() FINAL { | 132 void Generate() final { |
133 __ Move(result_, std::numeric_limits<float>::quiet_NaN()); | 133 __ Move(result_, std::numeric_limits<float>::quiet_NaN()); |
134 } | 134 } |
135 | 135 |
136 private: | 136 private: |
137 FloatRegister const result_; | 137 FloatRegister const result_; |
138 }; | 138 }; |
139 | 139 |
140 | 140 |
141 class OutOfLineLoadDouble FINAL : public OutOfLineCode { | 141 class OutOfLineLoadDouble final : public OutOfLineCode { |
142 public: | 142 public: |
143 OutOfLineLoadDouble(CodeGenerator* gen, DoubleRegister result) | 143 OutOfLineLoadDouble(CodeGenerator* gen, DoubleRegister result) |
144 : OutOfLineCode(gen), result_(result) {} | 144 : OutOfLineCode(gen), result_(result) {} |
145 | 145 |
146 void Generate() FINAL { | 146 void Generate() final { |
147 __ Move(result_, std::numeric_limits<double>::quiet_NaN()); | 147 __ Move(result_, std::numeric_limits<double>::quiet_NaN()); |
148 } | 148 } |
149 | 149 |
150 private: | 150 private: |
151 DoubleRegister const result_; | 151 DoubleRegister const result_; |
152 }; | 152 }; |
153 | 153 |
154 | 154 |
155 class OutOfLineLoadInteger FINAL : public OutOfLineCode { | 155 class OutOfLineLoadInteger final : public OutOfLineCode { |
156 public: | 156 public: |
157 OutOfLineLoadInteger(CodeGenerator* gen, Register result) | 157 OutOfLineLoadInteger(CodeGenerator* gen, Register result) |
158 : OutOfLineCode(gen), result_(result) {} | 158 : OutOfLineCode(gen), result_(result) {} |
159 | 159 |
160 void Generate() FINAL { __ mov(result_, zero_reg); } | 160 void Generate() final { __ mov(result_, zero_reg); } |
161 | 161 |
162 private: | 162 private: |
163 Register const result_; | 163 Register const result_; |
164 }; | 164 }; |
165 | 165 |
166 | 166 |
167 class OutOfLineRound : public OutOfLineCode { | 167 class OutOfLineRound : public OutOfLineCode { |
168 public: | 168 public: |
169 OutOfLineRound(CodeGenerator* gen, DoubleRegister result) | 169 OutOfLineRound(CodeGenerator* gen, DoubleRegister result) |
170 : OutOfLineCode(gen), result_(result) {} | 170 : OutOfLineCode(gen), result_(result) {} |
171 | 171 |
172 void Generate() FINAL { | 172 void Generate() final { |
173 // Handle rounding to zero case where sign has to be preserved. | 173 // Handle rounding to zero case where sign has to be preserved. |
174 // High bits of double input already in kScratchReg. | 174 // High bits of double input already in kScratchReg. |
175 __ srl(at, kScratchReg, 31); | 175 __ srl(at, kScratchReg, 31); |
176 __ sll(at, at, 31); | 176 __ sll(at, at, 31); |
177 __ Mthc1(at, result_); | 177 __ Mthc1(at, result_); |
178 } | 178 } |
179 | 179 |
180 private: | 180 private: |
181 DoubleRegister const result_; | 181 DoubleRegister const result_; |
182 }; | 182 }; |
183 | 183 |
184 | 184 |
185 class OutOfLineTruncate FINAL : public OutOfLineRound { | 185 class OutOfLineTruncate final : public OutOfLineRound { |
186 public: | 186 public: |
187 OutOfLineTruncate(CodeGenerator* gen, DoubleRegister result) | 187 OutOfLineTruncate(CodeGenerator* gen, DoubleRegister result) |
188 : OutOfLineRound(gen, result) {} | 188 : OutOfLineRound(gen, result) {} |
189 }; | 189 }; |
190 | 190 |
191 | 191 |
192 class OutOfLineFloor FINAL : public OutOfLineRound { | 192 class OutOfLineFloor final : public OutOfLineRound { |
193 public: | 193 public: |
194 OutOfLineFloor(CodeGenerator* gen, DoubleRegister result) | 194 OutOfLineFloor(CodeGenerator* gen, DoubleRegister result) |
195 : OutOfLineRound(gen, result) {} | 195 : OutOfLineRound(gen, result) {} |
196 }; | 196 }; |
197 | 197 |
198 | 198 |
199 class OutOfLineCeil FINAL : public OutOfLineRound { | 199 class OutOfLineCeil final : public OutOfLineRound { |
200 public: | 200 public: |
201 OutOfLineCeil(CodeGenerator* gen, DoubleRegister result) | 201 OutOfLineCeil(CodeGenerator* gen, DoubleRegister result) |
202 : OutOfLineRound(gen, result) {} | 202 : OutOfLineRound(gen, result) {} |
203 }; | 203 }; |
204 | 204 |
205 | 205 |
206 Condition FlagsConditionToConditionCmp(FlagsCondition condition) { | 206 Condition FlagsConditionToConditionCmp(FlagsCondition condition) { |
207 switch (condition) { | 207 switch (condition) { |
208 case kEqual: | 208 case kEqual: |
209 return eq; | 209 return eq; |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 } | 1299 } |
1300 } | 1300 } |
1301 MarkLazyDeoptSite(); | 1301 MarkLazyDeoptSite(); |
1302 } | 1302 } |
1303 | 1303 |
1304 #undef __ | 1304 #undef __ |
1305 | 1305 |
1306 } // namespace compiler | 1306 } // namespace compiler |
1307 } // namespace internal | 1307 } // namespace internal |
1308 } // namespace v8 | 1308 } // namespace v8 |
OLD | NEW |