OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } else { | 184 } else { |
185 int remaining = byte_size / kPointerSize; | 185 int remaining = byte_size / kPointerSize; |
186 do { | 186 do { |
187 remaining--; | 187 remaining--; |
188 *dst++ = *src++; | 188 *dst++ = *src++; |
189 } while (remaining > 0); | 189 } while (remaining > 0); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 | 193 |
| 194 void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { |
| 195 ASSERT(InFromSpace(object)); |
| 196 |
| 197 // We use the first word (where the map pointer usually is) of a heap |
| 198 // object to record the forwarding pointer. A forwarding pointer can |
| 199 // point to an old space, the code space, or the to space of the new |
| 200 // generation. |
| 201 MapWord first_word = object->map_word(); |
| 202 |
| 203 // If the first word is a forwarding address, the object has already been |
| 204 // copied. |
| 205 if (first_word.IsForwardingAddress()) { |
| 206 *p = first_word.ToForwardingAddress(); |
| 207 return; |
| 208 } |
| 209 |
| 210 // Call the slow part of scavenge object. |
| 211 return ScavengeObjectSlow(p, object); |
| 212 } |
| 213 |
| 214 |
194 Object* Heap::GetKeyedLookupCache() { | 215 Object* Heap::GetKeyedLookupCache() { |
195 if (keyed_lookup_cache()->IsUndefined()) { | 216 if (keyed_lookup_cache()->IsUndefined()) { |
196 Object* obj = LookupCache::Allocate(4); | 217 Object* obj = LookupCache::Allocate(4); |
197 if (obj->IsFailure()) return obj; | 218 if (obj->IsFailure()) return obj; |
198 keyed_lookup_cache_ = obj; | 219 keyed_lookup_cache_ = obj; |
199 } | 220 } |
200 return keyed_lookup_cache(); | 221 return keyed_lookup_cache(); |
201 } | 222 } |
202 | 223 |
203 | 224 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 allocation_allowed_ = new_state; | 298 allocation_allowed_ = new_state; |
278 return old; | 299 return old; |
279 } | 300 } |
280 | 301 |
281 #endif | 302 #endif |
282 | 303 |
283 | 304 |
284 } } // namespace v8::internal | 305 } } // namespace v8::internal |
285 | 306 |
286 #endif // V8_HEAP_INL_H_ | 307 #endif // V8_HEAP_INL_H_ |
OLD | NEW |