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

Side by Side Diff: src/parser.cc

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