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 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 | 1933 |
1934 offset += 2; | 1934 offset += 2; |
1935 current_cell >>= 2; | 1935 current_cell >>= 2; |
1936 | 1936 |
1937 // TODO(hpayer): Refactor EvacuateObject and call this function instead. | 1937 // TODO(hpayer): Refactor EvacuateObject and call this function instead. |
1938 if (heap()->ShouldBePromoted(object->address(), size) && | 1938 if (heap()->ShouldBePromoted(object->address(), size) && |
1939 TryPromoteObject(object, size)) { | 1939 TryPromoteObject(object, size)) { |
1940 continue; | 1940 continue; |
1941 } | 1941 } |
1942 | 1942 |
1943 AllocationResult allocation = new_space->AllocateRaw(size); | 1943 AllocationResult allocation; |
| 1944 #ifndef V8_HOST_ARCH_64_BIT |
| 1945 if (object->NeedsToEnsureDoubleAlignment()) { |
| 1946 allocation = new_space->AllocateRawDoubleAligned(size); |
| 1947 } else { |
| 1948 allocation = new_space->AllocateRaw(size); |
| 1949 } |
| 1950 #else |
| 1951 allocation = new_space->AllocateRaw(size); |
| 1952 #endif |
1944 if (allocation.IsRetry()) { | 1953 if (allocation.IsRetry()) { |
1945 if (!new_space->AddFreshPage()) { | 1954 if (!new_space->AddFreshPage()) { |
1946 // Shouldn't happen. We are sweeping linearly, and to-space | 1955 // Shouldn't happen. We are sweeping linearly, and to-space |
1947 // has the same number of pages as from-space, so there is | 1956 // has the same number of pages as from-space, so there is |
1948 // always room. | 1957 // always room. |
1949 UNREACHABLE(); | 1958 UNREACHABLE(); |
1950 } | 1959 } |
| 1960 #ifndef V8_HOST_ARCH_64_BIT |
| 1961 if (object->NeedsToEnsureDoubleAlignment()) { |
| 1962 allocation = new_space->AllocateRawDoubleAligned(size); |
| 1963 } else { |
| 1964 allocation = new_space->AllocateRaw(size); |
| 1965 } |
| 1966 #else |
1951 allocation = new_space->AllocateRaw(size); | 1967 allocation = new_space->AllocateRaw(size); |
| 1968 #endif |
1952 DCHECK(!allocation.IsRetry()); | 1969 DCHECK(!allocation.IsRetry()); |
1953 } | 1970 } |
1954 Object* target = allocation.ToObjectChecked(); | 1971 Object* target = allocation.ToObjectChecked(); |
1955 | 1972 |
1956 MigrateObject(HeapObject::cast(target), object, size, NEW_SPACE); | 1973 MigrateObject(HeapObject::cast(target), object, size, NEW_SPACE); |
1957 heap()->IncrementSemiSpaceCopiedObjectSize(size); | 1974 heap()->IncrementSemiSpaceCopiedObjectSize(size); |
1958 } | 1975 } |
1959 *cells = 0; | 1976 *cells = 0; |
1960 } | 1977 } |
1961 return survivors_size; | 1978 return survivors_size; |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3070 } | 3087 } |
3071 | 3088 |
3072 | 3089 |
3073 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, | 3090 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, |
3074 int object_size) { | 3091 int object_size) { |
3075 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize); | 3092 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize); |
3076 | 3093 |
3077 OldSpace* old_space = heap()->old_space(); | 3094 OldSpace* old_space = heap()->old_space(); |
3078 | 3095 |
3079 HeapObject* target; | 3096 HeapObject* target; |
3080 AllocationResult allocation = old_space->AllocateRaw(object_size); | 3097 AllocationResult allocation; |
| 3098 #ifndef V8_HOST_ARCH_64_BIT |
| 3099 if (object->NeedsToEnsureDoubleAlignment()) { |
| 3100 allocation = old_space->AllocateRawDoubleAligned(object_size); |
| 3101 } else { |
| 3102 allocation = old_space->AllocateRaw(object_size); |
| 3103 } |
| 3104 #else |
| 3105 allocation = old_space->AllocateRaw(object_size); |
| 3106 #endif |
3081 if (allocation.To(&target)) { | 3107 if (allocation.To(&target)) { |
3082 MigrateObject(target, object, object_size, old_space->identity()); | 3108 MigrateObject(target, object, object_size, old_space->identity()); |
3083 heap()->IncrementPromotedObjectsSize(object_size); | 3109 heap()->IncrementPromotedObjectsSize(object_size); |
3084 return true; | 3110 return true; |
3085 } | 3111 } |
3086 | 3112 |
3087 return false; | 3113 return false; |
3088 } | 3114 } |
3089 | 3115 |
3090 | 3116 |
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4731 SlotsBuffer* buffer = *buffer_address; | 4757 SlotsBuffer* buffer = *buffer_address; |
4732 while (buffer != NULL) { | 4758 while (buffer != NULL) { |
4733 SlotsBuffer* next_buffer = buffer->next(); | 4759 SlotsBuffer* next_buffer = buffer->next(); |
4734 DeallocateBuffer(buffer); | 4760 DeallocateBuffer(buffer); |
4735 buffer = next_buffer; | 4761 buffer = next_buffer; |
4736 } | 4762 } |
4737 *buffer_address = NULL; | 4763 *buffer_address = NULL; |
4738 } | 4764 } |
4739 } | 4765 } |
4740 } // namespace v8::internal | 4766 } // namespace v8::internal |
OLD | NEW |