Commit 3727b265 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

Revert "[cleanup] Replace ZoneList with ZoneVector for parser reported_errors_"

This reverts commit 133a6815.

Reason for revert: Regresses parsing time

Original change's description:
> [cleanup] Replace ZoneList with ZoneVector for parser reported_errors_
> 
> We use a ZoneVector because we do a fair amount of random access e.g.
> in ExpressionClassifier::Accumulate() so the vector is better suited
> than ZoneChunkList as it has constant time random access.
> 
> Bug: v8:6333
> Change-Id: I83e1de60ee8fe319cfa5ce77fc5f5f86beb5307d
> Reviewed-on: https://chromium-review.googlesource.com/1054672
> Reviewed-by: Georg Neis <neis@chromium.org>
> Commit-Queue: Peter Marshall <petermarshall@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#55315}

TBR=neis@chromium.org,petermarshall@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: v8:6333
Change-Id: Ib89f0aa1f27b7d6dbbf21af60ed7d1bcd2c0b7d3
Reviewed-on: https://chromium-review.googlesource.com/1189803Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55427}
parent 43d68145
......@@ -7,7 +7,6 @@
#include "src/messages.h"
#include "src/parsing/scanner.h"
#include "src/zone/zone-containers.h"
namespace v8 {
namespace internal {
......@@ -96,7 +95,7 @@ class ExpressionClassifier {
invalid_productions_(0),
is_non_simple_parameter_list_(0) {
base->classifier_ = this;
reported_errors_begin_ = reported_errors_end_ = reported_errors_->size();
reported_errors_begin_ = reported_errors_end_ = reported_errors_->length();
}
V8_INLINE ~ExpressionClassifier() {
......@@ -278,7 +277,7 @@ class ExpressionClassifier {
void Accumulate(ExpressionClassifier* inner, unsigned productions) {
DCHECK_EQ(inner->reported_errors_, reported_errors_);
DCHECK_EQ(inner->reported_errors_begin_, reported_errors_end_);
DCHECK_EQ(inner->reported_errors_end_, reported_errors_->size());
DCHECK_EQ(inner->reported_errors_end_, reported_errors_->length());
// Propagate errors from inner, but don't overwrite already recorded
// errors.
unsigned non_arrow_inner_invalid_productions =
......@@ -338,14 +337,14 @@ class ExpressionClassifier {
}
}
}
reported_errors_->resize(reported_errors_end_);
reported_errors_->Rewind(reported_errors_end_);
inner->reported_errors_begin_ = inner->reported_errors_end_ =
reported_errors_end_;
}
V8_INLINE void Discard() {
if (reported_errors_end_ == reported_errors_->size()) {
reported_errors_->resize(reported_errors_begin_);
if (reported_errors_end_ == reported_errors_->length()) {
reported_errors_->Rewind(reported_errors_begin_);
reported_errors_end_ = reported_errors_begin_;
}
DCHECK_EQ(reported_errors_begin_, reported_errors_end_);
......@@ -375,8 +374,8 @@ class ExpressionClassifier {
// Adds e to the end of the list of reported errors for this classifier.
// It is expected that this classifier is the last one in the stack.
V8_INLINE void Add(const Error& e) {
DCHECK_EQ(reported_errors_end_, reported_errors_->size());
reported_errors_->push_back(e);
DCHECK_EQ(reported_errors_end_, reported_errors_->length());
reported_errors_->Add(e, zone_);
reported_errors_end_++;
}
......@@ -386,7 +385,7 @@ class ExpressionClassifier {
// in an inner classifier) or it could be an existing error (in case a
// copy is needed).
V8_INLINE void Copy(int i) {
DCHECK_LT(i, reported_errors_->size());
DCHECK_LT(i, reported_errors_->length());
if (reported_errors_end_ != i)
reported_errors_->at(reported_errors_end_) = reported_errors_->at(i);
reported_errors_end_++;
......@@ -395,7 +394,7 @@ class ExpressionClassifier {
typename Types::Base* base_;
ExpressionClassifier* previous_;
Zone* zone_;
ZoneVector<Error>* reported_errors_;
ZoneList<Error>* reported_errors_;
DuplicateFinder* duplicate_finder_;
unsigned invalid_productions_ : 15;
unsigned is_non_simple_parameter_list_ : 1;
......
......@@ -433,7 +433,7 @@ class ParserBase {
return destructuring_assignments_to_rewrite_;
}
ZoneVector<typename ExpressionClassifier::Error>* GetReportedErrorList() {
ZoneList<typename ExpressionClassifier::Error>* GetReportedErrorList() {
return &reported_errors_;
}
......@@ -490,8 +490,7 @@ class ParserBase {
ZoneChunkList<RewritableExpressionT> destructuring_assignments_to_rewrite_;
// We use a ZoneVector here because we need to do a lot of random access.
ZoneVector<typename ExpressionClassifier::Error> reported_errors_;
ZoneList<typename ExpressionClassifier::Error> reported_errors_;
// A reason, if any, why this function should not be optimized.
BailoutReason dont_optimize_reason_;
......@@ -1592,13 +1591,12 @@ ParserBase<Impl>::FunctionState::FunctionState(
outer_function_state_(*function_state_stack),
scope_(scope),
destructuring_assignments_to_rewrite_(scope->zone()),
reported_errors_(scope_->zone()),
reported_errors_(16, scope->zone()),
dont_optimize_reason_(BailoutReason::kNoReason),
next_function_is_likely_called_(false),
previous_function_was_likely_called_(false),
contains_function_or_eval_(false) {
*function_state_stack = this;
reported_errors_.reserve(16);
if (outer_function_state_) {
outer_function_state_->previous_function_was_likely_called_ =
outer_function_state_->next_function_is_likely_called_;
......
......@@ -958,7 +958,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
void SetFunctionNameFromIdentifierRef(Expression* value,
Expression* identifier);
V8_INLINE ZoneVector<typename ExpressionClassifier::Error>*
V8_INLINE ZoneList<typename ExpressionClassifier::Error>*
GetReportedErrorList() const {
return function_state_->GetReportedErrorList();
}
......
......@@ -10,7 +10,6 @@
#include "src/parsing/parser-base.h"
#include "src/parsing/preparser-logger.h"
#include "src/pending-compilation-error-handler.h"
#include "src/zone/zone-containers.h"
namespace v8 {
namespace internal {
......@@ -1733,7 +1732,7 @@ class PreParser : public ParserBase<PreParser> {
const PreParserExpression& value, const PreParserExpression& identifier) {
}
V8_INLINE ZoneVector<typename ExpressionClassifier::Error>*
V8_INLINE ZoneList<typename ExpressionClassifier::Error>*
GetReportedErrorList() const {
return function_state_->GetReportedErrorList();
}
......
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