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

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

Issue 23039014: Hook-allocation on bleeding edge (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/cctest/cctest.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 // 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 3877 matching lines...) Expand 10 before | Expand all | Expand 10 after
3888 if (tag_result) { 3888 if (tag_result) {
3889 subq(result, Immediate(object_size - kHeapObjectTag)); 3889 subq(result, Immediate(object_size - kHeapObjectTag));
3890 } else { 3890 } else {
3891 subq(result, Immediate(object_size)); 3891 subq(result, Immediate(object_size));
3892 } 3892 }
3893 } else if (tag_result) { 3893 } else if (tag_result) {
3894 // Tag the result if requested. 3894 // Tag the result if requested.
3895 ASSERT(kHeapObjectTag == 1); 3895 ASSERT(kHeapObjectTag == 1);
3896 incq(result); 3896 incq(result);
3897 } 3897 }
3898
3899 RecordObjectAllocation(isolate(), result, object_size);
3898 } 3900 }
3899 3901
3900 3902
3901 void MacroAssembler::Allocate(int header_size, 3903 void MacroAssembler::Allocate(int header_size,
3902 ScaleFactor element_size, 3904 ScaleFactor element_size,
3903 Register element_count, 3905 Register element_count,
3904 Register result, 3906 Register result,
3905 Register result_end, 3907 Register result_end,
3906 Register scratch, 3908 Register scratch,
3907 Label* gc_required, 3909 Label* gc_required,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
3956 cmpq(result_end, limit_operand); 3958 cmpq(result_end, limit_operand);
3957 j(above, gc_required); 3959 j(above, gc_required);
3958 3960
3959 // Update allocation top. 3961 // Update allocation top.
3960 UpdateAllocationTopHelper(result_end, scratch, flags); 3962 UpdateAllocationTopHelper(result_end, scratch, flags);
3961 3963
3962 // Tag the result if requested. 3964 // Tag the result if requested.
3963 if ((flags & TAG_OBJECT) != 0) { 3965 if ((flags & TAG_OBJECT) != 0) {
3964 addq(result, Immediate(kHeapObjectTag)); 3966 addq(result, Immediate(kHeapObjectTag));
3965 } 3967 }
3968
3969 RecordObjectAllocation(isolate(), result, object_size);
3966 } 3970 }
3967 3971
3968 3972
3969 void MacroAssembler::UndoAllocationInNewSpace(Register object) { 3973 void MacroAssembler::UndoAllocationInNewSpace(Register object) {
3970 ExternalReference new_space_allocation_top = 3974 ExternalReference new_space_allocation_top =
3971 ExternalReference::new_space_allocation_top_address(isolate()); 3975 ExternalReference::new_space_allocation_top_address(isolate());
3972 3976
3973 // Make sure the object has no tag before resetting top. 3977 // Make sure the object has no tag before resetting top.
3974 and_(object, Immediate(~kHeapObjectTagMask)); 3978 and_(object, Immediate(~kHeapObjectTagMask));
3975 Operand top_operand = ExternalOperand(new_space_allocation_top); 3979 Operand top_operand = ExternalOperand(new_space_allocation_top);
(...skipping 715 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 cmpl(ExternalOperand(
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(rdx, object_size);
4719 movq(rsi, kScratchRegister);
4720 movq(rdi, 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 cmpl(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(rsi, object);
4740 movq(rdx, Immediate(object_size));
4741 movq(rdi, 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
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/cctest/cctest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698