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

Side by Side Diff: src/profile-generator.cc

Issue 3424002: Allow List::sort, with an integer comparison function, to sort 64-bit pointer... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 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/runtime.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 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 2431 matching lines...) Expand 10 before | Expand all | Expand 10 after
2442 for (int i = 0; i < sorted_strings.length(); ++i) { 2442 for (int i = 0; i < sorted_strings.length(); ++i) {
2443 writer_->AddCharacter(','); 2443 writer_->AddCharacter(',');
2444 SerializeString( 2444 SerializeString(
2445 reinterpret_cast<const unsigned char*>(sorted_strings[i]->key)); 2445 reinterpret_cast<const unsigned char*>(sorted_strings[i]->key));
2446 } 2446 }
2447 } 2447 }
2448 2448
2449 2449
2450 template<typename T> 2450 template<typename T>
2451 inline static int SortUsingEntryValue(const T* x, const T* y) { 2451 inline static int SortUsingEntryValue(const T* x, const T* y) {
2452 return reinterpret_cast<intptr_t>((*x)->value) - 2452 uintptr_t x_uint = reinterpret_cast<uintptr_t>((*x)->value);
2453 reinterpret_cast<intptr_t>((*y)->value); 2453 uintptr_t y_uint = reinterpret_cast<uintptr_t>((*y)->value);
2454 if (x_uint > y_uint) {
2455 return 1;
2456 } else if (x_uint == y_uint) {
2457 return 0;
2458 } else {
2459 return -1;
2460 }
2454 } 2461 }
2455 2462
2463
2456 void HeapSnapshotJSONSerializer::SortHashMap( 2464 void HeapSnapshotJSONSerializer::SortHashMap(
2457 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 2465 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
2458 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 2466 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
2459 sorted_entries->Add(p); 2467 sorted_entries->Add(p);
2460 sorted_entries->Sort(SortUsingEntryValue); 2468 sorted_entries->Sort(SortUsingEntryValue);
2461 } 2469 }
2462 2470
2463 } } // namespace v8::internal 2471 } } // namespace v8::internal
2464 2472
2465 #endif // ENABLE_LOGGING_AND_PROFILING 2473 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « no previous file | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698