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

Side by Side Diff: src/parser.cc

Issue 8314019: Port r9643 3.5 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.5
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 5157 matching lines...) Expand 10 before | Expand all | Expand 10 after
5168 } 5168 }
5169 5169
5170 5170
5171 bool ParserApi::Parse(CompilationInfo* info) { 5171 bool ParserApi::Parse(CompilationInfo* info) {
5172 ASSERT(info->function() == NULL); 5172 ASSERT(info->function() == NULL);
5173 FunctionLiteral* result = NULL; 5173 FunctionLiteral* result = NULL;
5174 Handle<Script> script = info->script(); 5174 Handle<Script> script = info->script();
5175 bool harmony_block_scoping = !info->is_native() && 5175 bool harmony_block_scoping = !info->is_native() &&
5176 FLAG_harmony_block_scoping; 5176 FLAG_harmony_block_scoping;
5177 if (info->is_lazy()) { 5177 if (info->is_lazy()) {
5178 Parser parser(script, true, NULL, NULL); 5178 bool allow_natives_syntax =
5179 FLAG_allow_natives_syntax ||
5180 info->is_native();
5181 Parser parser(script, allow_natives_syntax, NULL, NULL);
5179 parser.SetHarmonyBlockScoping(harmony_block_scoping); 5182 parser.SetHarmonyBlockScoping(harmony_block_scoping);
5180 result = parser.ParseLazy(info); 5183 result = parser.ParseLazy(info);
5181 } else { 5184 } else {
5182 // Whether we allow %identifier(..) syntax. 5185 // Whether we allow %identifier(..) syntax.
5183 bool allow_natives_syntax = 5186 bool allow_natives_syntax =
5184 info->allows_natives_syntax() || FLAG_allow_natives_syntax; 5187 info->is_native() || FLAG_allow_natives_syntax;
5185 ScriptDataImpl* pre_data = info->pre_parse_data(); 5188 ScriptDataImpl* pre_data = info->pre_parse_data();
5186 Parser parser(script, 5189 Parser parser(script,
5187 allow_natives_syntax, 5190 allow_natives_syntax,
5188 info->extension(), 5191 info->extension(),
5189 pre_data); 5192 pre_data);
5190 parser.SetHarmonyBlockScoping(harmony_block_scoping); 5193 parser.SetHarmonyBlockScoping(harmony_block_scoping);
5191 if (pre_data != NULL && pre_data->has_error()) { 5194 if (pre_data != NULL && pre_data->has_error()) {
5192 Scanner::Location loc = pre_data->MessageLocation(); 5195 Scanner::Location loc = pre_data->MessageLocation();
5193 const char* message = pre_data->BuildMessage(); 5196 const char* message = pre_data->BuildMessage();
5194 Vector<const char*> args = pre_data->BuildArgs(); 5197 Vector<const char*> args = pre_data->BuildArgs();
5195 parser.ReportMessageAt(loc, message, args); 5198 parser.ReportMessageAt(loc, message, args);
5196 DeleteArray(message); 5199 DeleteArray(message);
5197 for (int i = 0; i < args.length(); i++) { 5200 for (int i = 0; i < args.length(); i++) {
5198 DeleteArray(args[i]); 5201 DeleteArray(args[i]);
5199 } 5202 }
5200 DeleteArray(args.start()); 5203 DeleteArray(args.start());
5201 ASSERT(info->isolate()->has_pending_exception()); 5204 ASSERT(info->isolate()->has_pending_exception());
5202 } else { 5205 } else {
5203 Handle<String> source = Handle<String>(String::cast(script->source())); 5206 Handle<String> source = Handle<String>(String::cast(script->source()));
5204 result = parser.ParseProgram(source, 5207 result = parser.ParseProgram(source,
5205 info->is_global(), 5208 info->is_global(),
5206 info->StrictMode()); 5209 info->StrictMode());
5207 } 5210 }
5208 } 5211 }
5209 info->SetFunction(result); 5212 info->SetFunction(result);
5210 return (result != NULL); 5213 return (result != NULL);
5211 } 5214 }
5212 5215
5213 } } // namespace v8::internal 5216 } } // 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