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

Side by Side Diff: src/parser.cc

Issue 8314021: Port r9643 to 3.7 branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
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 5178 matching lines...) Expand 10 before | Expand all | Expand 10 after
5189 return !parser.failed(); 5189 return !parser.failed();
5190 } 5190 }
5191 5191
5192 5192
5193 bool ParserApi::Parse(CompilationInfo* info) { 5193 bool ParserApi::Parse(CompilationInfo* info) {
5194 ASSERT(info->function() == NULL); 5194 ASSERT(info->function() == NULL);
5195 FunctionLiteral* result = NULL; 5195 FunctionLiteral* result = NULL;
5196 Handle<Script> script = info->script(); 5196 Handle<Script> script = info->script();
5197 bool harmony_scoping = !info->is_native() && FLAG_harmony_scoping; 5197 bool harmony_scoping = !info->is_native() && FLAG_harmony_scoping;
5198 if (info->is_lazy()) { 5198 if (info->is_lazy()) {
5199 Parser parser(script, true, NULL, NULL); 5199 bool allow_natives_syntax =
5200 FLAG_allow_natives_syntax ||
5201 info->is_native();
5202 Parser parser(script, allow_natives_syntax, NULL, NULL);
5200 parser.SetHarmonyScoping(harmony_scoping); 5203 parser.SetHarmonyScoping(harmony_scoping);
5201 result = parser.ParseLazy(info); 5204 result = parser.ParseLazy(info);
5202 } else { 5205 } else {
5203 // Whether we allow %identifier(..) syntax. 5206 // Whether we allow %identifier(..) syntax.
5204 bool allow_natives_syntax = 5207 bool allow_natives_syntax =
5205 info->allows_natives_syntax() || FLAG_allow_natives_syntax; 5208 info->is_native() || FLAG_allow_natives_syntax;
5206 ScriptDataImpl* pre_data = info->pre_parse_data(); 5209 ScriptDataImpl* pre_data = info->pre_parse_data();
5207 Parser parser(script, 5210 Parser parser(script,
5208 allow_natives_syntax, 5211 allow_natives_syntax,
5209 info->extension(), 5212 info->extension(),
5210 pre_data); 5213 pre_data);
5211 parser.SetHarmonyScoping(harmony_scoping); 5214 parser.SetHarmonyScoping(harmony_scoping);
5212 if (pre_data != NULL && pre_data->has_error()) { 5215 if (pre_data != NULL && pre_data->has_error()) {
5213 Scanner::Location loc = pre_data->MessageLocation(); 5216 Scanner::Location loc = pre_data->MessageLocation();
5214 const char* message = pre_data->BuildMessage(); 5217 const char* message = pre_data->BuildMessage();
5215 Vector<const char*> args = pre_data->BuildArgs(); 5218 Vector<const char*> args = pre_data->BuildArgs();
5216 parser.ReportMessageAt(loc, message, args); 5219 parser.ReportMessageAt(loc, message, args);
5217 DeleteArray(message); 5220 DeleteArray(message);
5218 for (int i = 0; i < args.length(); i++) { 5221 for (int i = 0; i < args.length(); i++) {
5219 DeleteArray(args[i]); 5222 DeleteArray(args[i]);
5220 } 5223 }
5221 DeleteArray(args.start()); 5224 DeleteArray(args.start());
5222 ASSERT(info->isolate()->has_pending_exception()); 5225 ASSERT(info->isolate()->has_pending_exception());
5223 } else { 5226 } else {
5224 Handle<String> source = Handle<String>(String::cast(script->source())); 5227 Handle<String> source = Handle<String>(String::cast(script->source()));
5225 result = parser.ParseProgram(source, 5228 result = parser.ParseProgram(source,
5226 info->is_global(), 5229 info->is_global(),
5227 info->StrictMode()); 5230 info->StrictMode());
5228 } 5231 }
5229 } 5232 }
5230 info->SetFunction(result); 5233 info->SetFunction(result);
5231 return (result != NULL); 5234 return (result != NULL);
5232 } 5235 }
5233 5236
5234 } } // namespace v8::internal 5237 } } // 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