Commit b015961d authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Interpreter] Change BytecodeLabels to use ZoneLinkedList instead of ZoneVector.

BytecodeList::New() returns a reference to the BytecodeLabel added to the list.
Since ZoneVector can resize, this reference could become invalid. Instead
move to a ZoneLinkedList so the references never move.

Since we were using zone vectors, the old references were still valid, and
they were only mutated to set is_bound_, so only DCHECKs should have been
affected.

Change-Id: I5da850af2596dcd7f56578a6e5badd332350cb5b
Reviewed-on: https://chromium-review.googlesource.com/544941
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46145}
parent e2544f6c
...@@ -13,7 +13,7 @@ namespace interpreter { ...@@ -13,7 +13,7 @@ namespace interpreter {
BytecodeLabel* BytecodeLabels::New() { BytecodeLabel* BytecodeLabels::New() {
DCHECK(!is_bound()); DCHECK(!is_bound());
labels_.push_back(BytecodeLabel()); labels_.emplace_back(BytecodeLabel());
return &labels_.back(); return &labels_.back();
} }
......
...@@ -65,7 +65,7 @@ class V8_EXPORT_PRIVATE BytecodeLabels { ...@@ -65,7 +65,7 @@ class V8_EXPORT_PRIVATE BytecodeLabels {
void BindToLabel(BytecodeArrayBuilder* builder, const BytecodeLabel& target); void BindToLabel(BytecodeArrayBuilder* builder, const BytecodeLabel& target);
bool is_bound() const { bool is_bound() const {
bool is_bound = !labels_.empty() && labels_.at(0).is_bound(); bool is_bound = !labels_.empty() && labels_.front().is_bound();
DCHECK(!is_bound || DCHECK(!is_bound ||
std::all_of(labels_.begin(), labels_.end(), std::all_of(labels_.begin(), labels_.end(),
[](const BytecodeLabel& l) { return l.is_bound(); })); [](const BytecodeLabel& l) { return l.is_bound(); }));
...@@ -75,7 +75,7 @@ class V8_EXPORT_PRIVATE BytecodeLabels { ...@@ -75,7 +75,7 @@ class V8_EXPORT_PRIVATE BytecodeLabels {
bool empty() const { return labels_.empty(); } bool empty() const { return labels_.empty(); }
private: private:
ZoneVector<BytecodeLabel> labels_; ZoneLinkedList<BytecodeLabel> labels_;
DISALLOW_COPY_AND_ASSIGN(BytecodeLabels); DISALLOW_COPY_AND_ASSIGN(BytecodeLabels);
}; };
......
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