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

Side by Side Diff: src/zone.h

Issue 115347: Reduce the memory used by frame elements from two words to one by... (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
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 ~ZoneScope() { 183 virtual ~ZoneScope() {
184 if (--nesting_ == 0 && mode_ == DELETE_ON_EXIT) Zone::DeleteAll(); 184 if (ShouldDeleteOnExit()) Zone::DeleteAll();
185 --nesting_;
186 }
187
188 bool ShouldDeleteOnExit() {
189 return nesting_ == 1 && mode_ == DELETE_ON_EXIT;
185 } 190 }
186 191
187 // For ZoneScopes that do not delete on exit by default, call this 192 // For ZoneScopes that do not delete on exit by default, call this
188 // method to request deletion on exit. 193 // method to request deletion on exit.
189 void DeleteOnExit() { 194 void DeleteOnExit() {
190 mode_ = DELETE_ON_EXIT; 195 mode_ = DELETE_ON_EXIT;
191 } 196 }
192 197
193 static int nesting() { return nesting_; } 198 static int nesting() { return nesting_; }
194 199
195 private: 200 private:
196 ZoneScopeMode mode_; 201 ZoneScopeMode mode_;
197 static int nesting_; 202 static int nesting_;
198 }; 203 };
199 204
200 205
201 } } // namespace v8::internal 206 } } // namespace v8::internal
202 207
203 #endif // V8_ZONE_H_ 208 #endif // V8_ZONE_H_
OLDNEW
« src/virtual-frame.h ('K') | « src/virtual-frame.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698