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

Side by Side Diff: src/parser.cc

Issue 8311015: Port r9543 to the 3.4 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.4
Patch Set: Created 9 years, 2 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/compiler.cc ('k') | src/version.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 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 5103 matching lines...) Expand 10 before | Expand all | Expand 10 after
5114 } 5114 }
5115 return !parser.failed(); 5115 return !parser.failed();
5116 } 5116 }
5117 5117
5118 5118
5119 bool ParserApi::Parse(CompilationInfo* info) { 5119 bool ParserApi::Parse(CompilationInfo* info) {
5120 ASSERT(info->function() == NULL); 5120 ASSERT(info->function() == NULL);
5121 FunctionLiteral* result = NULL; 5121 FunctionLiteral* result = NULL;
5122 Handle<Script> script = info->script(); 5122 Handle<Script> script = info->script();
5123 if (info->is_lazy()) { 5123 if (info->is_lazy()) {
5124 Parser parser(script, true, NULL, NULL); 5124 bool allow_natives_syntax =
5125 FLAG_allow_natives_syntax ||
5126 info->is_native();
5127 Parser parser(script, allow_natives_syntax, NULL, NULL);
5125 result = parser.ParseLazy(info); 5128 result = parser.ParseLazy(info);
5126 } else { 5129 } else {
5127 // Whether we allow %identifier(..) syntax. 5130 // Whether we allow %identifier(..) syntax.
5128 bool allow_natives_syntax = 5131 bool allow_natives_syntax =
5129 info->allows_natives_syntax() || FLAG_allow_natives_syntax; 5132 info->is_native() || FLAG_allow_natives_syntax;
5130 ScriptDataImpl* pre_data = info->pre_parse_data(); 5133 ScriptDataImpl* pre_data = info->pre_parse_data();
5131 Parser parser(script, allow_natives_syntax, info->extension(), pre_data); 5134 Parser parser(script, allow_natives_syntax, info->extension(), pre_data);
5132 if (pre_data != NULL && pre_data->has_error()) { 5135 if (pre_data != NULL && pre_data->has_error()) {
5133 Scanner::Location loc = pre_data->MessageLocation(); 5136 Scanner::Location loc = pre_data->MessageLocation();
5134 const char* message = pre_data->BuildMessage(); 5137 const char* message = pre_data->BuildMessage();
5135 Vector<const char*> args = pre_data->BuildArgs(); 5138 Vector<const char*> args = pre_data->BuildArgs();
5136 parser.ReportMessageAt(loc, message, args); 5139 parser.ReportMessageAt(loc, message, args);
5137 DeleteArray(message); 5140 DeleteArray(message);
5138 for (int i = 0; i < args.length(); i++) { 5141 for (int i = 0; i < args.length(); i++) {
5139 DeleteArray(args[i]); 5142 DeleteArray(args[i]);
5140 } 5143 }
5141 DeleteArray(args.start()); 5144 DeleteArray(args.start());
5142 ASSERT(info->isolate()->has_pending_exception()); 5145 ASSERT(info->isolate()->has_pending_exception());
5143 } else { 5146 } else {
5144 Handle<String> source = Handle<String>(String::cast(script->source())); 5147 Handle<String> source = Handle<String>(String::cast(script->source()));
5145 result = parser.ParseProgram(source, 5148 result = parser.ParseProgram(source,
5146 info->is_global(), 5149 info->is_global(),
5147 info->StrictMode()); 5150 info->StrictMode());
5148 } 5151 }
5149 } 5152 }
5150 5153
5151 info->SetFunction(result); 5154 info->SetFunction(result);
5152 return (result != NULL); 5155 return (result != NULL);
5153 } 5156 }
5154 5157
5155 } } // namespace v8::internal 5158 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698