| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1"); \ | 244 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1"); \ |
| 245 } \ | 245 } \ |
| 246 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ | 246 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
| 247 Counters::gc_last_resort_from_handles.Increment(); \ | 247 Counters::gc_last_resort_from_handles.Increment(); \ |
| 248 Heap::CollectAllGarbage(); \ | 248 Heap::CollectAllGarbage(); \ |
| 249 { \ | 249 { \ |
| 250 AlwaysAllocateScope __scope__; \ | 250 AlwaysAllocateScope __scope__; \ |
| 251 __object__ = FUNCTION_CALL; \ | 251 __object__ = FUNCTION_CALL; \ |
| 252 } \ | 252 } \ |
| 253 if (!__object__->IsFailure()) RETURN_VALUE; \ | 253 if (!__object__->IsFailure()) RETURN_VALUE; \ |
| 254 if (__object__->IsOutOfMemoryFailure()) { \ | 254 if (__object__->IsOutOfMemoryFailure() || \ |
| 255 __object__->IsRetryAfterGC()) { \ |
| 255 /* TODO(1181417): Fix this. */ \ | 256 /* TODO(1181417): Fix this. */ \ |
| 256 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2"); \ | 257 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2"); \ |
| 257 } \ | 258 } \ |
| 258 ASSERT(!__object__->IsRetryAfterGC()); \ | |
| 259 RETURN_EMPTY; \ | 259 RETURN_EMPTY; \ |
| 260 } while (false) | 260 } while (false) |
| 261 | 261 |
| 262 | 262 |
| 263 #define CALL_HEAP_FUNCTION(FUNCTION_CALL, TYPE) \ | 263 #define CALL_HEAP_FUNCTION(FUNCTION_CALL, TYPE) \ |
| 264 CALL_AND_RETRY(FUNCTION_CALL, \ | 264 CALL_AND_RETRY(FUNCTION_CALL, \ |
| 265 return Handle<TYPE>(TYPE::cast(__object__)), \ | 265 return Handle<TYPE>(TYPE::cast(__object__)), \ |
| 266 return Handle<TYPE>()) | 266 return Handle<TYPE>()) |
| 267 | 267 |
| 268 | 268 |
| 269 #define CALL_HEAP_FUNCTION_VOID(FUNCTION_CALL) \ | 269 #define CALL_HEAP_FUNCTION_VOID(FUNCTION_CALL) \ |
| 270 CALL_AND_RETRY(FUNCTION_CALL, return, return) | 270 CALL_AND_RETRY(FUNCTION_CALL, return, return) |
| 271 | 271 |
| 272 | 272 |
| 273 #ifdef DEBUG | 273 #ifdef DEBUG |
| 274 | 274 |
| 275 inline bool Heap::allow_allocation(bool new_state) { | 275 inline bool Heap::allow_allocation(bool new_state) { |
| 276 bool old = allocation_allowed_; | 276 bool old = allocation_allowed_; |
| 277 allocation_allowed_ = new_state; | 277 allocation_allowed_ = new_state; |
| 278 return old; | 278 return old; |
| 279 } | 279 } |
| 280 | 280 |
| 281 #endif | 281 #endif |
| 282 | 282 |
| 283 | 283 |
| 284 } } // namespace v8::internal | 284 } } // namespace v8::internal |
| 285 | 285 |
| 286 #endif // V8_HEAP_INL_H_ | 286 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |