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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 16858013: Notify CPU profiler when calling native getters (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.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 // 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 690
691 // rcx must be used to pass the pointer to the return value slot. 691 // rcx must be used to pass the pointer to the return value slot.
692 lea(rcx, StackSpaceOperand(arg_stack_space)); 692 lea(rcx, StackSpaceOperand(arg_stack_space));
693 #else 693 #else
694 EnterApiExitFrame(arg_stack_space); 694 EnterApiExitFrame(arg_stack_space);
695 #endif 695 #endif
696 } 696 }
697 697
698 698
699 void MacroAssembler::CallApiFunctionAndReturn(Address function_address, 699 void MacroAssembler::CallApiFunctionAndReturn(Address function_address,
700 Address thunk_address,
701 Register thunk_last_arg,
700 int stack_space, 702 int stack_space,
701 bool returns_handle, 703 bool returns_handle,
702 int return_value_offset) { 704 int return_value_offset) {
703 Label prologue; 705 Label prologue;
704 Label promote_scheduled_exception; 706 Label promote_scheduled_exception;
705 Label delete_allocated_handles; 707 Label delete_allocated_handles;
706 Label leave_exit_frame; 708 Label leave_exit_frame;
707 Label write_back; 709 Label write_back;
708 710
709 Factory* factory = isolate()->factory(); 711 Factory* factory = isolate()->factory();
(...skipping 20 matching lines...) Expand all
730 732
731 if (FLAG_log_timer_events) { 733 if (FLAG_log_timer_events) {
732 FrameScope frame(this, StackFrame::MANUAL); 734 FrameScope frame(this, StackFrame::MANUAL);
733 PushSafepointRegisters(); 735 PushSafepointRegisters();
734 PrepareCallCFunction(1); 736 PrepareCallCFunction(1);
735 LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate())); 737 LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate()));
736 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1); 738 CallCFunction(ExternalReference::log_enter_external_function(isolate()), 1);
737 PopSafepointRegisters(); 739 PopSafepointRegisters();
738 } 740 }
739 741
742
743 Label profiler_disabled;
744 Label end_profiler_check;
745 bool* is_profiling_flag =
746 isolate()->cpu_profiler()->is_profiling_address();
747 STATIC_ASSERT(sizeof(*is_profiling_flag) == 1);
748 movq(rax, is_profiling_flag, RelocInfo::EXTERNAL_REFERENCE);
749 cmpb(Operand(rax, 0), Immediate(0));
750 j(zero, &profiler_disabled);
751
752 // Third parameter is the address of the actual getter function.
753 movq(thunk_last_arg, function_address, RelocInfo::EXTERNAL_REFERENCE);
754 movq(rax, thunk_address, RelocInfo::EXTERNAL_REFERENCE);
755 jmp(&end_profiler_check);
756
757 bind(&profiler_disabled);
740 // Call the api function! 758 // Call the api function!
741 movq(rax, reinterpret_cast<int64_t>(function_address), 759 movq(rax, reinterpret_cast<int64_t>(function_address),
742 RelocInfo::EXTERNAL_REFERENCE); 760 RelocInfo::EXTERNAL_REFERENCE);
761
762 bind(&end_profiler_check);
763
764 // Call the api function!
743 call(rax); 765 call(rax);
744 766
745 if (FLAG_log_timer_events) { 767 if (FLAG_log_timer_events) {
746 FrameScope frame(this, StackFrame::MANUAL); 768 FrameScope frame(this, StackFrame::MANUAL);
747 PushSafepointRegisters(); 769 PushSafepointRegisters();
748 PrepareCallCFunction(1); 770 PrepareCallCFunction(1);
749 LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate())); 771 LoadAddress(arg_reg_1, ExternalReference::isolate_address(isolate()));
750 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1); 772 CallCFunction(ExternalReference::log_leave_external_function(isolate()), 1);
751 PopSafepointRegisters(); 773 PopSafepointRegisters();
752 } 774 }
(...skipping 3925 matching lines...) Expand 10 before | Expand all | Expand 10 after
4678 j(greater, &no_info_available); 4700 j(greater, &no_info_available);
4679 CompareRoot(MemOperand(scratch_reg, -AllocationSiteInfo::kSize), 4701 CompareRoot(MemOperand(scratch_reg, -AllocationSiteInfo::kSize),
4680 Heap::kAllocationSiteInfoMapRootIndex); 4702 Heap::kAllocationSiteInfoMapRootIndex);
4681 bind(&no_info_available); 4703 bind(&no_info_available);
4682 } 4704 }
4683 4705
4684 4706
4685 } } // namespace v8::internal 4707 } } // namespace v8::internal
4686 4708
4687 #endif // V8_TARGET_ARCH_X64 4709 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698