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 (ISOLATE)->heap()->CollectGarbage(__allocation__.RetrySpace(), \ | 541 /* Two GCs before panicking. In newspace will almost always succeed. */ \ |
542 "allocation failure"); \ | 542 for (int __i__ = 0; __i__ < 2; __i__++) { \ |
543 __allocation__ = FUNCTION_CALL; \ | 543 (ISOLATE)->heap()->CollectGarbage(__allocation__.RetrySpace(), \ |
544 RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ | 544 "allocation failure"); \ |
| 545 __allocation__ = FUNCTION_CALL; \ |
| 546 RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
| 547 } \ |
545 (ISOLATE)->counters()->gc_last_resort_from_handles()->Increment(); \ | 548 (ISOLATE)->counters()->gc_last_resort_from_handles()->Increment(); \ |
546 (ISOLATE)->heap()->CollectAllAvailableGarbage("last resort gc"); \ | 549 (ISOLATE)->heap()->CollectAllAvailableGarbage("last resort gc"); \ |
547 { \ | 550 { \ |
548 AlwaysAllocateScope __scope__(ISOLATE); \ | 551 AlwaysAllocateScope __scope__(ISOLATE); \ |
549 __allocation__ = FUNCTION_CALL; \ | 552 __allocation__ = FUNCTION_CALL; \ |
550 } \ | 553 } \ |
551 RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ | 554 RETURN_OBJECT_UNLESS_RETRY(ISOLATE, RETURN_VALUE) \ |
552 /* TODO(1181417): Fix this. */ \ | 555 /* TODO(1181417): Fix this. */ \ |
553 v8::internal::Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); \ | 556 v8::internal::Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); \ |
554 RETURN_EMPTY; \ | 557 RETURN_EMPTY; \ |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 | 681 |
679 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 682 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
680 for (Object** current = start; current < end; current++) { | 683 for (Object** current = start; current < end; current++) { |
681 CHECK((*current)->IsSmi()); | 684 CHECK((*current)->IsSmi()); |
682 } | 685 } |
683 } | 686 } |
684 } | 687 } |
685 } // namespace v8::internal | 688 } // namespace v8::internal |
686 | 689 |
687 #endif // V8_HEAP_HEAP_INL_H_ | 690 #endif // V8_HEAP_HEAP_INL_H_ |
OLD | NEW |