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

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

Issue 22852024: Track JS allocations as they arrive with no affection on performance when tracking is switched off (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make separate API for JS allocations recording, add example of checking JS allocations recording in… Created 7 years, 3 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
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 3840 matching lines...) Expand 10 before | Expand all | Expand 10 after
3851 } 3851 }
3852 } 3852 }
3853 jmp(gc_required); 3853 jmp(gc_required);
3854 return; 3854 return;
3855 } 3855 }
3856 ASSERT(!result.is(result_end)); 3856 ASSERT(!result.is(result_end));
3857 3857
3858 // Load address of new object into result. 3858 // Load address of new object into result.
3859 LoadAllocationTopHelper(result, scratch, flags); 3859 LoadAllocationTopHelper(result, scratch, flags);
3860 3860
3861 RecordObjectAllocation(isolate(), result, object_size);
3862
3861 // Align the next allocation. Storing the filler map without checking top is 3863 // Align the next allocation. Storing the filler map without checking top is
3862 // safe in new-space because the limit of the heap is aligned there. 3864 // safe in new-space because the limit of the heap is aligned there.
3863 if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) { 3865 if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) {
3864 testq(result, Immediate(kDoubleAlignmentMask)); 3866 testq(result, Immediate(kDoubleAlignmentMask));
3865 Check(zero, kAllocationIsNotDoubleAligned); 3867 Check(zero, kAllocationIsNotDoubleAligned);
3866 } 3868 }
3867 3869
3868 // Calculate new top and bail out if new space is exhausted. 3870 // Calculate new top and bail out if new space is exhausted.
3869 ExternalReference allocation_limit = 3871 ExternalReference allocation_limit =
3870 AllocationUtils::GetAllocationLimitReference(isolate(), flags); 3872 AllocationUtils::GetAllocationLimitReference(isolate(), flags);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
3930 // object_size is left unchanged by this function. 3932 // object_size is left unchanged by this function.
3931 } 3933 }
3932 jmp(gc_required); 3934 jmp(gc_required);
3933 return; 3935 return;
3934 } 3936 }
3935 ASSERT(!result.is(result_end)); 3937 ASSERT(!result.is(result_end));
3936 3938
3937 // Load address of new object into result. 3939 // Load address of new object into result.
3938 LoadAllocationTopHelper(result, scratch, flags); 3940 LoadAllocationTopHelper(result, scratch, flags);
3939 3941
3942 RecordObjectAllocation(isolate(), result, object_size);
3943
3940 // Align the next allocation. Storing the filler map without checking top is 3944 // Align the next allocation. Storing the filler map without checking top is
3941 // safe in new-space because the limit of the heap is aligned there. 3945 // safe in new-space because the limit of the heap is aligned there.
3942 if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) { 3946 if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) {
3943 testq(result, Immediate(kDoubleAlignmentMask)); 3947 testq(result, Immediate(kDoubleAlignmentMask));
3944 Check(zero, kAllocationIsNotDoubleAligned); 3948 Check(zero, kAllocationIsNotDoubleAligned);
3945 } 3949 }
3946 3950
3947 // Calculate new top and bail out if new space is exhausted. 3951 // Calculate new top and bail out if new space is exhausted.
3948 ExternalReference allocation_limit = 3952 ExternalReference allocation_limit =
3949 AllocationUtils::GetAllocationLimitReference(isolate(), flags); 3953 AllocationUtils::GetAllocationLimitReference(isolate(), flags);
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
4691 cmpq(scratch_reg, kScratchRegister); 4695 cmpq(scratch_reg, kScratchRegister);
4692 j(less, &no_memento_available); 4696 j(less, &no_memento_available);
4693 cmpq(scratch_reg, ExternalOperand(new_space_allocation_top)); 4697 cmpq(scratch_reg, ExternalOperand(new_space_allocation_top));
4694 j(greater, &no_memento_available); 4698 j(greater, &no_memento_available);
4695 CompareRoot(MemOperand(scratch_reg, -AllocationMemento::kSize), 4699 CompareRoot(MemOperand(scratch_reg, -AllocationMemento::kSize),
4696 Heap::kAllocationMementoMapRootIndex); 4700 Heap::kAllocationMementoMapRootIndex);
4697 bind(&no_memento_available); 4701 bind(&no_memento_available);
4698 } 4702 }
4699 4703
4700 4704
4705 void MacroAssembler::RecordObjectAllocation(Isolate* isolate,
4706 Register object,
4707 Register object_size) {
4708 Label done;
4709 cmpb(ExternalOperand(
Hannes Payer (out of office) 2013/08/28 10:35:05 I am concerned about the performance impact of tha
4710 ExternalReference::is_tracking_allocations_address(isolate)),
4711 Immediate(0));
4712 j(zero, &done, Label::kNear);
4713 FrameScope frame(this, StackFrame::MANUAL);
4714 PushSafepointRegisters();
4715 PrepareCallCFunction(3);
4716 // In case object is rdx
4717 movq(kScratchRegister, object);
4718 movq(arg_reg_3, object_size);
4719 movq(arg_reg_2, kScratchRegister);
4720 movq(arg_reg_1, isolate, RelocInfo::EXTERNAL_REFERENCE);
4721 CallCFunction(
4722 ExternalReference::record_object_allocation_function(isolate), 3);
4723 PopSafepointRegisters();
4724 bind(&done);
4725 }
4726
4727
4728 void MacroAssembler::RecordObjectAllocation(Isolate* isolate,
4729 Register object,
4730 int object_size) {
4731 Label done;
4732 cmpb(ExternalOperand(
4733 ExternalReference::is_tracking_allocations_address(isolate)),
4734 Immediate(0));
4735 j(zero, &done, Label::kNear);
4736 FrameScope frame(this, StackFrame::MANUAL);
4737 PushSafepointRegisters();
4738 PrepareCallCFunction(3);
4739 movq(arg_reg_2, object);
4740 movq(arg_reg_3, Immediate(object_size));
4741 movq(arg_reg_1, isolate, RelocInfo::EXTERNAL_REFERENCE);
4742 CallCFunction(
4743 ExternalReference::record_object_allocation_function(isolate), 3);
4744 PopSafepointRegisters();
4745 bind(&done);
4746 }
4747
4748
4701 } } // namespace v8::internal 4749 } } // namespace v8::internal
4702 4750
4703 #endif // V8_TARGET_ARCH_X64 4751 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698