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

Side by Side Diff: src/compiler/mips/code-generator-mips.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/ia32/code-generator-ia32.cc ('k') | src/compiler/mips64/code-generator-mips64.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 #include "src/compiler/code-generator-impl.h" 6 #include "src/compiler/code-generator-impl.h"
7 #include "src/compiler/gap-resolver.h" 7 #include "src/compiler/gap-resolver.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/mips/macro-assembler-mips.h" 9 #include "src/mips/macro-assembler-mips.h"
10 #include "src/scopes.h" 10 #include "src/scopes.h"
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 906
907 void CodeGenerator::AssembleDeoptimizerCall(int deoptimization_id) { 907 void CodeGenerator::AssembleDeoptimizerCall(int deoptimization_id) {
908 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( 908 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
909 isolate(), deoptimization_id, Deoptimizer::LAZY); 909 isolate(), deoptimization_id, Deoptimizer::LAZY);
910 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); 910 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
911 } 911 }
912 912
913 913
914 void CodeGenerator::AssemblePrologue() { 914 void CodeGenerator::AssemblePrologue() {
915 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 915 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
916 int stack_slots = frame()->GetSpillSlotCount();
916 if (descriptor->kind() == CallDescriptor::kCallAddress) { 917 if (descriptor->kind() == CallDescriptor::kCallAddress) {
917 __ Push(ra, fp); 918 __ Push(ra, fp);
918 __ mov(fp, sp); 919 __ mov(fp, sp);
919 const RegList saves = descriptor->CalleeSavedRegisters(); 920 const RegList saves = descriptor->CalleeSavedRegisters();
920 if (saves != 0) { // Save callee-saved registers. 921 if (saves != 0) { // Save callee-saved registers.
921 // TODO(plind): make callee save size const, possibly DCHECK it. 922 // TODO(plind): make callee save size const, possibly DCHECK it.
922 int register_save_area_size = 0; 923 int register_save_area_size = 0;
923 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { 924 for (int i = Register::kNumRegisters - 1; i >= 0; i--) {
924 if (!((1 << i) & saves)) continue; 925 if (!((1 << i) & saves)) continue;
925 register_save_area_size += kPointerSize; 926 register_save_area_size += kPointerSize;
926 } 927 }
927 frame()->SetRegisterSaveAreaSize(register_save_area_size); 928 frame()->SetRegisterSaveAreaSize(register_save_area_size);
928 __ MultiPush(saves); 929 __ MultiPush(saves);
929 } 930 }
930 } else if (descriptor->IsJSFunctionCall()) { 931 } else if (descriptor->IsJSFunctionCall()) {
931 CompilationInfo* info = this->info(); 932 CompilationInfo* info = this->info();
932 __ Prologue(info->IsCodePreAgingActive()); 933 __ Prologue(info->IsCodePreAgingActive());
933 frame()->SetRegisterSaveAreaSize( 934 frame()->SetRegisterSaveAreaSize(
934 StandardFrameConstants::kFixedFrameSizeFromFp); 935 StandardFrameConstants::kFixedFrameSizeFromFp);
935 } else { 936 } else if (stack_slots > 0) {
936 __ StubPrologue(); 937 __ StubPrologue();
937 frame()->SetRegisterSaveAreaSize( 938 frame()->SetRegisterSaveAreaSize(
938 StandardFrameConstants::kFixedFrameSizeFromFp); 939 StandardFrameConstants::kFixedFrameSizeFromFp);
939 } 940 }
940 int stack_slots = frame()->GetSpillSlotCount();
941 941
942 if (info()->is_osr()) { 942 if (info()->is_osr()) {
943 // TurboFan OSR-compiled functions cannot be entered directly. 943 // TurboFan OSR-compiled functions cannot be entered directly.
944 __ Abort(kShouldNotDirectlyEnterOsrFunction); 944 __ Abort(kShouldNotDirectlyEnterOsrFunction);
945 945
946 // Unoptimized code jumps directly to this entrypoint while the unoptimized 946 // Unoptimized code jumps directly to this entrypoint while the unoptimized
947 // frame is still on the stack. Optimized code uses OSR values directly from 947 // frame is still on the stack. Optimized code uses OSR values directly from
948 // the unoptimized frame. Thus, all that needs to be done is to allocate the 948 // the unoptimized frame. Thus, all that needs to be done is to allocate the
949 // remaining stack slots. 949 // remaining stack slots.
950 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); 950 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
951 osr_pc_offset_ = __ pc_offset(); 951 osr_pc_offset_ = __ pc_offset();
952 DCHECK(stack_slots >= frame()->GetOsrStackSlotCount()); 952 DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
953 stack_slots -= frame()->GetOsrStackSlotCount(); 953 stack_slots -= frame()->GetOsrStackSlotCount();
954 } 954 }
955 955
956 if (stack_slots > 0) { 956 if (stack_slots > 0) {
957 __ Subu(sp, sp, Operand(stack_slots * kPointerSize)); 957 __ Subu(sp, sp, Operand(stack_slots * kPointerSize));
958 } 958 }
959 } 959 }
960 960
961 961
962 void CodeGenerator::AssembleReturn() { 962 void CodeGenerator::AssembleReturn() {
963 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 963 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
964 int stack_slots = frame()->GetSpillSlotCount();
964 if (descriptor->kind() == CallDescriptor::kCallAddress) { 965 if (descriptor->kind() == CallDescriptor::kCallAddress) {
965 if (frame()->GetRegisterSaveAreaSize() > 0) { 966 if (frame()->GetRegisterSaveAreaSize() > 0) {
966 // Remove this frame's spill slots first. 967 // Remove this frame's spill slots first.
967 int stack_slots = frame()->GetSpillSlotCount();
968 if (stack_slots > 0) { 968 if (stack_slots > 0) {
969 __ Addu(sp, sp, Operand(stack_slots * kPointerSize)); 969 __ Addu(sp, sp, Operand(stack_slots * kPointerSize));
970 } 970 }
971 // Restore registers. 971 // Restore registers.
972 const RegList saves = descriptor->CalleeSavedRegisters(); 972 const RegList saves = descriptor->CalleeSavedRegisters();
973 if (saves != 0) { 973 if (saves != 0) {
974 __ MultiPop(saves); 974 __ MultiPop(saves);
975 } 975 }
976 } 976 }
977 __ mov(sp, fp); 977 __ mov(sp, fp);
978 __ Pop(ra, fp); 978 __ Pop(ra, fp);
979 __ Ret(); 979 __ Ret();
980 } else { 980 } else if (descriptor->IsJSFunctionCall() || stack_slots > 0) {
981 __ mov(sp, fp); 981 __ mov(sp, fp);
982 __ Pop(ra, fp); 982 __ Pop(ra, fp);
983 int pop_count = descriptor->IsJSFunctionCall() 983 int pop_count = descriptor->IsJSFunctionCall()
984 ? static_cast<int>(descriptor->JSParameterCount()) 984 ? static_cast<int>(descriptor->JSParameterCount())
985 : 0; 985 : 0;
986 __ DropAndRet(pop_count); 986 __ DropAndRet(pop_count);
987 } else {
988 __ Ret();
987 } 989 }
988 } 990 }
989 991
990 992
991 void CodeGenerator::AssembleMove(InstructionOperand* source, 993 void CodeGenerator::AssembleMove(InstructionOperand* source,
992 InstructionOperand* destination) { 994 InstructionOperand* destination) {
993 MipsOperandConverter g(this, NULL); 995 MipsOperandConverter g(this, NULL);
994 // Dispatch on the source and destination operand kinds. Not all 996 // Dispatch on the source and destination operand kinds. Not all
995 // combinations are possible. 997 // combinations are possible.
996 if (source->IsRegister()) { 998 if (source->IsRegister()) {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 } 1185 }
1184 } 1186 }
1185 MarkLazyDeoptSite(); 1187 MarkLazyDeoptSite();
1186 } 1188 }
1187 1189
1188 #undef __ 1190 #undef __
1189 1191
1190 } // namespace compiler 1192 } // namespace compiler
1191 } // namespace internal 1193 } // namespace internal
1192 } // namespace v8 1194 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ia32/code-generator-ia32.cc ('k') | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698