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 2673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2684 }; | 2684 }; |
2685 | 2685 |
2686 | 2686 |
2687 // A helper class to document/test C++ scopes where we do not | 2687 // A helper class to document/test C++ scopes where we do not |
2688 // expect a GC. Usage: | 2688 // expect a GC. Usage: |
2689 // | 2689 // |
2690 // /* Allocation not allowed: we cannot handle a GC in this scope. */ | 2690 // /* Allocation not allowed: we cannot handle a GC in this scope. */ |
2691 // { AssertNoAllocation nogc; | 2691 // { AssertNoAllocation nogc; |
2692 // ... | 2692 // ... |
2693 // } | 2693 // } |
| 2694 |
| 2695 #ifdef DEBUG |
| 2696 typedef uint8_t AllocationScopeData; |
| 2697 inline AllocationScopeData EnterAllocationScope(Isolate* isolate, |
| 2698 bool allow_allocation); |
| 2699 inline void ExitAllocationScope(Isolate* isolate, AllocationScopeData); |
| 2700 #endif |
| 2701 |
| 2702 |
2694 class AssertNoAllocation { | 2703 class AssertNoAllocation { |
2695 public: | 2704 public: |
2696 inline AssertNoAllocation(); | 2705 inline AssertNoAllocation(); |
2697 inline ~AssertNoAllocation(); | 2706 inline ~AssertNoAllocation(); |
2698 | 2707 |
2699 #ifdef DEBUG | 2708 #ifdef DEBUG |
2700 private: | 2709 private: |
2701 bool old_state_; | 2710 AllocationScopeData data_; |
2702 bool active_; | |
2703 #endif | 2711 #endif |
2704 }; | 2712 }; |
2705 | 2713 |
2706 | 2714 |
2707 class DisableAssertNoAllocation { | 2715 class DisableAssertNoAllocation { |
2708 public: | 2716 public: |
2709 inline DisableAssertNoAllocation(); | 2717 inline DisableAssertNoAllocation(); |
2710 inline ~DisableAssertNoAllocation(); | 2718 inline ~DisableAssertNoAllocation(); |
2711 | 2719 |
2712 #ifdef DEBUG | 2720 #ifdef DEBUG |
2713 private: | 2721 private: |
2714 bool old_state_; | 2722 AllocationScopeData data_; |
2715 bool active_; | |
2716 #endif | 2723 #endif |
2717 }; | 2724 }; |
2718 | 2725 |
2719 // GCTracer collects and prints ONE line after each garbage collector | 2726 // GCTracer collects and prints ONE line after each garbage collector |
2720 // invocation IFF --trace_gc is used. | 2727 // invocation IFF --trace_gc is used. |
2721 | 2728 |
2722 class GCTracer BASE_EMBEDDED { | 2729 class GCTracer BASE_EMBEDDED { |
2723 public: | 2730 public: |
2724 class Scope BASE_EMBEDDED { | 2731 class Scope BASE_EMBEDDED { |
2725 public: | 2732 public: |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3062 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 3069 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
3063 | 3070 |
3064 private: | 3071 private: |
3065 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3072 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
3066 }; | 3073 }; |
3067 #endif // DEBUG | 3074 #endif // DEBUG |
3068 | 3075 |
3069 } } // namespace v8::internal | 3076 } } // namespace v8::internal |
3070 | 3077 |
3071 #endif // V8_HEAP_H_ | 3078 #endif // V8_HEAP_H_ |
OLD | NEW |