| OLD | NEW |
| 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 4063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4074 } | 4074 } |
| 4075 } | 4075 } |
| 4076 jmp(gc_required); | 4076 jmp(gc_required); |
| 4077 return; | 4077 return; |
| 4078 } | 4078 } |
| 4079 ASSERT(!result.is(result_end)); | 4079 ASSERT(!result.is(result_end)); |
| 4080 | 4080 |
| 4081 // Load address of new object into result. | 4081 // Load address of new object into result. |
| 4082 LoadAllocationTopHelper(result, scratch, flags); | 4082 LoadAllocationTopHelper(result, scratch, flags); |
| 4083 | 4083 |
| 4084 if (isolate()->heap_profiler()->is_tracking_allocations()) { |
| 4085 RecordObjectAllocation(isolate(), result, object_size); |
| 4086 } |
| 4087 |
| 4084 // Align the next allocation. Storing the filler map without checking top is | 4088 // Align the next allocation. Storing the filler map without checking top is |
| 4085 // safe in new-space because the limit of the heap is aligned there. | 4089 // safe in new-space because the limit of the heap is aligned there. |
| 4086 if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) { | 4090 if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) { |
| 4087 testq(result, Immediate(kDoubleAlignmentMask)); | 4091 testq(result, Immediate(kDoubleAlignmentMask)); |
| 4088 Check(zero, kAllocationIsNotDoubleAligned); | 4092 Check(zero, kAllocationIsNotDoubleAligned); |
| 4089 } | 4093 } |
| 4090 | 4094 |
| 4091 // Calculate new top and bail out if new space is exhausted. | 4095 // Calculate new top and bail out if new space is exhausted. |
| 4092 ExternalReference allocation_limit = | 4096 ExternalReference allocation_limit = |
| 4093 AllocationUtils::GetAllocationLimitReference(isolate(), flags); | 4097 AllocationUtils::GetAllocationLimitReference(isolate(), flags); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4153 // object_size is left unchanged by this function. | 4157 // object_size is left unchanged by this function. |
| 4154 } | 4158 } |
| 4155 jmp(gc_required); | 4159 jmp(gc_required); |
| 4156 return; | 4160 return; |
| 4157 } | 4161 } |
| 4158 ASSERT(!result.is(result_end)); | 4162 ASSERT(!result.is(result_end)); |
| 4159 | 4163 |
| 4160 // Load address of new object into result. | 4164 // Load address of new object into result. |
| 4161 LoadAllocationTopHelper(result, scratch, flags); | 4165 LoadAllocationTopHelper(result, scratch, flags); |
| 4162 | 4166 |
| 4167 if (isolate()->heap_profiler()->is_tracking_allocations()) { |
| 4168 RecordObjectAllocation(isolate(), result, object_size); |
| 4169 } |
| 4170 |
| 4163 // Align the next allocation. Storing the filler map without checking top is | 4171 // Align the next allocation. Storing the filler map without checking top is |
| 4164 // safe in new-space because the limit of the heap is aligned there. | 4172 // safe in new-space because the limit of the heap is aligned there. |
| 4165 if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) { | 4173 if (((flags & DOUBLE_ALIGNMENT) != 0) && FLAG_debug_code) { |
| 4166 testq(result, Immediate(kDoubleAlignmentMask)); | 4174 testq(result, Immediate(kDoubleAlignmentMask)); |
| 4167 Check(zero, kAllocationIsNotDoubleAligned); | 4175 Check(zero, kAllocationIsNotDoubleAligned); |
| 4168 } | 4176 } |
| 4169 | 4177 |
| 4170 // Calculate new top and bail out if new space is exhausted. | 4178 // Calculate new top and bail out if new space is exhausted. |
| 4171 ExternalReference allocation_limit = | 4179 ExternalReference allocation_limit = |
| 4172 AllocationUtils::GetAllocationLimitReference(isolate(), flags); | 4180 AllocationUtils::GetAllocationLimitReference(isolate(), flags); |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4914 cmpq(scratch_reg, kScratchRegister); | 4922 cmpq(scratch_reg, kScratchRegister); |
| 4915 j(less, &no_memento_available); | 4923 j(less, &no_memento_available); |
| 4916 cmpq(scratch_reg, ExternalOperand(new_space_allocation_top)); | 4924 cmpq(scratch_reg, ExternalOperand(new_space_allocation_top)); |
| 4917 j(greater, &no_memento_available); | 4925 j(greater, &no_memento_available); |
| 4918 CompareRoot(MemOperand(scratch_reg, -AllocationMemento::kSize), | 4926 CompareRoot(MemOperand(scratch_reg, -AllocationMemento::kSize), |
| 4919 Heap::kAllocationMementoMapRootIndex); | 4927 Heap::kAllocationMementoMapRootIndex); |
| 4920 bind(&no_memento_available); | 4928 bind(&no_memento_available); |
| 4921 } | 4929 } |
| 4922 | 4930 |
| 4923 | 4931 |
| 4932 void MacroAssembler::RecordObjectAllocation(Isolate* isolate, |
| 4933 Register object, |
| 4934 Register object_size) { |
| 4935 FrameScope frame(this, StackFrame::MANUAL); |
| 4936 PushSafepointRegisters(); |
| 4937 PrepareCallCFunction(3); |
| 4938 // In case object is rdx |
| 4939 movq(kScratchRegister, object); |
| 4940 movq(arg_reg_3, object_size); |
| 4941 movq(arg_reg_2, kScratchRegister); |
| 4942 movq(arg_reg_1, isolate, RelocInfo::EXTERNAL_REFERENCE); |
| 4943 CallCFunction( |
| 4944 ExternalReference::record_object_allocation_function(isolate), 3); |
| 4945 PopSafepointRegisters(); |
| 4946 } |
| 4947 |
| 4948 |
| 4949 void MacroAssembler::RecordObjectAllocation(Isolate* isolate, |
| 4950 Register object, |
| 4951 int object_size) { |
| 4952 FrameScope frame(this, StackFrame::MANUAL); |
| 4953 PushSafepointRegisters(); |
| 4954 PrepareCallCFunction(3); |
| 4955 movq(arg_reg_2, object); |
| 4956 movq(arg_reg_3, Immediate(object_size)); |
| 4957 movq(arg_reg_1, isolate, RelocInfo::EXTERNAL_REFERENCE); |
| 4958 CallCFunction( |
| 4959 ExternalReference::record_object_allocation_function(isolate), 3); |
| 4960 PopSafepointRegisters(); |
| 4961 } |
| 4962 |
| 4963 |
| 4924 } } // namespace v8::internal | 4964 } } // namespace v8::internal |
| 4925 | 4965 |
| 4926 #endif // V8_TARGET_ARCH_X64 | 4966 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |