Commit 06d750b5 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Disallow copy and assign of EmbeddedVector

EmbeddedVector lives on the stack only, and should not be implicitly
copied or assigned.
This also removes remaining uses of the removed Vector::set_start
method.

R=sigurds@chromium.org

Bug: v8:9142
Change-Id: I829e6ffad6b1a30baa6c874265e92d615dd0c981
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1578458Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60940}
parent 99b8521c
......@@ -315,28 +315,14 @@ class EmbeddedVector : public Vector<T> {
public:
EmbeddedVector() : Vector<T>(buffer_, kSize) {}
explicit EmbeddedVector(T initial_value) : Vector<T>(buffer_, kSize) {
for (int i = 0; i < kSize; ++i) {
buffer_[i] = initial_value;
}
}
// When copying, make underlying Vector to reference our buffer.
EmbeddedVector(const EmbeddedVector& rhs) V8_NOEXCEPT : Vector<T>(rhs) {
MemCopy(buffer_, rhs.buffer_, sizeof(T) * kSize);
this->set_start(buffer_);
}
EmbeddedVector& operator=(const EmbeddedVector& rhs) V8_NOEXCEPT {
if (this == &rhs) return *this;
Vector<T>::operator=(rhs);
MemCopy(buffer_, rhs.buffer_, sizeof(T) * kSize);
this->set_start(buffer_);
return *this;
explicit EmbeddedVector(const T& initial_value) : Vector<T>(buffer_, kSize) {
std::fill_n(buffer_, kSize, initial_value);
}
private:
T buffer_[kSize];
DISALLOW_COPY_AND_ASSIGN(EmbeddedVector);
};
} // namespace internal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment