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

Unified Diff: src/zone/zone-chunk-list.h

Issue 2468183004: Used ZoneChunkList in deoptimizer (Closed)
Patch Set: Added unittests to ensure correct copyto Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/deoptimizer.cc ('k') | test/unittests/zone/zone-chunk-list-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/zone/zone-chunk-list.h
diff --git a/src/zone/zone-chunk-list.h b/src/zone/zone-chunk-list.h
index 6b52c879f3fc16a6fcbb82420e6b9f8279072e8f..f977a0cb3105303aecd66f87b6998b26dc3970e7 100644
--- a/src/zone/zone-chunk-list.h
+++ b/src/zone/zone-chunk-list.h
@@ -82,6 +82,8 @@ class ZoneChunkList : public ZoneObject {
// TODO(heimbuef): Add 'rFind', seeking from the end and returning a
// reverse iterator.
+ void CopyTo(T* ptr);
+
ForwardZoneChunkListIterator<T> begin();
ForwardZoneChunkListIterator<T> end();
ReverseZoneChunkListIterator<T> rbegin();
@@ -392,6 +394,19 @@ ForwardZoneChunkListIterator<const T> ZoneChunkList<T>::Find(
}
template <typename T>
+void ZoneChunkList<T>::CopyTo(T* ptr) {
+ for (Chunk* current = front_; current != nullptr; current = current->next_) {
+ void* start = current->items();
+ void* end = current->items() + current->position_;
+ size_t bytes = static_cast<size_t>(reinterpret_cast<uintptr_t>(end) -
+ reinterpret_cast<uintptr_t>(start));
+
+ MemCopy(ptr, current->items(), bytes);
+ ptr += current->position_;
+ }
+}
+
+template <typename T>
ForwardZoneChunkListIterator<T> ZoneChunkList<T>::begin() {
return ForwardZoneChunkListIterator<T>::Begin(this);
}
« no previous file with comments | « src/deoptimizer.cc ('k') | test/unittests/zone/zone-chunk-list-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698