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

Side by Side Diff: src/parser.cc

Issue 12095035: %X => %_X, %_X => %__X (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 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/ia32/full-codegen-ia32.cc ('k') | src/runtime.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 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 4609 matching lines...) Expand 10 before | Expand all | Expand 10 after
4620 } 4620 }
4621 4621
4622 const Runtime::Function* function = Runtime::FunctionForSymbol(name); 4622 const Runtime::Function* function = Runtime::FunctionForSymbol(name);
4623 4623
4624 // Check for built-in IS_VAR macro. 4624 // Check for built-in IS_VAR macro.
4625 if (function != NULL && 4625 if (function != NULL &&
4626 function->intrinsic_type == Runtime::RUNTIME && 4626 function->intrinsic_type == Runtime::RUNTIME &&
4627 function->function_id == Runtime::kIS_VAR) { 4627 function->function_id == Runtime::kIS_VAR) {
4628 // %IS_VAR(x) evaluates to x if x is a variable, 4628 // %IS_VAR(x) evaluates to x if x is a variable,
4629 // leads to a parse error otherwise. Could be implemented as an 4629 // leads to a parse error otherwise. Could be implemented as an
4630 // inline function %_IS_VAR(x) to eliminate this special case. 4630 // inline function %__IS_VAR(x) to eliminate this special case.
4631 if (args->length() == 1 && args->at(0)->AsVariableProxy() != NULL) { 4631 if (args->length() == 1 && args->at(0)->AsVariableProxy() != NULL) {
4632 return args->at(0); 4632 return args->at(0);
4633 } else { 4633 } else {
4634 ReportMessage("unable_to_parse", Vector<const char*>::empty()); 4634 ReportMessage("unable_to_parse", Vector<const char*>::empty());
4635 *ok = false; 4635 *ok = false;
4636 return NULL; 4636 return NULL;
4637 } 4637 }
4638 } 4638 }
4639 4639
4640 // Check that the expected number of arguments are being passed. 4640 // Check that the expected number of arguments are being passed.
4641 if (function != NULL && 4641 if (function != NULL &&
4642 function->nargs != -1 && 4642 function->nargs != -1 &&
4643 function->nargs != args->length()) { 4643 function->nargs != args->length()) {
4644 ReportMessage("illegal_access", Vector<const char*>::empty()); 4644 ReportMessage("illegal_access", Vector<const char*>::empty());
4645 *ok = false; 4645 *ok = false;
4646 return NULL; 4646 return NULL;
4647 } 4647 }
4648 4648
4649 // Check that the function is defined if it's an inline runtime call. 4649 if (function == NULL && name->length() > 0 && name->Get(0) == '_') {
4650 if (function == NULL && name->Get(0) == '_') { 4650 // Check that the function is defined if it's an inline runtime call.
4651 ReportMessage("not_defined", Vector<Handle<String> >(&name, 1)); 4651 if (name->length() > 1 && name->Get(1) == '_') {
4652 *ok = false; 4652 ReportMessage("not_defined", Vector<Handle<String> >(&name, 1));
4653 return NULL; 4653 *ok = false;
4654 return NULL;
4655 }
4656 // Assume this is a runtime-js function called via %_name.
4657 name = isolate()->factory()->NewSubString(name, 1, name->length());
4658 name = isolate()->factory()->LookupSymbol(name);
4654 } 4659 }
4655 4660
4656 // We have a valid intrinsics call or a call to a builtin. 4661 // We have a valid intrinsics call or a call to a builtin.
4657 return factory()->NewCallRuntime(name, function, args); 4662 return factory()->NewCallRuntime(name, function, args);
4658 } 4663 }
4659 4664
4660 4665
4661 bool Parser::peek_any_identifier() { 4666 bool Parser::peek_any_identifier() {
4662 Token::Value next = peek(); 4667 Token::Value next = peek();
4663 return next == Token::IDENTIFIER || 4668 return next == Token::IDENTIFIER ||
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
5932 ASSERT(info->isolate()->has_pending_exception()); 5937 ASSERT(info->isolate()->has_pending_exception());
5933 } else { 5938 } else {
5934 result = parser.ParseProgram(); 5939 result = parser.ParseProgram();
5935 } 5940 }
5936 } 5941 }
5937 info->SetFunction(result); 5942 info->SetFunction(result);
5938 return (result != NULL); 5943 return (result != NULL);
5939 } 5944 }
5940 5945
5941 } } // namespace v8::internal 5946 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698