| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 InstanceType type = object->map()->instance_type(); | 139 InstanceType type = object->map()->instance_type(); |
| 140 ASSERT((type != CODE_TYPE) && (type != MAP_TYPE)); | 140 ASSERT((type != CODE_TYPE) && (type != MAP_TYPE)); |
| 141 bool has_pointers = | 141 bool has_pointers = |
| 142 type != HEAP_NUMBER_TYPE && | 142 type != HEAP_NUMBER_TYPE && |
| 143 (type >= FIRST_NONSTRING_TYPE || | 143 (type >= FIRST_NONSTRING_TYPE || |
| 144 String::cast(object)->representation_tag() != kSeqStringTag); | 144 String::cast(object)->representation_tag() != kSeqStringTag); |
| 145 return has_pointers ? old_pointer_space_ : old_data_space_; | 145 return has_pointers ? old_pointer_space_ : old_data_space_; |
| 146 } | 146 } |
| 147 | 147 |
| 148 | 148 |
| 149 void Heap::CopyBlock(Object** dst, Object** src, int byte_size) { |
| 150 ASSERT(IsAligned(byte_size, kPointerSize)); |
| 151 |
| 152 // Use block copying memcpy if the segment we're copying is |
| 153 // enough to justify the extra call/setup overhead. |
| 154 static const int kBlockCopyLimit = 16 * kPointerSize; |
| 155 |
| 156 if (byte_size >= kBlockCopyLimit) { |
| 157 memcpy(dst, src, byte_size); |
| 158 } else { |
| 159 int remaining = byte_size / kPointerSize; |
| 160 do { |
| 161 remaining--; |
| 162 *dst++ = *src++; |
| 163 } while (remaining > 0); |
| 164 } |
| 165 } |
| 166 |
| 167 |
| 149 #define GC_GREEDY_CHECK() \ | 168 #define GC_GREEDY_CHECK() \ |
| 150 ASSERT(!FLAG_gc_greedy || v8::internal::Heap::GarbageCollectionGreedyCheck()) | 169 ASSERT(!FLAG_gc_greedy || v8::internal::Heap::GarbageCollectionGreedyCheck()) |
| 151 | 170 |
| 152 // Do not use the identifier __object__ in a call to this macro. | 171 // Do not use the identifier __object__ in a call to this macro. |
| 153 // | 172 // |
| 154 // Call the function FUNCTION_CALL. If it fails with a RetryAfterGC | 173 // Call the function FUNCTION_CALL. If it fails with a RetryAfterGC |
| 155 // failure, call the garbage collector and retry the function. If the | 174 // failure, call the garbage collector and retry the function. If the |
| 156 // garbage collector cannot reclaim the required space or the second | 175 // garbage collector cannot reclaim the required space or the second |
| 157 // call fails with a RetryAfterGC failure, fail with out of memory. | 176 // call fails with a RetryAfterGC failure, fail with out of memory. |
| 158 // If there is any other failure, return a null handle. If either | 177 // If there is any other failure, return a null handle. If either |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 allocation_allowed_ = new_state; | 245 allocation_allowed_ = new_state; |
| 227 return old; | 246 return old; |
| 228 } | 247 } |
| 229 | 248 |
| 230 #endif | 249 #endif |
| 231 | 250 |
| 232 | 251 |
| 233 } } // namespace v8::internal | 252 } } // namespace v8::internal |
| 234 | 253 |
| 235 #endif // V8_HEAP_INL_H_ | 254 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |