OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 30 matching lines...) Expand all Loading... |
41 // The list is parameterized by the type of its elements (T) and by an | 41 // The list is parameterized by the type of its elements (T) and by an |
42 // allocation policy (P). The policy is used for allocating lists in | 42 // allocation policy (P). The policy is used for allocating lists in |
43 // the C free store or the zone; see zone.h. | 43 // the C free store or the zone; see zone.h. |
44 | 44 |
45 // Forward defined as | 45 // Forward defined as |
46 // template <typename T, class P = FreeStoreAllocationPolicy> class List; | 46 // template <typename T, class P = FreeStoreAllocationPolicy> class List; |
47 template <typename T, class P> | 47 template <typename T, class P> |
48 class List { | 48 class List { |
49 public: | 49 public: |
50 | 50 |
| 51 List() { Initialize(0); } |
51 INLINE(explicit List(int capacity)) { Initialize(capacity); } | 52 INLINE(explicit List(int capacity)) { Initialize(capacity); } |
52 INLINE(~List()) { DeleteData(data_); } | 53 INLINE(~List()) { DeleteData(data_); } |
53 | 54 |
54 // Deallocates memory used by the list and leaves the list in a consistent | 55 // Deallocates memory used by the list and leaves the list in a consistent |
55 // empty state. | 56 // empty state. |
56 void Free() { | 57 void Free() { |
57 DeleteData(data_); | 58 DeleteData(data_); |
58 Initialize(0); | 59 Initialize(0); |
59 } | 60 } |
60 | 61 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 147 |
147 // Add() is inlined, ResizeAdd() called by Add() is inlined except for | 148 // Add() is inlined, ResizeAdd() called by Add() is inlined except for |
148 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd(). | 149 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd(). |
149 template <> | 150 template <> |
150 void List<FrameElement, | 151 void List<FrameElement, |
151 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element); | 152 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element); |
152 | 153 |
153 } } // namespace v8::internal | 154 } } // namespace v8::internal |
154 | 155 |
155 #endif // V8_LIST_H_ | 156 #endif // V8_LIST_H_ |
OLD | NEW |