| 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 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2098     } | 2098     } | 
| 2099   } | 2099   } | 
| 2100 | 2100 | 
| 2101   template <int alignment> | 2101   template <int alignment> | 
| 2102   static inline bool SemiSpaceCopyObject(Map* map, HeapObject** slot, | 2102   static inline bool SemiSpaceCopyObject(Map* map, HeapObject** slot, | 
| 2103                                          HeapObject* object, int object_size) { | 2103                                          HeapObject* object, int object_size) { | 
| 2104     Heap* heap = map->GetHeap(); | 2104     Heap* heap = map->GetHeap(); | 
| 2105 | 2105 | 
| 2106     DCHECK(heap->AllowedToBeMigrated(object, NEW_SPACE)); | 2106     DCHECK(heap->AllowedToBeMigrated(object, NEW_SPACE)); | 
| 2107     AllocationResult allocation; | 2107     AllocationResult allocation; | 
|  | 2108 #ifndef V8_HOST_ARCH_64_BIT | 
| 2108     if (alignment == kDoubleAlignment) { | 2109     if (alignment == kDoubleAlignment) { | 
| 2109       allocation = heap->new_space()->AllocateRawDoubleAligned(object_size); | 2110       allocation = heap->new_space()->AllocateRawDoubleAligned(object_size); | 
| 2110     } else { | 2111     } else { | 
| 2111       allocation = heap->new_space()->AllocateRaw(object_size); | 2112       allocation = heap->new_space()->AllocateRaw(object_size); | 
| 2112     } | 2113     } | 
|  | 2114 #else | 
|  | 2115     allocation = heap->new_space()->AllocateRaw(object_size); | 
|  | 2116 #endif | 
| 2113 | 2117 | 
| 2114     HeapObject* target = NULL;  // Initialization to please compiler. | 2118     HeapObject* target = NULL;  // Initialization to please compiler. | 
| 2115     if (allocation.To(&target)) { | 2119     if (allocation.To(&target)) { | 
| 2116       // Order is important here: Set the promotion limit before storing a | 2120       // Order is important here: Set the promotion limit before storing a | 
| 2117       // filler for double alignment or migrating the object. Otherwise we | 2121       // filler for double alignment or migrating the object. Otherwise we | 
| 2118       // may end up overwriting promotion queue entries when we migrate the | 2122       // may end up overwriting promotion queue entries when we migrate the | 
| 2119       // object. | 2123       // object. | 
| 2120       heap->promotion_queue()->SetNewLimit(heap->new_space()->top()); | 2124       heap->promotion_queue()->SetNewLimit(heap->new_space()->top()); | 
| 2121 | 2125 | 
| 2122       MigrateObject(heap, object, target, object_size); | 2126       MigrateObject(heap, object, target, object_size); | 
| 2123 | 2127 | 
| 2124       // Update slot to new target. | 2128       // Update slot to new target. | 
| 2125       *slot = target; | 2129       *slot = target; | 
| 2126 | 2130 | 
| 2127       heap->IncrementSemiSpaceCopiedObjectSize(object_size); | 2131       heap->IncrementSemiSpaceCopiedObjectSize(object_size); | 
| 2128       return true; | 2132       return true; | 
| 2129     } | 2133     } | 
| 2130     return false; | 2134     return false; | 
| 2131   } | 2135   } | 
| 2132 | 2136 | 
| 2133 | 2137 | 
| 2134   template <ObjectContents object_contents, int alignment> | 2138   template <ObjectContents object_contents, int alignment> | 
| 2135   static inline bool PromoteObject(Map* map, HeapObject** slot, | 2139   static inline bool PromoteObject(Map* map, HeapObject** slot, | 
| 2136                                    HeapObject* object, int object_size) { | 2140                                    HeapObject* object, int object_size) { | 
| 2137     Heap* heap = map->GetHeap(); | 2141     Heap* heap = map->GetHeap(); | 
| 2138 | 2142 | 
| 2139     AllocationResult allocation; | 2143     AllocationResult allocation; | 
|  | 2144 #ifndef V8_HOST_ARCH_64_BIT | 
| 2140     if (alignment == kDoubleAlignment) { | 2145     if (alignment == kDoubleAlignment) { | 
| 2141       allocation = heap->old_space()->AllocateRawDoubleAligned(object_size); | 2146       allocation = heap->old_space()->AllocateRawDoubleAligned(object_size); | 
| 2142     } else { | 2147     } else { | 
| 2143       allocation = heap->old_space()->AllocateRaw(object_size); | 2148       allocation = heap->old_space()->AllocateRaw(object_size); | 
| 2144     } | 2149     } | 
|  | 2150 #else | 
|  | 2151     allocation = heap->old_space()->AllocateRaw(object_size); | 
|  | 2152 #endif | 
| 2145 | 2153 | 
| 2146     HeapObject* target = NULL;  // Initialization to please compiler. | 2154     HeapObject* target = NULL;  // Initialization to please compiler. | 
| 2147     if (allocation.To(&target)) { | 2155     if (allocation.To(&target)) { | 
| 2148       MigrateObject(heap, object, target, object_size); | 2156       MigrateObject(heap, object, target, object_size); | 
| 2149 | 2157 | 
| 2150       // Update slot to new target. | 2158       // Update slot to new target. | 
| 2151       *slot = target; | 2159       *slot = target; | 
| 2152 | 2160 | 
| 2153       if (object_contents == POINTER_OBJECT) { | 2161       if (object_contents == POINTER_OBJECT) { | 
| 2154         if (map->instance_type() == JS_FUNCTION_TYPE) { | 2162         if (map->instance_type() == JS_FUNCTION_TYPE) { | 
| (...skipping 4314 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6469       } | 6477       } | 
| 6470       delete list; | 6478       delete list; | 
| 6471     } else { | 6479     } else { | 
| 6472       prev = list; | 6480       prev = list; | 
| 6473     } | 6481     } | 
| 6474     list = next; | 6482     list = next; | 
| 6475   } | 6483   } | 
| 6476 } | 6484 } | 
| 6477 } | 6485 } | 
| 6478 }  // namespace v8::internal | 6486 }  // namespace v8::internal | 
| OLD | NEW | 
|---|