OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3503 const_cast<char*>(s), ObjectHash(s), true); | 3503 const_cast<char*>(s), ObjectHash(s), true); |
3504 if (cache_entry->value == NULL) { | 3504 if (cache_entry->value == NULL) { |
3505 cache_entry->value = reinterpret_cast<void*>(next_string_id_++); | 3505 cache_entry->value = reinterpret_cast<void*>(next_string_id_++); |
3506 } | 3506 } |
3507 return static_cast<int>(reinterpret_cast<intptr_t>(cache_entry->value)); | 3507 return static_cast<int>(reinterpret_cast<intptr_t>(cache_entry->value)); |
3508 } | 3508 } |
3509 | 3509 |
3510 | 3510 |
3511 // This function won't work correctly for MIN_INT but this is not | 3511 // This function won't work correctly for MIN_INT but this is not |
3512 // a problem in case of heap snapshots serialization. | 3512 // a problem in case of heap snapshots serialization. |
3513 static int itoa(int value, Vector<char>& buffer, int buffer_pos) { | 3513 static int itoa(int value, const Vector<char>& buffer, int buffer_pos) { |
3514 if (value < 0) { | 3514 if (value < 0) { |
3515 buffer[buffer_pos++] = '-'; | 3515 buffer[buffer_pos++] = '-'; |
3516 value = -value; | 3516 value = -value; |
3517 } | 3517 } |
3518 | 3518 |
3519 int number_of_digits = 0; | 3519 int number_of_digits = 0; |
3520 int t = value; | 3520 int t = value; |
3521 do { | 3521 do { |
3522 ++number_of_digits; | 3522 ++number_of_digits; |
3523 } while (t /= 10); | 3523 } while (t /= 10); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3763 | 3763 |
3764 | 3764 |
3765 void HeapSnapshotJSONSerializer::SortHashMap( | 3765 void HeapSnapshotJSONSerializer::SortHashMap( |
3766 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3766 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3767 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3767 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3768 sorted_entries->Add(p); | 3768 sorted_entries->Add(p); |
3769 sorted_entries->Sort(SortUsingEntryValue); | 3769 sorted_entries->Sort(SortUsingEntryValue); |
3770 } | 3770 } |
3771 | 3771 |
3772 } } // namespace v8::internal | 3772 } } // namespace v8::internal |
OLD | NEW |