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

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

Issue 1774353002: X87: [runtime] Unify and simplify how frames are marked. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« no previous file with comments | « src/compiler/x87/code-generator-x87.cc ('k') | src/debug/x87/debug-x87.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/crankshaft/x87/lithium-codegen-x87.h" 7 #include "src/crankshaft/x87/lithium-codegen-x87.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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 if (info()->IsOptimizing()) { 92 if (info()->IsOptimizing()) {
93 ProfileEntryHookStub::MaybeCallEntryHook(masm_); 93 ProfileEntryHookStub::MaybeCallEntryHook(masm_);
94 } 94 }
95 95
96 info()->set_prologue_offset(masm_->pc_offset()); 96 info()->set_prologue_offset(masm_->pc_offset());
97 if (NeedsEagerFrame()) { 97 if (NeedsEagerFrame()) {
98 DCHECK(!frame_is_built_); 98 DCHECK(!frame_is_built_);
99 frame_is_built_ = true; 99 frame_is_built_ = true;
100 if (info()->IsStub()) { 100 if (info()->IsStub()) {
101 __ StubPrologue(); 101 __ StubPrologue(StackFrame::STUB);
102 } else { 102 } else {
103 __ Prologue(info()->GeneratePreagedPrologue()); 103 __ Prologue(info()->GeneratePreagedPrologue());
104 } 104 }
105 } 105 }
106 106
107 // Reserve space for the stack slots needed by the code. 107 // Reserve space for the stack slots needed by the code.
108 int slots = GetStackSlotCount(); 108 int slots = GetStackSlotCount();
109 DCHECK(slots != 0 || !info()->IsOptimizing()); 109 DCHECK(slots != 0 || !info()->IsOptimizing());
110 if (slots > 0) { 110 if (slots > 0) {
111 __ sub(Operand(esp), Immediate(slots * kPointerSize)); 111 __ sub(Operand(esp), Immediate(slots * kPointerSize));
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 __ push(Immediate(ExternalReference::ForDeoptEntry(entry))); 266 __ push(Immediate(ExternalReference::ForDeoptEntry(entry)));
267 __ call(&needs_frame); 267 __ call(&needs_frame);
268 } else { 268 } else {
269 __ call(entry, RelocInfo::RUNTIME_ENTRY); 269 __ call(entry, RelocInfo::RUNTIME_ENTRY);
270 } 270 }
271 info()->LogDeoptCallPosition(masm()->pc_offset(), 271 info()->LogDeoptCallPosition(masm()->pc_offset(),
272 table_entry->deopt_info.inlining_id); 272 table_entry->deopt_info.inlining_id);
273 } 273 }
274 if (needs_frame.is_linked()) { 274 if (needs_frame.is_linked()) {
275 __ bind(&needs_frame); 275 __ bind(&needs_frame);
276
277 /* stack layout 276 /* stack layout
278 4: entry address 277 3: entry address
279 3: return address <-- esp 278 2: return address <-- esp
280 2: garbage
281 1: garbage 279 1: garbage
282 0: garbage 280 0: garbage
283 */ 281 */
284 __ sub(esp, Immediate(kPointerSize)); // Reserve space for stub marker. 282 __ push(MemOperand(esp, 0)); // Copy return address.
285 __ push(MemOperand(esp, kPointerSize)); // Copy return address. 283 __ push(MemOperand(esp, 2 * kPointerSize)); // Copy entry address.
286 __ push(MemOperand(esp, 3 * kPointerSize)); // Copy entry address.
287 284
288 /* stack layout 285 /* stack layout
289 4: entry address 286 4: entry address
290 3: return address 287 3: return address
291 2: garbage
292 1: return address 288 1: return address
293 0: entry address <-- esp 289 0: entry address <-- esp
294 */ 290 */
295 __ mov(MemOperand(esp, 4 * kPointerSize), ebp); // Save ebp. 291 __ mov(MemOperand(esp, 3 * kPointerSize), ebp); // Save ebp.
296
297 // Copy context.
298 __ mov(ebp, MemOperand(ebp, StandardFrameConstants::kContextOffset));
299 __ mov(MemOperand(esp, 3 * kPointerSize), ebp);
300 // Fill ebp with the right stack frame address. 292 // Fill ebp with the right stack frame address.
301 __ lea(ebp, MemOperand(esp, 4 * kPointerSize)); 293 __ lea(ebp, MemOperand(esp, 3 * kPointerSize));
302 294
303 // This variant of deopt can only be used with stubs. Since we don't 295 // This variant of deopt can only be used with stubs. Since we don't
304 // have a function pointer to install in the stack frame that we're 296 // have a function pointer to install in the stack frame that we're
305 // building, install a special marker there instead. 297 // building, install a special marker there instead.
306 DCHECK(info()->IsStub()); 298 DCHECK(info()->IsStub());
307 __ mov(MemOperand(esp, 2 * kPointerSize), 299 __ mov(MemOperand(esp, 2 * kPointerSize),
308 Immediate(Smi::FromInt(StackFrame::STUB))); 300 Immediate(Smi::FromInt(StackFrame::STUB)));
309 301
310 /* stack layout 302 /* stack layout
311 4: old ebp 303 3: old ebp
312 3: context pointer
313 2: stub marker 304 2: stub marker
314 1: return address 305 1: return address
315 0: entry address <-- esp 306 0: entry address <-- esp
316 */ 307 */
317 __ ret(0); // Call the continuation without clobbering registers. 308 __ ret(0); // Call the continuation without clobbering registers.
318 } 309 }
319 return !is_aborted(); 310 return !is_aborted();
320 } 311 }
321 312
322 313
(...skipping 16 matching lines...) Expand all
339 code->instr()->hydrogen_value()->id(), 330 code->instr()->hydrogen_value()->id(),
340 code->instr()->Mnemonic()); 331 code->instr()->Mnemonic());
341 __ bind(code->entry()); 332 __ bind(code->entry());
342 if (NeedsDeferredFrame()) { 333 if (NeedsDeferredFrame()) {
343 Comment(";;; Build frame"); 334 Comment(";;; Build frame");
344 DCHECK(!frame_is_built_); 335 DCHECK(!frame_is_built_);
345 DCHECK(info()->IsStub()); 336 DCHECK(info()->IsStub());
346 frame_is_built_ = true; 337 frame_is_built_ = true;
347 // Build the frame in such a way that esi isn't trashed. 338 // Build the frame in such a way that esi isn't trashed.
348 __ push(ebp); // Caller's frame pointer. 339 __ push(ebp); // Caller's frame pointer.
349 __ push(Operand(ebp, StandardFrameConstants::kContextOffset));
350 __ push(Immediate(Smi::FromInt(StackFrame::STUB))); 340 __ push(Immediate(Smi::FromInt(StackFrame::STUB)));
351 __ lea(ebp, Operand(esp, 2 * kPointerSize)); 341 __ lea(ebp, Operand(esp, TypedFrameConstants::kFixedFrameSizeFromFp));
352 Comment(";;; Deferred code"); 342 Comment(";;; Deferred code");
353 } 343 }
354 code->Generate(); 344 code->Generate();
355 if (NeedsDeferredFrame()) { 345 if (NeedsDeferredFrame()) {
356 __ bind(code->done()); 346 __ bind(code->done());
357 Comment(";;; Destroy frame"); 347 Comment(";;; Destroy frame");
358 DCHECK(frame_is_built_); 348 DCHECK(frame_is_built_);
359 frame_is_built_ = false; 349 frame_is_built_ = false;
360 __ mov(esp, ebp); 350 __ mov(esp, ebp);
361 __ pop(ebp); 351 __ pop(ebp);
(...skipping 2719 matching lines...) Expand 10 before | Expand all | Expand 10 after
3081 3071
3082 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { 3072 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) {
3083 Register result = ToRegister(instr->result()); 3073 Register result = ToRegister(instr->result());
3084 3074
3085 if (instr->hydrogen()->from_inlined()) { 3075 if (instr->hydrogen()->from_inlined()) {
3086 __ lea(result, Operand(esp, -2 * kPointerSize)); 3076 __ lea(result, Operand(esp, -2 * kPointerSize));
3087 } else { 3077 } else {
3088 // Check for arguments adapter frame. 3078 // Check for arguments adapter frame.
3089 Label done, adapted; 3079 Label done, adapted;
3090 __ mov(result, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); 3080 __ mov(result, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
3091 __ mov(result, Operand(result, StandardFrameConstants::kContextOffset)); 3081 __ mov(result,
3082 Operand(result, CommonFrameConstants::kContextOrFrameTypeOffset));
3092 __ cmp(Operand(result), 3083 __ cmp(Operand(result),
3093 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 3084 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
3094 __ j(equal, &adapted, Label::kNear); 3085 __ j(equal, &adapted, Label::kNear);
3095 3086
3096 // No arguments adaptor frame. 3087 // No arguments adaptor frame.
3097 __ mov(result, Operand(ebp)); 3088 __ mov(result, Operand(ebp));
3098 __ jmp(&done, Label::kNear); 3089 __ jmp(&done, Label::kNear);
3099 3090
3100 // Arguments adaptor frame present. 3091 // Arguments adaptor frame present.
3101 __ bind(&adapted); 3092 __ bind(&adapted);
(...skipping 2731 matching lines...) Expand 10 before | Expand all | Expand 10 after
5833 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), context); 5824 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), context);
5834 } 5825 }
5835 5826
5836 5827
5837 #undef __ 5828 #undef __
5838 5829
5839 } // namespace internal 5830 } // namespace internal
5840 } // namespace v8 5831 } // namespace v8
5841 5832
5842 #endif // V8_TARGET_ARCH_X87 5833 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/compiler/x87/code-generator-x87.cc ('k') | src/debug/x87/debug-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698