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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 // Warning: Do not use the identifiers __object__ or __scope__ in a | 384 // Warning: Do not use the identifiers __object__ or __scope__ in a |
385 // call to this macro. | 385 // call to this macro. |
386 | 386 |
387 #define CALL_AND_RETRY(FUNCTION_CALL, RETURN_VALUE, RETURN_EMPTY) \ | 387 #define CALL_AND_RETRY(FUNCTION_CALL, RETURN_VALUE, RETURN_EMPTY) \ |
388 do { \ | 388 do { \ |
389 GC_GREEDY_CHECK(); \ | 389 GC_GREEDY_CHECK(); \ |
390 Object* __object__ = FUNCTION_CALL; \ | 390 Object* __object__ = FUNCTION_CALL; \ |
391 if (!__object__->IsFailure()) RETURN_VALUE; \ | 391 if (!__object__->IsFailure()) RETURN_VALUE; \ |
392 if (__object__->IsOutOfMemoryFailure()) { \ | 392 if (__object__->IsOutOfMemoryFailure()) { \ |
393 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_0"); \ | 393 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_0", true);\ |
394 } \ | 394 } \ |
395 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ | 395 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
396 Heap::CollectGarbage(Failure::cast(__object__)->requested(), \ | 396 Heap::CollectGarbage(Failure::cast(__object__)->requested(), \ |
397 Failure::cast(__object__)->allocation_space()); \ | 397 Failure::cast(__object__)->allocation_space()); \ |
398 __object__ = FUNCTION_CALL; \ | 398 __object__ = FUNCTION_CALL; \ |
399 if (!__object__->IsFailure()) RETURN_VALUE; \ | 399 if (!__object__->IsFailure()) RETURN_VALUE; \ |
400 if (__object__->IsOutOfMemoryFailure()) { \ | 400 if (__object__->IsOutOfMemoryFailure()) { \ |
401 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1"); \ | 401 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1", true);\ |
402 } \ | 402 } \ |
403 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ | 403 if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ |
404 Counters::gc_last_resort_from_handles.Increment(); \ | 404 Counters::gc_last_resort_from_handles.Increment(); \ |
405 Heap::CollectAllGarbage(false); \ | 405 Heap::CollectAllGarbage(false); \ |
406 { \ | 406 { \ |
407 AlwaysAllocateScope __scope__; \ | 407 AlwaysAllocateScope __scope__; \ |
408 __object__ = FUNCTION_CALL; \ | 408 __object__ = FUNCTION_CALL; \ |
409 } \ | 409 } \ |
410 if (!__object__->IsFailure()) RETURN_VALUE; \ | 410 if (!__object__->IsFailure()) RETURN_VALUE; \ |
411 if (__object__->IsOutOfMemoryFailure() || \ | 411 if (__object__->IsOutOfMemoryFailure() || \ |
412 __object__->IsRetryAfterGC()) { \ | 412 __object__->IsRetryAfterGC()) { \ |
413 /* TODO(1181417): Fix this. */ \ | 413 /* TODO(1181417): Fix this. */ \ |
414 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2"); \ | 414 v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2", true);\ |
415 } \ | 415 } \ |
416 RETURN_EMPTY; \ | 416 RETURN_EMPTY; \ |
417 } while (false) | 417 } while (false) |
418 | 418 |
419 | 419 |
420 #define CALL_HEAP_FUNCTION(FUNCTION_CALL, TYPE) \ | 420 #define CALL_HEAP_FUNCTION(FUNCTION_CALL, TYPE) \ |
421 CALL_AND_RETRY(FUNCTION_CALL, \ | 421 CALL_AND_RETRY(FUNCTION_CALL, \ |
422 return Handle<TYPE>(TYPE::cast(__object__)), \ | 422 return Handle<TYPE>(TYPE::cast(__object__)), \ |
423 return Handle<TYPE>()) | 423 return Handle<TYPE>()) |
424 | 424 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 484 |
485 | 485 |
486 void ExternalStringTable::ShrinkNewStrings(int position) { | 486 void ExternalStringTable::ShrinkNewStrings(int position) { |
487 new_space_strings_.Rewind(position); | 487 new_space_strings_.Rewind(position); |
488 Verify(); | 488 Verify(); |
489 } | 489 } |
490 | 490 |
491 } } // namespace v8::internal | 491 } } // namespace v8::internal |
492 | 492 |
493 #endif // V8_HEAP_INL_H_ | 493 #endif // V8_HEAP_INL_H_ |
OLD | NEW |