OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 R (*function)(P1, P2), | 632 R (*function)(P1, P2), |
633 P1 p1, | 633 P1 p1, |
634 P2 p2) { | 634 P2 p2) { |
635 int collections = isolate_->heap()->gc_count(); | 635 int collections = isolate_->heap()->gc_count(); |
636 Object* result = (*function)(p1, p2); | 636 Object* result = (*function)(p1, p2); |
637 return (collections == isolate_->heap()->gc_count()) | 637 return (collections == isolate_->heap()->gc_count()) |
638 ? result | 638 ? result |
639 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC()); | 639 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC()); |
640 } | 640 } |
641 | 641 |
| 642 template<typename R, typename P1, typename P2, typename P3, typename P4, |
| 643 typename P5, typename P6, typename P7> |
| 644 MUST_USE_RESULT MaybeObject* CallWithReturnValue( |
| 645 R (*function)(P1, P2, P3, P4, P5, P6, P7), |
| 646 P1 p1, |
| 647 P2 p2, |
| 648 P3 p3, |
| 649 P4 p4, |
| 650 P5 p5, |
| 651 P6 p6, |
| 652 P7 p7) { |
| 653 int collections = isolate_->heap()->gc_count(); |
| 654 Handle<Object> result = (*function)(p1, p2, p3, p4, p5, p6, p7); |
| 655 return (collections == isolate_->heap()->gc_count()) |
| 656 ? *result |
| 657 : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC()); |
| 658 } |
| 659 |
642 private: | 660 private: |
643 Isolate* isolate_; | 661 Isolate* isolate_; |
644 }; | 662 }; |
645 | 663 |
646 | 664 |
647 } } // namespace v8::internal | 665 } } // namespace v8::internal |
648 | 666 |
649 #endif // V8_FACTORY_H_ | 667 #endif // V8_FACTORY_H_ |
OLD | NEW |