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

Side by Side Diff: src/zone.h

Issue 12826: RegExp stack and zone limits. (Closed)
Patch Set: Created 12 years 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
« src/parser.cc ('K') | « src/top.cc ('k') | src/zone.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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 class Zone { 55 class Zone {
56 public: 56 public:
57 // Allocate 'size' bytes of memory in the Zone; expands the Zone by 57 // Allocate 'size' bytes of memory in the Zone; expands the Zone by
58 // allocating new segments of memory on demand using malloc(). 58 // allocating new segments of memory on demand using malloc().
59 static inline void* New(int size); 59 static inline void* New(int size);
60 60
61 // Delete all objects and free all memory allocated in the Zone. 61 // Delete all objects and free all memory allocated in the Zone.
62 static void DeleteAll(); 62 static void DeleteAll();
63 63
64 // Returns true if more memory has been allocated in zones than
65 // the limit allows.
66 static inline bool excess_allocation();
67
64 private: 68 private:
69 friend class Segment;
70
65 // All pointers returned from New() have this alignment. 71 // All pointers returned from New() have this alignment.
66 static const int kAlignment = kPointerSize; 72 static const int kAlignment = kPointerSize;
67 73
68 // Never allocate segments smaller than this size in bytes. 74 // Never allocate segments smaller than this size in bytes.
69 static const int kMinimumSegmentSize = 8 * KB; 75 static const int kMinimumSegmentSize = 8 * KB;
70 76
71 // Never keep segments larger than this size in bytes around. 77 // Never keep segments larger than this size in bytes around.
72 static const int kMaximumKeptSegmentSize = 64 * KB; 78 static const int kMaximumKeptSegmentSize = 64 * KB;
73 79
80 // Report zone excess when allocation exceeds this limit.
81 static int zone_excess_limit_;
82
83 // The number of bytes allocated in segments. Note that this number
84 // includes memory allocated from the OS but not yet allocated from
85 // the zone.
86 static int segment_bytes_allocated_;
74 87
75 // The Zone is intentionally a singleton; you should not try to 88 // The Zone is intentionally a singleton; you should not try to
76 // allocate instances of the class. 89 // allocate instances of the class.
77 Zone() { UNREACHABLE(); } 90 Zone() { UNREACHABLE(); }
78 91
79 92
80 // Expand the Zone to hold at least 'size' more bytes and allocate 93 // Expand the Zone to hold at least 'size' more bytes and allocate
81 // the bytes. Returns the address of the newly allocated chunk of 94 // the bytes. Returns the address of the newly allocated chunk of
82 // memory in the Zone. Should only be called if there isn't enough 95 // memory in the Zone. Should only be called if there isn't enough
83 // room in the Zone already. 96 // room in the Zone already.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 185
173 private: 186 private:
174 ZoneScopeMode mode_; 187 ZoneScopeMode mode_;
175 static int nesting_; 188 static int nesting_;
176 }; 189 };
177 190
178 191
179 } } // namespace v8::internal 192 } } // namespace v8::internal
180 193
181 #endif // V8_ZONE_H_ 194 #endif // V8_ZONE_H_
OLDNEW
« src/parser.cc ('K') | « src/top.cc ('k') | src/zone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698