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

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 1234833003: Debugger: use debug break slots to break at function exit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix for arm Created 5 years, 5 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/x64/debug-x64.cc ('k') | src/x64/macro-assembler-x64.h » ('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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 460 }
461 EmitProfilingCounterDecrement(weight); 461 EmitProfilingCounterDecrement(weight);
462 Label ok; 462 Label ok;
463 __ j(positive, &ok, Label::kNear); 463 __ j(positive, &ok, Label::kNear);
464 __ Push(rax); 464 __ Push(rax);
465 __ call(isolate()->builtins()->InterruptCheck(), 465 __ call(isolate()->builtins()->InterruptCheck(),
466 RelocInfo::CODE_TARGET); 466 RelocInfo::CODE_TARGET);
467 __ Pop(rax); 467 __ Pop(rax);
468 EmitProfilingCounterReset(); 468 EmitProfilingCounterReset();
469 __ bind(&ok); 469 __ bind(&ok);
470 #ifdef DEBUG 470
471 // Add a label for checking the size of the code used for returning.
472 Label check_exit_codesize;
473 masm_->bind(&check_exit_codesize);
474 #endif
475 SetReturnPosition(function()); 471 SetReturnPosition(function());
476 __ RecordJSReturn();
477 // Do not use the leave instruction here because it is too short to
478 // patch with the code required by the debugger.
479 __ movp(rsp, rbp);
480 __ popq(rbp);
481 int no_frame_start = masm_->pc_offset(); 472 int no_frame_start = masm_->pc_offset();
473 __ leave();
482 474
483 int arg_count = info_->scope()->num_parameters() + 1; 475 int arg_count = info_->scope()->num_parameters() + 1;
484 int arguments_bytes = arg_count * kPointerSize; 476 int arguments_bytes = arg_count * kPointerSize;
485 __ Ret(arguments_bytes, rcx); 477 __ Ret(arguments_bytes, rcx);
486 478
487 // Add padding that will be overwritten by a debugger breakpoint. We
488 // have just generated at least 7 bytes: "movp rsp, rbp; pop rbp; ret k"
489 // (3 + 1 + 3) for x64 and at least 6 (2 + 1 + 3) bytes for x32.
490 const int kPadding = Assembler::kJSReturnSequenceLength -
491 kPointerSize == kInt64Size ? 7 : 6;
492 for (int i = 0; i < kPadding; ++i) {
493 masm_->int3();
494 }
495 // Check that the size of the code used for returning is large enough
496 // for the debugger's requirements.
497 DCHECK(Assembler::kJSReturnSequenceLength <=
498 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize));
499
500 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); 479 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset());
501 } 480 }
502 } 481 }
503 482
504 483
505 void FullCodeGenerator::EffectContext::Plug(Variable* var) const { 484 void FullCodeGenerator::EffectContext::Plug(Variable* var) const {
506 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 485 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
507 } 486 }
508 487
509 488
(...skipping 5009 matching lines...) Expand 10 before | Expand all | Expand 10 after
5519 Assembler::target_address_at(call_target_address, 5498 Assembler::target_address_at(call_target_address,
5520 unoptimized_code)); 5499 unoptimized_code));
5521 return OSR_AFTER_STACK_CHECK; 5500 return OSR_AFTER_STACK_CHECK;
5522 } 5501 }
5523 5502
5524 5503
5525 } // namespace internal 5504 } // namespace internal
5526 } // namespace v8 5505 } // namespace v8
5527 5506
5528 #endif // V8_TARGET_ARCH_X64 5507 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/debug-x64.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698