Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: src/heap.h

Issue 14625003: expose AssertNoAllocation to api (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: state is now bool Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | src/heap-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 // Given an address occupied by a live code object, return that object. 1469 // Given an address occupied by a live code object, return that object.
1470 Object* FindCodeObject(Address a); 1470 Object* FindCodeObject(Address a);
1471 1471
1472 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; 1472 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT };
1473 inline HeapState gc_state() { return gc_state_; } 1473 inline HeapState gc_state() { return gc_state_; }
1474 1474
1475 inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; } 1475 inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; }
1476 1476
1477 #ifdef DEBUG 1477 #ifdef DEBUG
1478 bool IsAllocationAllowed() { return allocation_allowed_; } 1478 bool IsAllocationAllowed() { return allocation_allowed_; }
1479 inline void set_allow_allocation(bool allocation_allowed);
1479 inline bool allow_allocation(bool enable); 1480 inline bool allow_allocation(bool enable);
1480 1481
1481 bool disallow_allocation_failure() { 1482 bool disallow_allocation_failure() {
1482 return disallow_allocation_failure_; 1483 return disallow_allocation_failure_;
1483 } 1484 }
1484 1485
1485 void TracePathToObjectFrom(Object* target, Object* root); 1486 void TracePathToObjectFrom(Object* target, Object* root);
1486 void TracePathToObject(Object* target); 1487 void TracePathToObject(Object* target);
1487 void TracePathToGlobal(); 1488 void TracePathToGlobal();
1488 #endif 1489 #endif
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2684 }; 2685 };
2685 2686
2686 2687
2687 // A helper class to document/test C++ scopes where we do not 2688 // A helper class to document/test C++ scopes where we do not
2688 // expect a GC. Usage: 2689 // expect a GC. Usage:
2689 // 2690 //
2690 // /* Allocation not allowed: we cannot handle a GC in this scope. */ 2691 // /* Allocation not allowed: we cannot handle a GC in this scope. */
2691 // { AssertNoAllocation nogc; 2692 // { AssertNoAllocation nogc;
2692 // ... 2693 // ...
2693 // } 2694 // }
2695
2696 #ifdef DEBUG
2697 inline bool EnterAllocationScope(Isolate* isolate, bool allow_allocation);
2698 inline void ExitAllocationScope(Isolate* isolate, bool last_state);
2699 #endif
2700
2701
2694 class AssertNoAllocation { 2702 class AssertNoAllocation {
2695 public: 2703 public:
2696 inline AssertNoAllocation(); 2704 inline AssertNoAllocation();
2697 inline ~AssertNoAllocation(); 2705 inline ~AssertNoAllocation();
2698 2706
2699 #ifdef DEBUG 2707 #ifdef DEBUG
2700 private: 2708 private:
2701 bool old_state_; 2709 bool last_state_;
2702 bool active_;
2703 #endif 2710 #endif
2704 }; 2711 };
2705 2712
2706 2713
2707 class DisableAssertNoAllocation { 2714 class DisableAssertNoAllocation {
2708 public: 2715 public:
2709 inline DisableAssertNoAllocation(); 2716 inline DisableAssertNoAllocation();
2710 inline ~DisableAssertNoAllocation(); 2717 inline ~DisableAssertNoAllocation();
2711 2718
2712 #ifdef DEBUG 2719 #ifdef DEBUG
2713 private: 2720 private:
2714 bool old_state_; 2721 bool last_state_;
2715 bool active_;
2716 #endif 2722 #endif
2717 }; 2723 };
2718 2724
2719 // GCTracer collects and prints ONE line after each garbage collector 2725 // GCTracer collects and prints ONE line after each garbage collector
2720 // invocation IFF --trace_gc is used. 2726 // invocation IFF --trace_gc is used.
2721 2727
2722 class GCTracer BASE_EMBEDDED { 2728 class GCTracer BASE_EMBEDDED {
2723 public: 2729 public:
2724 class Scope BASE_EMBEDDED { 2730 class Scope BASE_EMBEDDED {
2725 public: 2731 public:
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
3062 AssertNoAllocation no_alloc; // i.e. no gc allowed. 3068 AssertNoAllocation no_alloc; // i.e. no gc allowed.
3063 3069
3064 private: 3070 private:
3065 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3071 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3066 }; 3072 };
3067 #endif // DEBUG 3073 #endif // DEBUG
3068 3074
3069 } } // namespace v8::internal 3075 } } // namespace v8::internal
3070 3076
3071 #endif // V8_HEAP_H_ 3077 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698