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

Side by Side Diff: src/compiler/mips64/code-generator-mips64.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/mips/code-generator-mips.cc ('k') | src/compiler/x64/code-generator-x64.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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 1036
1037 void CodeGenerator::AssembleDeoptimizerCall(int deoptimization_id) { 1037 void CodeGenerator::AssembleDeoptimizerCall(int deoptimization_id) {
1038 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( 1038 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry(
1039 isolate(), deoptimization_id, Deoptimizer::LAZY); 1039 isolate(), deoptimization_id, Deoptimizer::LAZY);
1040 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); 1040 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY);
1041 } 1041 }
1042 1042
1043 1043
1044 void CodeGenerator::AssemblePrologue() { 1044 void CodeGenerator::AssemblePrologue() {
1045 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1045 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1046 int stack_slots = frame()->GetSpillSlotCount();
1046 if (descriptor->kind() == CallDescriptor::kCallAddress) { 1047 if (descriptor->kind() == CallDescriptor::kCallAddress) {
1047 __ Push(ra, fp); 1048 __ Push(ra, fp);
1048 __ mov(fp, sp); 1049 __ mov(fp, sp);
1049 const RegList saves = descriptor->CalleeSavedRegisters(); 1050 const RegList saves = descriptor->CalleeSavedRegisters();
1050 if (saves != 0) { // Save callee-saved registers. 1051 if (saves != 0) { // Save callee-saved registers.
1051 // TODO(plind): make callee save size const, possibly DCHECK it. 1052 // TODO(plind): make callee save size const, possibly DCHECK it.
1052 int register_save_area_size = 0; 1053 int register_save_area_size = 0;
1053 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { 1054 for (int i = Register::kNumRegisters - 1; i >= 0; i--) {
1054 if (!((1 << i) & saves)) continue; 1055 if (!((1 << i) & saves)) continue;
1055 register_save_area_size += kPointerSize; 1056 register_save_area_size += kPointerSize;
1056 } 1057 }
1057 frame()->SetRegisterSaveAreaSize(register_save_area_size); 1058 frame()->SetRegisterSaveAreaSize(register_save_area_size);
1058 __ MultiPush(saves); 1059 __ MultiPush(saves);
1059 } 1060 }
1060 } else if (descriptor->IsJSFunctionCall()) { 1061 } else if (descriptor->IsJSFunctionCall()) {
1061 CompilationInfo* info = this->info(); 1062 CompilationInfo* info = this->info();
1062 __ Prologue(info->IsCodePreAgingActive()); 1063 __ Prologue(info->IsCodePreAgingActive());
1063 frame()->SetRegisterSaveAreaSize( 1064 frame()->SetRegisterSaveAreaSize(
1064 StandardFrameConstants::kFixedFrameSizeFromFp); 1065 StandardFrameConstants::kFixedFrameSizeFromFp);
1065 } else { 1066 } else if (stack_slots > 0) {
1066 __ StubPrologue(); 1067 __ StubPrologue();
1067 frame()->SetRegisterSaveAreaSize( 1068 frame()->SetRegisterSaveAreaSize(
1068 StandardFrameConstants::kFixedFrameSizeFromFp); 1069 StandardFrameConstants::kFixedFrameSizeFromFp);
1069 } 1070 }
1070 int stack_slots = frame()->GetSpillSlotCount();
1071 1071
1072 if (info()->is_osr()) { 1072 if (info()->is_osr()) {
1073 // TurboFan OSR-compiled functions cannot be entered directly. 1073 // TurboFan OSR-compiled functions cannot be entered directly.
1074 __ Abort(kShouldNotDirectlyEnterOsrFunction); 1074 __ Abort(kShouldNotDirectlyEnterOsrFunction);
1075 1075
1076 // Unoptimized code jumps directly to this entrypoint while the unoptimized 1076 // Unoptimized code jumps directly to this entrypoint while the unoptimized
1077 // frame is still on the stack. Optimized code uses OSR values directly from 1077 // frame is still on the stack. Optimized code uses OSR values directly from
1078 // the unoptimized frame. Thus, all that needs to be done is to allocate the 1078 // the unoptimized frame. Thus, all that needs to be done is to allocate the
1079 // remaining stack slots. 1079 // remaining stack slots.
1080 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); 1080 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
1081 osr_pc_offset_ = __ pc_offset(); 1081 osr_pc_offset_ = __ pc_offset();
1082 DCHECK(stack_slots >= frame()->GetOsrStackSlotCount()); 1082 DCHECK(stack_slots >= frame()->GetOsrStackSlotCount());
1083 stack_slots -= frame()->GetOsrStackSlotCount(); 1083 stack_slots -= frame()->GetOsrStackSlotCount();
1084 } 1084 }
1085 1085
1086 if (stack_slots > 0) { 1086 if (stack_slots > 0) {
1087 __ Dsubu(sp, sp, Operand(stack_slots * kPointerSize)); 1087 __ Dsubu(sp, sp, Operand(stack_slots * kPointerSize));
1088 } 1088 }
1089 } 1089 }
1090 1090
1091 1091
1092 void CodeGenerator::AssembleReturn() { 1092 void CodeGenerator::AssembleReturn() {
1093 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1093 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1094 int stack_slots = frame()->GetSpillSlotCount();
1094 if (descriptor->kind() == CallDescriptor::kCallAddress) { 1095 if (descriptor->kind() == CallDescriptor::kCallAddress) {
1095 if (frame()->GetRegisterSaveAreaSize() > 0) { 1096 if (frame()->GetRegisterSaveAreaSize() > 0) {
1096 // Remove this frame's spill slots first. 1097 // Remove this frame's spill slots first.
1097 int stack_slots = frame()->GetSpillSlotCount();
1098 if (stack_slots > 0) { 1098 if (stack_slots > 0) {
1099 __ Daddu(sp, sp, Operand(stack_slots * kPointerSize)); 1099 __ Daddu(sp, sp, Operand(stack_slots * kPointerSize));
1100 } 1100 }
1101 // Restore registers. 1101 // Restore registers.
1102 const RegList saves = descriptor->CalleeSavedRegisters(); 1102 const RegList saves = descriptor->CalleeSavedRegisters();
1103 if (saves != 0) { 1103 if (saves != 0) {
1104 __ MultiPop(saves); 1104 __ MultiPop(saves);
1105 } 1105 }
1106 } 1106 }
1107 __ mov(sp, fp); 1107 __ mov(sp, fp);
1108 __ Pop(ra, fp); 1108 __ Pop(ra, fp);
1109 __ Ret(); 1109 __ Ret();
1110 } else { 1110 } else if (descriptor->IsJSFunctionCall() || stack_slots > 0) {
1111 __ mov(sp, fp); 1111 __ mov(sp, fp);
1112 __ Pop(ra, fp); 1112 __ Pop(ra, fp);
1113 int pop_count = descriptor->IsJSFunctionCall() 1113 int pop_count = descriptor->IsJSFunctionCall()
1114 ? static_cast<int>(descriptor->JSParameterCount()) 1114 ? static_cast<int>(descriptor->JSParameterCount())
1115 : 0; 1115 : 0;
1116 __ DropAndRet(pop_count); 1116 __ DropAndRet(pop_count);
1117 } else {
1118 __ Ret();
1117 } 1119 }
1118 } 1120 }
1119 1121
1120 1122
1121 void CodeGenerator::AssembleMove(InstructionOperand* source, 1123 void CodeGenerator::AssembleMove(InstructionOperand* source,
1122 InstructionOperand* destination) { 1124 InstructionOperand* destination) {
1123 MipsOperandConverter g(this, NULL); 1125 MipsOperandConverter g(this, NULL);
1124 // Dispatch on the source and destination operand kinds. Not all 1126 // Dispatch on the source and destination operand kinds. Not all
1125 // combinations are possible. 1127 // combinations are possible.
1126 if (source->IsRegister()) { 1128 if (source->IsRegister()) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 } 1309 }
1308 } 1310 }
1309 MarkLazyDeoptSite(); 1311 MarkLazyDeoptSite();
1310 } 1312 }
1311 1313
1312 #undef __ 1314 #undef __
1313 1315
1314 } // namespace compiler 1316 } // namespace compiler
1315 } // namespace internal 1317 } // namespace internal
1316 } // namespace v8 1318 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/compiler/x64/code-generator-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698