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

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

Issue 1696043002: [runtime] Unify and simplify how frames are marked (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix merge problems Created 4 years, 9 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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/crankshaft/x64/lithium-codegen-x64.h" 7 #include "src/crankshaft/x64/lithium-codegen-x64.h"
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 if (info()->IsOptimizing()) { 119 if (info()->IsOptimizing()) {
120 ProfileEntryHookStub::MaybeCallEntryHook(masm_); 120 ProfileEntryHookStub::MaybeCallEntryHook(masm_);
121 } 121 }
122 122
123 info()->set_prologue_offset(masm_->pc_offset()); 123 info()->set_prologue_offset(masm_->pc_offset());
124 if (NeedsEagerFrame()) { 124 if (NeedsEagerFrame()) {
125 DCHECK(!frame_is_built_); 125 DCHECK(!frame_is_built_);
126 frame_is_built_ = true; 126 frame_is_built_ = true;
127 if (info()->IsStub()) { 127 if (info()->IsStub()) {
128 __ StubPrologue(); 128 __ StubPrologue(StackFrame::STUB);
129 } else { 129 } else {
130 __ Prologue(info()->GeneratePreagedPrologue()); 130 __ Prologue(info()->GeneratePreagedPrologue());
131 } 131 }
132 } 132 }
133 133
134 // Reserve space for the stack slots needed by the code. 134 // Reserve space for the stack slots needed by the code.
135 int slots = GetStackSlotCount(); 135 int slots = GetStackSlotCount();
136 if (slots > 0) { 136 if (slots > 0) {
137 if (FLAG_debug_code) { 137 if (FLAG_debug_code) {
138 __ subp(rsp, Immediate(slots * kPointerSize)); 138 __ subp(rsp, Immediate(slots * kPointerSize));
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 299 }
300 __ call(entry, RelocInfo::RUNTIME_ENTRY); 300 __ call(entry, RelocInfo::RUNTIME_ENTRY);
301 } 301 }
302 info()->LogDeoptCallPosition(masm()->pc_offset(), 302 info()->LogDeoptCallPosition(masm()->pc_offset(),
303 table_entry->deopt_info.inlining_id); 303 table_entry->deopt_info.inlining_id);
304 } 304 }
305 305
306 if (needs_frame.is_linked()) { 306 if (needs_frame.is_linked()) {
307 __ bind(&needs_frame); 307 __ bind(&needs_frame);
308 /* stack layout 308 /* stack layout
309 4: return address <-- rsp 309 3: return address <-- rsp
310 3: garbage
311 2: garbage 310 2: garbage
312 1: garbage 311 1: garbage
313 0: garbage 312 0: garbage
314 */ 313 */
315 // Reserve space for context and stub marker. 314 // Reserve space for stub marker.
316 __ subp(rsp, Immediate(2 * kPointerSize)); 315 __ subp(rsp, Immediate(TypedFrameConstants::kFrameTypeSize));
317 __ Push(MemOperand(rsp, 2 * kPointerSize)); // Copy return address. 316 __ Push(MemOperand(
318 __ Push(kScratchRegister); // Save entry address for ret(0) 317 rsp, TypedFrameConstants::kFrameTypeSize)); // Copy return address.
318 __ Push(kScratchRegister);
319 319
320 /* stack layout 320 /* stack layout
321 4: return address 321 3: return address
322 3: garbage
323 2: garbage 322 2: garbage
324 1: return address 323 1: return address
325 0: entry address <-- rsp 324 0: entry address <-- rsp
326 */ 325 */
327 326
328 // Remember context pointer.
329 __ movp(kScratchRegister,
330 MemOperand(rbp, StandardFrameConstants::kContextOffset));
331 // Save context pointer into the stack frame.
332 __ movp(MemOperand(rsp, 3 * kPointerSize), kScratchRegister);
333
334 // Create a stack frame. 327 // Create a stack frame.
335 __ movp(MemOperand(rsp, 4 * kPointerSize), rbp); 328 __ movp(MemOperand(rsp, 3 * kPointerSize), rbp);
336 __ leap(rbp, MemOperand(rsp, 4 * kPointerSize)); 329 __ leap(rbp, MemOperand(rsp, 3 * kPointerSize));
337 330
338 // This variant of deopt can only be used with stubs. Since we don't 331 // This variant of deopt can only be used with stubs. Since we don't
339 // have a function pointer to install in the stack frame that we're 332 // have a function pointer to install in the stack frame that we're
340 // building, install a special marker there instead. 333 // building, install a special marker there instead.
341 DCHECK(info()->IsStub()); 334 DCHECK(info()->IsStub());
342 __ Move(MemOperand(rsp, 2 * kPointerSize), Smi::FromInt(StackFrame::STUB)); 335 __ Move(MemOperand(rsp, 2 * kPointerSize), Smi::FromInt(StackFrame::STUB));
343 336
344 /* stack layout 337 /* stack layout
345 4: old rbp 338 3: old rbp
346 3: context pointer
347 2: stub marker 339 2: stub marker
348 1: return address 340 1: return address
349 0: entry address <-- rsp 341 0: entry address <-- rsp
350 */ 342 */
351 __ ret(0); 343 __ ret(0);
352 } 344 }
353 345
354 return !is_aborted(); 346 return !is_aborted();
355 } 347 }
356 348
(...skipping 15 matching lines...) Expand all
372 code->instr()->hydrogen_value()->id(), 364 code->instr()->hydrogen_value()->id(),
373 code->instr()->Mnemonic()); 365 code->instr()->Mnemonic());
374 __ bind(code->entry()); 366 __ bind(code->entry());
375 if (NeedsDeferredFrame()) { 367 if (NeedsDeferredFrame()) {
376 Comment(";;; Build frame"); 368 Comment(";;; Build frame");
377 DCHECK(!frame_is_built_); 369 DCHECK(!frame_is_built_);
378 DCHECK(info()->IsStub()); 370 DCHECK(info()->IsStub());
379 frame_is_built_ = true; 371 frame_is_built_ = true;
380 // Build the frame in such a way that esi isn't trashed. 372 // Build the frame in such a way that esi isn't trashed.
381 __ pushq(rbp); // Caller's frame pointer. 373 __ pushq(rbp); // Caller's frame pointer.
382 __ Push(Operand(rbp, StandardFrameConstants::kContextOffset));
383 __ Push(Smi::FromInt(StackFrame::STUB)); 374 __ Push(Smi::FromInt(StackFrame::STUB));
384 __ leap(rbp, Operand(rsp, 2 * kPointerSize)); 375 __ leap(rbp, Operand(rsp, TypedFrameConstants::kFixedFrameSizeFromFp));
385 Comment(";;; Deferred code"); 376 Comment(";;; Deferred code");
386 } 377 }
387 code->Generate(); 378 code->Generate();
388 if (NeedsDeferredFrame()) { 379 if (NeedsDeferredFrame()) {
389 __ bind(code->done()); 380 __ bind(code->done());
390 Comment(";;; Destroy frame"); 381 Comment(";;; Destroy frame");
391 DCHECK(frame_is_built_); 382 DCHECK(frame_is_built_);
392 frame_is_built_ = false; 383 frame_is_built_ = false;
393 __ movp(rsp, rbp); 384 __ movp(rsp, rbp);
394 __ popq(rbp); 385 __ popq(rbp);
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after
3007 2998
3008 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { 2999 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
3009 Register result = ToRegister(instr->result()); 3000 Register result = ToRegister(instr->result());
3010 3001
3011 if (instr->hydrogen()->from_inlined()) { 3002 if (instr->hydrogen()->from_inlined()) {
3012 __ leap(result, Operand(rsp, -kFPOnStackSize + -kPCOnStackSize)); 3003 __ leap(result, Operand(rsp, -kFPOnStackSize + -kPCOnStackSize));
3013 } else { 3004 } else {
3014 // Check for arguments adapter frame. 3005 // Check for arguments adapter frame.
3015 Label done, adapted; 3006 Label done, adapted;
3016 __ movp(result, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 3007 __ movp(result, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
3017 __ Cmp(Operand(result, StandardFrameConstants::kContextOffset), 3008 __ Cmp(Operand(result, CommonFrameConstants::kContextOrFrameTypeOffset),
3018 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 3009 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
3019 __ j(equal, &adapted, Label::kNear); 3010 __ j(equal, &adapted, Label::kNear);
3020 3011
3021 // No arguments adaptor frame. 3012 // No arguments adaptor frame.
3022 __ movp(result, rbp); 3013 __ movp(result, rbp);
3023 __ jmp(&done, Label::kNear); 3014 __ jmp(&done, Label::kNear);
3024 3015
3025 // Arguments adaptor frame present. 3016 // Arguments adaptor frame present.
3026 __ bind(&adapted); 3017 __ bind(&adapted);
3027 __ movp(result, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 3018 __ movp(result, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
(...skipping 2562 matching lines...) Expand 10 before | Expand all | Expand 10 after
5590 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), context); 5581 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), context);
5591 } 5582 }
5592 5583
5593 5584
5594 #undef __ 5585 #undef __
5595 5586
5596 } // namespace internal 5587 } // namespace internal
5597 } // namespace v8 5588 } // namespace v8
5598 5589
5599 #endif // V8_TARGET_ARCH_X64 5590 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698