| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 | 198 |
| 199 static int nesting() { return nesting_; } | 199 static int nesting() { return nesting_; } |
| 200 | 200 |
| 201 private: | 201 private: |
| 202 ZoneScopeMode mode_; | 202 ZoneScopeMode mode_; |
| 203 static int nesting_; | 203 static int nesting_; |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 | 206 |
| 207 template <typename Node, class Callback> | |
| 208 static void DoForEach(Node* node, Callback* callback); | |
| 209 | |
| 210 | |
| 211 // A zone splay tree. The config type parameter encapsulates the | 207 // A zone splay tree. The config type parameter encapsulates the |
| 212 // different configurations of a concrete splay tree: | 208 // different configurations of a concrete splay tree: |
| 213 // | 209 // |
| 214 // typedef Key: the key type | 210 // typedef Key: the key type |
| 215 // typedef Value: the value type | 211 // typedef Value: the value type |
| 216 // static const kNoKey: the dummy key used when no key is set | 212 // static const kNoKey: the dummy key used when no key is set |
| 217 // static const kNoValue: the dummy value used to initialize nodes | 213 // static const kNoValue: the dummy value used to initialize nodes |
| 218 // int (Compare)(Key& a, Key& b) -> {-1, 0, 1}: comparison function | 214 // int (Compare)(Key& a, Key& b) -> {-1, 0, 1}: comparison function |
| 219 // | 215 // |
| 220 template <typename Config> | 216 template <typename Config> |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 Locator() : node_(NULL) { } | 286 Locator() : node_(NULL) { } |
| 291 const Key& key() { return node_->key_; } | 287 const Key& key() { return node_->key_; } |
| 292 Value& value() { return node_->value_; } | 288 Value& value() { return node_->value_; } |
| 293 void set_value(const Value& value) { node_->value_ = value; } | 289 void set_value(const Value& value) { node_->value_ = value; } |
| 294 inline void bind(Node* node) { node_ = node; } | 290 inline void bind(Node* node) { node_ = node; } |
| 295 private: | 291 private: |
| 296 Node* node_; | 292 Node* node_; |
| 297 }; | 293 }; |
| 298 | 294 |
| 299 template <class Callback> | 295 template <class Callback> |
| 300 void ForEach(Callback* c) { | 296 void ForEach(Callback* callback); |
| 301 DoForEach<typename ZoneSplayTree<Config>::Node, Callback>(root_, c); | |
| 302 } | |
| 303 | 297 |
| 304 private: | 298 private: |
| 305 Node* root_; | 299 Node* root_; |
| 306 }; | 300 }; |
| 307 | 301 |
| 308 | 302 |
| 309 } } // namespace v8::internal | 303 } } // namespace v8::internal |
| 310 | 304 |
| 311 #endif // V8_ZONE_H_ | 305 #endif // V8_ZONE_H_ |
| OLD | NEW |