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

Side by Side Diff: src/zone.h

Issue 115350: Revert revision 1949. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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/virtual-frame.cc ('k') | tools/gyp/v8.gyp » ('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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 // ZoneScopes keep track of the current parsing and compilation 174 // ZoneScopes keep track of the current parsing and compilation
175 // nesting and cleans up generated ASTs in the Zone when exiting the 175 // nesting and cleans up generated ASTs in the Zone when exiting the
176 // outer-most scope. 176 // outer-most scope.
177 class ZoneScope BASE_EMBEDDED { 177 class ZoneScope BASE_EMBEDDED {
178 public: 178 public:
179 explicit ZoneScope(ZoneScopeMode mode) : mode_(mode) { 179 explicit ZoneScope(ZoneScopeMode mode) : mode_(mode) {
180 nesting_++; 180 nesting_++;
181 } 181 }
182 182
183 virtual ~ZoneScope() { 183 ~ZoneScope() {
184 if (ShouldDeleteOnExit()) Zone::DeleteAll(); 184 if (--nesting_ == 0 && mode_ == DELETE_ON_EXIT) Zone::DeleteAll();
185 --nesting_;
186 }
187
188 bool ShouldDeleteOnExit() {
189 return nesting_ == 1 && mode_ == DELETE_ON_EXIT;
190 } 185 }
191 186
192 // For ZoneScopes that do not delete on exit by default, call this 187 // For ZoneScopes that do not delete on exit by default, call this
193 // method to request deletion on exit. 188 // method to request deletion on exit.
194 void DeleteOnExit() { 189 void DeleteOnExit() {
195 mode_ = DELETE_ON_EXIT; 190 mode_ = DELETE_ON_EXIT;
196 } 191 }
197 192
198 static int nesting() { return nesting_; } 193 static int nesting() { return nesting_; }
199 194
200 private: 195 private:
201 ZoneScopeMode mode_; 196 ZoneScopeMode mode_;
202 static int nesting_; 197 static int nesting_;
203 }; 198 };
204 199
205 200
206 } } // namespace v8::internal 201 } } // namespace v8::internal
207 202
208 #endif // V8_ZONE_H_ 203 #endif // V8_ZONE_H_
OLDNEW
« no previous file with comments | « src/virtual-frame.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698