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

Side by Side Diff: src/parser.cc

Issue 6694024: Use NativesFlag to allow/disallow natives syntax during compilation. (Closed)
Patch Set: Created 9 years, 9 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
« no previous file with comments | « src/debug.cc ('k') | no next file » | 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 2010 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 5115 matching lines...) Expand 10 before | Expand all | Expand 10 after
5126 5126
5127 bool ParserApi::Parse(CompilationInfo* info) { 5127 bool ParserApi::Parse(CompilationInfo* info) {
5128 ASSERT(info->function() == NULL); 5128 ASSERT(info->function() == NULL);
5129 FunctionLiteral* result = NULL; 5129 FunctionLiteral* result = NULL;
5130 Handle<Script> script = info->script(); 5130 Handle<Script> script = info->script();
5131 if (info->is_lazy()) { 5131 if (info->is_lazy()) {
5132 Parser parser(script, true, NULL, NULL); 5132 Parser parser(script, true, NULL, NULL);
5133 result = parser.ParseLazy(info); 5133 result = parser.ParseLazy(info);
5134 } else { 5134 } else {
5135 bool allow_natives_syntax = 5135 bool allow_natives_syntax =
5136 FLAG_allow_natives_syntax || Bootstrapper::IsActive(); 5136 info->allows_natives_syntax() || FLAG_allow_natives_syntax;
5137 ScriptDataImpl* pre_data = info->pre_parse_data(); 5137 ScriptDataImpl* pre_data = info->pre_parse_data();
5138 Parser parser(script, allow_natives_syntax, info->extension(), pre_data); 5138 Parser parser(script, allow_natives_syntax, info->extension(), pre_data);
5139 if (pre_data != NULL && pre_data->has_error()) { 5139 if (pre_data != NULL && pre_data->has_error()) {
5140 Scanner::Location loc = pre_data->MessageLocation(); 5140 Scanner::Location loc = pre_data->MessageLocation();
5141 const char* message = pre_data->BuildMessage(); 5141 const char* message = pre_data->BuildMessage();
5142 Vector<const char*> args = pre_data->BuildArgs(); 5142 Vector<const char*> args = pre_data->BuildArgs();
5143 parser.ReportMessageAt(loc, message, args); 5143 parser.ReportMessageAt(loc, message, args);
5144 DeleteArray(message); 5144 DeleteArray(message);
5145 for (int i = 0; i < args.length(); i++) { 5145 for (int i = 0; i < args.length(); i++) {
5146 DeleteArray(args[i]); 5146 DeleteArray(args[i]);
5147 } 5147 }
5148 DeleteArray(args.start()); 5148 DeleteArray(args.start());
5149 ASSERT(Top::has_pending_exception()); 5149 ASSERT(Top::has_pending_exception());
5150 } else { 5150 } else {
5151 Handle<String> source = Handle<String>(String::cast(script->source())); 5151 Handle<String> source = Handle<String>(String::cast(script->source()));
5152 result = parser.ParseProgram(source, 5152 result = parser.ParseProgram(source,
5153 info->is_global(), 5153 info->is_global(),
5154 info->StrictMode()); 5154 info->StrictMode());
5155 } 5155 }
5156 } 5156 }
5157 5157
5158 info->SetFunction(result); 5158 info->SetFunction(result);
5159 return (result != NULL); 5159 return (result != NULL);
5160 } 5160 }
5161 5161
5162 } } // namespace v8::internal 5162 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698