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

Side by Side Diff: src/list-inl.h

Issue 6901090: Add support for startup data (snapshot) compression. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: The version I'll commit Created 9 years, 7 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 | « src/list.h ('k') | src/mksnapshot.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 28 matching lines...) Expand all
39 if (length_ < capacity_) { 39 if (length_ < capacity_) {
40 data_[length_++] = element; 40 data_[length_++] = element;
41 } else { 41 } else {
42 List<T, P>::ResizeAdd(element); 42 List<T, P>::ResizeAdd(element);
43 } 43 }
44 } 44 }
45 45
46 46
47 template<typename T, class P> 47 template<typename T, class P>
48 void List<T, P>::AddAll(const List<T, P>& other) { 48 void List<T, P>::AddAll(const List<T, P>& other) {
49 int result_length = length_ + other.length_; 49 AddAll(other.ToVector());
50 }
51
52
53 template<typename T, class P>
54 void List<T, P>::AddAll(const Vector<T>& other) {
55 int result_length = length_ + other.length();
50 if (capacity_ < result_length) Resize(result_length); 56 if (capacity_ < result_length) Resize(result_length);
51 for (int i = 0; i < other.length_; i++) { 57 for (int i = 0; i < other.length(); i++) {
52 data_[length_ + i] = other.data_[i]; 58 data_[length_ + i] = other.at(i);
53 } 59 }
54 length_ = result_length; 60 length_ = result_length;
55 } 61 }
56 62
57 63
58 // Use two layers of inlining so that the non-inlined function can 64 // Use two layers of inlining so that the non-inlined function can
59 // use the same implementation as the inlined version. 65 // use the same implementation as the inlined version.
60 template<typename T, class P> 66 template<typename T, class P>
61 void List<T, P>::ResizeAdd(const T& element) { 67 void List<T, P>::ResizeAdd(const T& element) {
62 ResizeAddInternal(element); 68 ResizeAddInternal(element);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 ASSERT(capacity >= 0); 203 ASSERT(capacity >= 0);
198 data_ = (capacity > 0) ? NewData(capacity) : NULL; 204 data_ = (capacity > 0) ? NewData(capacity) : NULL;
199 capacity_ = capacity; 205 capacity_ = capacity;
200 length_ = 0; 206 length_ = 0;
201 } 207 }
202 208
203 209
204 } } // namespace v8::internal 210 } } // namespace v8::internal
205 211
206 #endif // V8_LIST_INL_H_ 212 #endif // V8_LIST_INL_H_
OLDNEW
« no previous file with comments | « src/list.h ('k') | src/mksnapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698