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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 } else { \ | 363 } else { \ |
364 if (instr->InputAt(1)->IsRegister()) { \ | 364 if (instr->InputAt(1)->IsRegister()) { \ |
365 __ asm_instr(i.InputRegister(0), i.InputRegister(1)); \ | 365 __ asm_instr(i.InputRegister(0), i.InputRegister(1)); \ |
366 } else { \ | 366 } else { \ |
367 __ asm_instr(i.InputRegister(0), i.InputOperand(1)); \ | 367 __ asm_instr(i.InputRegister(0), i.InputOperand(1)); \ |
368 } \ | 368 } \ |
369 } \ | 369 } \ |
370 } \ | 370 } \ |
371 } while (0) | 371 } while (0) |
372 | 372 |
| 373 #define ASSEMBLE_IEEE754_UNOP(name) \ |
| 374 do { \ |
| 375 /* Saves the esp into ebx */ \ |
| 376 __ push(ebx); \ |
| 377 __ mov(ebx, esp); \ |
| 378 /* Pass one double as argument on the stack. */ \ |
| 379 __ PrepareCallCFunction(2, eax); \ |
| 380 __ fstp(0); \ |
| 381 /* Load operand from original stack */ \ |
| 382 __ fld_d(MemOperand(ebx, 4)); \ |
| 383 /* Put operand into stack for function call */ \ |
| 384 __ fstp_d(Operand(esp, 0)); \ |
| 385 __ CallCFunction(ExternalReference::ieee754_##name##_function(isolate()), \ |
| 386 2); \ |
| 387 /* Restore the ebx */ \ |
| 388 __ pop(ebx); \ |
| 389 /* Return value is in st(0) on x87. */ \ |
| 390 __ lea(esp, Operand(esp, kDoubleSize)); \ |
| 391 } while (false) |
| 392 |
373 void CodeGenerator::AssembleDeconstructFrame() { | 393 void CodeGenerator::AssembleDeconstructFrame() { |
374 __ mov(esp, ebp); | 394 __ mov(esp, ebp); |
375 __ pop(ebp); | 395 __ pop(ebp); |
376 } | 396 } |
377 | 397 |
378 void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { | 398 void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { |
379 int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); | 399 int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); |
380 if (sp_slot_delta > 0) { | 400 if (sp_slot_delta > 0) { |
381 __ add(esp, Immediate(sp_slot_delta * kPointerSize)); | 401 __ add(esp, Immediate(sp_slot_delta * kPointerSize)); |
382 } | 402 } |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 frame_access_state()->GetFrameOffset(i.InputInt32(0)); | 716 frame_access_state()->GetFrameOffset(i.InputInt32(0)); |
697 Register base; | 717 Register base; |
698 if (offset.from_stack_pointer()) { | 718 if (offset.from_stack_pointer()) { |
699 base = esp; | 719 base = esp; |
700 } else { | 720 } else { |
701 base = ebp; | 721 base = ebp; |
702 } | 722 } |
703 __ lea(i.OutputRegister(), Operand(base, offset.offset())); | 723 __ lea(i.OutputRegister(), Operand(base, offset.offset())); |
704 break; | 724 break; |
705 } | 725 } |
706 case kIeee754Float64Log: { | 726 case kIeee754Float64Log: |
707 // Saves the esp into ebx | 727 ASSEMBLE_IEEE754_UNOP(log); |
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; | 728 break; |
723 } | 729 case kIeee754Float64Log1p: |
| 730 ASSEMBLE_IEEE754_UNOP(log1p); |
| 731 break; |
724 case kX87Add: | 732 case kX87Add: |
725 if (HasImmediateInput(instr, 1)) { | 733 if (HasImmediateInput(instr, 1)) { |
726 __ add(i.InputOperand(0), i.InputImmediate(1)); | 734 __ add(i.InputOperand(0), i.InputImmediate(1)); |
727 } else { | 735 } else { |
728 __ add(i.InputRegister(0), i.InputOperand(1)); | 736 __ add(i.InputRegister(0), i.InputOperand(1)); |
729 } | 737 } |
730 break; | 738 break; |
731 case kX87And: | 739 case kX87And: |
732 if (HasImmediateInput(instr, 1)) { | 740 if (HasImmediateInput(instr, 1)) { |
733 __ and_(i.InputOperand(0), i.InputImmediate(1)); | 741 __ and_(i.InputOperand(0), i.InputImmediate(1)); |
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2526 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2519 __ Nop(padding_size); | 2527 __ Nop(padding_size); |
2520 } | 2528 } |
2521 } | 2529 } |
2522 | 2530 |
2523 #undef __ | 2531 #undef __ |
2524 | 2532 |
2525 } // namespace compiler | 2533 } // namespace compiler |
2526 } // namespace internal | 2534 } // namespace internal |
2527 } // namespace v8 | 2535 } // namespace v8 |
OLD | NEW |