[cleanup] Fix NOLINT(runtime/references) for asm.js parser.

R=clemensh@chromium.org
BUG=v8:9429,v8:9396

Change-Id: I35c6ef903e760ac3797ebe51722b4e6bccd4d105
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1690945
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62567}
This commit is contained in:
Michael Starzinger 2019-07-08 14:28:40 +02:00 committed by Commit Bot
parent 5c6e407d9d
commit 326f23782b
2 changed files with 9 additions and 10 deletions

View File

@ -754,7 +754,7 @@ void AsmJsParser::ValidateFunction() {
// Record start of the function, used as position for the stack check.
current_function_builder_->SetAsmFunctionStartPosition(scanner_.Position());
CachedVector<AsmType*> params(cached_asm_type_p_vectors_);
CachedVector<AsmType*> params(&cached_asm_type_p_vectors_);
ValidateFunctionParams(&params);
// Check against limit on number of parameters.
@ -762,7 +762,7 @@ void AsmJsParser::ValidateFunction() {
FAIL("Number of parameters exceeds internal limit");
}
CachedVector<ValueType> locals(cached_valuetype_vectors_);
CachedVector<ValueType> locals(&cached_valuetype_vectors_);
ValidateFunctionLocals(params.size(), &locals);
function_temp_locals_offset_ = static_cast<uint32_t>(
@ -837,7 +837,7 @@ void AsmJsParser::ValidateFunctionParams(ZoneVector<AsmType*>* params) {
scanner_.EnterLocalScope();
EXPECT_TOKEN('(');
CachedVector<AsmJsScanner::token_t> function_parameters(
cached_token_t_vectors_);
&cached_token_t_vectors_);
while (!failed_ && !Peek(')')) {
if (!scanner_.IsLocal()) {
FAIL("Expected parameter name");
@ -1315,7 +1315,7 @@ void AsmJsParser::SwitchStatement() {
Begin(pending_label_);
pending_label_ = 0;
// TODO(bradnelson): Make less weird.
CachedVector<int32_t> cases(cached_int_vectors_);
CachedVector<int32_t> cases(&cached_int_vectors_);
GatherCases(&cases);
EXPECT_TOKEN('{');
size_t count = cases.size() + 1;
@ -2166,8 +2166,8 @@ AsmType* AsmJsParser::ValidateCall() {
}
// Parse argument list and gather types.
CachedVector<AsmType*> param_types(cached_asm_type_p_vectors_);
CachedVector<AsmType*> param_specific_types(cached_asm_type_p_vectors_);
CachedVector<AsmType*> param_types(&cached_asm_type_p_vectors_);
CachedVector<AsmType*> param_specific_types(&cached_asm_type_p_vectors_);
EXPECT_TOKENn('(');
while (!failed_ && !Peek(')')) {
AsmType* t;

View File

@ -154,10 +154,9 @@ class AsmJsParser {
template <typename T>
class CachedVector final : public ZoneVector<T> {
public:
explicit CachedVector(
CachedVectors<T>& cache) // NOLINT(runtime/references)
: ZoneVector<T>(cache.zone()), cache_(&cache) {
cache.fill(this);
explicit CachedVector(CachedVectors<T>* cache)
: ZoneVector<T>(cache->zone()), cache_(cache) {
cache->fill(this);
}
~CachedVector() { cache_->reuse(this); }