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

Side by Side Diff: src/parser.cc

Issue 8355038: Port r9643 to 3.2 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.2
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 5123 matching lines...) Expand 10 before | Expand all | Expand 10 after
5134 } 5134 }
5135 return !parser.failed(); 5135 return !parser.failed();
5136 } 5136 }
5137 5137
5138 5138
5139 bool ParserApi::Parse(CompilationInfo* info) { 5139 bool ParserApi::Parse(CompilationInfo* info) {
5140 ASSERT(info->function() == NULL); 5140 ASSERT(info->function() == NULL);
5141 FunctionLiteral* result = NULL; 5141 FunctionLiteral* result = NULL;
5142 Handle<Script> script = info->script(); 5142 Handle<Script> script = info->script();
5143 if (info->is_lazy()) { 5143 if (info->is_lazy()) {
5144 Parser parser(script, true, NULL, NULL); 5144 bool allow_natives_syntax =
5145 FLAG_allow_natives_syntax ||
5146 info->is_native();
5147 Parser parser(script, allow_natives_syntax, NULL, NULL);
5145 result = parser.ParseLazy(info); 5148 result = parser.ParseLazy(info);
5146 } else { 5149 } else {
5147 bool allow_natives_syntax = 5150 bool allow_natives_syntax =
5148 info->allows_natives_syntax() || FLAG_allow_natives_syntax; 5151 info->is_native() || FLAG_allow_natives_syntax;
5149 ScriptDataImpl* pre_data = info->pre_parse_data(); 5152 ScriptDataImpl* pre_data = info->pre_parse_data();
5150 Parser parser(script, allow_natives_syntax, info->extension(), pre_data); 5153 Parser parser(script, allow_natives_syntax, info->extension(), pre_data);
5151 if (pre_data != NULL && pre_data->has_error()) { 5154 if (pre_data != NULL && pre_data->has_error()) {
5152 Scanner::Location loc = pre_data->MessageLocation(); 5155 Scanner::Location loc = pre_data->MessageLocation();
5153 const char* message = pre_data->BuildMessage(); 5156 const char* message = pre_data->BuildMessage();
5154 Vector<const char*> args = pre_data->BuildArgs(); 5157 Vector<const char*> args = pre_data->BuildArgs();
5155 parser.ReportMessageAt(loc, message, args); 5158 parser.ReportMessageAt(loc, message, args);
5156 DeleteArray(message); 5159 DeleteArray(message);
5157 for (int i = 0; i < args.length(); i++) { 5160 for (int i = 0; i < args.length(); i++) {
5158 DeleteArray(args[i]); 5161 DeleteArray(args[i]);
5159 } 5162 }
5160 DeleteArray(args.start()); 5163 DeleteArray(args.start());
5161 ASSERT(info->isolate()->has_pending_exception()); 5164 ASSERT(info->isolate()->has_pending_exception());
5162 } else { 5165 } else {
5163 Handle<String> source = Handle<String>(String::cast(script->source())); 5166 Handle<String> source = Handle<String>(String::cast(script->source()));
5164 result = parser.ParseProgram(source, 5167 result = parser.ParseProgram(source,
5165 info->is_global(), 5168 info->is_global(),
5166 info->StrictMode()); 5169 info->StrictMode());
5167 } 5170 }
5168 } 5171 }
5169 5172
5170 info->SetFunction(result); 5173 info->SetFunction(result);
5171 return (result != NULL); 5174 return (result != NULL);
5172 } 5175 }
5173 5176
5174 } } // namespace v8::internal 5177 } } // 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