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 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 size_t HeapObjectsMap::GetUsedMemorySize() const { | 725 size_t HeapObjectsMap::GetUsedMemorySize() const { |
726 return | 726 return |
727 sizeof(*this) + | 727 sizeof(*this) + |
728 sizeof(HashMap::Entry) * entries_map_.capacity() + | 728 sizeof(HashMap::Entry) * entries_map_.capacity() + |
729 GetMemoryUsedByList(entries_) + | 729 GetMemoryUsedByList(entries_) + |
730 GetMemoryUsedByList(time_intervals_); | 730 GetMemoryUsedByList(time_intervals_); |
731 } | 731 } |
732 | 732 |
733 | 733 |
734 HeapEntriesMap::HeapEntriesMap() | 734 HeapEntriesMap::HeapEntriesMap() |
735 : entries_(HeapThingsMatch) { | 735 : entries_(HashMap::PointersMatch) { |
736 } | 736 } |
737 | 737 |
738 | 738 |
739 int HeapEntriesMap::Map(HeapThing thing) { | 739 int HeapEntriesMap::Map(HeapThing thing) { |
740 HashMap::Entry* cache_entry = entries_.Lookup(thing, Hash(thing), false); | 740 HashMap::Entry* cache_entry = entries_.Lookup(thing, Hash(thing), false); |
741 if (cache_entry == NULL) return HeapEntry::kNoEntry; | 741 if (cache_entry == NULL) return HeapEntry::kNoEntry; |
742 return static_cast<int>(reinterpret_cast<intptr_t>(cache_entry->value)); | 742 return static_cast<int>(reinterpret_cast<intptr_t>(cache_entry->value)); |
743 } | 743 } |
744 | 744 |
745 | 745 |
746 void HeapEntriesMap::Pair(HeapThing thing, int entry) { | 746 void HeapEntriesMap::Pair(HeapThing thing, int entry) { |
747 HashMap::Entry* cache_entry = entries_.Lookup(thing, Hash(thing), true); | 747 HashMap::Entry* cache_entry = entries_.Lookup(thing, Hash(thing), true); |
748 ASSERT(cache_entry->value == NULL); | 748 ASSERT(cache_entry->value == NULL); |
749 cache_entry->value = reinterpret_cast<void*>(static_cast<intptr_t>(entry)); | 749 cache_entry->value = reinterpret_cast<void*>(static_cast<intptr_t>(entry)); |
750 } | 750 } |
751 | 751 |
752 | 752 |
753 HeapObjectsSet::HeapObjectsSet() | 753 HeapObjectsSet::HeapObjectsSet() |
754 : entries_(HeapEntriesMap::HeapThingsMatch) { | 754 : entries_(HashMap::PointersMatch) { |
755 } | 755 } |
756 | 756 |
757 | 757 |
758 void HeapObjectsSet::Clear() { | 758 void HeapObjectsSet::Clear() { |
759 entries_.Clear(); | 759 entries_.Clear(); |
760 } | 760 } |
761 | 761 |
762 | 762 |
763 bool HeapObjectsSet::Contains(Object* obj) { | 763 bool HeapObjectsSet::Contains(Object* obj) { |
764 if (!obj->IsHeapObject()) return false; | 764 if (!obj->IsHeapObject()) return false; |
(...skipping 2395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3160 writer_->AddString("\"<dummy>\""); | 3160 writer_->AddString("\"<dummy>\""); |
3161 for (int i = 1; i < sorted_strings.length(); ++i) { | 3161 for (int i = 1; i < sorted_strings.length(); ++i) { |
3162 writer_->AddCharacter(','); | 3162 writer_->AddCharacter(','); |
3163 SerializeString(sorted_strings[i]); | 3163 SerializeString(sorted_strings[i]); |
3164 if (writer_->aborted()) return; | 3164 if (writer_->aborted()) return; |
3165 } | 3165 } |
3166 } | 3166 } |
3167 | 3167 |
3168 | 3168 |
3169 } } // namespace v8::internal | 3169 } } // namespace v8::internal |
OLD | NEW |