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

Side by Side Diff: src/parser.cc

Issue 1350913005: Don't crash when preparsing destructured arguments (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months 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/harmony/regress/regress-4400.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 4182 matching lines...) Expand 10 before | Expand all | Expand 10 after
4193 Scanner::BookmarkScope* maybe_bookmark = 4193 Scanner::BookmarkScope* maybe_bookmark =
4194 bookmark.Set() ? &bookmark : nullptr; 4194 bookmark.Set() ? &bookmark : nullptr;
4195 SkipLazyFunctionBody(&materialized_literal_count, 4195 SkipLazyFunctionBody(&materialized_literal_count,
4196 &expected_property_count, /*CHECK_OK*/ ok, 4196 &expected_property_count, /*CHECK_OK*/ ok,
4197 maybe_bookmark); 4197 maybe_bookmark);
4198 4198
4199 if (formals.materialized_literals_count > 0) { 4199 if (formals.materialized_literals_count > 0) {
4200 materialized_literal_count += formals.materialized_literals_count; 4200 materialized_literal_count += formals.materialized_literals_count;
4201 } 4201 }
4202 4202
4203 if (function_state.materialized_literal_count() > 0) {
caitp (gmail) 2015/09/18 21:30:08 FunctionState's materialized_literal_count() never
caitp (gmail) 2015/09/18 21:38:16 In fact, this seems to be true for FormalParameter
adamk 2015/09/18 23:23:03 Sounds good, combined into a single statement.
4204 materialized_literal_count +=
4205 function_state.materialized_literal_count();
4206 }
4207
4203 if (bookmark.HasBeenReset()) { 4208 if (bookmark.HasBeenReset()) {
4204 // Trigger eager (re-)parsing, just below this block. 4209 // Trigger eager (re-)parsing, just below this block.
4205 is_lazily_parsed = false; 4210 is_lazily_parsed = false;
4206 4211
4207 // This is probably an initialization function. Inform the compiler it 4212 // This is probably an initialization function. Inform the compiler it
4208 // should also eager-compile this function, and that we expect it to be 4213 // should also eager-compile this function, and that we expect it to be
4209 // used once. 4214 // used once.
4210 eager_compile_hint = FunctionLiteral::kShouldEagerCompile; 4215 eager_compile_hint = FunctionLiteral::kShouldEagerCompile;
4211 should_be_used_once_hint = true; 4216 should_be_used_once_hint = true;
4212 } 4217 }
(...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after
6244 6249
6245 Expression* Parser::SpreadCallNew(Expression* function, 6250 Expression* Parser::SpreadCallNew(Expression* function,
6246 ZoneList<v8::internal::Expression*>* args, 6251 ZoneList<v8::internal::Expression*>* args,
6247 int pos) { 6252 int pos) {
6248 args->InsertAt(0, function, zone()); 6253 args->InsertAt(0, function, zone());
6249 6254
6250 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); 6255 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos);
6251 } 6256 }
6252 } // namespace internal 6257 } // namespace internal
6253 } // namespace v8 6258 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/regress/regress-4400.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698