Reviewers: Sven Panne,
Description:
Enter a description of the change.
Use memcpy in List::AddAll for fundamental types.
[email protected]
Please review this at https://codereview.chromium.org/663893004/
Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+4, -2 lines):
M src/list-inl.h
Index: src/list-inl.h
diff --git a/src/list-inl.h b/src/list-inl.h
index
60e8fab6f6fb5196aa6c500e0fd3d7dfd948505a..7cc81f3846e354d73f4cffb4588ed5872d08f12a
100644
--- a/src/list-inl.h
+++ b/src/list-inl.h
@@ -33,8 +33,10 @@ template<typename T, class P>
void List<T, P>::AddAll(const Vector<T>& other, P alloc) {
int result_length = length_ + other.length();
if (capacity_ < result_length) Resize(result_length, alloc);
- for (int i = 0; i < other.length(); i++) {
- data_[length_ + i] = other.at(i);
+ if (std::is_fundamental<T>::value) {
+ memcpy(data_ + length_, other.start(), sizeof(*data_) *
other.length());
+ } else {
+ for (int i = 0; i < other.length(); i++) data_[length_ + i] =
other.at(i);
}
length_ = result_length;
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.