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

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

Issue 2060743002: [builtins] Introduce proper Float64Log1p operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@Math_Log
Patch Set: REBASE Created 4 years, 6 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
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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } else { \ 356 } else { \
357 if (instr->InputAt(1)->IsRegister()) { \ 357 if (instr->InputAt(1)->IsRegister()) { \
358 __ asm_instr(i.InputRegister(0), i.InputRegister(1)); \ 358 __ asm_instr(i.InputRegister(0), i.InputRegister(1)); \
359 } else { \ 359 } else { \
360 __ asm_instr(i.InputRegister(0), i.InputOperand(1)); \ 360 __ asm_instr(i.InputRegister(0), i.InputOperand(1)); \
361 } \ 361 } \
362 } \ 362 } \
363 } \ 363 } \
364 } while (0) 364 } while (0)
365 365
366 #define ASSEMBLE_IEEE754_UNOP(name) \
367 do { \
368 /* Pass one double as argument on the stack.*/ \
369 __ PrepareCallCFunction(2, eax); \
370 __ movsd(Operand(esp, 0 * kDoubleSize), i.InputDoubleRegister(0)); \
371 __ CallCFunction(ExternalReference::ieee754_##name##_function(isolate()), \
372 2); \
373 /* Return value is in st(0) on ia32. */ \
374 /* Store it into the result register. */ \
375 __ sub(esp, Immediate(kDoubleSize)); \
376 __ fstp_d(Operand(esp, 0)); \
377 __ movsd(i.OutputDoubleRegister(), Operand(esp, 0)); \
378 __ add(esp, Immediate(kDoubleSize)); \
379 } while (false)
380
366 void CodeGenerator::AssembleDeconstructFrame() { 381 void CodeGenerator::AssembleDeconstructFrame() {
367 __ mov(esp, ebp); 382 __ mov(esp, ebp);
368 __ pop(ebp); 383 __ pop(ebp);
369 } 384 }
370 385
371 void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { 386 void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) {
372 int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); 387 int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta);
373 if (sp_slot_delta > 0) { 388 if (sp_slot_delta > 0) {
374 __ add(esp, Immediate(sp_slot_delta * kPointerSize)); 389 __ add(esp, Immediate(sp_slot_delta * kPointerSize));
375 } 390 }
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 frame_access_state()->GetFrameOffset(i.InputInt32(0)); 625 frame_access_state()->GetFrameOffset(i.InputInt32(0));
611 Register base; 626 Register base;
612 if (offset.from_stack_pointer()) { 627 if (offset.from_stack_pointer()) {
613 base = esp; 628 base = esp;
614 } else { 629 } else {
615 base = ebp; 630 base = ebp;
616 } 631 }
617 __ lea(i.OutputRegister(), Operand(base, offset.offset())); 632 __ lea(i.OutputRegister(), Operand(base, offset.offset()));
618 break; 633 break;
619 } 634 }
620 case kIeee754Float64Log: { 635 case kIeee754Float64Log:
621 // Pass one double as argument on the stack. 636 ASSEMBLE_IEEE754_UNOP(log);
622 __ PrepareCallCFunction(2, eax);
623 __ movsd(Operand(esp, 0 * kDoubleSize), i.InputDoubleRegister(0));
624 __ CallCFunction(ExternalReference::ieee754_log_function(isolate()), 2);
625 // Return value is in st(0) on ia32.
626 // Store it into the result register.
627 __ sub(esp, Immediate(kDoubleSize));
628 __ fstp_d(Operand(esp, 0));
629 __ movsd(i.OutputDoubleRegister(), Operand(esp, 0));
630 __ add(esp, Immediate(kDoubleSize));
631 break; 637 break;
632 } 638 case kIeee754Float64Log1p:
639 ASSEMBLE_IEEE754_UNOP(log1p);
640 break;
633 case kIA32Add: 641 case kIA32Add:
634 if (HasImmediateInput(instr, 1)) { 642 if (HasImmediateInput(instr, 1)) {
635 __ add(i.InputOperand(0), i.InputImmediate(1)); 643 __ add(i.InputOperand(0), i.InputImmediate(1));
636 } else { 644 } else {
637 __ add(i.InputRegister(0), i.InputOperand(1)); 645 __ add(i.InputRegister(0), i.InputOperand(1));
638 } 646 }
639 break; 647 break;
640 case kIA32And: 648 case kIA32And:
641 if (HasImmediateInput(instr, 1)) { 649 if (HasImmediateInput(instr, 1)) {
642 __ and_(i.InputOperand(0), i.InputImmediate(1)); 650 __ and_(i.InputOperand(0), i.InputImmediate(1));
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; 1983 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
1976 __ Nop(padding_size); 1984 __ Nop(padding_size);
1977 } 1985 }
1978 } 1986 }
1979 1987
1980 #undef __ 1988 #undef __
1981 1989
1982 } // namespace compiler 1990 } // namespace compiler
1983 } // namespace internal 1991 } // namespace internal
1984 } // namespace v8 1992 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698