| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 int amount = amount_of_external_allocated_memory_ + change_in_bytes; | 231 int amount = amount_of_external_allocated_memory_ + change_in_bytes; |
| 232 if (change_in_bytes >= 0) { | 232 if (change_in_bytes >= 0) { |
| 233 // Avoid overflow. | 233 // Avoid overflow. |
| 234 if (amount > amount_of_external_allocated_memory_) { | 234 if (amount > amount_of_external_allocated_memory_) { |
| 235 amount_of_external_allocated_memory_ = amount; | 235 amount_of_external_allocated_memory_ = amount; |
| 236 } | 236 } |
| 237 int amount_since_last_global_gc = | 237 int amount_since_last_global_gc = |
| 238 amount_of_external_allocated_memory_ - | 238 amount_of_external_allocated_memory_ - |
| 239 amount_of_external_allocated_memory_at_last_global_gc_; | 239 amount_of_external_allocated_memory_at_last_global_gc_; |
| 240 if (amount_since_last_global_gc > external_allocation_limit_) { | 240 if (amount_since_last_global_gc > external_allocation_limit_) { |
| 241 CollectAllGarbage(); | 241 CollectAllGarbage(false); |
| 242 } | 242 } |
| 243 } else { | 243 } else { |
| 244 // Avoid underflow. | 244 // Avoid underflow. |
| 245 if (amount >= 0) { | 245 if (amount >= 0) { |
| 246 amount_of_external_allocated_memory_ = amount; | 246 amount_of_external_allocated_memory_ = amount; |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 ASSERT(amount_of_external_allocated_memory_ >= 0); | 249 ASSERT(amount_of_external_allocated_memory_ >= 0); |
| 250 return amount_of_external_allocated_memory_; | 250 return amount_of_external_allocated_memory_; |
| 251 } | 251 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 278 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ | 278 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
| 279 Heap::CollectGarbage(Failure::cast(__object__)->requested(), \ | 279 Heap::CollectGarbage(Failure::cast(__object__)->requested(), \ |
| 280 Failure::cast(__object__)->allocation_space()); \ | 280 Failure::cast(__object__)->allocation_space()); \ |
| 281 __object__ = FUNCTION_CALL; \ | 281 __object__ = FUNCTION_CALL; \ |
| 282 if (!__object__->IsFailure()) RETURN_VALUE; \ | 282 if (!__object__->IsFailure()) RETURN_VALUE; \ |
| 283 if (__object__->IsOutOfMemoryFailure()) { \ | 283 if (__object__->IsOutOfMemoryFailure()) { \ |
| 284 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1"); \ | 284 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1"); \ |
| 285 } \ | 285 } \ |
| 286 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ | 286 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
| 287 Counters::gc_last_resort_from_handles.Increment(); \ | 287 Counters::gc_last_resort_from_handles.Increment(); \ |
| 288 Heap::CollectAllGarbage(); \ | 288 Heap::CollectAllGarbage(false); \ |
| 289 { \ | 289 { \ |
| 290 AlwaysAllocateScope __scope__; \ | 290 AlwaysAllocateScope __scope__; \ |
| 291 __object__ = FUNCTION_CALL; \ | 291 __object__ = FUNCTION_CALL; \ |
| 292 } \ | 292 } \ |
| 293 if (!__object__->IsFailure()) RETURN_VALUE; \ | 293 if (!__object__->IsFailure()) RETURN_VALUE; \ |
| 294 if (__object__->IsOutOfMemoryFailure() || \ | 294 if (__object__->IsOutOfMemoryFailure() || \ |
| 295 __object__->IsRetryAfterGC()) { \ | 295 __object__->IsRetryAfterGC()) { \ |
| 296 /* TODO(1181417): Fix this. */ \ | 296 /* TODO(1181417): Fix this. */ \ |
| 297 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2"); \ | 297 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2"); \ |
| 298 } \ | 298 } \ |
| (...skipping 18 matching lines...) Expand all Loading... |
| 317 allocation_allowed_ = new_state; | 317 allocation_allowed_ = new_state; |
| 318 return old; | 318 return old; |
| 319 } | 319 } |
| 320 | 320 |
| 321 #endif | 321 #endif |
| 322 | 322 |
| 323 | 323 |
| 324 } } // namespace v8::internal | 324 } } // namespace v8::internal |
| 325 | 325 |
| 326 #endif // V8_HEAP_INL_H_ | 326 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |