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

Side by Side Diff: src/compiler/x64/code-generator-x64.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 | « src/compiler/ia32/code-generator-ia32.cc ('k') | no next file » | 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 public: 148 public:
149 OutOfLineLoadFloat(CodeGenerator* gen, XMMRegister result) 149 OutOfLineLoadFloat(CodeGenerator* gen, XMMRegister result)
150 : OutOfLineCode(gen), result_(result) {} 150 : OutOfLineCode(gen), result_(result) {}
151 151
152 void Generate() FINAL { __ pcmpeqd(result_, result_); } 152 void Generate() FINAL { __ pcmpeqd(result_, result_); }
153 153
154 private: 154 private:
155 XMMRegister const result_; 155 XMMRegister const result_;
156 }; 156 };
157 157
158
159 class OutOfLineTruncateDoubleToI FINAL : public OutOfLineCode {
160 public:
161 OutOfLineTruncateDoubleToI(CodeGenerator* gen, Register result,
162 XMMRegister input)
163 : OutOfLineCode(gen), result_(result), input_(input) {}
164
165 void Generate() FINAL {
166 __ subp(rsp, Immediate(kDoubleSize));
167 __ movsd(MemOperand(rsp, 0), input_);
168 __ SlowTruncateToI(result_, rsp, 0);
169 __ addp(rsp, Immediate(kDoubleSize));
170 }
171
172 private:
173 Register const result_;
174 XMMRegister const input_;
175 };
176
158 } // namespace 177 } // namespace
159 178
160 179
161 #define ASSEMBLE_UNOP(asm_instr) \ 180 #define ASSEMBLE_UNOP(asm_instr) \
162 do { \ 181 do { \
163 if (instr->Output()->IsRegister()) { \ 182 if (instr->Output()->IsRegister()) { \
164 __ asm_instr(i.OutputRegister()); \ 183 __ asm_instr(i.OutputRegister()); \
165 } else { \ 184 } else { \
166 __ asm_instr(i.OutputOperand()); \ 185 __ asm_instr(i.OutputOperand()); \
167 } \ 186 } \
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 break; 367 break;
349 case kArchNop: 368 case kArchNop:
350 // don't emit code for nops. 369 // don't emit code for nops.
351 break; 370 break;
352 case kArchRet: 371 case kArchRet:
353 AssembleReturn(); 372 AssembleReturn();
354 break; 373 break;
355 case kArchStackPointer: 374 case kArchStackPointer:
356 __ movq(i.OutputRegister(), rsp); 375 __ movq(i.OutputRegister(), rsp);
357 break; 376 break;
358 case kArchTruncateDoubleToI: 377 case kArchTruncateDoubleToI: {
359 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); 378 auto result = i.OutputRegister();
379 auto input = i.InputDoubleRegister(0);
380 auto ool = new (zone()) OutOfLineTruncateDoubleToI(this, result, input);
381 __ cvttsd2siq(result, input);
382 __ cmpq(result, Immediate(1));
383 __ j(overflow, ool->entry());
384 __ bind(ool->exit());
360 break; 385 break;
386 }
361 case kX64Add32: 387 case kX64Add32:
362 ASSEMBLE_BINOP(addl); 388 ASSEMBLE_BINOP(addl);
363 break; 389 break;
364 case kX64Add: 390 case kX64Add:
365 ASSEMBLE_BINOP(addq); 391 ASSEMBLE_BINOP(addq);
366 break; 392 break;
367 case kX64Sub32: 393 case kX64Sub32:
368 ASSEMBLE_BINOP(subl); 394 ASSEMBLE_BINOP(subl);
369 break; 395 break;
370 case kX64Sub: 396 case kX64Sub:
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 } 1232 }
1207 } 1233 }
1208 MarkLazyDeoptSite(); 1234 MarkLazyDeoptSite();
1209 } 1235 }
1210 1236
1211 #undef __ 1237 #undef __
1212 1238
1213 } // namespace internal 1239 } // namespace internal
1214 } // namespace compiler 1240 } // namespace compiler
1215 } // namespace v8 1241 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ia32/code-generator-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698