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

Side by Side Diff: src/heap.h

Issue 3047027: Avoid GC when compiling CallIC stubs.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 4 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/arm/stub-cache-arm.cc ('k') | src/heap.cc » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 870
871 // Invoke Shrink on shrinkable spaces. 871 // Invoke Shrink on shrinkable spaces.
872 static void Shrink(); 872 static void Shrink();
873 873
874 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; 874 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT };
875 static inline HeapState gc_state() { return gc_state_; } 875 static inline HeapState gc_state() { return gc_state_; }
876 876
877 #ifdef DEBUG 877 #ifdef DEBUG
878 static bool IsAllocationAllowed() { return allocation_allowed_; } 878 static bool IsAllocationAllowed() { return allocation_allowed_; }
879 static inline bool allow_allocation(bool enable); 879 static inline bool allow_allocation(bool enable);
880 static bool IsGCAllowed() { return gc_allowed_; }
881 static inline bool allow_gc(bool enable);
880 882
881 static bool disallow_allocation_failure() { 883 static bool disallow_allocation_failure() {
882 return disallow_allocation_failure_; 884 return disallow_allocation_failure_;
883 } 885 }
884 886
885 static void TracePathToObject(Object* target); 887 static void TracePathToObject(Object* target);
886 static void TracePathToGlobal(); 888 static void TracePathToGlobal();
887 #endif 889 #endif
888 890
889 // Callback function passed to Heap::Iterate etc. Copies an object if 891 // Callback function passed to Heap::Iterate etc. Copies an object if
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 1073
1072 #define ROOT_ACCESSOR(type, name, camel_name) \ 1074 #define ROOT_ACCESSOR(type, name, camel_name) \
1073 static inline void set_##name(type* value) { \ 1075 static inline void set_##name(type* value) { \
1074 roots_[k##camel_name##RootIndex] = value; \ 1076 roots_[k##camel_name##RootIndex] = value; \
1075 } 1077 }
1076 ROOT_LIST(ROOT_ACCESSOR) 1078 ROOT_LIST(ROOT_ACCESSOR)
1077 #undef ROOT_ACCESSOR 1079 #undef ROOT_ACCESSOR
1078 1080
1079 #ifdef DEBUG 1081 #ifdef DEBUG
1080 static bool allocation_allowed_; 1082 static bool allocation_allowed_;
1083 static bool gc_allowed_;
1081 1084
1082 // If the --gc-interval flag is set to a positive value, this 1085 // If the --gc-interval flag is set to a positive value, this
1083 // variable holds the value indicating the number of allocations 1086 // variable holds the value indicating the number of allocations
1084 // remain until the next failure and garbage collection. 1087 // remain until the next failure and garbage collection.
1085 static int allocation_timeout_; 1088 static int allocation_timeout_;
1086 1089
1087 // Do we expect to be able to handle allocation failure at this 1090 // Do we expect to be able to handle allocation failure at this
1088 // time? 1091 // time?
1089 static bool disallow_allocation_failure_; 1092 static bool disallow_allocation_failure_;
1090 #endif // DEBUG 1093 #endif // DEBUG
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 } 1676 }
1674 1677
1675 ~AssertNoAllocation() { 1678 ~AssertNoAllocation() {
1676 Heap::allow_allocation(old_state_); 1679 Heap::allow_allocation(old_state_);
1677 } 1680 }
1678 1681
1679 private: 1682 private:
1680 bool old_state_; 1683 bool old_state_;
1681 }; 1684 };
1682 1685
1686 class AssertNoGC {
1687 public:
1688 AssertNoGC() {
1689 old_state_ = Heap::allow_gc(false);
1690 }
1691
1692 ~AssertNoGC() {
1693 Heap::allow_gc(old_state_);
1694 }
1695
1696 private:
1697 bool old_state_;
1698 };
1699
1683 class DisableAssertNoAllocation { 1700 class DisableAssertNoAllocation {
1684 public: 1701 public:
1685 DisableAssertNoAllocation() { 1702 DisableAssertNoAllocation() {
1686 old_state_ = Heap::allow_allocation(true); 1703 old_state_ = Heap::allow_allocation(true);
1687 } 1704 }
1688 1705
1689 ~DisableAssertNoAllocation() { 1706 ~DisableAssertNoAllocation() {
1690 Heap::allow_allocation(old_state_); 1707 Heap::allow_allocation(old_state_);
1691 } 1708 }
1692 1709
1693 private: 1710 private:
1694 bool old_state_; 1711 bool old_state_;
1695 }; 1712 };
1696 1713
1697 #else // ndef DEBUG 1714 #else // ndef DEBUG
1698 1715
1699 class AssertNoAllocation { 1716 class AssertNoAllocation {
1700 public: 1717 public:
1701 AssertNoAllocation() { } 1718 AssertNoAllocation() { }
1702 ~AssertNoAllocation() { } 1719 ~AssertNoAllocation() { }
1703 }; 1720 };
1704 1721
1722 class AssertNoGC {
1723 public:
1724 AssertNoGC() { }
1725 ~AssertNoGC() { }
1726 };
1727
1705 class DisableAssertNoAllocation { 1728 class DisableAssertNoAllocation {
1706 public: 1729 public:
1707 DisableAssertNoAllocation() { } 1730 DisableAssertNoAllocation() { }
1708 ~DisableAssertNoAllocation() { } 1731 ~DisableAssertNoAllocation() { }
1709 }; 1732 };
1710 1733
1711 #endif 1734 #endif
1712 1735
1713 // GCTracer collects and prints ONE line after each garbage collector 1736 // GCTracer collects and prints ONE line after each garbage collector
1714 // invocation IFF --trace_gc is used. 1737 // invocation IFF --trace_gc is used.
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 1998
1976 // To speed up scavenge collections new space string are kept 1999 // To speed up scavenge collections new space string are kept
1977 // separate from old space strings. 2000 // separate from old space strings.
1978 static List<Object*> new_space_strings_; 2001 static List<Object*> new_space_strings_;
1979 static List<Object*> old_space_strings_; 2002 static List<Object*> old_space_strings_;
1980 }; 2003 };
1981 2004
1982 } } // namespace v8::internal 2005 } } // namespace v8::internal
1983 2006
1984 #endif // V8_HEAP_H_ 2007 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698