Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1372)

Side by Side Diff: src/parser.cc

Issue 1442653004: Run the materialized literal reindexer on default parameter initializers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-554865.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/parser.h" 5 #include "src/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/ast-literal-reindexer.h" 9 #include "src/ast-literal-reindexer.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 4130 matching lines...) Expand 10 before | Expand all | Expand 10 after
4141 DCHECK_EQ(parameters->is_simple, parameters->scope->has_simple_parameters()); 4141 DCHECK_EQ(parameters->is_simple, parameters->scope->has_simple_parameters());
4142 } 4142 }
4143 4143
4144 4144
4145 void ParserTraits::ReindexLiterals(const ParserFormalParameters& parameters) { 4145 void ParserTraits::ReindexLiterals(const ParserFormalParameters& parameters) {
4146 if (parser_->function_state_->materialized_literal_count() > 0) { 4146 if (parser_->function_state_->materialized_literal_count() > 0) {
4147 AstLiteralReindexer reindexer; 4147 AstLiteralReindexer reindexer;
4148 4148
4149 for (const auto p : parameters.params) { 4149 for (const auto p : parameters.params) {
4150 if (p.pattern != nullptr) reindexer.Reindex(p.pattern); 4150 if (p.pattern != nullptr) reindexer.Reindex(p.pattern);
4151 if (p.initializer != nullptr) reindexer.Reindex(p.initializer);
4151 } 4152 }
4152 4153
4153 if (parameters.has_rest) { 4154 if (parameters.has_rest) {
4154 parameters.rest_array_literal_index = reindexer.NextIndex(); 4155 parameters.rest_array_literal_index = reindexer.NextIndex();
4155 } 4156 }
4156 4157
4157 DCHECK(reindexer.count() <= 4158 DCHECK(reindexer.count() <=
4158 parser_->function_state_->materialized_literal_count()); 4159 parser_->function_state_->materialized_literal_count());
4159 } 4160 }
4160 } 4161 }
(...skipping 2264 matching lines...) Expand 10 before | Expand all | Expand 10 after
6425 } 6426 }
6426 6427
6427 6428
6428 void Parser::RaiseLanguageMode(LanguageMode mode) { 6429 void Parser::RaiseLanguageMode(LanguageMode mode) {
6429 SetLanguageMode(scope_, 6430 SetLanguageMode(scope_,
6430 static_cast<LanguageMode>(scope_->language_mode() | mode)); 6431 static_cast<LanguageMode>(scope_->language_mode() | mode));
6431 } 6432 }
6432 6433
6433 } // namespace internal 6434 } // namespace internal
6434 } // namespace v8 6435 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-554865.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698