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

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

Issue 778113002: [x86] Slow case of TruncateDoubleToI shouldn't be inline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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/x64/code-generator-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/gap-resolver.h" 8 #include "src/compiler/gap-resolver.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 public: 184 public:
185 OutOfLineLoadFloat(CodeGenerator* gen, XMMRegister result) 185 OutOfLineLoadFloat(CodeGenerator* gen, XMMRegister result)
186 : OutOfLineCode(gen), result_(result) {} 186 : OutOfLineCode(gen), result_(result) {}
187 187
188 void Generate() FINAL { __ pcmpeqd(result_, result_); } 188 void Generate() FINAL { __ pcmpeqd(result_, result_); }
189 189
190 private: 190 private:
191 XMMRegister const result_; 191 XMMRegister const result_;
192 }; 192 };
193 193
194
195 class OutOfLineTruncateDoubleToI FINAL : public OutOfLineCode {
196 public:
197 OutOfLineTruncateDoubleToI(CodeGenerator* gen, Register result,
198 XMMRegister input)
199 : OutOfLineCode(gen), result_(result), input_(input) {}
200
201 void Generate() FINAL {
202 __ sub(esp, Immediate(kDoubleSize));
203 __ movsd(MemOperand(esp, 0), input_);
204 __ SlowTruncateToI(result_, esp, 0);
205 __ add(esp, Immediate(kDoubleSize));
206 }
207
208 private:
209 Register const result_;
210 XMMRegister const input_;
211 };
212
194 } // namespace 213 } // namespace
195 214
196 215
197 #define ASSEMBLE_CHECKED_LOAD_FLOAT(asm_instr) \ 216 #define ASSEMBLE_CHECKED_LOAD_FLOAT(asm_instr) \
198 do { \ 217 do { \
199 auto result = i.OutputDoubleRegister(); \ 218 auto result = i.OutputDoubleRegister(); \
200 auto offset = i.InputRegister(0); \ 219 auto offset = i.InputRegister(0); \
201 if (instr->InputAt(1)->IsRegister()) { \ 220 if (instr->InputAt(1)->IsRegister()) { \
202 __ cmp(offset, i.InputRegister(1)); \ 221 __ cmp(offset, i.InputRegister(1)); \
203 } else { \ 222 } else { \
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 break; 313 break;
295 case kArchNop: 314 case kArchNop:
296 // don't emit code for nops. 315 // don't emit code for nops.
297 break; 316 break;
298 case kArchRet: 317 case kArchRet:
299 AssembleReturn(); 318 AssembleReturn();
300 break; 319 break;
301 case kArchStackPointer: 320 case kArchStackPointer:
302 __ mov(i.OutputRegister(), esp); 321 __ mov(i.OutputRegister(), esp);
303 break; 322 break;
304 case kArchTruncateDoubleToI: 323 case kArchTruncateDoubleToI: {
305 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); 324 auto result = i.OutputRegister();
325 auto input = i.InputDoubleRegister(0);
326 auto ool = new (zone()) OutOfLineTruncateDoubleToI(this, result, input);
327 __ cvttsd2si(result, Operand(input));
328 __ cmp(result, 1);
329 __ j(overflow, ool->entry());
330 __ bind(ool->exit());
306 break; 331 break;
332 }
307 case kIA32Add: 333 case kIA32Add:
308 if (HasImmediateInput(instr, 1)) { 334 if (HasImmediateInput(instr, 1)) {
309 __ add(i.InputOperand(0), i.InputImmediate(1)); 335 __ add(i.InputOperand(0), i.InputImmediate(1));
310 } else { 336 } else {
311 __ add(i.InputRegister(0), i.InputOperand(1)); 337 __ add(i.InputRegister(0), i.InputOperand(1));
312 } 338 }
313 break; 339 break;
314 case kIA32And: 340 case kIA32And:
315 if (HasImmediateInput(instr, 1)) { 341 if (HasImmediateInput(instr, 1)) {
316 __ and_(i.InputOperand(0), i.InputImmediate(1)); 342 __ and_(i.InputOperand(0), i.InputImmediate(1));
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 } 1213 }
1188 } 1214 }
1189 MarkLazyDeoptSite(); 1215 MarkLazyDeoptSite();
1190 } 1216 }
1191 1217
1192 #undef __ 1218 #undef __
1193 1219
1194 } // namespace compiler 1220 } // namespace compiler
1195 } // namespace internal 1221 } // namespace internal
1196 } // namespace v8 1222 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698