| OLD | NEW |
| 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 2327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2338 AddSubstring(s, StrLength(s)); | 2338 AddSubstring(s, StrLength(s)); |
| 2339 } | 2339 } |
| 2340 void AddSubstring(const char* s, int n) { | 2340 void AddSubstring(const char* s, int n) { |
| 2341 if (n <= 0) return; | 2341 if (n <= 0) return; |
| 2342 ASSERT(static_cast<size_t>(n) <= strlen(s)); | 2342 ASSERT(static_cast<size_t>(n) <= strlen(s)); |
| 2343 const char* s_end = s + n; | 2343 const char* s_end = s + n; |
| 2344 while (s < s_end) { | 2344 while (s < s_end) { |
| 2345 int s_chunk_size = Min( | 2345 int s_chunk_size = Min( |
| 2346 chunk_size_ - chunk_pos_, static_cast<int>(s_end - s)); | 2346 chunk_size_ - chunk_pos_, static_cast<int>(s_end - s)); |
| 2347 ASSERT(s_chunk_size > 0); | 2347 ASSERT(s_chunk_size > 0); |
| 2348 memcpy(chunk_.start() + chunk_pos_, s, s_chunk_size); | 2348 OS::MemCopy(chunk_.start() + chunk_pos_, s, s_chunk_size); |
| 2349 s += s_chunk_size; | 2349 s += s_chunk_size; |
| 2350 chunk_pos_ += s_chunk_size; | 2350 chunk_pos_ += s_chunk_size; |
| 2351 MaybeWriteChunk(); | 2351 MaybeWriteChunk(); |
| 2352 } | 2352 } |
| 2353 } | 2353 } |
| 2354 void AddNumber(unsigned n) { AddNumberImpl<unsigned>(n, "%u"); } | 2354 void AddNumber(unsigned n) { AddNumberImpl<unsigned>(n, "%u"); } |
| 2355 void Finalize() { | 2355 void Finalize() { |
| 2356 if (aborted_) return; | 2356 if (aborted_) return; |
| 2357 ASSERT(chunk_pos_ < chunk_size_); | 2357 ASSERT(chunk_pos_ < chunk_size_); |
| 2358 if (chunk_pos_ != 0) { | 2358 if (chunk_pos_ != 0) { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2720 | 2720 |
| 2721 | 2721 |
| 2722 void HeapSnapshotJSONSerializer::SortHashMap( | 2722 void HeapSnapshotJSONSerializer::SortHashMap( |
| 2723 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2723 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 2724 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 2724 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
| 2725 sorted_entries->Add(p); | 2725 sorted_entries->Add(p); |
| 2726 sorted_entries->Sort(SortUsingEntryValue); | 2726 sorted_entries->Sort(SortUsingEntryValue); |
| 2727 } | 2727 } |
| 2728 | 2728 |
| 2729 } } // namespace v8::internal | 2729 } } // namespace v8::internal |
| OLD | NEW |