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

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

Issue 933603002: Build stack frames for stubs only when needed. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: MIPS ports Created 5 years, 10 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 | « src/compiler/arm/code-generator-arm.cc ('k') | src/compiler/ia32/code-generator-ia32.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/arm64/macro-assembler-arm64.h" 7 #include "src/arm64/macro-assembler-arm64.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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 880
881 // TODO(dcarney): increase stack slots in frame once before first use. 881 // TODO(dcarney): increase stack slots in frame once before first use.
882 static int AlignedStackSlots(int stack_slots) { 882 static int AlignedStackSlots(int stack_slots) {
883 if (stack_slots & 1) stack_slots++; 883 if (stack_slots & 1) stack_slots++;
884 return stack_slots; 884 return stack_slots;
885 } 885 }
886 886
887 887
888 void CodeGenerator::AssemblePrologue() { 888 void CodeGenerator::AssemblePrologue() {
889 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 889 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
890 int stack_slots = frame()->GetSpillSlotCount();
890 if (descriptor->kind() == CallDescriptor::kCallAddress) { 891 if (descriptor->kind() == CallDescriptor::kCallAddress) {
891 __ SetStackPointer(csp); 892 __ SetStackPointer(csp);
892 __ Push(lr, fp); 893 __ Push(lr, fp);
893 __ Mov(fp, csp); 894 __ Mov(fp, csp);
894 // TODO(dcarney): correct callee saved registers. 895 // TODO(dcarney): correct callee saved registers.
895 __ PushCalleeSavedRegisters(); 896 __ PushCalleeSavedRegisters();
896 frame()->SetRegisterSaveAreaSize(20 * kPointerSize); 897 frame()->SetRegisterSaveAreaSize(20 * kPointerSize);
897 } else if (descriptor->IsJSFunctionCall()) { 898 } else if (descriptor->IsJSFunctionCall()) {
898 CompilationInfo* info = this->info(); 899 CompilationInfo* info = this->info();
899 __ SetStackPointer(jssp); 900 __ SetStackPointer(jssp);
900 __ Prologue(info->IsCodePreAgingActive()); 901 __ Prologue(info->IsCodePreAgingActive());
901 frame()->SetRegisterSaveAreaSize( 902 frame()->SetRegisterSaveAreaSize(
902 StandardFrameConstants::kFixedFrameSizeFromFp); 903 StandardFrameConstants::kFixedFrameSizeFromFp);
903 } else { 904 } else if (stack_slots > 0) {
904 __ SetStackPointer(jssp); 905 __ SetStackPointer(jssp);
905 __ StubPrologue(); 906 __ StubPrologue();
906 frame()->SetRegisterSaveAreaSize( 907 frame()->SetRegisterSaveAreaSize(
907 StandardFrameConstants::kFixedFrameSizeFromFp); 908 StandardFrameConstants::kFixedFrameSizeFromFp);
908 } 909 }
909 int stack_slots = frame()->GetSpillSlotCount();
910 910
911 if (info()->is_osr()) { 911 if (info()->is_osr()) {
912 // TurboFan OSR-compiled functions cannot be entered directly. 912 // TurboFan OSR-compiled functions cannot be entered directly.
913 __ Abort(kShouldNotDirectlyEnterOsrFunction); 913 __ Abort(kShouldNotDirectlyEnterOsrFunction);
914 914
915 // Unoptimized code jumps directly to this entrypoint while the unoptimized 915 // Unoptimized code jumps directly to this entrypoint while the unoptimized
916 // frame is still on the stack. Optimized code uses OSR values directly from 916 // frame is still on the stack. Optimized code uses OSR values directly from
917 // the unoptimized frame. Thus, all that needs to be done is to allocate the 917 // the unoptimized frame. Thus, all that needs to be done is to allocate the
918 // remaining stack slots. 918 // remaining stack slots.
919 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); 919 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
920 osr_pc_offset_ = __ pc_offset(); 920 osr_pc_offset_ = __ pc_offset();
921 DCHECK(stack_slots >= frame()->GetOsrStackSlotCount()); 921 DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
922 stack_slots -= frame()->GetOsrStackSlotCount(); 922 stack_slots -= frame()->GetOsrStackSlotCount();
923 } 923 }
924 924
925 if (stack_slots > 0) { 925 if (stack_slots > 0) {
926 Register sp = __ StackPointer(); 926 Register sp = __ StackPointer();
927 if (!sp.Is(csp)) { 927 if (!sp.Is(csp)) {
928 __ Sub(sp, sp, stack_slots * kPointerSize); 928 __ Sub(sp, sp, stack_slots * kPointerSize);
929 } 929 }
930 __ Sub(csp, csp, AlignedStackSlots(stack_slots) * kPointerSize); 930 __ Sub(csp, csp, AlignedStackSlots(stack_slots) * kPointerSize);
931 } 931 }
932 } 932 }
933 933
934 934
935 void CodeGenerator::AssembleReturn() { 935 void CodeGenerator::AssembleReturn() {
936 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 936 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
937 int stack_slots = frame()->GetSpillSlotCount();
937 if (descriptor->kind() == CallDescriptor::kCallAddress) { 938 if (descriptor->kind() == CallDescriptor::kCallAddress) {
938 if (frame()->GetRegisterSaveAreaSize() > 0) { 939 if (frame()->GetRegisterSaveAreaSize() > 0) {
939 // Remove this frame's spill slots first. 940 // Remove this frame's spill slots first.
940 int stack_slots = frame()->GetSpillSlotCount();
941 if (stack_slots > 0) { 941 if (stack_slots > 0) {
942 __ Add(csp, csp, AlignedStackSlots(stack_slots) * kPointerSize); 942 __ Add(csp, csp, AlignedStackSlots(stack_slots) * kPointerSize);
943 } 943 }
944 // Restore registers. 944 // Restore registers.
945 // TODO(dcarney): correct callee saved registers. 945 // TODO(dcarney): correct callee saved registers.
946 __ PopCalleeSavedRegisters(); 946 __ PopCalleeSavedRegisters();
947 } 947 }
948 __ Mov(csp, fp); 948 __ Mov(csp, fp);
949 __ Pop(fp, lr); 949 __ Pop(fp, lr);
950 __ Ret(); 950 __ Ret();
951 } else { 951 } else if (descriptor->IsJSFunctionCall() || stack_slots > 0) {
952 __ Mov(jssp, fp); 952 __ Mov(jssp, fp);
953 __ Pop(fp, lr); 953 __ Pop(fp, lr);
954 int pop_count = descriptor->IsJSFunctionCall() 954 int pop_count = descriptor->IsJSFunctionCall()
955 ? static_cast<int>(descriptor->JSParameterCount()) 955 ? static_cast<int>(descriptor->JSParameterCount())
956 : 0; 956 : 0;
957 __ Drop(pop_count); 957 __ Drop(pop_count);
958 __ Ret(); 958 __ Ret();
959 } else {
960 __ Ret();
959 } 961 }
960 } 962 }
961 963
962 964
963 void CodeGenerator::AssembleMove(InstructionOperand* source, 965 void CodeGenerator::AssembleMove(InstructionOperand* source,
964 InstructionOperand* destination) { 966 InstructionOperand* destination) {
965 Arm64OperandConverter g(this, NULL); 967 Arm64OperandConverter g(this, NULL);
966 // Dispatch on the source and destination operand kinds. Not all 968 // Dispatch on the source and destination operand kinds. Not all
967 // combinations are possible. 969 // combinations are possible.
968 if (source->IsRegister()) { 970 if (source->IsRegister()) {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 } 1134 }
1133 } 1135 }
1134 MarkLazyDeoptSite(); 1136 MarkLazyDeoptSite();
1135 } 1137 }
1136 1138
1137 #undef __ 1139 #undef __
1138 1140
1139 } // namespace compiler 1141 } // namespace compiler
1140 } // namespace internal 1142 } // namespace internal
1141 } // namespace v8 1143 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm/code-generator-arm.cc ('k') | src/compiler/ia32/code-generator-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698