ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1 | // Copyright 2006-2008 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #ifndef V8_HEAP_INL_H_ |
| 29 | #define V8_HEAP_INL_H_ |
| 30 | |
| 31 | #include "log.h" |
| 32 | #include "v8-counters.h" |
| 33 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 34 | namespace v8 { |
| 35 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 36 | |
ager@chromium.org | 5aa501c | 2009-06-23 07:57:28 +0000 | [diff] [blame] | 37 | int Heap::MaxObjectSizeInPagedSpace() { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 38 | return Page::kMaxHeapObjectSize; |
| 39 | } |
| 40 | |
| 41 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 42 | Object* Heap::AllocateSymbol(Vector<const char> str, |
| 43 | int chars, |
| 44 | uint32_t length_field) { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 45 | unibrow::Utf8InputBuffer<> buffer(str.start(), |
| 46 | static_cast<unsigned>(str.length())); |
| 47 | return AllocateInternalSymbol(&buffer, chars, length_field); |
| 48 | } |
| 49 | |
| 50 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 51 | Object* Heap::AllocateRaw(int size_in_bytes, |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 52 | AllocationSpace space, |
| 53 | AllocationSpace retry_space) { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 54 | ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 55 | ASSERT(space != NEW_SPACE || |
| 56 | retry_space == OLD_POINTER_SPACE || |
| 57 | retry_space == OLD_DATA_SPACE); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 58 | #ifdef DEBUG |
| 59 | if (FLAG_gc_interval >= 0 && |
| 60 | !disallow_allocation_failure_ && |
| 61 | Heap::allocation_timeout_-- <= 0) { |
| 62 | return Failure::RetryAfterGC(size_in_bytes, space); |
| 63 | } |
| 64 | Counters::objs_since_last_full.Increment(); |
| 65 | Counters::objs_since_last_young.Increment(); |
| 66 | #endif |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 67 | Object* result; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 68 | if (NEW_SPACE == space) { |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 69 | result = new_space_.AllocateRaw(size_in_bytes); |
| 70 | if (always_allocate() && result->IsFailure()) { |
| 71 | space = retry_space; |
| 72 | } else { |
| 73 | return result; |
| 74 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 75 | } |
| 76 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 77 | if (OLD_POINTER_SPACE == space) { |
| 78 | result = old_pointer_space_->AllocateRaw(size_in_bytes); |
| 79 | } else if (OLD_DATA_SPACE == space) { |
| 80 | result = old_data_space_->AllocateRaw(size_in_bytes); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 81 | } else if (CODE_SPACE == space) { |
| 82 | result = code_space_->AllocateRaw(size_in_bytes); |
| 83 | } else if (LO_SPACE == space) { |
| 84 | result = lo_space_->AllocateRaw(size_in_bytes); |
kasperl@chromium.org | defbd10 | 2009-07-13 14:04:26 +0000 | [diff] [blame] | 85 | } else if (CELL_SPACE == space) { |
| 86 | result = cell_space_->AllocateRaw(size_in_bytes); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 87 | } else { |
| 88 | ASSERT(MAP_SPACE == space); |
| 89 | result = map_space_->AllocateRaw(size_in_bytes); |
| 90 | } |
| 91 | if (result->IsFailure()) old_gen_exhausted_ = true; |
| 92 | return result; |
| 93 | } |
| 94 | |
| 95 | |
| 96 | Object* Heap::NumberFromInt32(int32_t value) { |
| 97 | if (Smi::IsValid(value)) return Smi::FromInt(value); |
| 98 | // Bypass NumberFromDouble to avoid various redundant checks. |
| 99 | return AllocateHeapNumber(FastI2D(value)); |
| 100 | } |
| 101 | |
| 102 | |
| 103 | Object* Heap::NumberFromUint32(uint32_t value) { |
| 104 | if ((int32_t)value >= 0 && Smi::IsValid((int32_t)value)) { |
| 105 | return Smi::FromInt((int32_t)value); |
| 106 | } |
| 107 | // Bypass NumberFromDouble to avoid various redundant checks. |
| 108 | return AllocateHeapNumber(FastUI2D(value)); |
| 109 | } |
| 110 | |
| 111 | |
kasperl@chromium.org | defbd10 | 2009-07-13 14:04:26 +0000 | [diff] [blame] | 112 | Object* Heap::AllocateRawMap() { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 113 | #ifdef DEBUG |
| 114 | Counters::objs_since_last_full.Increment(); |
| 115 | Counters::objs_since_last_young.Increment(); |
| 116 | #endif |
kasperl@chromium.org | defbd10 | 2009-07-13 14:04:26 +0000 | [diff] [blame] | 117 | Object* result = map_space_->AllocateRaw(Map::kSize); |
| 118 | if (result->IsFailure()) old_gen_exhausted_ = true; |
| 119 | return result; |
| 120 | } |
| 121 | |
| 122 | |
| 123 | Object* Heap::AllocateRawCell() { |
| 124 | #ifdef DEBUG |
| 125 | Counters::objs_since_last_full.Increment(); |
| 126 | Counters::objs_since_last_young.Increment(); |
| 127 | #endif |
| 128 | Object* result = cell_space_->AllocateRaw(JSGlobalPropertyCell::kSize); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 129 | if (result->IsFailure()) old_gen_exhausted_ = true; |
| 130 | return result; |
| 131 | } |
| 132 | |
| 133 | |
| 134 | bool Heap::InNewSpace(Object* object) { |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 135 | return new_space_.Contains(object); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | |
| 139 | bool Heap::InFromSpace(Object* object) { |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 140 | return new_space_.FromSpaceContains(object); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | |
| 144 | bool Heap::InToSpace(Object* object) { |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 145 | return new_space_.ToSpaceContains(object); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | |
| 149 | bool Heap::ShouldBePromoted(Address old_address, int object_size) { |
| 150 | // An object should be promoted if: |
| 151 | // - the object has survived a scavenge operation or |
| 152 | // - to space is already 25% full. |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 153 | return old_address < new_space_.age_mark() |
| 154 | || (new_space_.Size() + object_size) >= (new_space_.Capacity() >> 2); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | |
| 158 | void Heap::RecordWrite(Address address, int offset) { |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 159 | if (new_space_.Contains(address)) return; |
| 160 | ASSERT(!new_space_.FromSpaceContains(address)); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 161 | SLOW_ASSERT(Contains(address + offset)); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 162 | #ifndef V8_HOST_ARCH_64_BIT |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 163 | Page::SetRSet(address, offset); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 164 | #endif // V8_HOST_ARCH_64_BIT |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 168 | OldSpace* Heap::TargetSpace(HeapObject* object) { |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 169 | InstanceType type = object->map()->instance_type(); |
| 170 | AllocationSpace space = TargetSpaceId(type); |
| 171 | return (space == OLD_POINTER_SPACE) |
| 172 | ? old_pointer_space_ |
| 173 | : old_data_space_; |
| 174 | } |
| 175 | |
| 176 | |
| 177 | AllocationSpace Heap::TargetSpaceId(InstanceType type) { |
ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 178 | // Heap numbers and sequential strings are promoted to old data space, all |
| 179 | // other object types are promoted to old pointer space. We do not use |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 180 | // object->IsHeapNumber() and object->IsSeqString() because we already |
| 181 | // know that object has the heap object tag. |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 182 | ASSERT((type != CODE_TYPE) && (type != MAP_TYPE)); |
| 183 | bool has_pointers = |
| 184 | type != HEAP_NUMBER_TYPE && |
| 185 | (type >= FIRST_NONSTRING_TYPE || |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 186 | (type & kStringRepresentationMask) != kSeqStringTag); |
| 187 | return has_pointers ? OLD_POINTER_SPACE : OLD_DATA_SPACE; |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 191 | void Heap::CopyBlock(Object** dst, Object** src, int byte_size) { |
| 192 | ASSERT(IsAligned(byte_size, kPointerSize)); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 193 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 194 | // Use block copying memcpy if the segment we're copying is |
| 195 | // enough to justify the extra call/setup overhead. |
| 196 | static const int kBlockCopyLimit = 16 * kPointerSize; |
| 197 | |
| 198 | if (byte_size >= kBlockCopyLimit) { |
| 199 | memcpy(dst, src, byte_size); |
| 200 | } else { |
| 201 | int remaining = byte_size / kPointerSize; |
| 202 | do { |
| 203 | remaining--; |
| 204 | *dst++ = *src++; |
| 205 | } while (remaining > 0); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | |
kasperl@chromium.org | b3284ad | 2009-05-18 06:12:45 +0000 | [diff] [blame] | 210 | void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { |
| 211 | ASSERT(InFromSpace(object)); |
| 212 | |
| 213 | // We use the first word (where the map pointer usually is) of a heap |
| 214 | // object to record the forwarding pointer. A forwarding pointer can |
| 215 | // point to an old space, the code space, or the to space of the new |
| 216 | // generation. |
| 217 | MapWord first_word = object->map_word(); |
| 218 | |
| 219 | // If the first word is a forwarding address, the object has already been |
| 220 | // copied. |
| 221 | if (first_word.IsForwardingAddress()) { |
| 222 | *p = first_word.ToForwardingAddress(); |
| 223 | return; |
| 224 | } |
| 225 | |
| 226 | // Call the slow part of scavenge object. |
| 227 | return ScavengeObjectSlow(p, object); |
| 228 | } |
| 229 | |
| 230 | |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame^] | 231 | int Heap::AdjustAmountOfExternalAllocatedMemory(int change_in_bytes) { |
| 232 | ASSERT(HasBeenSetup()); |
| 233 | int amount = amount_of_external_allocated_memory_ + change_in_bytes; |
| 234 | if (change_in_bytes >= 0) { |
| 235 | // Avoid overflow. |
| 236 | if (amount > amount_of_external_allocated_memory_) { |
| 237 | amount_of_external_allocated_memory_ = amount; |
| 238 | } |
| 239 | int amount_since_last_global_gc = |
| 240 | amount_of_external_allocated_memory_ - |
| 241 | amount_of_external_allocated_memory_at_last_global_gc_; |
| 242 | if (amount_since_last_global_gc > external_allocation_limit_) { |
| 243 | CollectAllGarbage(); |
| 244 | } |
| 245 | } else { |
| 246 | // Avoid underflow. |
| 247 | if (amount >= 0) { |
| 248 | amount_of_external_allocated_memory_ = amount; |
| 249 | } |
| 250 | } |
| 251 | ASSERT(amount_of_external_allocated_memory_ >= 0); |
| 252 | return amount_of_external_allocated_memory_; |
| 253 | } |
| 254 | |
| 255 | |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 256 | void Heap::SetLastScriptId(Object* last_script_id) { |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 257 | roots_[kLastScriptIdRootIndex] = last_script_id; |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 261 | #define GC_GREEDY_CHECK() \ |
| 262 | ASSERT(!FLAG_gc_greedy || v8::internal::Heap::GarbageCollectionGreedyCheck()) |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 263 | |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 264 | |
| 265 | // Calls the FUNCTION_CALL function and retries it up to three times |
| 266 | // to guarantee that any allocations performed during the call will |
| 267 | // succeed if there's enough memory. |
| 268 | |
| 269 | // Warning: Do not use the identifiers __object__ or __scope__ in a |
| 270 | // call to this macro. |
| 271 | |
| 272 | #define CALL_AND_RETRY(FUNCTION_CALL, RETURN_VALUE, RETURN_EMPTY) \ |
| 273 | do { \ |
| 274 | GC_GREEDY_CHECK(); \ |
| 275 | Object* __object__ = FUNCTION_CALL; \ |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 276 | if (!__object__->IsFailure()) RETURN_VALUE; \ |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 277 | if (__object__->IsOutOfMemoryFailure()) { \ |
| 278 | v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_0"); \ |
| 279 | } \ |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 280 | if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
kasperl@chromium.org | 5887095 | 2008-10-30 14:34:19 +0000 | [diff] [blame] | 281 | Heap::CollectGarbage(Failure::cast(__object__)->requested(), \ |
| 282 | Failure::cast(__object__)->allocation_space()); \ |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 283 | __object__ = FUNCTION_CALL; \ |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 284 | if (!__object__->IsFailure()) RETURN_VALUE; \ |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 285 | if (__object__->IsOutOfMemoryFailure()) { \ |
kasperl@chromium.org | 5887095 | 2008-10-30 14:34:19 +0000 | [diff] [blame] | 286 | v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1"); \ |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 287 | } \ |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 288 | if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 289 | Counters::gc_last_resort_from_handles.Increment(); \ |
| 290 | Heap::CollectAllGarbage(); \ |
| 291 | { \ |
| 292 | AlwaysAllocateScope __scope__; \ |
| 293 | __object__ = FUNCTION_CALL; \ |
| 294 | } \ |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 295 | if (!__object__->IsFailure()) RETURN_VALUE; \ |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 296 | if (__object__->IsOutOfMemoryFailure() || \ |
| 297 | __object__->IsRetryAfterGC()) { \ |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 298 | /* TODO(1181417): Fix this. */ \ |
kasperl@chromium.org | 5887095 | 2008-10-30 14:34:19 +0000 | [diff] [blame] | 299 | v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2"); \ |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 300 | } \ |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 301 | RETURN_EMPTY; \ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 302 | } while (false) |
| 303 | |
| 304 | |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 305 | #define CALL_HEAP_FUNCTION(FUNCTION_CALL, TYPE) \ |
| 306 | CALL_AND_RETRY(FUNCTION_CALL, \ |
| 307 | return Handle<TYPE>(TYPE::cast(__object__)), \ |
| 308 | return Handle<TYPE>()) |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 309 | |
| 310 | |
| 311 | #define CALL_HEAP_FUNCTION_VOID(FUNCTION_CALL) \ |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 312 | CALL_AND_RETRY(FUNCTION_CALL, return, return) |
kasperl@chromium.org | b912362 | 2008-09-17 14:05:56 +0000 | [diff] [blame] | 313 | |
| 314 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 315 | #ifdef DEBUG |
| 316 | |
| 317 | inline bool Heap::allow_allocation(bool new_state) { |
| 318 | bool old = allocation_allowed_; |
| 319 | allocation_allowed_ = new_state; |
| 320 | return old; |
| 321 | } |
| 322 | |
| 323 | #endif |
| 324 | |
| 325 | |
| 326 | } } // namespace v8::internal |
| 327 | |
| 328 | #endif // V8_HEAP_INL_H_ |