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

Side by Side Diff: src/allocation-tracker.cc

Issue 239133002: Refactoring: HashMap: provide a pointer match function, so users don't need to. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 8 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 | « no previous file | src/bootstrapper.cc » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 while (it != ranges_.end()); 204 while (it != ranges_.end());
205 205
206 ranges_.erase(to_remove_begin, it); 206 ranges_.erase(to_remove_begin, it);
207 207
208 if (prev_range.start != 0) { 208 if (prev_range.start != 0) {
209 ranges_.insert(RangeMap::value_type(start, prev_range)); 209 ranges_.insert(RangeMap::value_type(start, prev_range));
210 } 210 }
211 } 211 }
212 212
213 213
214 static bool AddressesMatch(void* key1, void* key2) {
215 return key1 == key2;
216 }
217
218
219 void AllocationTracker::DeleteFunctionInfo(FunctionInfo** info) { 214 void AllocationTracker::DeleteFunctionInfo(FunctionInfo** info) {
220 delete *info; 215 delete *info;
221 } 216 }
222 217
223 218
224 AllocationTracker::AllocationTracker( 219 AllocationTracker::AllocationTracker(
225 HeapObjectsMap* ids, StringsStorage* names) 220 HeapObjectsMap* ids, StringsStorage* names)
226 : ids_(ids), 221 : ids_(ids),
227 names_(names), 222 names_(names),
228 id_to_function_info_index_(AddressesMatch), 223 id_to_function_info_index_(HashMap::PointersMatch),
229 info_index_for_other_state_(0) { 224 info_index_for_other_state_(0) {
230 FunctionInfo* info = new FunctionInfo(); 225 FunctionInfo* info = new FunctionInfo();
231 info->name = "(root)"; 226 info->name = "(root)";
232 function_info_list_.Add(info); 227 function_info_list_.Add(info);
233 } 228 }
234 229
235 230
236 AllocationTracker::~AllocationTracker() { 231 AllocationTracker::~AllocationTracker() {
237 unresolved_locations_.Iterate(DeleteUnresolvedLocation); 232 unresolved_locations_.Iterate(DeleteUnresolvedLocation);
238 function_info_list_.Iterate(&DeleteFunctionInfo); 233 function_info_list_.Iterate(&DeleteFunctionInfo);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 void AllocationTracker::UnresolvedLocation::HandleWeakScript( 357 void AllocationTracker::UnresolvedLocation::HandleWeakScript(
363 const v8::WeakCallbackData<v8::Value, void>& data) { 358 const v8::WeakCallbackData<v8::Value, void>& data) {
364 UnresolvedLocation* loc = 359 UnresolvedLocation* loc =
365 reinterpret_cast<UnresolvedLocation*>(data.GetParameter()); 360 reinterpret_cast<UnresolvedLocation*>(data.GetParameter());
366 GlobalHandles::Destroy(reinterpret_cast<Object**>(loc->script_.location())); 361 GlobalHandles::Destroy(reinterpret_cast<Object**>(loc->script_.location()));
367 loc->script_ = Handle<Script>::null(); 362 loc->script_ = Handle<Script>::null();
368 } 363 }
369 364
370 365
371 } } // namespace v8::internal 366 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698