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

Side by Side Diff: src/compiler/x87/code-generator-x87.cc

Issue 2093423003: X87: [builtins] Introduce proper Float64Atan and Float64Atan2 operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months 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 | « no previous file | src/compiler/x87/instruction-selector-x87.cc » ('j') | 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/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
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_BINOP(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(4, eax); \
380 __ fstp(0); \
381 /* Load first operand from original stack */ \
382 __ fld_d(MemOperand(ebx, 4 + kDoubleSize)); \
383 /* Put first operand into stack for function call */ \
384 __ fstp_d(Operand(esp, 0 * kDoubleSize)); \
385 /* Load second operand from original stack */ \
386 __ fld_d(MemOperand(ebx, 4)); \
387 /* Put second operand into stack for function call */ \
388 __ fstp_d(Operand(esp, 1 * kDoubleSize)); \
389 __ CallCFunction(ExternalReference::ieee754_##name##_function(isolate()), \
390 4); \
391 /* Restore the ebx */ \
392 __ pop(ebx); \
393 /* Return value is in st(0) on x87. */ \
394 __ lea(esp, Operand(esp, 2 * kDoubleSize)); \
395 } while (false)
396
373 #define ASSEMBLE_IEEE754_UNOP(name) \ 397 #define ASSEMBLE_IEEE754_UNOP(name) \
374 do { \ 398 do { \
375 /* Saves the esp into ebx */ \ 399 /* Saves the esp into ebx */ \
376 __ push(ebx); \ 400 __ push(ebx); \
377 __ mov(ebx, esp); \ 401 __ mov(ebx, esp); \
378 /* Pass one double as argument on the stack. */ \ 402 /* Pass one double as argument on the stack. */ \
379 __ PrepareCallCFunction(2, eax); \ 403 __ PrepareCallCFunction(2, eax); \
380 __ fstp(0); \ 404 __ fstp(0); \
381 /* Load operand from original stack */ \ 405 /* Load operand from original stack */ \
382 __ fld_d(MemOperand(ebx, 4)); \ 406 __ fld_d(MemOperand(ebx, 4)); \
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 frame_access_state()->GetFrameOffset(i.InputInt32(0)); 740 frame_access_state()->GetFrameOffset(i.InputInt32(0));
717 Register base; 741 Register base;
718 if (offset.from_stack_pointer()) { 742 if (offset.from_stack_pointer()) {
719 base = esp; 743 base = esp;
720 } else { 744 } else {
721 base = ebp; 745 base = ebp;
722 } 746 }
723 __ lea(i.OutputRegister(), Operand(base, offset.offset())); 747 __ lea(i.OutputRegister(), Operand(base, offset.offset()));
724 break; 748 break;
725 } 749 }
750 case kIeee754Float64Atan:
751 ASSEMBLE_IEEE754_UNOP(atan);
752 break;
753 case kIeee754Float64Atan2:
754 ASSEMBLE_IEEE754_BINOP(atan2);
755 break;
726 case kIeee754Float64Log: 756 case kIeee754Float64Log:
727 ASSEMBLE_IEEE754_UNOP(log); 757 ASSEMBLE_IEEE754_UNOP(log);
728 break; 758 break;
729 case kIeee754Float64Log1p: 759 case kIeee754Float64Log1p:
730 ASSEMBLE_IEEE754_UNOP(log1p); 760 ASSEMBLE_IEEE754_UNOP(log1p);
731 break; 761 break;
732 case kX87Add: 762 case kX87Add:
733 if (HasImmediateInput(instr, 1)) { 763 if (HasImmediateInput(instr, 1)) {
734 __ add(i.InputOperand(0), i.InputImmediate(1)); 764 __ add(i.InputOperand(0), i.InputImmediate(1));
735 } else { 765 } else {
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 2556 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
2527 __ Nop(padding_size); 2557 __ Nop(padding_size);
2528 } 2558 }
2529 } 2559 }
2530 2560
2531 #undef __ 2561 #undef __
2532 2562
2533 } // namespace compiler 2563 } // namespace compiler
2534 } // namespace internal 2564 } // namespace internal
2535 } // namespace v8 2565 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/x87/instruction-selector-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698