Index: src/parser.cc |
=================================================================== |
--- src/parser.cc (revision 6703) |
+++ src/parser.cc (working copy) |
@@ -753,8 +753,6 @@ |
result = ParseFunctionLiteral(name, RelocInfo::kNoPosition, type, &ok); |
// Make sure the results agree. |
ASSERT(ok == (result != NULL)); |
- // The only errors should be stack overflows. |
- ASSERT(ok || stack_overflow_); |
} |
// Make sure the target stack is empty. |
@@ -763,8 +761,8 @@ |
// If there was a stack overflow we have to get rid of AST and it is |
// not safe to do before scope has been deleted. |
if (result == NULL) { |
- Top::StackOverflow(); |
zone_scope->DeleteOnExit(); |
+ if (stack_overflow_) Top::StackOverflow(); |
} else { |
Handle<String> inferred_name(info->inferred_name()); |
result->set_inferred_name(inferred_name); |
@@ -3470,6 +3468,12 @@ |
Variable* parameter = top_scope_->DeclareLocal(param_name, Variable::VAR); |
top_scope_->AddParameter(parameter); |
num_parameters++; |
+ if (num_parameters > kMaxNumFunctionParameters) { |
+ ReportMessageAt(scanner().location(), "too_many_parameters", |
+ Vector<const char*>::empty()); |
+ *ok = false; |
+ return NULL; |
+ } |
done = (peek() == Token::RPAREN); |
if (!done) Expect(Token::COMMA, CHECK_OK); |
} |