OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 new_map = is_internalized | 1731 new_map = is_internalized |
1732 ? (is_one_byte | 1732 ? (is_one_byte |
1733 ? heap->external_internalized_string_with_one_byte_data_map() | 1733 ? heap->external_internalized_string_with_one_byte_data_map() |
1734 : heap->external_internalized_string_map()) | 1734 : heap->external_internalized_string_map()) |
1735 : (is_one_byte ? heap->external_string_with_one_byte_data_map() | 1735 : (is_one_byte ? heap->external_string_with_one_byte_data_map() |
1736 : heap->external_string_map()); | 1736 : heap->external_string_map()); |
1737 } | 1737 } |
1738 | 1738 |
1739 // Byte size of the external String object. | 1739 // Byte size of the external String object. |
1740 int new_size = this->SizeFromMap(new_map); | 1740 int new_size = this->SizeFromMap(new_map); |
1741 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); | 1741 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size, |
| 1742 ClearRecordedSlots::kNo); |
1742 | 1743 |
1743 // We are storing the new map using release store after creating a filler for | 1744 // We are storing the new map using release store after creating a filler for |
1744 // the left-over space to avoid races with the sweeper thread. | 1745 // the left-over space to avoid races with the sweeper thread. |
1745 this->synchronized_set_map(new_map); | 1746 this->synchronized_set_map(new_map); |
1746 | 1747 |
1747 ExternalTwoByteString* self = ExternalTwoByteString::cast(this); | 1748 ExternalTwoByteString* self = ExternalTwoByteString::cast(this); |
1748 self->set_resource(resource); | 1749 self->set_resource(resource); |
1749 if (is_internalized) self->Hash(); // Force regeneration of the hash value. | 1750 if (is_internalized) self->Hash(); // Force regeneration of the hash value. |
1750 | 1751 |
1751 heap->AdjustLiveBytes(this, new_size - size, Heap::CONCURRENT_TO_SWEEPER); | 1752 heap->AdjustLiveBytes(this, new_size - size, Heap::CONCURRENT_TO_SWEEPER); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1792 ? heap->short_external_one_byte_internalized_string_map() | 1793 ? heap->short_external_one_byte_internalized_string_map() |
1793 : heap->short_external_one_byte_string_map(); | 1794 : heap->short_external_one_byte_string_map(); |
1794 } else { | 1795 } else { |
1795 new_map = is_internalized | 1796 new_map = is_internalized |
1796 ? heap->external_one_byte_internalized_string_map() | 1797 ? heap->external_one_byte_internalized_string_map() |
1797 : heap->external_one_byte_string_map(); | 1798 : heap->external_one_byte_string_map(); |
1798 } | 1799 } |
1799 | 1800 |
1800 // Byte size of the external String object. | 1801 // Byte size of the external String object. |
1801 int new_size = this->SizeFromMap(new_map); | 1802 int new_size = this->SizeFromMap(new_map); |
1802 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); | 1803 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size, |
| 1804 ClearRecordedSlots::kNo); |
1803 | 1805 |
1804 // We are storing the new map using release store after creating a filler for | 1806 // We are storing the new map using release store after creating a filler for |
1805 // the left-over space to avoid races with the sweeper thread. | 1807 // the left-over space to avoid races with the sweeper thread. |
1806 this->synchronized_set_map(new_map); | 1808 this->synchronized_set_map(new_map); |
1807 | 1809 |
1808 ExternalOneByteString* self = ExternalOneByteString::cast(this); | 1810 ExternalOneByteString* self = ExternalOneByteString::cast(this); |
1809 self->set_resource(resource); | 1811 self->set_resource(resource); |
1810 if (is_internalized) self->Hash(); // Force regeneration of the hash value. | 1812 if (is_internalized) self->Hash(); // Force regeneration of the hash value. |
1811 | 1813 |
1812 heap->AdjustLiveBytes(this, new_size - size, Heap::CONCURRENT_TO_SWEEPER); | 1814 heap->AdjustLiveBytes(this, new_size - size, Heap::CONCURRENT_TO_SWEEPER); |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2936 object->set_properties(*array); | 2938 object->set_properties(*array); |
2937 } | 2939 } |
2938 | 2940 |
2939 // Create filler object past the new instance size. | 2941 // Create filler object past the new instance size. |
2940 int new_instance_size = new_map->instance_size(); | 2942 int new_instance_size = new_map->instance_size(); |
2941 int instance_size_delta = old_map->instance_size() - new_instance_size; | 2943 int instance_size_delta = old_map->instance_size() - new_instance_size; |
2942 DCHECK(instance_size_delta >= 0); | 2944 DCHECK(instance_size_delta >= 0); |
2943 | 2945 |
2944 if (instance_size_delta > 0) { | 2946 if (instance_size_delta > 0) { |
2945 Address address = object->address(); | 2947 Address address = object->address(); |
2946 heap->CreateFillerObjectAt( | 2948 heap->CreateFillerObjectAt(address + new_instance_size, instance_size_delta, |
2947 address + new_instance_size, instance_size_delta); | 2949 ClearRecordedSlots::kYes); |
2948 heap->AdjustLiveBytes(*object, -instance_size_delta, | 2950 heap->AdjustLiveBytes(*object, -instance_size_delta, |
2949 Heap::CONCURRENT_TO_SWEEPER); | 2951 Heap::CONCURRENT_TO_SWEEPER); |
2950 } | 2952 } |
2951 | 2953 |
2952 // We are storing the new map using release store after creating a filler for | 2954 // We are storing the new map using release store after creating a filler for |
2953 // the left-over space to avoid races with the sweeper thread. | 2955 // the left-over space to avoid races with the sweeper thread. |
2954 object->synchronized_set_map(*new_map); | 2956 object->synchronized_set_map(*new_map); |
2955 } | 2957 } |
2956 | 2958 |
2957 void MigrateFastToSlow(Handle<JSObject> object, Handle<Map> new_map, | 2959 void MigrateFastToSlow(Handle<JSObject> object, Handle<Map> new_map, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3032 DisallowHeapAllocation no_allocation; | 3034 DisallowHeapAllocation no_allocation; |
3033 | 3035 |
3034 // Resize the object in the heap if necessary. | 3036 // Resize the object in the heap if necessary. |
3035 int new_instance_size = new_map->instance_size(); | 3037 int new_instance_size = new_map->instance_size(); |
3036 int instance_size_delta = map->instance_size() - new_instance_size; | 3038 int instance_size_delta = map->instance_size() - new_instance_size; |
3037 DCHECK(instance_size_delta >= 0); | 3039 DCHECK(instance_size_delta >= 0); |
3038 | 3040 |
3039 if (instance_size_delta > 0) { | 3041 if (instance_size_delta > 0) { |
3040 Heap* heap = isolate->heap(); | 3042 Heap* heap = isolate->heap(); |
3041 heap->CreateFillerObjectAt(object->address() + new_instance_size, | 3043 heap->CreateFillerObjectAt(object->address() + new_instance_size, |
3042 instance_size_delta); | 3044 instance_size_delta, ClearRecordedSlots::kYes); |
3043 heap->AdjustLiveBytes(*object, -instance_size_delta, | 3045 heap->AdjustLiveBytes(*object, -instance_size_delta, |
3044 Heap::CONCURRENT_TO_SWEEPER); | 3046 Heap::CONCURRENT_TO_SWEEPER); |
3045 } | 3047 } |
3046 | 3048 |
3047 // We are storing the new map using release store after creating a filler for | 3049 // We are storing the new map using release store after creating a filler for |
3048 // the left-over space to avoid races with the sweeper thread. | 3050 // the left-over space to avoid races with the sweeper thread. |
3049 object->synchronized_set_map(*new_map); | 3051 object->synchronized_set_map(*new_map); |
3050 | 3052 |
3051 object->set_properties(*dictionary); | 3053 object->set_properties(*dictionary); |
3052 | 3054 |
(...skipping 9055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12108 | 12110 |
12109 int delta = old_size - new_size; | 12111 int delta = old_size - new_size; |
12110 | 12112 |
12111 Address start_of_string = string->address(); | 12113 Address start_of_string = string->address(); |
12112 DCHECK_OBJECT_ALIGNED(start_of_string); | 12114 DCHECK_OBJECT_ALIGNED(start_of_string); |
12113 DCHECK_OBJECT_ALIGNED(start_of_string + new_size); | 12115 DCHECK_OBJECT_ALIGNED(start_of_string + new_size); |
12114 | 12116 |
12115 Heap* heap = string->GetHeap(); | 12117 Heap* heap = string->GetHeap(); |
12116 // Sizes are pointer size aligned, so that we can use filler objects | 12118 // Sizes are pointer size aligned, so that we can use filler objects |
12117 // that are a multiple of pointer size. | 12119 // that are a multiple of pointer size. |
12118 heap->CreateFillerObjectAt(start_of_string + new_size, delta); | 12120 heap->CreateFillerObjectAt(start_of_string + new_size, delta, |
| 12121 ClearRecordedSlots::kNo); |
12119 heap->AdjustLiveBytes(*string, -delta, Heap::CONCURRENT_TO_SWEEPER); | 12122 heap->AdjustLiveBytes(*string, -delta, Heap::CONCURRENT_TO_SWEEPER); |
12120 | 12123 |
12121 // We are storing the new length using release store after creating a filler | 12124 // We are storing the new length using release store after creating a filler |
12122 // for the left-over space to avoid races with the sweeper thread. | 12125 // for the left-over space to avoid races with the sweeper thread. |
12123 string->synchronized_set_length(new_length); | 12126 string->synchronized_set_length(new_length); |
12124 | 12127 |
12125 if (new_length == 0) return heap->isolate()->factory()->empty_string(); | 12128 if (new_length == 0) return heap->isolate()->factory()->empty_string(); |
12126 return string; | 12129 return string; |
12127 } | 12130 } |
12128 | 12131 |
(...skipping 7733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19862 if (cell->value() != *new_value) { | 19865 if (cell->value() != *new_value) { |
19863 cell->set_value(*new_value); | 19866 cell->set_value(*new_value); |
19864 Isolate* isolate = cell->GetIsolate(); | 19867 Isolate* isolate = cell->GetIsolate(); |
19865 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19868 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19866 isolate, DependentCode::kPropertyCellChangedGroup); | 19869 isolate, DependentCode::kPropertyCellChangedGroup); |
19867 } | 19870 } |
19868 } | 19871 } |
19869 | 19872 |
19870 } // namespace internal | 19873 } // namespace internal |
19871 } // namespace v8 | 19874 } // namespace v8 |
OLD | NEW |