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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 static Address position_; | 111 static Address position_; |
112 static Address limit_; | 112 static Address limit_; |
113 }; | 113 }; |
114 | 114 |
115 | 115 |
116 // ZoneObject is an abstraction that helps define classes of objects | 116 // ZoneObject is an abstraction that helps define classes of objects |
117 // allocated in the Zone. Use it as a base class; see ast.h. | 117 // allocated in the Zone. Use it as a base class; see ast.h. |
118 class ZoneObject { | 118 class ZoneObject { |
119 public: | 119 public: |
120 // Allocate a new ZoneObject of 'size' bytes in the Zone. | 120 // Allocate a new ZoneObject of 'size' bytes in the Zone. |
121 void* operator new(size_t size) { return Zone::New(size); } | 121 void* operator new(size_t size) { return Zone::New(static_cast<int>(size)); } |
122 | 122 |
123 // Ideally, the delete operator should be private instead of | 123 // Ideally, the delete operator should be private instead of |
124 // public, but unfortunately the compiler sometimes synthesizes | 124 // public, but unfortunately the compiler sometimes synthesizes |
125 // (unused) destructors for classes derived from ZoneObject, which | 125 // (unused) destructors for classes derived from ZoneObject, which |
126 // require the operator to be visible. MSVC requires the delete | 126 // require the operator to be visible. MSVC requires the delete |
127 // operator to be public. | 127 // operator to be public. |
128 | 128 |
129 // ZoneObjects should never be deleted individually; use | 129 // ZoneObjects should never be deleted individually; use |
130 // Zone::DeleteAll() to delete all zone objects in one go. | 130 // Zone::DeleteAll() to delete all zone objects in one go. |
131 void operator delete(void*, size_t) { UNREACHABLE(); } | 131 void operator delete(void*, size_t) { UNREACHABLE(); } |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 void ForEach(Callback* callback); | 296 void ForEach(Callback* callback); |
297 | 297 |
298 private: | 298 private: |
299 Node* root_; | 299 Node* root_; |
300 }; | 300 }; |
301 | 301 |
302 | 302 |
303 } } // namespace v8::internal | 303 } } // namespace v8::internal |
304 | 304 |
305 #endif // V8_ZONE_H_ | 305 #endif // V8_ZONE_H_ |
OLD | NEW |