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

Side by Side Diff: src/crankshaft/arm64/lithium-codegen-arm64.cc

Issue 1702593002: More simplification and unification of frame handling (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm64 Created 4 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/crankshaft/arm64/lithium-codegen-arm64.h" 5 #include "src/crankshaft/arm64/lithium-codegen-arm64.h"
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 environment->HasTaggedValueAt(env_offset + i), 270 environment->HasTaggedValueAt(env_offset + i),
271 environment->HasUint32ValueAt(env_offset + i), 271 environment->HasUint32ValueAt(env_offset + i),
272 object_index_pointer, 272 object_index_pointer,
273 dematerialized_index_pointer); 273 dematerialized_index_pointer);
274 } 274 }
275 return; 275 return;
276 } 276 }
277 277
278 if (op->IsStackSlot()) { 278 if (op->IsStackSlot()) {
279 int index = op->index(); 279 int index = op->index();
280 if (index >= 0) {
281 index += StandardFrameConstants::kFixedFrameSize / kPointerSize;
282 }
283 if (is_tagged) { 280 if (is_tagged) {
284 translation->StoreStackSlot(index); 281 translation->StoreStackSlot(index);
285 } else if (is_uint32) { 282 } else if (is_uint32) {
286 translation->StoreUint32StackSlot(index); 283 translation->StoreUint32StackSlot(index);
287 } else { 284 } else {
288 translation->StoreInt32StackSlot(index); 285 translation->StoreInt32StackSlot(index);
289 } 286 }
290 } else if (op->IsDoubleStackSlot()) { 287 } else if (op->IsDoubleStackSlot()) {
291 int index = op->index(); 288 int index = op->index();
292 if (index >= 0) {
293 index += StandardFrameConstants::kFixedFrameSize / kPointerSize;
294 }
295 translation->StoreDoubleStackSlot(index); 289 translation->StoreDoubleStackSlot(index);
296 } else if (op->IsRegister()) { 290 } else if (op->IsRegister()) {
297 Register reg = ToRegister(op); 291 Register reg = ToRegister(op);
298 if (is_tagged) { 292 if (is_tagged) {
299 translation->StoreRegister(reg); 293 translation->StoreRegister(reg);
300 } else if (is_uint32) { 294 } else if (is_uint32) {
301 translation->StoreUint32Register(reg); 295 translation->StoreUint32Register(reg);
302 } else { 296 } else {
303 translation->StoreInt32Register(reg); 297 translation->StoreInt32Register(reg);
304 } 298 }
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 if (!is_aborted()) status_ = DONE; 851 if (!is_aborted()) status_ = DONE;
858 return !is_aborted(); 852 return !is_aborted();
859 } 853 }
860 854
861 855
862 bool LCodeGen::GenerateSafepointTable() { 856 bool LCodeGen::GenerateSafepointTable() {
863 DCHECK(is_done()); 857 DCHECK(is_done());
864 // We do not know how much data will be emitted for the safepoint table, so 858 // We do not know how much data will be emitted for the safepoint table, so
865 // force emission of the veneer pool. 859 // force emission of the veneer pool.
866 masm()->CheckVeneerPool(true, true); 860 masm()->CheckVeneerPool(true, true);
867 safepoints_.Emit(masm(), GetStackSlotCount()); 861 safepoints_.Emit(masm(), GetTotalFrameSlotCount());
868 return !is_aborted(); 862 return !is_aborted();
869 } 863 }
870 864
871 865
872 void LCodeGen::FinishCode(Handle<Code> code) { 866 void LCodeGen::FinishCode(Handle<Code> code) {
873 DCHECK(is_done()); 867 DCHECK(is_done());
874 code->set_stack_slots(GetStackSlotCount()); 868 code->set_stack_slots(GetTotalFrameSlotCount());
875 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); 869 code->set_safepoint_table_offset(safepoints_.GetCodeOffset());
876 PopulateDeoptimizationData(code); 870 PopulateDeoptimizationData(code);
877 } 871 }
878 872
879 873
880 void LCodeGen::DeoptimizeBranch( 874 void LCodeGen::DeoptimizeBranch(
881 LInstruction* instr, Deoptimizer::DeoptReason deopt_reason, 875 LInstruction* instr, Deoptimizer::DeoptReason deopt_reason,
882 BranchType branch_type, Register reg, int bit, 876 BranchType branch_type, Register reg, int bit,
883 Deoptimizer::BailoutType* override_bailout_type) { 877 Deoptimizer::BailoutType* override_bailout_type) {
884 LEnvironment* environment = instr->environment(); 878 LEnvironment* environment = instr->environment();
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 return -(index + 1) * kPointerSize; 1142 return -(index + 1) * kPointerSize;
1149 } 1143 }
1150 1144
1151 1145
1152 MemOperand LCodeGen::ToMemOperand(LOperand* op, StackMode stack_mode) const { 1146 MemOperand LCodeGen::ToMemOperand(LOperand* op, StackMode stack_mode) const {
1153 DCHECK(op != NULL); 1147 DCHECK(op != NULL);
1154 DCHECK(!op->IsRegister()); 1148 DCHECK(!op->IsRegister());
1155 DCHECK(!op->IsDoubleRegister()); 1149 DCHECK(!op->IsDoubleRegister());
1156 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot()); 1150 DCHECK(op->IsStackSlot() || op->IsDoubleStackSlot());
1157 if (NeedsEagerFrame()) { 1151 if (NeedsEagerFrame()) {
1158 int fp_offset = StackSlotOffset(op->index()); 1152 int fp_offset = FrameSlotToFPOffset(op->index());
1159 // Loads and stores have a bigger reach in positive offset than negative. 1153 // Loads and stores have a bigger reach in positive offset than negative.
1160 // We try to access using jssp (positive offset) first, then fall back to 1154 // We try to access using jssp (positive offset) first, then fall back to
1161 // fp (negative offset) if that fails. 1155 // fp (negative offset) if that fails.
1162 // 1156 //
1163 // We can reference a stack slot from jssp only if we know how much we've 1157 // We can reference a stack slot from jssp only if we know how much we've
1164 // put on the stack. We don't know this in the following cases: 1158 // put on the stack. We don't know this in the following cases:
1165 // - stack_mode != kCanUseStackPointer: this is the case when deferred 1159 // - stack_mode != kCanUseStackPointer: this is the case when deferred
1166 // code has saved the registers. 1160 // code has saved the registers.
1167 // - saves_caller_doubles(): some double registers have been pushed, jssp 1161 // - saves_caller_doubles(): some double registers have been pushed, jssp
1168 // references the end of the double registers and not the end of the stack 1162 // references the end of the double registers and not the end of the stack
1169 // slots. 1163 // slots.
1170 // In both of the cases above, we _could_ add the tracking information 1164 // In both of the cases above, we _could_ add the tracking information
1171 // required so that we can use jssp here, but in practice it isn't worth it. 1165 // required so that we can use jssp here, but in practice it isn't worth it.
1172 if ((stack_mode == kCanUseStackPointer) && 1166 if ((stack_mode == kCanUseStackPointer) &&
1173 !info()->saves_caller_doubles()) { 1167 !info()->saves_caller_doubles()) {
1174 int jssp_offset_to_fp = 1168 int jssp_offset_to_fp =
1175 StandardFrameConstants::kFixedFrameSizeFromFp + 1169 (pushed_arguments_ + GetTotalFrameSlotCount()) * kPointerSize -
1176 (pushed_arguments_ + GetStackSlotCount()) * kPointerSize; 1170 StandardFrameConstants::kFixedFrameSizeAboveFp;
1177 int jssp_offset = fp_offset + jssp_offset_to_fp; 1171 int jssp_offset = fp_offset + jssp_offset_to_fp;
1178 if (masm()->IsImmLSScaled(jssp_offset, LSDoubleWord)) { 1172 if (masm()->IsImmLSScaled(jssp_offset, LSDoubleWord)) {
1179 return MemOperand(masm()->StackPointer(), jssp_offset); 1173 return MemOperand(masm()->StackPointer(), jssp_offset);
1180 } 1174 }
1181 } 1175 }
1182 return MemOperand(fp, fp_offset); 1176 return MemOperand(fp, fp_offset);
1183 } else { 1177 } else {
1184 // Retrieve parameter without eager stack-frame relative to the 1178 // Retrieve parameter without eager stack-frame relative to the
1185 // stack-pointer. 1179 // stack-pointer.
1186 return MemOperand(masm()->StackPointer(), 1180 return MemOperand(masm()->StackPointer(),
(...skipping 4553 matching lines...) Expand 10 before | Expand all | Expand 10 after
5740 Handle<ScopeInfo> scope_info = instr->scope_info(); 5734 Handle<ScopeInfo> scope_info = instr->scope_info();
5741 __ Push(scope_info); 5735 __ Push(scope_info);
5742 __ Push(ToRegister(instr->function())); 5736 __ Push(ToRegister(instr->function()));
5743 CallRuntime(Runtime::kPushBlockContext, instr); 5737 CallRuntime(Runtime::kPushBlockContext, instr);
5744 RecordSafepoint(Safepoint::kNoLazyDeopt); 5738 RecordSafepoint(Safepoint::kNoLazyDeopt);
5745 } 5739 }
5746 5740
5747 5741
5748 } // namespace internal 5742 } // namespace internal
5749 } // namespace v8 5743 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/arm64/lithium-codegen-arm64.h ('k') | src/crankshaft/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698