| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 3875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3886 // If we're forced to always allocate, we use the general allocation | 3886 // If we're forced to always allocate, we use the general allocation |
| 3887 // functions which may leave us with an object in old space. | 3887 // functions which may leave us with an object in old space. |
| 3888 if (always_allocate()) { | 3888 if (always_allocate()) { |
| 3889 { | 3889 { |
| 3890 AllocationResult allocation = | 3890 AllocationResult allocation = |
| 3891 AllocateRaw(object_size, NEW_SPACE, OLD_POINTER_SPACE); | 3891 AllocateRaw(object_size, NEW_SPACE, OLD_POINTER_SPACE); |
| 3892 if (!allocation.To(&clone)) return allocation; | 3892 if (!allocation.To(&clone)) return allocation; |
| 3893 } | 3893 } |
| 3894 Address clone_address = clone->address(); | 3894 Address clone_address = clone->address(); |
| 3895 CopyBlock(clone_address, source->address(), object_size); | 3895 CopyBlock(clone_address, source->address(), object_size); |
| 3896 // Update write barrier for all fields that lie beyond the header. | 3896 |
| 3897 RecordWrites(clone_address, JSObject::kHeaderSize, | 3897 // Update write barrier for all tagged fields that lie beyond the header. |
| 3898 (object_size - JSObject::kHeaderSize) / kPointerSize); | 3898 const int start_offset = JSObject::kHeaderSize; |
| 3899 const int end_offset = object_size; |
| 3900 |
| 3901 #if V8_DOUBLE_FIELDS_UNBOXING |
| 3902 LayoutDescriptorHelper helper(map); |
| 3903 bool has_only_tagged_fields = helper.all_fields_tagged(); |
| 3904 |
| 3905 if (!has_only_tagged_fields) { |
| 3906 for (int offset = start_offset; offset < end_offset;) { |
| 3907 int end_of_region_offset; |
| 3908 if (helper.IsTagged(offset, end_offset, &end_of_region_offset)) { |
| 3909 RecordWrites(clone_address, offset, |
| 3910 (end_of_region_offset - offset) / kPointerSize); |
| 3911 } |
| 3912 offset = end_of_region_offset; |
| 3913 } |
| 3914 } else { |
| 3915 #endif |
| 3916 // Object has only tagged fields. |
| 3917 RecordWrites(clone_address, start_offset, |
| 3918 (end_offset - start_offset) / kPointerSize); |
| 3919 #if V8_DOUBLE_FIELDS_UNBOXING |
| 3920 } |
| 3921 #endif |
| 3922 |
| 3899 } else { | 3923 } else { |
| 3900 wb_mode = SKIP_WRITE_BARRIER; | 3924 wb_mode = SKIP_WRITE_BARRIER; |
| 3901 | 3925 |
| 3902 { | 3926 { |
| 3903 int adjusted_object_size = | 3927 int adjusted_object_size = |
| 3904 site != NULL ? object_size + AllocationMemento::kSize : object_size; | 3928 site != NULL ? object_size + AllocationMemento::kSize : object_size; |
| 3905 AllocationResult allocation = | 3929 AllocationResult allocation = |
| 3906 AllocateRaw(adjusted_object_size, NEW_SPACE, NEW_SPACE); | 3930 AllocateRaw(adjusted_object_size, NEW_SPACE, NEW_SPACE); |
| 3907 if (!allocation.To(&clone)) return allocation; | 3931 if (!allocation.To(&clone)) return allocation; |
| 3908 } | 3932 } |
| (...skipping 2541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6450 static_cast<int>(object_sizes_last_time_[index])); | 6474 static_cast<int>(object_sizes_last_time_[index])); |
| 6451 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6475 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6452 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6476 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6453 | 6477 |
| 6454 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6478 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6455 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6479 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6456 ClearObjectStats(); | 6480 ClearObjectStats(); |
| 6457 } | 6481 } |
| 6458 } | 6482 } |
| 6459 } // namespace v8::internal | 6483 } // namespace v8::internal |
| OLD | NEW |