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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 7353017: 2011-07-13: Version 3.4.12 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/code-stubs-x64.h ('k') | src/x64/codegen-x64.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 break; 635 break;
636 case Token::BIT_NOT: 636 case Token::BIT_NOT:
637 __ InvokeBuiltin(Builtins::BIT_NOT, JUMP_FUNCTION); 637 __ InvokeBuiltin(Builtins::BIT_NOT, JUMP_FUNCTION);
638 break; 638 break;
639 default: 639 default:
640 UNREACHABLE(); 640 UNREACHABLE();
641 } 641 }
642 } 642 }
643 643
644 644
645 const char* UnaryOpStub::GetName() { 645 void UnaryOpStub::PrintName(StringStream* stream) {
646 if (name_ != NULL) return name_;
647 const int kMaxNameLength = 100;
648 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
649 kMaxNameLength);
650 if (name_ == NULL) return "OOM";
651 const char* op_name = Token::Name(op_); 646 const char* op_name = Token::Name(op_);
652 const char* overwrite_name = NULL; // Make g++ happy. 647 const char* overwrite_name = NULL; // Make g++ happy.
653 switch (mode_) { 648 switch (mode_) {
654 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; 649 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break;
655 case UNARY_OVERWRITE: overwrite_name = "Overwrite"; break; 650 case UNARY_OVERWRITE: overwrite_name = "Overwrite"; break;
656 } 651 }
657 652 stream->Add("UnaryOpStub_%s_%s_%s",
658 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), 653 op_name,
659 "UnaryOpStub_%s_%s_%s", 654 overwrite_name,
660 op_name, 655 UnaryOpIC::GetName(operand_type_));
661 overwrite_name,
662 UnaryOpIC::GetName(operand_type_));
663 return name_;
664 } 656 }
665 657
666 658
667 void BinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) { 659 void BinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) {
668 __ pop(rcx); // Save return address. 660 __ pop(rcx); // Save return address.
669 __ push(rdx); 661 __ push(rdx);
670 __ push(rax); 662 __ push(rax);
671 // Left and right arguments are now on top. 663 // Left and right arguments are now on top.
672 // Push this stub's key. Although the operation and the type info are 664 // Push this stub's key. Although the operation and the type info are
673 // encoded into the key, the encoding is opaque, so push them too. 665 // encoded into the key, the encoding is opaque, so push them too.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 break; 706 break;
715 case BinaryOpIC::GENERIC: 707 case BinaryOpIC::GENERIC:
716 GenerateGeneric(masm); 708 GenerateGeneric(masm);
717 break; 709 break;
718 default: 710 default:
719 UNREACHABLE(); 711 UNREACHABLE();
720 } 712 }
721 } 713 }
722 714
723 715
724 const char* BinaryOpStub::GetName() { 716 void BinaryOpStub::PrintName(StringStream* stream) {
725 if (name_ != NULL) return name_;
726 const int kMaxNameLength = 100;
727 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
728 kMaxNameLength);
729 if (name_ == NULL) return "OOM";
730 const char* op_name = Token::Name(op_); 717 const char* op_name = Token::Name(op_);
731 const char* overwrite_name; 718 const char* overwrite_name;
732 switch (mode_) { 719 switch (mode_) {
733 case NO_OVERWRITE: overwrite_name = "Alloc"; break; 720 case NO_OVERWRITE: overwrite_name = "Alloc"; break;
734 case OVERWRITE_RIGHT: overwrite_name = "OverwriteRight"; break; 721 case OVERWRITE_RIGHT: overwrite_name = "OverwriteRight"; break;
735 case OVERWRITE_LEFT: overwrite_name = "OverwriteLeft"; break; 722 case OVERWRITE_LEFT: overwrite_name = "OverwriteLeft"; break;
736 default: overwrite_name = "UnknownOverwrite"; break; 723 default: overwrite_name = "UnknownOverwrite"; break;
737 } 724 }
738 725 stream->Add("BinaryOpStub_%s_%s_%s",
739 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), 726 op_name,
740 "BinaryOpStub_%s_%s_%s", 727 overwrite_name,
741 op_name, 728 BinaryOpIC::GetName(operands_type_));
742 overwrite_name,
743 BinaryOpIC::GetName(operands_type_));
744 return name_;
745 } 729 }
746 730
747 731
748 void BinaryOpStub::GenerateSmiCode( 732 void BinaryOpStub::GenerateSmiCode(
749 MacroAssembler* masm, 733 MacroAssembler* masm,
750 Label* slow, 734 Label* slow,
751 SmiCodeGenerateHeapNumberResults allow_heapnumber_results) { 735 SmiCodeGenerateHeapNumberResults allow_heapnumber_results) {
752 736
753 // Arguments to BinaryOpStub are in rdx and rax. 737 // Arguments to BinaryOpStub are in rdx and rax.
754 Register left = rdx; 738 Register left = rdx;
(...skipping 2688 matching lines...) Expand 10 before | Expand all | Expand 10 after
3443 __ bind(&throw_termination_exception); 3427 __ bind(&throw_termination_exception);
3444 GenerateThrowUncatchable(masm, TERMINATION); 3428 GenerateThrowUncatchable(masm, TERMINATION);
3445 3429
3446 __ bind(&throw_normal_exception); 3430 __ bind(&throw_normal_exception);
3447 GenerateThrowTOS(masm); 3431 GenerateThrowTOS(masm);
3448 } 3432 }
3449 3433
3450 3434
3451 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { 3435 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
3452 Label invoke, exit; 3436 Label invoke, exit;
3453 #ifdef ENABLE_LOGGING_AND_PROFILING
3454 Label not_outermost_js, not_outermost_js_2; 3437 Label not_outermost_js, not_outermost_js_2;
3455 #endif
3456 { // NOLINT. Scope block confuses linter. 3438 { // NOLINT. Scope block confuses linter.
3457 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); 3439 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm);
3458 // Setup frame. 3440 // Setup frame.
3459 __ push(rbp); 3441 __ push(rbp);
3460 __ movq(rbp, rsp); 3442 __ movq(rbp, rsp);
3461 3443
3462 // Push the stack frame type marker twice. 3444 // Push the stack frame type marker twice.
3463 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; 3445 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
3464 // Scratch register is neither callee-save, nor an argument register on any 3446 // Scratch register is neither callee-save, nor an argument register on any
3465 // platform. It's free to use at this point. 3447 // platform. It's free to use at this point.
(...skipping 24 matching lines...) Expand all
3490 3472
3491 Isolate* isolate = masm->isolate(); 3473 Isolate* isolate = masm->isolate();
3492 3474
3493 // Save copies of the top frame descriptor on the stack. 3475 // Save copies of the top frame descriptor on the stack.
3494 ExternalReference c_entry_fp(Isolate::k_c_entry_fp_address, isolate); 3476 ExternalReference c_entry_fp(Isolate::k_c_entry_fp_address, isolate);
3495 { 3477 {
3496 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); 3478 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp);
3497 __ push(c_entry_fp_operand); 3479 __ push(c_entry_fp_operand);
3498 } 3480 }
3499 3481
3500 #ifdef ENABLE_LOGGING_AND_PROFILING
3501 // If this is the outermost JS call, set js_entry_sp value. 3482 // If this is the outermost JS call, set js_entry_sp value.
3502 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate); 3483 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate);
3503 __ Load(rax, js_entry_sp); 3484 __ Load(rax, js_entry_sp);
3504 __ testq(rax, rax); 3485 __ testq(rax, rax);
3505 __ j(not_zero, &not_outermost_js); 3486 __ j(not_zero, &not_outermost_js);
3506 __ Push(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)); 3487 __ Push(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME));
3507 __ movq(rax, rbp); 3488 __ movq(rax, rbp);
3508 __ Store(js_entry_sp, rax); 3489 __ Store(js_entry_sp, rax);
3509 Label cont; 3490 Label cont;
3510 __ jmp(&cont); 3491 __ jmp(&cont);
3511 __ bind(&not_outermost_js); 3492 __ bind(&not_outermost_js);
3512 __ Push(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME)); 3493 __ Push(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME));
3513 __ bind(&cont); 3494 __ bind(&cont);
3514 #endif
3515 3495
3516 // Call a faked try-block that does the invoke. 3496 // Call a faked try-block that does the invoke.
3517 __ call(&invoke); 3497 __ call(&invoke);
3518 3498
3519 // Caught exception: Store result (exception) in the pending 3499 // Caught exception: Store result (exception) in the pending
3520 // exception field in the JSEnv and return a failure sentinel. 3500 // exception field in the JSEnv and return a failure sentinel.
3521 ExternalReference pending_exception(Isolate::k_pending_exception_address, 3501 ExternalReference pending_exception(Isolate::k_pending_exception_address,
3522 isolate); 3502 isolate);
3523 __ Store(pending_exception, rax); 3503 __ Store(pending_exception, rax);
3524 __ movq(rax, Failure::Exception(), RelocInfo::NONE); 3504 __ movq(rax, Failure::Exception(), RelocInfo::NONE);
(...skipping 23 matching lines...) Expand all
3548 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate); 3528 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate);
3549 __ Load(rax, entry); 3529 __ Load(rax, entry);
3550 } 3530 }
3551 __ lea(kScratchRegister, FieldOperand(rax, Code::kHeaderSize)); 3531 __ lea(kScratchRegister, FieldOperand(rax, Code::kHeaderSize));
3552 __ call(kScratchRegister); 3532 __ call(kScratchRegister);
3553 3533
3554 // Unlink this frame from the handler chain. 3534 // Unlink this frame from the handler chain.
3555 __ PopTryHandler(); 3535 __ PopTryHandler();
3556 3536
3557 __ bind(&exit); 3537 __ bind(&exit);
3558 #ifdef ENABLE_LOGGING_AND_PROFILING
3559 // Check if the current stack frame is marked as the outermost JS frame. 3538 // Check if the current stack frame is marked as the outermost JS frame.
3560 __ pop(rbx); 3539 __ pop(rbx);
3561 __ Cmp(rbx, Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)); 3540 __ Cmp(rbx, Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME));
3562 __ j(not_equal, &not_outermost_js_2); 3541 __ j(not_equal, &not_outermost_js_2);
3563 __ movq(kScratchRegister, js_entry_sp); 3542 __ movq(kScratchRegister, js_entry_sp);
3564 __ movq(Operand(kScratchRegister, 0), Immediate(0)); 3543 __ movq(Operand(kScratchRegister, 0), Immediate(0));
3565 __ bind(&not_outermost_js_2); 3544 __ bind(&not_outermost_js_2);
3566 #endif
3567 3545
3568 // Restore the top frame descriptor from the stack. 3546 // Restore the top frame descriptor from the stack.
3569 { Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); 3547 { Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp);
3570 __ pop(c_entry_fp_operand); 3548 __ pop(c_entry_fp_operand);
3571 } 3549 }
3572 3550
3573 // Restore callee-saved registers (X64 conventions). 3551 // Restore callee-saved registers (X64 conventions).
3574 __ pop(rbx); 3552 __ pop(rbx);
3575 #ifdef _WIN64 3553 #ifdef _WIN64
3576 // Callee save on in Win64 ABI, arguments/volatile in AMD64 ABI. 3554 // Callee save on in Win64 ABI, arguments/volatile in AMD64 ABI.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
3765 | RegisterField::encode(false) // lhs_ and rhs_ are not used 3743 | RegisterField::encode(false) // lhs_ and rhs_ are not used
3766 | StrictField::encode(strict_) 3744 | StrictField::encode(strict_)
3767 | NeverNanNanField::encode(cc_ == equal ? never_nan_nan_ : false) 3745 | NeverNanNanField::encode(cc_ == equal ? never_nan_nan_ : false)
3768 | IncludeNumberCompareField::encode(include_number_compare_) 3746 | IncludeNumberCompareField::encode(include_number_compare_)
3769 | IncludeSmiCompareField::encode(include_smi_compare_); 3747 | IncludeSmiCompareField::encode(include_smi_compare_);
3770 } 3748 }
3771 3749
3772 3750
3773 // Unfortunately you have to run without snapshots to see most of these 3751 // Unfortunately you have to run without snapshots to see most of these
3774 // names in the profile since most compare stubs end up in the snapshot. 3752 // names in the profile since most compare stubs end up in the snapshot.
3775 const char* CompareStub::GetName() { 3753 void CompareStub::PrintName(StringStream* stream) {
3776 ASSERT(lhs_.is(no_reg) && rhs_.is(no_reg)); 3754 ASSERT(lhs_.is(no_reg) && rhs_.is(no_reg));
3777
3778 if (name_ != NULL) return name_;
3779 const int kMaxNameLength = 100;
3780 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
3781 kMaxNameLength);
3782 if (name_ == NULL) return "OOM";
3783
3784 const char* cc_name; 3755 const char* cc_name;
3785 switch (cc_) { 3756 switch (cc_) {
3786 case less: cc_name = "LT"; break; 3757 case less: cc_name = "LT"; break;
3787 case greater: cc_name = "GT"; break; 3758 case greater: cc_name = "GT"; break;
3788 case less_equal: cc_name = "LE"; break; 3759 case less_equal: cc_name = "LE"; break;
3789 case greater_equal: cc_name = "GE"; break; 3760 case greater_equal: cc_name = "GE"; break;
3790 case equal: cc_name = "EQ"; break; 3761 case equal: cc_name = "EQ"; break;
3791 case not_equal: cc_name = "NE"; break; 3762 case not_equal: cc_name = "NE"; break;
3792 default: cc_name = "UnknownCondition"; break; 3763 default: cc_name = "UnknownCondition"; break;
3793 } 3764 }
3794 3765 bool is_equality = cc_ == equal || cc_ == not_equal;
3795 const char* strict_name = ""; 3766 stream->Add("CompareStub_%s", cc_name);
3796 if (strict_ && (cc_ == equal || cc_ == not_equal)) { 3767 if (strict_ && is_equality) stream->Add("_STRICT");
3797 strict_name = "_STRICT"; 3768 if (never_nan_nan_ && is_equality) stream->Add("_NO_NAN");
3798 } 3769 if (!include_number_compare_) stream->Add("_NO_NUMBER");
3799 3770 if (!include_smi_compare_) stream->Add("_NO_SMI");
3800 const char* never_nan_nan_name = "";
3801 if (never_nan_nan_ && (cc_ == equal || cc_ == not_equal)) {
3802 never_nan_nan_name = "_NO_NAN";
3803 }
3804
3805 const char* include_number_compare_name = "";
3806 if (!include_number_compare_) {
3807 include_number_compare_name = "_NO_NUMBER";
3808 }
3809
3810 const char* include_smi_compare_name = "";
3811 if (!include_smi_compare_) {
3812 include_smi_compare_name = "_NO_SMI";
3813 }
3814
3815 OS::SNPrintF(Vector<char>(name_, kMaxNameLength),
3816 "CompareStub_%s%s%s%s",
3817 cc_name,
3818 strict_name,
3819 never_nan_nan_name,
3820 include_number_compare_name,
3821 include_smi_compare_name);
3822 return name_;
3823 } 3771 }
3824 3772
3825 3773
3826 // ------------------------------------------------------------------------- 3774 // -------------------------------------------------------------------------
3827 // StringCharCodeAtGenerator 3775 // StringCharCodeAtGenerator
3828 3776
3829 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { 3777 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
3830 Label flat_string; 3778 Label flat_string;
3831 Label ascii_string; 3779 Label ascii_string;
3832 Label got_char_code; 3780 Label got_char_code;
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
5333 __ Drop(1); 5281 __ Drop(1);
5334 __ ret(2 * kPointerSize); 5282 __ ret(2 * kPointerSize);
5335 } 5283 }
5336 5284
5337 5285
5338 #undef __ 5286 #undef __
5339 5287
5340 } } // namespace v8::internal 5288 } } // namespace v8::internal
5341 5289
5342 #endif // V8_TARGET_ARCH_X64 5290 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.h ('k') | src/x64/codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698