OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 INLINE(void* operator new(size_t size, | 69 INLINE(void* operator new(size_t size, |
70 AllocationPolicy allocator = AllocationPolicy())) { | 70 AllocationPolicy allocator = AllocationPolicy())) { |
71 return allocator.New(static_cast<int>(size)); | 71 return allocator.New(static_cast<int>(size)); |
72 } | 72 } |
73 INLINE(void operator delete(void* p)) { | 73 INLINE(void operator delete(void* p)) { |
74 AllocationPolicy::Delete(p); | 74 AllocationPolicy::Delete(p); |
75 } | 75 } |
76 | 76 |
| 77 // Please the MSVC compiler. We should never have to execute this. |
| 78 INLINE(void operator delete(void* p, AllocationPolicy allocator)) { |
| 79 UNREACHABLE(); |
| 80 } |
| 81 |
77 // Returns a reference to the element at index i. This reference is | 82 // Returns a reference to the element at index i. This reference is |
78 // not safe to use after operations that can change the list's | 83 // not safe to use after operations that can change the list's |
79 // backing store (e.g. Add). | 84 // backing store (e.g. Add). |
80 inline T& operator[](int i) const { | 85 inline T& operator[](int i) const { |
81 ASSERT(0 <= i); | 86 ASSERT(0 <= i); |
82 ASSERT(i < length_); | 87 ASSERT(i < length_); |
83 return data_[i]; | 88 return data_[i]; |
84 } | 89 } |
85 inline T& at(int i) const { return operator[](i); } | 90 inline T& at(int i) const { return operator[](i); } |
86 inline T& last() const { return at(length_ - 1); } | 91 inline T& last() const { return at(length_ - 1); } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 template <typename T, class P> | 206 template <typename T, class P> |
202 int SortedListBSearch(const List<T>& list, P cmp); | 207 int SortedListBSearch(const List<T>& list, P cmp); |
203 template <typename T> | 208 template <typename T> |
204 int SortedListBSearch(const List<T>& list, T elem); | 209 int SortedListBSearch(const List<T>& list, T elem); |
205 | 210 |
206 | 211 |
207 } } // namespace v8::internal | 212 } } // namespace v8::internal |
208 | 213 |
209 | 214 |
210 #endif // V8_LIST_H_ | 215 #endif // V8_LIST_H_ |
OLD | NEW |