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

Side by Side Diff: src/parser.cc

Issue 7054074: Limit the number of arguments in a function call to 32766. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add regression test Created 9 years, 6 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/messages.js ('k') | test/mjsunit/regress/regress-1122.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3487 matching lines...) Expand 10 before | Expand all | Expand 10 after
3498 ZoneList<Expression*>* Parser::ParseArguments(bool* ok) { 3498 ZoneList<Expression*>* Parser::ParseArguments(bool* ok) {
3499 // Arguments :: 3499 // Arguments ::
3500 // '(' (AssignmentExpression)*[','] ')' 3500 // '(' (AssignmentExpression)*[','] ')'
3501 3501
3502 ZoneList<Expression*>* result = new(zone()) ZoneList<Expression*>(4); 3502 ZoneList<Expression*>* result = new(zone()) ZoneList<Expression*>(4);
3503 Expect(Token::LPAREN, CHECK_OK); 3503 Expect(Token::LPAREN, CHECK_OK);
3504 bool done = (peek() == Token::RPAREN); 3504 bool done = (peek() == Token::RPAREN);
3505 while (!done) { 3505 while (!done) {
3506 Expression* argument = ParseAssignmentExpression(true, CHECK_OK); 3506 Expression* argument = ParseAssignmentExpression(true, CHECK_OK);
3507 result->Add(argument); 3507 result->Add(argument);
3508 if (result->length() > kMaxNumFunctionParameters) {
3509 ReportMessageAt(scanner().location(), "too_many_arguments",
3510 Vector<const char*>::empty());
3511 *ok = false;
3512 return NULL;
3513 }
3508 done = (peek() == Token::RPAREN); 3514 done = (peek() == Token::RPAREN);
3509 if (!done) Expect(Token::COMMA, CHECK_OK); 3515 if (!done) Expect(Token::COMMA, CHECK_OK);
3510 } 3516 }
3511 Expect(Token::RPAREN, CHECK_OK); 3517 Expect(Token::RPAREN, CHECK_OK);
3512 return result; 3518 return result;
3513 } 3519 }
3514 3520
3515 3521
3516 FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name, 3522 FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name,
3517 bool name_is_reserved, 3523 bool name_is_reserved,
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
4984 info->is_global(), 4990 info->is_global(),
4985 info->StrictMode()); 4991 info->StrictMode());
4986 } 4992 }
4987 } 4993 }
4988 4994
4989 info->SetFunction(result); 4995 info->SetFunction(result);
4990 return (result != NULL); 4996 return (result != NULL);
4991 } 4997 }
4992 4998
4993 } } // namespace v8::internal 4999 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/messages.js ('k') | test/mjsunit/regress/regress-1122.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698