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

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

Issue 171107: X64: Implement debugger hooks. (Closed)
Patch Set: Created 11 years, 4 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 // reference to rax. This is safe because the current frame does not 493 // reference to rax. This is safe because the current frame does not
494 // contain a reference to rax (it is prepared for the return by spilling 494 // contain a reference to rax (it is prepared for the return by spilling
495 // all registers). 495 // all registers).
496 if (FLAG_trace) { 496 if (FLAG_trace) {
497 frame_->Push(return_value); 497 frame_->Push(return_value);
498 *return_value = frame_->CallRuntime(Runtime::kTraceExit, 1); 498 *return_value = frame_->CallRuntime(Runtime::kTraceExit, 1);
499 } 499 }
500 return_value->ToRegister(rax); 500 return_value->ToRegister(rax);
501 501
502 // Add a label for checking the size of the code used for returning. 502 // Add a label for checking the size of the code used for returning.
503 #ifdef DEBUG
503 Label check_exit_codesize; 504 Label check_exit_codesize;
504 masm_->bind(&check_exit_codesize); 505 masm_->bind(&check_exit_codesize);
506 #endif
505 507
506 // Leave the frame and return popping the arguments and the 508 // Leave the frame and return popping the arguments and the
507 // receiver. 509 // receiver.
508 frame_->Exit(); 510 frame_->Exit();
509 masm_->ret((scope_->num_parameters() + 1) * kPointerSize); 511 masm_->ret((scope_->num_parameters() + 1) * kPointerSize);
510 // Add padding that will be overwritten by a debugger breakpoint. 512 // Add padding that will be overwritten by a debugger breakpoint.
511 // frame_->Exit() generates "movq rsp, rbp; pop rbp" length 5. 513 // frame_->Exit() generates "movq rsp, rbp; pop rbp" length 3+1.
512 // "ret k" has length 2. 514 // "ret k" has length 3.
513 const int kPadding = Debug::kX64JSReturnSequenceLength - 5 - 2; 515 const int kPadding = Debug::kX64JSReturnSequenceLength - 4 - 3;
514 for (int i = 0; i < kPadding; ++i) { 516 for (int i = 0; i < kPadding; ++i) {
515 masm_->int3(); 517 masm_->int3();
516 } 518 }
517 DeleteFrame(); 519 DeleteFrame();
518 520
519 // Check that the size of the code used for returning matches what is 521 // Check that the size of the code used for returning matches what is
520 // expected by the debugger. 522 // expected by the debugger.
521 ASSERT_EQ(Debug::kX64JSReturnSequenceLength, 523 ASSERT_EQ(Debug::kX64JSReturnSequenceLength,
522 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize)); 524 masm_->SizeOfCodeGeneratedSince(&check_exit_codesize));
523 } 525 }
(...skipping 5200 matching lines...) Expand 10 before | Expand all | Expand 10 after
5724 return Handle<String>(String::cast(*raw_name->handle())); 5726 return Handle<String>(String::cast(*raw_name->handle()));
5725 } 5727 }
5726 } 5728 }
5727 5729
5728 5730
5729 void Reference::GetValue(TypeofState typeof_state) { 5731 void Reference::GetValue(TypeofState typeof_state) {
5730 ASSERT(!cgen_->in_spilled_code()); 5732 ASSERT(!cgen_->in_spilled_code());
5731 ASSERT(cgen_->HasValidEntryRegisters()); 5733 ASSERT(cgen_->HasValidEntryRegisters());
5732 ASSERT(!is_illegal()); 5734 ASSERT(!is_illegal());
5733 MacroAssembler* masm = cgen_->masm(); 5735 MacroAssembler* masm = cgen_->masm();
5736
5737 // Record the source position for the property load.
5738 Property* property = expression_->AsProperty();
5739 if (property != NULL) {
5740 cgen_->CodeForSourcePosition(property->position());
5741 }
5742
5734 switch (type_) { 5743 switch (type_) {
5735 case SLOT: { 5744 case SLOT: {
5736 Comment cmnt(masm, "[ Load from Slot"); 5745 Comment cmnt(masm, "[ Load from Slot");
5737 Slot* slot = expression_->AsVariableProxy()->AsVariable()->slot(); 5746 Slot* slot = expression_->AsVariableProxy()->AsVariable()->slot();
5738 ASSERT(slot != NULL); 5747 ASSERT(slot != NULL);
5739 cgen_->LoadFromSlotCheckForArguments(slot, typeof_state); 5748 cgen_->LoadFromSlotCheckForArguments(slot, typeof_state);
5740 break; 5749 break;
5741 } 5750 }
5742 5751
5743 case NAMED: { 5752 case NAMED: {
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after
7681 int CompareStub::MinorKey() { 7690 int CompareStub::MinorKey() {
7682 // Encode the two parameters in a unique 16 bit value. 7691 // Encode the two parameters in a unique 16 bit value.
7683 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 7692 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
7684 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 7693 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
7685 } 7694 }
7686 7695
7687 7696
7688 #undef __ 7697 #undef __
7689 7698
7690 } } // namespace v8::internal 7699 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698