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

Side by Side Diff: src/parser.cc

Issue 6447007: Fix a bug that occurs when functions are defined with more than 16,382 parame... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/parser.h ('k') | src/x64/codegen-x64.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 strict_mode_ = (parent_ != NULL) && parent_->strict_mode_; 326 strict_mode_ = (parent_ != NULL) && parent_->strict_mode_;
327 *variable = this; 327 *variable = this;
328 } 328 }
329 329
330 330
331 TemporaryScope::~TemporaryScope() { 331 TemporaryScope::~TemporaryScope() {
332 *variable_ = parent_; 332 *variable_ = parent_;
333 } 333 }
334 334
335 335
336 const int Parser::kMaxNumFunctionParameters;
337
338
336 Handle<String> Parser::LookupSymbol(int symbol_id) { 339 Handle<String> Parser::LookupSymbol(int symbol_id) {
337 // Length of symbol cache is the number of identified symbols. 340 // Length of symbol cache is the number of identified symbols.
338 // If we are larger than that, or negative, it's not a cached symbol. 341 // If we are larger than that, or negative, it's not a cached symbol.
339 // This might also happen if there is no preparser symbol data, even 342 // This might also happen if there is no preparser symbol data, even
340 // if there is some preparser data. 343 // if there is some preparser data.
341 if (static_cast<unsigned>(symbol_id) 344 if (static_cast<unsigned>(symbol_id)
342 >= static_cast<unsigned>(symbol_cache_.length())) { 345 >= static_cast<unsigned>(symbol_cache_.length())) {
343 if (scanner().is_literal_ascii()) { 346 if (scanner().is_literal_ascii()) {
344 return Factory::LookupAsciiSymbol(scanner().literal_ascii_string()); 347 return Factory::LookupAsciiSymbol(scanner().literal_ascii_string());
345 } else { 348 } else {
(...skipping 3146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3492 if (!dupe_loc.IsValid() && top_scope_->IsDeclared(param_name)) { 3495 if (!dupe_loc.IsValid() && top_scope_->IsDeclared(param_name)) {
3493 dupe_loc = scanner().location(); 3496 dupe_loc = scanner().location();
3494 } 3497 }
3495 if (!reserved_loc.IsValid() && is_reserved) { 3498 if (!reserved_loc.IsValid() && is_reserved) {
3496 reserved_loc = scanner().location(); 3499 reserved_loc = scanner().location();
3497 } 3500 }
3498 3501
3499 Variable* parameter = top_scope_->DeclareLocal(param_name, Variable::VAR); 3502 Variable* parameter = top_scope_->DeclareLocal(param_name, Variable::VAR);
3500 top_scope_->AddParameter(parameter); 3503 top_scope_->AddParameter(parameter);
3501 num_parameters++; 3504 num_parameters++;
3505 if (num_parameters > kMaxNumFunctionParameters) {
3506 ReportMessageAt(scanner().location(), "too_many_parameters",
3507 Vector<const char*>::empty());
3508 *ok = false;
3509 return NULL;
3510 }
3502 done = (peek() == Token::RPAREN); 3511 done = (peek() == Token::RPAREN);
3503 if (!done) Expect(Token::COMMA, CHECK_OK); 3512 if (!done) Expect(Token::COMMA, CHECK_OK);
3504 } 3513 }
3505 Expect(Token::RPAREN, CHECK_OK); 3514 Expect(Token::RPAREN, CHECK_OK);
3506 3515
3507 Expect(Token::LBRACE, CHECK_OK); 3516 Expect(Token::LBRACE, CHECK_OK);
3508 ZoneList<Statement*>* body = new ZoneList<Statement*>(8); 3517 ZoneList<Statement*>* body = new ZoneList<Statement*>(8);
3509 3518
3510 // If we have a named function expression, we add a local variable 3519 // If we have a named function expression, we add a local variable
3511 // declaration to the body of the function with the name of the 3520 // declaration to the body of the function with the name of the
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
5097 info->is_global(), 5106 info->is_global(),
5098 info->StrictMode()); 5107 info->StrictMode());
5099 } 5108 }
5100 } 5109 }
5101 5110
5102 info->SetFunction(result); 5111 info->SetFunction(result);
5103 return (result != NULL); 5112 return (result != NULL);
5104 } 5113 }
5105 5114
5106 } } // namespace v8::internal 5115 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.h ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698