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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 ? old_pointer_space_ | 189 ? old_pointer_space_ |
190 : old_data_space_; | 190 : old_data_space_; |
191 } | 191 } |
192 | 192 |
193 | 193 |
194 AllocationSpace Heap::TargetSpaceId(InstanceType type) { | 194 AllocationSpace Heap::TargetSpaceId(InstanceType type) { |
195 // Heap numbers and sequential strings are promoted to old data space, all | 195 // Heap numbers and sequential strings are promoted to old data space, all |
196 // other object types are promoted to old pointer space. We do not use | 196 // other object types are promoted to old pointer space. We do not use |
197 // object->IsHeapNumber() and object->IsSeqString() because we already | 197 // object->IsHeapNumber() and object->IsSeqString() because we already |
198 // know that object has the heap object tag. | 198 // know that object has the heap object tag. |
199 ASSERT((type != CODE_TYPE) && (type != MAP_TYPE)); | 199 |
200 bool has_pointers = | 200 // These objects are never allocated in new space. |
201 type != HEAP_NUMBER_TYPE && | 201 ASSERT(type != MAP_TYPE); |
202 (type >= FIRST_NONSTRING_TYPE || | 202 ASSERT(type != CODE_TYPE); |
203 (type & kStringRepresentationMask) != kSeqStringTag); | 203 ASSERT(type != ODDBALL_TYPE); |
204 return has_pointers ? OLD_POINTER_SPACE : OLD_DATA_SPACE; | 204 ASSERT(type != JS_GLOBAL_PROPERTY_CELL_TYPE); |
| 205 |
| 206 if (type < FIRST_NONSTRING_TYPE) { |
| 207 // There are three string representations: sequential strings, cons |
| 208 // strings, and external strings. Only cons strings contain |
| 209 // non-map-word pointers to heap objects. |
| 210 return ((type & kStringRepresentationMask) == kConsStringTag) |
| 211 ? OLD_POINTER_SPACE |
| 212 : OLD_DATA_SPACE; |
| 213 } else { |
| 214 return (type <= LAST_DATA_TYPE) ? OLD_DATA_SPACE : OLD_POINTER_SPACE; |
| 215 } |
205 } | 216 } |
206 | 217 |
207 | 218 |
208 void Heap::CopyBlock(Object** dst, Object** src, int byte_size) { | 219 void Heap::CopyBlock(Object** dst, Object** src, int byte_size) { |
209 ASSERT(IsAligned(byte_size, kPointerSize)); | 220 ASSERT(IsAligned(byte_size, kPointerSize)); |
210 | 221 |
211 // Use block copying memcpy if the segment we're copying is | 222 // Use block copying memcpy if the segment we're copying is |
212 // enough to justify the extra call/setup overhead. | 223 // enough to justify the extra call/setup overhead. |
213 static const int kBlockCopyLimit = 16 * kPointerSize; | 224 static const int kBlockCopyLimit = 16 * kPointerSize; |
214 | 225 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 397 |
387 | 398 |
388 void ExternalStringTable::ShrinkNewStrings(int position) { | 399 void ExternalStringTable::ShrinkNewStrings(int position) { |
389 new_space_strings_.Rewind(position); | 400 new_space_strings_.Rewind(position); |
390 Verify(); | 401 Verify(); |
391 } | 402 } |
392 | 403 |
393 } } // namespace v8::internal | 404 } } // namespace v8::internal |
394 | 405 |
395 #endif // V8_HEAP_INL_H_ | 406 #endif // V8_HEAP_INL_H_ |
OLD | NEW |