OLD | NEW |
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 | 111 |
112 // ZoneObject is an abstraction that helps define classes of objects | 112 // ZoneObject is an abstraction that helps define classes of objects |
113 // allocated in the Zone. Use it as a base class; see ast.h. | 113 // allocated in the Zone. Use it as a base class; see ast.h. |
114 class ZoneObject { | 114 class ZoneObject { |
115 public: | 115 public: |
116 // Allocate a new ZoneObject of 'size' bytes in the Zone. | 116 // Allocate a new ZoneObject of 'size' bytes in the Zone. |
117 void* operator new(size_t size) { return Zone::New(size); } | 117 void* operator new(size_t size) { return Zone::New(size); } |
118 | 118 |
119 // Ideally, the delete operator should be private instead of | 119 // Ideally, the delete operator should be private instead of |
120 // public, but unfortuately the compiler sometimes synthesizes | 120 // public, but unfortunately the compiler sometimes synthesizes |
121 // (unused) destructors for classes derived from ZoneObject, which | 121 // (unused) destructors for classes derived from ZoneObject, which |
122 // require the operator to be visible. MSVC requires the delete | 122 // require the operator to be visible. MSVC requires the delete |
123 // operator to be public. | 123 // operator to be public. |
124 | 124 |
125 // ZoneObjects should never be deleted individually; use | 125 // ZoneObjects should never be deleted individually; use |
126 // Zone::DeleteAll() to delete all zone objects in one go. | 126 // Zone::DeleteAll() to delete all zone objects in one go. |
127 void operator delete(void*, size_t) { UNREACHABLE(); } | 127 void operator delete(void*, size_t) { UNREACHABLE(); } |
128 }; | 128 }; |
129 | 129 |
130 | 130 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 private: | 192 private: |
193 ZoneScopeMode mode_; | 193 ZoneScopeMode mode_; |
194 static int nesting_; | 194 static int nesting_; |
195 }; | 195 }; |
196 | 196 |
197 | 197 |
198 } } // namespace v8::internal | 198 } } // namespace v8::internal |
199 | 199 |
200 #endif // V8_ZONE_H_ | 200 #endif // V8_ZONE_H_ |
OLD | NEW |