Commit 247e9ccc authored by Bill Budge's avatar Bill Budge Committed by Commit Bot

Revert "[parser] Use SmallVector(1) for DeclarationParsingResult::declarations"

This reverts commit c0564971.

Reason for revert: Speculative revert, ASAN is failing consistently:
https://ci.chromium.org/p/v8/builders/ci/V8%20Win64%20ASAN/15103

Original change's description:
> [parser] Use SmallVector(1) for DeclarationParsingResult::declarations
> 
> Typically we'll parse a single declaration when parsing variable declarations.
> Using on-stack storage rather than std::vector that requires malloc is much
> more efficient.
> 
> Change-Id: Id99515bb4ce7ea2dae46498f8f9f9d49c33c7353
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2418393
> Commit-Queue: Toon Verwaest <verwaest@chromium.org>
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#69995}

TBR=leszeks@chromium.org,verwaest@chromium.org

Change-Id: I6e46c058f16c965e905f20b8df473a8fb22cc6cc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2419037Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70011}
parent 2bc09b89
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define V8_PARSING_PARSER_BASE_H_ #define V8_PARSING_PARSER_BASE_H_
#include <stdint.h> #include <stdint.h>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -15,7 +14,6 @@ ...@@ -15,7 +14,6 @@
#include "src/ast/scopes.h" #include "src/ast/scopes.h"
#include "src/base/flags.h" #include "src/base/flags.h"
#include "src/base/hashmap.h" #include "src/base/hashmap.h"
#include "src/base/small-vector.h"
#include "src/base/v8-fallthrough.h" #include "src/base/v8-fallthrough.h"
#include "src/codegen/bailout-reason.h" #include "src/codegen/bailout-reason.h"
#include "src/common/globals.h" #include "src/common/globals.h"
...@@ -541,17 +539,14 @@ class ParserBase { ...@@ -541,17 +539,14 @@ class ParserBase {
struct DeclarationParsingResult { struct DeclarationParsingResult {
struct Declaration { struct Declaration {
Declaration(ExpressionT pattern, ExpressionT initializer, Declaration(ExpressionT pattern, ExpressionT initializer)
int value_beg_pos = kNoSourcePosition) : pattern(pattern), initializer(initializer) {
: pattern(pattern),
initializer(initializer),
value_beg_pos(value_beg_pos) {
DCHECK_IMPLIES(Impl::IsNull(pattern), Impl::IsNull(initializer)); DCHECK_IMPLIES(Impl::IsNull(pattern), Impl::IsNull(initializer));
} }
ExpressionT pattern; ExpressionT pattern;
ExpressionT initializer; ExpressionT initializer;
int value_beg_pos; int value_beg_pos = kNoSourcePosition;
}; };
DeclarationParsingResult() DeclarationParsingResult()
...@@ -559,7 +554,7 @@ class ParserBase { ...@@ -559,7 +554,7 @@ class ParserBase {
bindings_loc(Scanner::Location::invalid()) {} bindings_loc(Scanner::Location::invalid()) {}
DeclarationDescriptor descriptor; DeclarationDescriptor descriptor;
base::SmallVector<Declaration, 1> declarations; std::vector<Declaration> declarations;
Scanner::Location first_initializer_loc; Scanner::Location first_initializer_loc;
Scanner::Location bindings_loc; Scanner::Location bindings_loc;
}; };
...@@ -3934,7 +3929,10 @@ void ParserBase<Impl>::ParseVariableDeclarations( ...@@ -3934,7 +3929,10 @@ void ParserBase<Impl>::ParseVariableDeclarations(
impl()->IsNull(value) || impl()->IsNull(value) ||
(var_context == kForStatement && PeekInOrOf())); (var_context == kForStatement && PeekInOrOf()));
parsing_result->declarations.emplace_back(pattern, value, value_beg_pos); typename DeclarationParsingResult::Declaration decl(pattern, value);
decl.value_beg_pos = value_beg_pos;
parsing_result->declarations.push_back(decl);
} while (Check(Token::COMMA)); } while (Check(Token::COMMA));
parsing_result->bindings_loc = parsing_result->bindings_loc =
......
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