| 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/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
| (...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1935 offset += 2; | 1935 offset += 2; |
| 1936 current_cell >>= 2; | 1936 current_cell >>= 2; |
| 1937 | 1937 |
| 1938 // TODO(hpayer): Refactor EvacuateObject and call this function instead. | 1938 // TODO(hpayer): Refactor EvacuateObject and call this function instead. |
| 1939 if (heap()->ShouldBePromoted(object->address(), size) && | 1939 if (heap()->ShouldBePromoted(object->address(), size) && |
| 1940 TryPromoteObject(object, size)) { | 1940 TryPromoteObject(object, size)) { |
| 1941 continue; | 1941 continue; |
| 1942 } | 1942 } |
| 1943 | 1943 |
| 1944 AllocationResult allocation; | 1944 AllocationResult allocation; |
| 1945 #ifndef V8_HOST_ARCH_64_BIT | 1945 #ifdef V8_HOST_ARCH_32_BIT |
| 1946 if (object->NeedsToEnsureDoubleAlignment()) { | 1946 if (object->NeedsToEnsureDoubleAlignment()) { |
| 1947 allocation = new_space->AllocateRawDoubleAligned(size); | 1947 allocation = new_space->AllocateRawAligned(size, kDoubleAligned); |
| 1948 } else { | 1948 } else { |
| 1949 allocation = new_space->AllocateRaw(size); | 1949 allocation = new_space->AllocateRaw(size); |
| 1950 } | 1950 } |
| 1951 #else | 1951 #else |
| 1952 allocation = new_space->AllocateRaw(size); | 1952 allocation = new_space->AllocateRaw(size); |
| 1953 #endif | 1953 #endif |
| 1954 if (allocation.IsRetry()) { | 1954 if (allocation.IsRetry()) { |
| 1955 if (!new_space->AddFreshPage()) { | 1955 if (!new_space->AddFreshPage()) { |
| 1956 // Shouldn't happen. We are sweeping linearly, and to-space | 1956 // Shouldn't happen. We are sweeping linearly, and to-space |
| 1957 // has the same number of pages as from-space, so there is | 1957 // has the same number of pages as from-space, so there is |
| 1958 // always room. | 1958 // always room. |
| 1959 UNREACHABLE(); | 1959 UNREACHABLE(); |
| 1960 } | 1960 } |
| 1961 #ifndef V8_HOST_ARCH_64_BIT | 1961 #ifdef V8_HOST_ARCH_32_BIT |
| 1962 if (object->NeedsToEnsureDoubleAlignment()) { | 1962 if (object->NeedsToEnsureDoubleAlignment()) { |
| 1963 allocation = new_space->AllocateRawDoubleAligned(size); | 1963 allocation = new_space->AllocateRawAligned(size, kDoubleAligned); |
| 1964 } else { | 1964 } else { |
| 1965 allocation = new_space->AllocateRaw(size); | 1965 allocation = new_space->AllocateRaw(size); |
| 1966 } | 1966 } |
| 1967 #else | 1967 #else |
| 1968 allocation = new_space->AllocateRaw(size); | 1968 allocation = new_space->AllocateRaw(size); |
| 1969 #endif | 1969 #endif |
| 1970 DCHECK(!allocation.IsRetry()); | 1970 DCHECK(!allocation.IsRetry()); |
| 1971 } | 1971 } |
| 1972 Object* target = allocation.ToObjectChecked(); | 1972 Object* target = allocation.ToObjectChecked(); |
| 1973 | 1973 |
| (...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3113 | 3113 |
| 3114 | 3114 |
| 3115 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, | 3115 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, |
| 3116 int object_size) { | 3116 int object_size) { |
| 3117 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize); | 3117 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize); |
| 3118 | 3118 |
| 3119 OldSpace* old_space = heap()->old_space(); | 3119 OldSpace* old_space = heap()->old_space(); |
| 3120 | 3120 |
| 3121 HeapObject* target; | 3121 HeapObject* target; |
| 3122 AllocationResult allocation; | 3122 AllocationResult allocation; |
| 3123 #ifndef V8_HOST_ARCH_64_BIT | 3123 #ifdef V8_HOST_ARCH_32_BIT |
| 3124 if (object->NeedsToEnsureDoubleAlignment()) { | 3124 if (object->NeedsToEnsureDoubleAlignment()) { |
| 3125 allocation = old_space->AllocateRawDoubleAligned(object_size); | 3125 allocation = old_space->AllocateRawAligned(object_size, kDoubleAligned); |
| 3126 } else { | 3126 } else { |
| 3127 allocation = old_space->AllocateRaw(object_size); | 3127 allocation = old_space->AllocateRaw(object_size); |
| 3128 } | 3128 } |
| 3129 #else | 3129 #else |
| 3130 allocation = old_space->AllocateRaw(object_size); | 3130 allocation = old_space->AllocateRaw(object_size); |
| 3131 #endif | 3131 #endif |
| 3132 if (allocation.To(&target)) { | 3132 if (allocation.To(&target)) { |
| 3133 MigrateObject(target, object, object_size, old_space->identity()); | 3133 MigrateObject(target, object, object_size, old_space->identity()); |
| 3134 heap()->IncrementPromotedObjectsSize(object_size); | 3134 heap()->IncrementPromotedObjectsSize(object_size); |
| 3135 return true; | 3135 return true; |
| (...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4782 SlotsBuffer* buffer = *buffer_address; | 4782 SlotsBuffer* buffer = *buffer_address; |
| 4783 while (buffer != NULL) { | 4783 while (buffer != NULL) { |
| 4784 SlotsBuffer* next_buffer = buffer->next(); | 4784 SlotsBuffer* next_buffer = buffer->next(); |
| 4785 DeallocateBuffer(buffer); | 4785 DeallocateBuffer(buffer); |
| 4786 buffer = next_buffer; | 4786 buffer = next_buffer; |
| 4787 } | 4787 } |
| 4788 *buffer_address = NULL; | 4788 *buffer_address = NULL; |
| 4789 } | 4789 } |
| 4790 } | 4790 } |
| 4791 } // namespace v8::internal | 4791 } // namespace v8::internal |
| OLD | NEW |