OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_D8_H_ | 5 #ifndef V8_D8_H_ |
6 #define V8_D8_H_ | 6 #define V8_D8_H_ |
7 | 7 |
8 #ifndef V8_SHARED | 8 #ifndef V8_SHARED |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 Hash(name), | 62 Hash(name), |
63 false); | 63 false); |
64 if (!answer) return NULL; | 64 if (!answer) return NULL; |
65 return reinterpret_cast<Counter*>(answer->value); | 65 return reinterpret_cast<Counter*>(answer->value); |
66 } | 66 } |
67 void Set(const char* name, Counter* value) { | 67 void Set(const char* name, Counter* value) { |
68 i::HashMap::Entry* answer = hash_map_.Lookup( | 68 i::HashMap::Entry* answer = hash_map_.Lookup( |
69 const_cast<char*>(name), | 69 const_cast<char*>(name), |
70 Hash(name), | 70 Hash(name), |
71 true); | 71 true); |
72 ASSERT(answer != NULL); | 72 DCHECK(answer != NULL); |
73 answer->value = value; | 73 answer->value = value; |
74 } | 74 } |
75 class Iterator { | 75 class Iterator { |
76 public: | 76 public: |
77 explicit Iterator(CounterMap* map) | 77 explicit Iterator(CounterMap* map) |
78 : map_(&map->hash_map_), entry_(map_->Start()) { } | 78 : map_(&map->hash_map_), entry_(map_->Start()) { } |
79 void Next() { entry_ = map_->Next(entry_); } | 79 void Next() { entry_ = map_->Next(entry_); } |
80 bool More() { return entry_ != NULL; } | 80 bool More() { return entry_ != NULL; } |
81 const char* CurrentKey() { return static_cast<const char*>(entry_->key); } | 81 const char* CurrentKey() { return static_cast<const char*>(entry_->key); } |
82 Counter* CurrentValue() { return static_cast<Counter*>(entry_->value); } | 82 Counter* CurrentValue() { return static_cast<Counter*>(entry_->value); } |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 static void ExternalArrayWeakCallback(Isolate* isolate, | 404 static void ExternalArrayWeakCallback(Isolate* isolate, |
405 Persistent<Object>* object, | 405 Persistent<Object>* object, |
406 uint8_t* data); | 406 uint8_t* data); |
407 }; | 407 }; |
408 | 408 |
409 | 409 |
410 } // namespace v8 | 410 } // namespace v8 |
411 | 411 |
412 | 412 |
413 #endif // V8_D8_H_ | 413 #endif // V8_D8_H_ |
OLD | NEW |