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

Side by Side Diff: src/parser.cc

Issue 10828282: Prevent segfault on undefined inline runtime call. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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 | « no previous file | test/mjsunit/regress-2286.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 // 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 4786 matching lines...) Expand 10 before | Expand all | Expand 10 after
4797 4797
4798 // Check that the expected number of arguments are being passed. 4798 // Check that the expected number of arguments are being passed.
4799 if (function != NULL && 4799 if (function != NULL &&
4800 function->nargs != -1 && 4800 function->nargs != -1 &&
4801 function->nargs != args->length()) { 4801 function->nargs != args->length()) {
4802 ReportMessage("illegal_access", Vector<const char*>::empty()); 4802 ReportMessage("illegal_access", Vector<const char*>::empty());
4803 *ok = false; 4803 *ok = false;
4804 return NULL; 4804 return NULL;
4805 } 4805 }
4806 4806
4807 // Check that the function is defined if it's a inline runtime call.
Michael Starzinger 2012/08/13 19:04:54 "[...] it's an inline [...]"
4808 if (function == NULL && name->Get(0) == '_') {
4809 ReportMessage("not_defined", Vector<Handle<String> >(&name, 1));
4810 *ok = false;
4811 return NULL;
4812 }
4813
4807 // We have a valid intrinsics call or a call to a builtin. 4814 // We have a valid intrinsics call or a call to a builtin.
4808 return factory()->NewCallRuntime(name, function, args); 4815 return factory()->NewCallRuntime(name, function, args);
4809 } 4816 }
4810 4817
4811 4818
4812 bool Parser::peek_any_identifier() { 4819 bool Parser::peek_any_identifier() {
4813 Token::Value next = peek(); 4820 Token::Value next = peek();
4814 return next == Token::IDENTIFIER || 4821 return next == Token::IDENTIFIER ||
4815 next == Token::FUTURE_RESERVED_WORD || 4822 next == Token::FUTURE_RESERVED_WORD ||
4816 next == Token::FUTURE_STRICT_RESERVED_WORD; 4823 next == Token::FUTURE_STRICT_RESERVED_WORD;
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
6083 ASSERT(info->isolate()->has_pending_exception()); 6090 ASSERT(info->isolate()->has_pending_exception());
6084 } else { 6091 } else {
6085 result = parser.ParseProgram(); 6092 result = parser.ParseProgram();
6086 } 6093 }
6087 } 6094 }
6088 info->SetFunction(result); 6095 info->SetFunction(result);
6089 return (result != NULL); 6096 return (result != NULL);
6090 } 6097 }
6091 6098
6092 } } // namespace v8::internal 6099 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress-2286.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698