| 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
| 9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 frame_access_state()->GetFrameOffset(i.InputInt32(0)); | 696 frame_access_state()->GetFrameOffset(i.InputInt32(0)); |
| 697 Register base; | 697 Register base; |
| 698 if (offset.from_stack_pointer()) { | 698 if (offset.from_stack_pointer()) { |
| 699 base = esp; | 699 base = esp; |
| 700 } else { | 700 } else { |
| 701 base = ebp; | 701 base = ebp; |
| 702 } | 702 } |
| 703 __ lea(i.OutputRegister(), Operand(base, offset.offset())); | 703 __ lea(i.OutputRegister(), Operand(base, offset.offset())); |
| 704 break; | 704 break; |
| 705 } | 705 } |
| 706 case kIeee754Float64Log: { |
| 707 // Saves the esp into ebx |
| 708 __ push(ebx); |
| 709 __ mov(ebx, esp); |
| 710 // Pass one double as argument on the stack. |
| 711 __ PrepareCallCFunction(2, eax); |
| 712 __ fstp(0); |
| 713 // Load operand from original stack |
| 714 __ fld_d(MemOperand(ebx, 4)); |
| 715 // Put operand into stack for function call |
| 716 __ fstp_d(Operand(esp, 0)); |
| 717 __ CallCFunction(ExternalReference::ieee754_log_function(isolate()), 2); |
| 718 // Restore the ebx |
| 719 __ pop(ebx); |
| 720 // Return value is in st(0) on x87. |
| 721 __ lea(esp, Operand(esp, kDoubleSize)); |
| 722 break; |
| 723 } |
| 706 case kX87Add: | 724 case kX87Add: |
| 707 if (HasImmediateInput(instr, 1)) { | 725 if (HasImmediateInput(instr, 1)) { |
| 708 __ add(i.InputOperand(0), i.InputImmediate(1)); | 726 __ add(i.InputOperand(0), i.InputImmediate(1)); |
| 709 } else { | 727 } else { |
| 710 __ add(i.InputRegister(0), i.InputOperand(1)); | 728 __ add(i.InputRegister(0), i.InputOperand(1)); |
| 711 } | 729 } |
| 712 break; | 730 break; |
| 713 case kX87And: | 731 case kX87And: |
| 714 if (HasImmediateInput(instr, 1)) { | 732 if (HasImmediateInput(instr, 1)) { |
| 715 __ and_(i.InputOperand(0), i.InputImmediate(1)); | 733 __ and_(i.InputOperand(0), i.InputImmediate(1)); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 } else { | 914 } else { |
| 897 __ ror_cl(i.OutputOperand()); | 915 __ ror_cl(i.OutputOperand()); |
| 898 } | 916 } |
| 899 break; | 917 break; |
| 900 case kX87Lzcnt: | 918 case kX87Lzcnt: |
| 901 __ Lzcnt(i.OutputRegister(), i.InputOperand(0)); | 919 __ Lzcnt(i.OutputRegister(), i.InputOperand(0)); |
| 902 break; | 920 break; |
| 903 case kX87Popcnt: | 921 case kX87Popcnt: |
| 904 __ Popcnt(i.OutputRegister(), i.InputOperand(0)); | 922 __ Popcnt(i.OutputRegister(), i.InputOperand(0)); |
| 905 break; | 923 break; |
| 906 case kX87Float64Log: | |
| 907 if (FLAG_debug_code && FLAG_enable_slow_asserts) { | |
| 908 __ VerifyX87StackDepth(1); | |
| 909 } | |
| 910 __ X87SetFPUCW(0x027F); | |
| 911 __ fstp(0); | |
| 912 __ fldln2(); | |
| 913 __ fld_d(MemOperand(esp, 0)); | |
| 914 __ fyl2x(); | |
| 915 __ lea(esp, Operand(esp, kDoubleSize)); | |
| 916 __ X87SetFPUCW(0x037F); | |
| 917 break; | |
| 918 case kX87LoadFloat64Constant: { | 924 case kX87LoadFloat64Constant: { |
| 919 InstructionOperand* source = instr->InputAt(0); | 925 InstructionOperand* source = instr->InputAt(0); |
| 920 InstructionOperand* destination = instr->Output(); | 926 InstructionOperand* destination = instr->Output(); |
| 921 DCHECK(source->IsConstant()); | 927 DCHECK(source->IsConstant()); |
| 922 X87OperandConverter g(this, nullptr); | 928 X87OperandConverter g(this, nullptr); |
| 923 Constant src_constant = g.ToConstant(source); | 929 Constant src_constant = g.ToConstant(source); |
| 924 | 930 |
| 925 DCHECK_EQ(Constant::kFloat64, src_constant.type()); | 931 DCHECK_EQ(Constant::kFloat64, src_constant.type()); |
| 926 uint64_t src = bit_cast<uint64_t>(src_constant.ToFloat64()); | 932 uint64_t src = bit_cast<uint64_t>(src_constant.ToFloat64()); |
| 927 uint32_t lower = static_cast<uint32_t>(src); | 933 uint32_t lower = static_cast<uint32_t>(src); |
| (...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2512 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2518 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
| 2513 __ Nop(padding_size); | 2519 __ Nop(padding_size); |
| 2514 } | 2520 } |
| 2515 } | 2521 } |
| 2516 | 2522 |
| 2517 #undef __ | 2523 #undef __ |
| 2518 | 2524 |
| 2519 } // namespace compiler | 2525 } // namespace compiler |
| 2520 } // namespace internal | 2526 } // namespace internal |
| 2521 } // namespace v8 | 2527 } // namespace v8 |
| OLD | NEW |