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

Side by Side Diff: src/x64/codegen-x64.cc

Issue 23480031: Enable preaging of code objects when --optimize-for-size. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Rebase and add MIPS support Created 7 years, 2 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 __ subsd(result, double_scratch); 671 __ subsd(result, double_scratch);
672 __ addsd(result, Operand(kScratchRegister, 8 * kDoubleSize)); 672 __ addsd(result, Operand(kScratchRegister, 8 * kDoubleSize));
673 __ mulsd(result, input); 673 __ mulsd(result, input);
674 674
675 __ bind(&done); 675 __ bind(&done);
676 } 676 }
677 677
678 #undef __ 678 #undef __
679 679
680 680
681 static const int kNoCodeAgeSequenceLength = 6;
682
683 static byte* GetNoCodeAgeSequence(uint32_t* length) { 681 static byte* GetNoCodeAgeSequence(uint32_t* length) {
684 static bool initialized = false; 682 static bool initialized = false;
685 static byte sequence[kNoCodeAgeSequenceLength]; 683 static byte sequence[kNoCodeAgeSequenceLength];
686 *length = kNoCodeAgeSequenceLength; 684 *length = kNoCodeAgeSequenceLength;
687 if (!initialized) { 685 if (!initialized) {
688 // The sequence of instructions that is patched out for aging code is the 686 // The sequence of instructions that is patched out for aging code is the
689 // following boilerplate stack-building prologue that is found both in 687 // following boilerplate stack-building prologue that is found both in
690 // FUNCTION and OPTIMIZED_FUNCTION code: 688 // FUNCTION and OPTIMIZED_FUNCTION code:
691 CodePatcher patcher(sequence, kNoCodeAgeSequenceLength); 689 CodePatcher patcher(sequence, kNoCodeAgeSequenceLength);
692 patcher.masm()->push(rbp); 690 patcher.masm()->push(rbp);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 MarkingParity parity) { 727 MarkingParity parity) {
730 uint32_t young_length; 728 uint32_t young_length;
731 byte* young_sequence = GetNoCodeAgeSequence(&young_length); 729 byte* young_sequence = GetNoCodeAgeSequence(&young_length);
732 if (age == kNoAge) { 730 if (age == kNoAge) {
733 CopyBytes(sequence, young_sequence, young_length); 731 CopyBytes(sequence, young_sequence, young_length);
734 CPU::FlushICache(sequence, young_length); 732 CPU::FlushICache(sequence, young_length);
735 } else { 733 } else {
736 Code* stub = GetCodeAgeStub(isolate, age, parity); 734 Code* stub = GetCodeAgeStub(isolate, age, parity);
737 CodePatcher patcher(sequence, young_length); 735 CodePatcher patcher(sequence, young_length);
738 patcher.masm()->call(stub->instruction_start()); 736 patcher.masm()->call(stub->instruction_start());
739 for (int i = 0; 737 patcher.masm()->Nop(
740 i < kNoCodeAgeSequenceLength - Assembler::kShortCallInstructionLength; 738 kNoCodeAgeSequenceLength - Assembler::kShortCallInstructionLength);
741 i++) {
742 patcher.masm()->nop();
743 }
744 } 739 }
745 } 740 }
746 741
747 742
748 Operand StackArgumentsAccessor::GetArgumentOperand(int index) { 743 Operand StackArgumentsAccessor::GetArgumentOperand(int index) {
749 ASSERT(index >= 0); 744 ASSERT(index >= 0);
750 int receiver = (receiver_mode_ == ARGUMENTS_CONTAIN_RECEIVER) ? 1 : 0; 745 int receiver = (receiver_mode_ == ARGUMENTS_CONTAIN_RECEIVER) ? 1 : 0;
751 int displacement_to_last_argument = base_reg_.is(rsp) ? 746 int displacement_to_last_argument = base_reg_.is(rsp) ?
752 kPCOnStackSize : kFPOnStackSize + kPCOnStackSize; 747 kPCOnStackSize : kFPOnStackSize + kPCOnStackSize;
753 displacement_to_last_argument += extra_displacement_to_last_argument_; 748 displacement_to_last_argument += extra_displacement_to_last_argument_;
754 if (argument_count_reg_.is(no_reg)) { 749 if (argument_count_reg_.is(no_reg)) {
755 // argument[0] is at base_reg_ + displacement_to_last_argument + 750 // argument[0] is at base_reg_ + displacement_to_last_argument +
756 // (argument_count_immediate_ + receiver - 1) * kPointerSize. 751 // (argument_count_immediate_ + receiver - 1) * kPointerSize.
757 ASSERT(argument_count_immediate_ + receiver > 0); 752 ASSERT(argument_count_immediate_ + receiver > 0);
758 return Operand(base_reg_, displacement_to_last_argument + 753 return Operand(base_reg_, displacement_to_last_argument +
759 (argument_count_immediate_ + receiver - 1 - index) * kPointerSize); 754 (argument_count_immediate_ + receiver - 1 - index) * kPointerSize);
760 } else { 755 } else {
761 // argument[0] is at base_reg_ + displacement_to_last_argument + 756 // argument[0] is at base_reg_ + displacement_to_last_argument +
762 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. 757 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize.
763 return Operand(base_reg_, argument_count_reg_, times_pointer_size, 758 return Operand(base_reg_, argument_count_reg_, times_pointer_size,
764 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); 759 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize);
765 } 760 }
766 } 761 }
767 762
768 763
769 } } // namespace v8::internal 764 } } // namespace v8::internal
770 765
771 #endif // V8_TARGET_ARCH_X64 766 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698