OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_HEAP_INL_H_ | 5 #ifndef V8_HEAP_HEAP_INL_H_ |
6 #define V8_HEAP_HEAP_INL_H_ | 6 #define V8_HEAP_HEAP_INL_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
531 if (__allocation__.To(&__object__)) { \ | 531 if (__allocation__.To(&__object__)) { \ |
532 DCHECK(__object__ != (ISOLATE)->heap()->exception()); \ | 532 DCHECK(__object__ != (ISOLATE)->heap()->exception()); \ |
533 RETURN_VALUE; \ | 533 RETURN_VALUE; \ |
534 } | 534 } |
535 | 535 |
536 #define CALL_AND_RETRY(ISOLATE, FUNCTION_CALL, RETURN_VALUE, RETURN_EMPTY) \ | 536 #define CALL_AND_RETRY(ISOLATE, FUNCTION_CALL, RETURN_VALUE, RETURN_EMPTY) \ |
537 do { \ | 537 do { \ |
538 AllocationResult __allocation__ = FUNCTION_CALL; \ | 538 AllocationResult __allocation__ = FUNCTION_CALL; \ |
539 Object* __object__ = NULL; \ | 539 Object* __object__ = NULL; \ |
540 RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ | 540 RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
541 bool __scavenge__ = (__allocation__.RetrySpace() == NEW_SPACE); \ | |
541 (ISOLATE)->heap()->CollectGarbage(__allocation__.RetrySpace(), \ | 542 (ISOLATE)->heap()->CollectGarbage(__allocation__.RetrySpace(), \ |
542 "allocation failure"); \ | 543 "allocation failure"); \ |
543 __allocation__ = FUNCTION_CALL; \ | 544 __allocation__ = FUNCTION_CALL; \ |
544 RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ | 545 RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
546 if (__scavenge__) { /* Second scavenge in a row will empty newspace */ \ | |
547 (ISOLATE)->heap()->CollectGarbage(__allocation__.RetrySpace(), \ | |
548 "insufficient newspace freed"); \ | |
Hannes Payer (out of office)
2015/04/27 12:33:22
Let's do unconditionally a retry with the same spa
| |
549 __allocation__ = FUNCTION_CALL; \ | |
550 RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ | |
551 \ | |
552 } \ | |
545 (ISOLATE)->counters()->gc_last_resort_from_handles()->Increment(); \ | 553 (ISOLATE)->counters()->gc_last_resort_from_handles()->Increment(); \ |
546 (ISOLATE)->heap()->CollectAllAvailableGarbage("last resort gc"); \ | 554 (ISOLATE)->heap()->CollectAllAvailableGarbage("last resort gc"); \ |
547 { \ | 555 { \ |
548 AlwaysAllocateScope __scope__(ISOLATE); \ | 556 AlwaysAllocateScope __scope__(ISOLATE); \ |
549 __allocation__ = FUNCTION_CALL; \ | 557 __allocation__ = FUNCTION_CALL; \ |
550 } \ | 558 } \ |
551 RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ | 559 RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
552 /* TODO(1181417): Fix this. */ \ | 560 /* TODO(1181417): Fix this. */ \ |
553 v8::internal::Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); \ | 561 v8::internal::Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); \ |
554 RETURN_EMPTY; \ | 562 RETURN_EMPTY; \ |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
678 | 686 |
679 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 687 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
680 for (Object** current = start; current < end; current++) { | 688 for (Object** current = start; current < end; current++) { |
681 CHECK((*current)->IsSmi()); | 689 CHECK((*current)->IsSmi()); |
682 } | 690 } |
683 } | 691 } |
684 } | 692 } |
685 } // namespace v8::internal | 693 } // namespace v8::internal |
686 | 694 |
687 #endif // V8_HEAP_HEAP_INL_H_ | 695 #endif // V8_HEAP_HEAP_INL_H_ |
OLD | NEW |