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

Side by Side Diff: src/x64/builtins-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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 __ push(rax); 498 __ push(rax);
499 499
500 // Push the function to invoke on the stack. 500 // Push the function to invoke on the stack.
501 __ push(rdi); 501 __ push(rdi);
502 502
503 // Try to allocate the object without transitioning into C code. If any of the 503 // Try to allocate the object without transitioning into C code. If any of the
504 // preconditions is not met, the code bails out to the runtime call. 504 // preconditions is not met, the code bails out to the runtime call.
505 Label rt_call, allocated; 505 Label rt_call, allocated;
506 if (FLAG_inline_new) { 506 if (FLAG_inline_new) {
507 Label undo_allocation; 507 Label undo_allocation;
508 // TODO(X64): Enable debugger support, using debug_step_in_fp. 508
509 #ifdef ENABLE_DEBUGGER_SUPPORT
510 ExternalReference debug_step_in_fp =
511 ExternalReference::debug_step_in_fp_address();
512 __ movq(kScratchRegister, debug_step_in_fp);
513 __ cmpq(Operand(kScratchRegister, 0), Immediate(0));
514 __ j(not_equal, &rt_call);
515 #endif
509 516
510 // Verified that the constructor is a JSFunction. 517 // Verified that the constructor is a JSFunction.
511 // Load the initial map and verify that it is in fact a map. 518 // Load the initial map and verify that it is in fact a map.
512 // rdi: constructor 519 // rdi: constructor
513 __ movq(rax, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); 520 __ movq(rax, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset));
514 // Will both indicate a NULL and a Smi 521 // Will both indicate a NULL and a Smi
515 __ testl(rax, Immediate(kSmiTagMask)); 522 __ testl(rax, Immediate(kSmiTagMask));
516 __ j(zero, &rt_call); 523 __ j(zero, &rt_call);
517 // rdi: constructor 524 // rdi: constructor
518 // rax: initial map (if proven valid below) 525 // rax: initial map (if proven valid below)
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 __ movq(kScratchRegister, Operand(rbx, rcx, times_pointer_size, 0)); 823 __ movq(kScratchRegister, Operand(rbx, rcx, times_pointer_size, 0));
817 __ push(Operand(kScratchRegister, 0)); // dereference handle 824 __ push(Operand(kScratchRegister, 0)); // dereference handle
818 __ addq(rcx, Immediate(1)); 825 __ addq(rcx, Immediate(1));
819 __ bind(&entry); 826 __ bind(&entry);
820 __ cmpq(rcx, rax); 827 __ cmpq(rcx, rax);
821 __ j(not_equal, &loop); 828 __ j(not_equal, &loop);
822 829
823 // Invoke the code. 830 // Invoke the code.
824 if (is_construct) { 831 if (is_construct) {
825 // Expects rdi to hold function pointer. 832 // Expects rdi to hold function pointer.
826 __ movq(kScratchRegister, 833 __ Call(Handle<Code>(Builtins::builtin(Builtins::JSConstructCall)),
827 Handle<Code>(Builtins::builtin(Builtins::JSConstructCall)),
828 RelocInfo::CODE_TARGET); 834 RelocInfo::CODE_TARGET);
829 __ call(kScratchRegister);
830 } else { 835 } else {
831 ParameterCount actual(rax); 836 ParameterCount actual(rax);
832 // Function must be in rdi. 837 // Function must be in rdi.
833 __ InvokeFunction(rdi, actual, CALL_FUNCTION); 838 __ InvokeFunction(rdi, actual, CALL_FUNCTION);
834 } 839 }
835 840
836 // Exit the JS frame. Notice that this also removes the empty 841 // Exit the JS frame. Notice that this also removes the empty
837 // context and the function left on the stack by the code 842 // context and the function left on the stack by the code
838 // invocation. 843 // invocation.
839 __ LeaveInternalFrame(); 844 __ LeaveInternalFrame();
840 // TODO(X64): Is argument correct? Is there a receiver to remove? 845 // TODO(X64): Is argument correct? Is there a receiver to remove?
841 __ ret(1 * kPointerSize); // remove receiver 846 __ ret(1 * kPointerSize); // remove receiver
842 } 847 }
843 848
844 849
845 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { 850 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) {
846 Generate_JSEntryTrampolineHelper(masm, false); 851 Generate_JSEntryTrampolineHelper(masm, false);
847 } 852 }
848 853
849 854
850 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { 855 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) {
851 Generate_JSEntryTrampolineHelper(masm, true); 856 Generate_JSEntryTrampolineHelper(masm, true);
852 } 857 }
853 858
854 } } // namespace v8::internal 859 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698