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

Side by Side Diff: src/parser.cc

Issue 8460007: Port r9643 to 3.1 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.1
Patch Set: Created 9 years, 1 month 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.h ('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 2010 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
11 // with the distribution. 11 // with the distribution.
(...skipping 5123 matching lines...) Expand 10 before | Expand all | Expand 10 after
5135 } 5135 }
5136 return !parser.failed(); 5136 return !parser.failed();
5137 } 5137 }
5138 5138
5139 5139
5140 bool ParserApi::Parse(CompilationInfo* info) { 5140 bool ParserApi::Parse(CompilationInfo* info) {
5141 ASSERT(info->function() == NULL); 5141 ASSERT(info->function() == NULL);
5142 FunctionLiteral* result = NULL; 5142 FunctionLiteral* result = NULL;
5143 Handle<Script> script = info->script(); 5143 Handle<Script> script = info->script();
5144 if (info->is_lazy()) { 5144 if (info->is_lazy()) {
5145 Parser parser(script, true, NULL, NULL); 5145 bool allow_natives_syntax =
5146 FLAG_allow_natives_syntax ||
5147 info->is_native();
5148 Parser parser(script, allow_natives_syntax, NULL, NULL);
5146 result = parser.ParseLazy(info); 5149 result = parser.ParseLazy(info);
5147 } else { 5150 } else {
5148 bool allow_natives_syntax = 5151 bool allow_natives_syntax =
5149 FLAG_allow_natives_syntax || Bootstrapper::IsActive(); 5152 info->is_native() || FLAG_allow_natives_syntax;
5150 ScriptDataImpl* pre_data = info->pre_parse_data(); 5153 ScriptDataImpl* pre_data = info->pre_parse_data();
5151 Parser parser(script, allow_natives_syntax, info->extension(), pre_data); 5154 Parser parser(script, allow_natives_syntax, info->extension(), pre_data);
5152 if (pre_data != NULL && pre_data->has_error()) { 5155 if (pre_data != NULL && pre_data->has_error()) {
5153 Scanner::Location loc = pre_data->MessageLocation(); 5156 Scanner::Location loc = pre_data->MessageLocation();
5154 const char* message = pre_data->BuildMessage(); 5157 const char* message = pre_data->BuildMessage();
5155 Vector<const char*> args = pre_data->BuildArgs(); 5158 Vector<const char*> args = pre_data->BuildArgs();
5156 parser.ReportMessageAt(loc, message, args); 5159 parser.ReportMessageAt(loc, message, args);
5157 DeleteArray(message); 5160 DeleteArray(message);
5158 for (int i = 0; i < args.length(); i++) { 5161 for (int i = 0; i < args.length(); i++) {
5159 DeleteArray(args[i]); 5162 DeleteArray(args[i]);
5160 } 5163 }
5161 DeleteArray(args.start()); 5164 DeleteArray(args.start());
5162 ASSERT(Top::has_pending_exception()); 5165 ASSERT(Top::has_pending_exception());
5163 } else { 5166 } else {
5164 Handle<String> source = Handle<String>(String::cast(script->source())); 5167 Handle<String> source = Handle<String>(String::cast(script->source()));
5165 result = parser.ParseProgram(source, 5168 result = parser.ParseProgram(source,
5166 info->is_global(), 5169 info->is_global(),
5167 info->StrictMode()); 5170 info->StrictMode());
5168 } 5171 }
5169 } 5172 }
5170 5173
5171 info->SetFunction(result); 5174 info->SetFunction(result);
5172 return (result != NULL); 5175 return (result != NULL);
5173 } 5176 }
5174 5177
5175 } } // namespace v8::internal 5178 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698