OLD | NEW |
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 #define ASSEMBLE_DOUBLE_BINOP(asm_instr) \ | 200 #define ASSEMBLE_DOUBLE_BINOP(asm_instr) \ |
201 do { \ | 201 do { \ |
202 if (instr->InputAt(1)->IsDoubleRegister()) { \ | 202 if (instr->InputAt(1)->IsDoubleRegister()) { \ |
203 __ asm_instr(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); \ | 203 __ asm_instr(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); \ |
204 } else { \ | 204 } else { \ |
205 __ asm_instr(i.InputDoubleRegister(0), i.InputOperand(1)); \ | 205 __ asm_instr(i.InputDoubleRegister(0), i.InputOperand(1)); \ |
206 } \ | 206 } \ |
207 } while (0) | 207 } while (0) |
208 | 208 |
209 | 209 |
| 210 #define ASSEMBLE_AVX_DOUBLE_BINOP(asm_instr) \ |
| 211 do { \ |
| 212 CpuFeatureScope avx_scope(masm(), AVX); \ |
| 213 if (instr->InputAt(1)->IsDoubleRegister()) { \ |
| 214 __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0), \ |
| 215 i.InputDoubleRegister(1)); \ |
| 216 } else { \ |
| 217 __ asm_instr(i.OutputDoubleRegister(), i.InputDoubleRegister(0), \ |
| 218 i.InputOperand(1)); \ |
| 219 } \ |
| 220 } while (0) |
| 221 |
| 222 |
210 // Assembles an instruction after register allocation, producing machine code. | 223 // Assembles an instruction after register allocation, producing machine code. |
211 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { | 224 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
212 X64OperandConverter i(this, instr); | 225 X64OperandConverter i(this, instr); |
213 | 226 |
214 switch (ArchOpcodeField::decode(instr->opcode())) { | 227 switch (ArchOpcodeField::decode(instr->opcode())) { |
215 case kArchCallCodeObject: { | 228 case kArchCallCodeObject: { |
216 EnsureSpaceForLazyDeopt(); | 229 EnsureSpaceForLazyDeopt(); |
217 if (HasImmediateInput(instr, 0)) { | 230 if (HasImmediateInput(instr, 0)) { |
218 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); | 231 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); |
219 __ Call(code, RelocInfo::CODE_TARGET); | 232 __ Call(code, RelocInfo::CODE_TARGET); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 488 } |
476 break; | 489 break; |
477 case kSSEUint32ToFloat64: | 490 case kSSEUint32ToFloat64: |
478 if (instr->InputAt(0)->IsRegister()) { | 491 if (instr->InputAt(0)->IsRegister()) { |
479 __ movl(kScratchRegister, i.InputRegister(0)); | 492 __ movl(kScratchRegister, i.InputRegister(0)); |
480 } else { | 493 } else { |
481 __ movl(kScratchRegister, i.InputOperand(0)); | 494 __ movl(kScratchRegister, i.InputOperand(0)); |
482 } | 495 } |
483 __ cvtqsi2sd(i.OutputDoubleRegister(), kScratchRegister); | 496 __ cvtqsi2sd(i.OutputDoubleRegister(), kScratchRegister); |
484 break; | 497 break; |
| 498 case kAVXFloat64Add: |
| 499 ASSEMBLE_AVX_DOUBLE_BINOP(vaddsd); |
| 500 break; |
| 501 case kAVXFloat64Sub: |
| 502 ASSEMBLE_AVX_DOUBLE_BINOP(vsubsd); |
| 503 break; |
| 504 case kAVXFloat64Mul: |
| 505 ASSEMBLE_AVX_DOUBLE_BINOP(vmulsd); |
| 506 break; |
| 507 case kAVXFloat64Div: |
| 508 ASSEMBLE_AVX_DOUBLE_BINOP(vdivsd); |
| 509 break; |
485 case kX64Movsxbl: | 510 case kX64Movsxbl: |
486 if (instr->addressing_mode() != kMode_None) { | 511 if (instr->addressing_mode() != kMode_None) { |
487 __ movsxbl(i.OutputRegister(), i.MemoryOperand()); | 512 __ movsxbl(i.OutputRegister(), i.MemoryOperand()); |
488 } else if (instr->InputAt(0)->IsRegister()) { | 513 } else if (instr->InputAt(0)->IsRegister()) { |
489 __ movsxbl(i.OutputRegister(), i.InputRegister(0)); | 514 __ movsxbl(i.OutputRegister(), i.InputRegister(0)); |
490 } else { | 515 } else { |
491 __ movsxbl(i.OutputRegister(), i.InputOperand(0)); | 516 __ movsxbl(i.OutputRegister(), i.InputOperand(0)); |
492 } | 517 } |
493 __ AssertZeroExtended(i.OutputRegister()); | 518 __ AssertZeroExtended(i.OutputRegister()); |
494 break; | 519 break; |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 } | 1060 } |
1036 } | 1061 } |
1037 MarkLazyDeoptSite(); | 1062 MarkLazyDeoptSite(); |
1038 } | 1063 } |
1039 | 1064 |
1040 #undef __ | 1065 #undef __ |
1041 | 1066 |
1042 } // namespace internal | 1067 } // namespace internal |
1043 } // namespace compiler | 1068 } // namespace compiler |
1044 } // namespace v8 | 1069 } // namespace v8 |
OLD | NEW |