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 8465006: Port r9643 to 3.0 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.0
Patch Set: Created 9 years, 1 month 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.h ('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 2010 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
11 // with the distribution. 11 // with the distribution.
(...skipping 5000 matching lines...) Expand 10 before | Expand all | Expand 10 after
5012 } 5012 }
5013 return !parser.failed(); 5013 return !parser.failed();
5014 } 5014 }
5015 5015
5016 5016
5017 bool ParserApi::Parse(CompilationInfo* info) { 5017 bool ParserApi::Parse(CompilationInfo* info) {
5018 ASSERT(info->function() == NULL); 5018 ASSERT(info->function() == NULL);
5019 FunctionLiteral* result = NULL; 5019 FunctionLiteral* result = NULL;
5020 Handle<Script> script = info->script(); 5020 Handle<Script> script = info->script();
5021 if (info->is_lazy()) { 5021 if (info->is_lazy()) {
5022 Parser parser(script, true, NULL, NULL); 5022 bool allow_natives_syntax =
5023 FLAG_allow_natives_syntax ||
5024 info->is_native();
5025 Parser parser(script, allow_natives_syntax, NULL, NULL);
5023 result = parser.ParseLazy(info); 5026 result = parser.ParseLazy(info);
5024 } else { 5027 } else {
5025 bool allow_natives_syntax = 5028 bool allow_natives_syntax =
5026 FLAG_allow_natives_syntax || Bootstrapper::IsActive(); 5029 info->is_native() || FLAG_allow_natives_syntax;
5027 ScriptDataImpl* pre_data = info->pre_parse_data(); 5030 ScriptDataImpl* pre_data = info->pre_parse_data();
5028 Parser parser(script, allow_natives_syntax, info->extension(), pre_data); 5031 Parser parser(script, allow_natives_syntax, info->extension(), pre_data);
5029 if (pre_data != NULL && pre_data->has_error()) { 5032 if (pre_data != NULL && pre_data->has_error()) {
5030 Scanner::Location loc = pre_data->MessageLocation(); 5033 Scanner::Location loc = pre_data->MessageLocation();
5031 const char* message = pre_data->BuildMessage(); 5034 const char* message = pre_data->BuildMessage();
5032 Vector<const char*> args = pre_data->BuildArgs(); 5035 Vector<const char*> args = pre_data->BuildArgs();
5033 parser.ReportMessageAt(loc, message, args); 5036 parser.ReportMessageAt(loc, message, args);
5034 DeleteArray(message); 5037 DeleteArray(message);
5035 for (int i = 0; i < args.length(); i++) { 5038 for (int i = 0; i < args.length(); i++) {
5036 DeleteArray(args[i]); 5039 DeleteArray(args[i]);
5037 } 5040 }
5038 DeleteArray(args.start()); 5041 DeleteArray(args.start());
5039 ASSERT(Top::has_pending_exception()); 5042 ASSERT(Top::has_pending_exception());
5040 } else { 5043 } else {
5041 Handle<String> source = Handle<String>(String::cast(script->source())); 5044 Handle<String> source = Handle<String>(String::cast(script->source()));
5042 result = parser.ParseProgram(source, info->is_global()); 5045 result = parser.ParseProgram(source, info->is_global());
5043 } 5046 }
5044 } 5047 }
5045 5048
5046 info->SetFunction(result); 5049 info->SetFunction(result);
5047 return (result != NULL); 5050 return (result != NULL);
5048 } 5051 }
5049 5052
5050 } } // namespace v8::internal 5053 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698