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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 1014783002: CpuProfiler: ia32. put right address to the stack, so the callee would be able to resolve it into t… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comments were added Created 5 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 | « no previous file | no next file » | 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 if (!instr->IsLazyBailout() && !instr->IsGap()) { 370 if (!instr->IsLazyBailout() && !instr->IsGap()) {
371 safepoints_.BumpLastLazySafepointIndex(); 371 safepoints_.BumpLastLazySafepointIndex();
372 } 372 }
373 } 373 }
374 374
375 375
376 void LCodeGen::GenerateBodyInstructionPost(LInstruction* instr) { } 376 void LCodeGen::GenerateBodyInstructionPost(LInstruction* instr) { }
377 377
378 378
379 bool LCodeGen::GenerateJumpTable() { 379 bool LCodeGen::GenerateJumpTable() {
380 if (!jump_table_.length()) return !is_aborted();
381
380 Label needs_frame; 382 Label needs_frame;
381 if (jump_table_.length() > 0) { 383 Comment(";;; -------------------- Jump table --------------------");
382 Comment(";;; -------------------- Jump table --------------------"); 384
383 }
384 for (int i = 0; i < jump_table_.length(); i++) { 385 for (int i = 0; i < jump_table_.length(); i++) {
385 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i]; 386 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i];
386 __ bind(&table_entry->label); 387 __ bind(&table_entry->label);
387 Address entry = table_entry->address; 388 Address entry = table_entry->address;
388 DeoptComment(table_entry->deopt_info); 389 DeoptComment(table_entry->deopt_info);
389 if (table_entry->needs_frame) { 390 if (table_entry->needs_frame) {
390 DCHECK(!info()->saves_caller_doubles()); 391 DCHECK(!info()->saves_caller_doubles());
391 __ push(Immediate(ExternalReference::ForDeoptEntry(entry))); 392 __ push(Immediate(ExternalReference::ForDeoptEntry(entry)));
392 if (needs_frame.is_bound()) { 393 __ call(&needs_frame);
393 __ jmp(&needs_frame);
394 } else {
395 __ bind(&needs_frame);
396 __ push(MemOperand(ebp, StandardFrameConstants::kContextOffset));
397 // This variant of deopt can only be used with stubs. Since we don't
398 // have a function pointer to install in the stack frame that we're
399 // building, install a special marker there instead.
400 DCHECK(info()->IsStub());
401 __ push(Immediate(Smi::FromInt(StackFrame::STUB)));
402 // Push a PC inside the function so that the deopt code can find where
403 // the deopt comes from. It doesn't have to be the precise return
404 // address of a "calling" LAZY deopt, it only has to be somewhere
405 // inside the code body.
406 Label push_approx_pc;
407 __ call(&push_approx_pc);
408 __ bind(&push_approx_pc);
409 // Push the continuation which was stashed were the ebp should
410 // be. Replace it with the saved ebp.
411 __ push(MemOperand(esp, 3 * kPointerSize));
412 __ mov(MemOperand(esp, 4 * kPointerSize), ebp);
413 __ lea(ebp, MemOperand(esp, 4 * kPointerSize));
414 __ ret(0); // Call the continuation without clobbering registers.
415 }
416 } else { 394 } else {
417 if (info()->saves_caller_doubles()) RestoreCallerDoubles(); 395 if (info()->saves_caller_doubles()) RestoreCallerDoubles();
418 __ call(entry, RelocInfo::RUNTIME_ENTRY); 396 __ call(entry, RelocInfo::RUNTIME_ENTRY);
419 } 397 }
420 } 398 }
399 if (needs_frame.is_linked()) {
400 __ bind(&needs_frame);
401 /* stack layout
402 4: entry address
403 3: return address <-- esp
404 2: garbage
405 1: garbage
406 0: garbage
407 */
408 __ sub(esp, Immediate(kPointerSize)); // Reserve space for stub marker.
409 __ push(MemOperand(esp, kPointerSize)); // Copy return address.
410 __ push(MemOperand(esp, 3 * kPointerSize)); // Copy entry address.
411
412 /* stack layout
413 4: entry address
414 3: return address
415 2: garbage
416 1: return address
417 0: entry address <-- esp
418 */
419 __ mov(MemOperand(esp, 4 * kPointerSize), ebp); // Save ebp.
420 // Copy context.
421 __ mov(ebp, MemOperand(ebp, StandardFrameConstants::kContextOffset));
422 __ mov(MemOperand(esp, 3 * kPointerSize), ebp);
423 // Fill ebp with the right stack frame address.
424 __ lea(ebp, MemOperand(esp, 4 * kPointerSize));
425 // This variant of deopt can only be used with stubs. Since we don't
426 // have a function pointer to install in the stack frame that we're
427 // building, install a special marker there instead.
428 DCHECK(info()->IsStub());
429 __ mov(MemOperand(esp, 2 * kPointerSize),
430 Immediate(Smi::FromInt(StackFrame::STUB)));
431
432 /* stack layout
433 4: old ebp
434 3: context pointer
435 2: stub marker
436 1: return address
437 0: entry address <-- esp
438 */
439 __ ret(0); // Call the continuation without clobbering registers.
440 }
421 return !is_aborted(); 441 return !is_aborted();
422 } 442 }
423 443
424 444
425 bool LCodeGen::GenerateDeferredCode() { 445 bool LCodeGen::GenerateDeferredCode() {
426 DCHECK(is_generating()); 446 DCHECK(is_generating());
427 if (deferred_.length() > 0) { 447 if (deferred_.length() > 0) {
428 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { 448 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) {
429 LDeferredCode* code = deferred_[i]; 449 LDeferredCode* code = deferred_[i];
430 450
(...skipping 5350 matching lines...) Expand 10 before | Expand all | Expand 10 after
5781 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5801 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5782 RecordSafepoint(Safepoint::kNoLazyDeopt); 5802 RecordSafepoint(Safepoint::kNoLazyDeopt);
5783 } 5803 }
5784 5804
5785 5805
5786 #undef __ 5806 #undef __
5787 5807
5788 } } // namespace v8::internal 5808 } } // namespace v8::internal
5789 5809
5790 #endif // V8_TARGET_ARCH_IA32 5810 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698