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

Side by Side Diff: src/list.h

Issue 113582: Introduced copy constructor for List<T, P> and changed constructor of Virtual... (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/jump-target.cc ('k') | src/list-inl.h » ('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-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
41 // allocation policy (P). The policy is used for allocating lists in 41 // allocation policy (P). The policy is used for allocating lists in
42 // the C free store or the zone; see zone.h. 42 // the C free store or the zone; see zone.h.
43 43
44 // Forward defined as 44 // Forward defined as
45 // template <typename T, class P = FreeStoreAllocationPolicy> class List; 45 // template <typename T, class P = FreeStoreAllocationPolicy> class List;
46 template <typename T, class P> 46 template <typename T, class P>
47 class List { 47 class List {
48 public: 48 public:
49 49
50 INLINE(explicit List(int capacity)) { Initialize(capacity); } 50 INLINE(explicit List(int capacity)) { Initialize(capacity); }
51 INLINE(explicit List(const List<T, P>& other));
51 INLINE(~List()) { DeleteData(data_); } 52 INLINE(~List()) { DeleteData(data_); }
52 53
53 INLINE(void* operator new(size_t size)) { return P::New(size); } 54 INLINE(void* operator new(size_t size)) { return P::New(size); }
54 INLINE(void operator delete(void* p, size_t)) { return P::Delete(p); } 55 INLINE(void operator delete(void* p, size_t)) { return P::Delete(p); }
55 56
56 // Returns a reference to the element at index i. This reference is 57 // Returns a reference to the element at index i. This reference is
57 // not safe to use after operations that can change the list's 58 // not safe to use after operations that can change the list's
58 // backing store (eg, Add). 59 // backing store (eg, Add).
59 inline T& operator[](int i) const { 60 inline T& operator[](int i) const {
60 ASSERT(0 <= i && i < length_); 61 ASSERT(0 <= i && i < length_);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 INLINE(T* NewData(int n)) { return static_cast<T*>(P::New(n * sizeof(T))); } 119 INLINE(T* NewData(int n)) { return static_cast<T*>(P::New(n * sizeof(T))); }
119 INLINE(void DeleteData(T* data)) { P::Delete(data); } 120 INLINE(void DeleteData(T* data)) { P::Delete(data); }
120 121
121 // Increase the capacity of a full list, and add an element. 122 // Increase the capacity of a full list, and add an element.
122 // List must be full already. 123 // List must be full already.
123 void ResizeAdd(const T& element); 124 void ResizeAdd(const T& element);
124 125
125 // Inlined implementation of ResizeAdd, shared by inlined and 126 // Inlined implementation of ResizeAdd, shared by inlined and
126 // non-inlined versions of ResizeAdd. 127 // non-inlined versions of ResizeAdd.
127 void ResizeAddInternal(const T& element); 128 void ResizeAddInternal(const T& element);
128
129 DISALLOW_COPY_AND_ASSIGN(List);
130 }; 129 };
131 130
132 class FrameElement; 131 class FrameElement;
133 132
134 // Add() is inlined, ResizeAdd() called by Add() is inlined except for 133 // Add() is inlined, ResizeAdd() called by Add() is inlined except for
135 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd(). 134 // Lists of FrameElements, and ResizeAddInternal() is inlined in ResizeAdd().
136 template <> 135 template <>
137 void List<FrameElement, 136 void List<FrameElement,
138 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element); 137 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element);
139 138
140 } } // namespace v8::internal 139 } } // namespace v8::internal
141 140
142 #endif // V8_LIST_H_ 141 #endif // V8_LIST_H_
OLDNEW
« no previous file with comments | « src/jump-target.cc ('k') | src/list-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698