| 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/ia32/assembler-ia32.h" | 10 #include "src/ia32/assembler-ia32.h" |
| 11 #include "src/ia32/macro-assembler-ia32.h" | 11 #include "src/ia32/macro-assembler-ia32.h" |
| 12 #include "src/scopes.h" | 12 #include "src/scopes.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 namespace compiler { | 16 namespace compiler { |
| 17 | 17 |
| 18 #define __ masm()-> | 18 #define __ masm()-> |
| 19 | 19 |
| 20 | 20 |
| 21 // Adds IA-32 specific methods for decoding operands. | 21 // Adds IA-32 specific methods for decoding operands. |
| 22 class IA32OperandConverter : public InstructionOperandConverter { | 22 class IA32OperandConverter : public InstructionOperandConverter { |
| 23 public: | 23 public: |
| 24 IA32OperandConverter(CodeGenerator* gen, Instruction* instr) | 24 IA32OperandConverter(CodeGenerator* gen, Instruction* instr) |
| 25 : InstructionOperandConverter(gen, instr) {} | 25 : InstructionOperandConverter(gen, instr) {} |
| 26 | 26 |
| 27 Operand InputOperand(size_t index) { | 27 Operand InputOperand(size_t index, int extra = 0) { |
| 28 return ToOperand(instr_->InputAt(index)); | 28 return ToOperand(instr_->InputAt(index), extra); |
| 29 } | 29 } |
| 30 | 30 |
| 31 Immediate InputImmediate(size_t index) { | 31 Immediate InputImmediate(size_t index) { |
| 32 return ToImmediate(instr_->InputAt(index)); | 32 return ToImmediate(instr_->InputAt(index)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 Operand OutputOperand() { return ToOperand(instr_->Output()); } | 35 Operand OutputOperand() { return ToOperand(instr_->Output()); } |
| 36 | 36 |
| 37 Operand ToOperand(InstructionOperand* op, int extra = 0) { | 37 Operand ToOperand(InstructionOperand* op, int extra = 0) { |
| 38 if (op->IsRegister()) { | 38 if (op->IsRegister()) { |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 __ cvttsd2si(i.OutputRegister(), scratch); | 524 __ cvttsd2si(i.OutputRegister(), scratch); |
| 525 __ add(i.OutputRegister(), Immediate(0x80000000)); | 525 __ add(i.OutputRegister(), Immediate(0x80000000)); |
| 526 break; | 526 break; |
| 527 } | 527 } |
| 528 case kSSEInt32ToFloat64: | 528 case kSSEInt32ToFloat64: |
| 529 __ cvtsi2sd(i.OutputDoubleRegister(), i.InputOperand(0)); | 529 __ cvtsi2sd(i.OutputDoubleRegister(), i.InputOperand(0)); |
| 530 break; | 530 break; |
| 531 case kSSEUint32ToFloat64: | 531 case kSSEUint32ToFloat64: |
| 532 __ LoadUint32(i.OutputDoubleRegister(), i.InputOperand(0)); | 532 __ LoadUint32(i.OutputDoubleRegister(), i.InputOperand(0)); |
| 533 break; | 533 break; |
| 534 case kSSEFloat64ExtractLowWord32: |
| 535 if (instr->InputAt(0)->IsDoubleStackSlot()) { |
| 536 __ mov(i.OutputRegister(), i.InputOperand(0)); |
| 537 } else { |
| 538 __ movd(i.OutputRegister(), i.InputDoubleRegister(0)); |
| 539 } |
| 540 break; |
| 541 case kSSEFloat64ExtractHighWord32: |
| 542 if (instr->InputAt(0)->IsDoubleStackSlot()) { |
| 543 __ mov(i.OutputRegister(), i.InputOperand(0, kDoubleSize / 2)); |
| 544 } else { |
| 545 __ Pextrd(i.OutputRegister(), i.InputDoubleRegister(0), 1); |
| 546 } |
| 547 break; |
| 548 case kSSEFloat64InsertLowWord32: |
| 549 __ Pinsrd(i.OutputDoubleRegister(), i.InputOperand(1), 0); |
| 550 break; |
| 551 case kSSEFloat64InsertHighWord32: |
| 552 __ Pinsrd(i.OutputDoubleRegister(), i.InputOperand(1), 1); |
| 553 break; |
| 554 case kSSEFloat64LoadLowWord32: |
| 555 __ movd(i.OutputDoubleRegister(), i.InputOperand(0)); |
| 556 break; |
| 534 case kAVXFloat64Add: { | 557 case kAVXFloat64Add: { |
| 535 CpuFeatureScope avx_scope(masm(), AVX); | 558 CpuFeatureScope avx_scope(masm(), AVX); |
| 536 __ vaddsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), | 559 __ vaddsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), |
| 537 i.InputOperand(1)); | 560 i.InputOperand(1)); |
| 538 break; | 561 break; |
| 539 } | 562 } |
| 540 case kAVXFloat64Sub: { | 563 case kAVXFloat64Sub: { |
| 541 CpuFeatureScope avx_scope(masm(), AVX); | 564 CpuFeatureScope avx_scope(masm(), AVX); |
| 542 __ vsubsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), | 565 __ vsubsd(i.OutputDoubleRegister(), i.InputDoubleRegister(0), |
| 543 i.InputOperand(1)); | 566 i.InputOperand(1)); |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 } | 1314 } |
| 1292 } | 1315 } |
| 1293 MarkLazyDeoptSite(); | 1316 MarkLazyDeoptSite(); |
| 1294 } | 1317 } |
| 1295 | 1318 |
| 1296 #undef __ | 1319 #undef __ |
| 1297 | 1320 |
| 1298 } // namespace compiler | 1321 } // namespace compiler |
| 1299 } // namespace internal | 1322 } // namespace internal |
| 1300 } // namespace v8 | 1323 } // namespace v8 |
| OLD | NEW |