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

Side by Side Diff: src/splay-tree.h

Issue 10556038: Fix MSVC warning about missing operator delete. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove size_t argument from operator delete Created 8 years, 6 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/list.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 class Locator; 59 class Locator;
60 60
61 SplayTree(AllocationPolicy allocator = AllocationPolicy()) 61 SplayTree(AllocationPolicy allocator = AllocationPolicy())
62 : root_(NULL), allocator_(allocator) { } 62 : root_(NULL), allocator_(allocator) { }
63 ~SplayTree(); 63 ~SplayTree();
64 64
65 INLINE(void* operator new(size_t size, 65 INLINE(void* operator new(size_t size,
66 AllocationPolicy allocator = AllocationPolicy())) { 66 AllocationPolicy allocator = AllocationPolicy())) {
67 return allocator.New(static_cast<int>(size)); 67 return allocator.New(static_cast<int>(size));
68 } 68 }
69 INLINE(void operator delete(void* p, size_t)) { 69 INLINE(void operator delete(void* p)) {
70 AllocationPolicy::Delete(p); 70 AllocationPolicy::Delete(p);
71 } 71 }
72 // Please the MSVC compiler. We should never have to execute this.
73 INLINE(void operator delete(void* p, AllocationPolicy policy)) {
74 UNREACHABLE();
75 }
72 76
73 // Inserts the given key in this tree with the given value. Returns 77 // Inserts the given key in this tree with the given value. Returns
74 // true if a node was inserted, otherwise false. If found the locator 78 // true if a node was inserted, otherwise false. If found the locator
75 // is enabled and provides access to the mapping for the key. 79 // is enabled and provides access to the mapping for the key.
76 bool Insert(const Key& key, Locator* locator); 80 bool Insert(const Key& key, Locator* locator);
77 81
78 // Looks up the key in this tree and returns true if it was found, 82 // Looks up the key in this tree and returns true if it was found,
79 // otherwise false. If the node is found the locator is enabled and 83 // otherwise false. If the node is found the locator is enabled and
80 // provides access to the mapping for the key. 84 // provides access to the mapping for the key.
81 bool Find(const Key& key, Locator* locator); 85 bool Find(const Key& key, Locator* locator);
(...skipping 30 matching lines...) Expand all
112 public: 116 public:
113 Node(const Key& key, const Value& value) 117 Node(const Key& key, const Value& value)
114 : key_(key), 118 : key_(key),
115 value_(value), 119 value_(value),
116 left_(NULL), 120 left_(NULL),
117 right_(NULL) { } 121 right_(NULL) { }
118 122
119 INLINE(void* operator new(size_t size, AllocationPolicy allocator)) { 123 INLINE(void* operator new(size_t size, AllocationPolicy allocator)) {
120 return allocator.New(static_cast<int>(size)); 124 return allocator.New(static_cast<int>(size));
121 } 125 }
122 INLINE(void operator delete(void* p, size_t)) { 126 INLINE(void operator delete(void* p)) {
123 return AllocationPolicy::Delete(p); 127 return AllocationPolicy::Delete(p);
124 } 128 }
129 // Please the MSVC compiler. We should never have to execute
130 // this.
131 INLINE(void operator delete(void* p, AllocationPolicy allocator)) {
132 UNREACHABLE();
133 }
125 134
126 Key key() { return key_; } 135 Key key() { return key_; }
127 Value value() { return value_; } 136 Value value() { return value_; }
128 Node* left() { return left_; } 137 Node* left() { return left_; }
129 Node* right() { return right_; } 138 Node* right() { return right_; }
130 139
131 private: 140 private:
132 friend class SplayTree; 141 friend class SplayTree;
133 friend class Locator; 142 friend class Locator;
134 Key key_; 143 Key key_;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 Node* root_; 209 Node* root_;
201 AllocationPolicy allocator_; 210 AllocationPolicy allocator_;
202 211
203 DISALLOW_COPY_AND_ASSIGN(SplayTree); 212 DISALLOW_COPY_AND_ASSIGN(SplayTree);
204 }; 213 };
205 214
206 215
207 } } // namespace v8::internal 216 } } // namespace v8::internal
208 217
209 #endif // V8_SPLAY_TREE_H_ 218 #endif // V8_SPLAY_TREE_H_
OLDNEW
« no previous file with comments | « src/list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698