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 10787036: Remove obsolete ParserApi::PartialPreParse method. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 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/parser.h ('k') | test/cctest/test-parsing.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 5961 matching lines...) Expand 10 before | Expand all | Expand 10 after
5972 return NULL; 5972 return NULL;
5973 } 5973 }
5974 5974
5975 // Extract the accumulated data from the recorder as a single 5975 // Extract the accumulated data from the recorder as a single
5976 // contiguous vector that we are responsible for disposing. 5976 // contiguous vector that we are responsible for disposing.
5977 Vector<unsigned> store = recorder->ExtractData(); 5977 Vector<unsigned> store = recorder->ExtractData();
5978 return new ScriptDataImpl(store); 5978 return new ScriptDataImpl(store);
5979 } 5979 }
5980 5980
5981 5981
5982 // Preparse, but only collect data that is immediately useful,
5983 // even if the preparser data is only used once.
5984 ScriptDataImpl* ParserApi::PartialPreParse(Handle<String> source,
5985 v8::Extension* extension,
5986 int flags) {
5987 bool allow_lazy = FLAG_lazy && (extension == NULL);
5988 if (!allow_lazy) {
5989 // Partial preparsing is only about lazily compiled functions.
5990 // If we don't allow lazy compilation, the log data will be empty.
5991 return NULL;
5992 }
5993 flags |= kAllowLazy;
5994 PartialParserRecorder recorder;
5995 int source_length = source->length();
5996 if (source->IsExternalTwoByteString()) {
5997 ExternalTwoByteStringUtf16CharacterStream stream(
5998 Handle<ExternalTwoByteString>::cast(source), 0, source_length);
5999 return DoPreParse(&stream, flags, &recorder);
6000 } else {
6001 GenericStringUtf16CharacterStream stream(source, 0, source_length);
6002 return DoPreParse(&stream, flags, &recorder);
6003 }
6004 }
6005
6006
6007 ScriptDataImpl* ParserApi::PreParse(Utf16CharacterStream* source, 5982 ScriptDataImpl* ParserApi::PreParse(Utf16CharacterStream* source,
6008 v8::Extension* extension, 5983 v8::Extension* extension,
6009 int flags) { 5984 int flags) {
6010 Handle<Script> no_script; 5985 Handle<Script> no_script;
6011 if (FLAG_lazy && (extension == NULL)) { 5986 if (FLAG_lazy && (extension == NULL)) {
6012 flags |= kAllowLazy; 5987 flags |= kAllowLazy;
6013 } 5988 }
6014 CompleteParserRecorder recorder; 5989 CompleteParserRecorder recorder;
6015 return DoPreParse(source, flags, &recorder); 5990 return DoPreParse(source, flags, &recorder);
6016 } 5991 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
6078 ASSERT(info->isolate()->has_pending_exception()); 6053 ASSERT(info->isolate()->has_pending_exception());
6079 } else { 6054 } else {
6080 result = parser.ParseProgram(); 6055 result = parser.ParseProgram();
6081 } 6056 }
6082 } 6057 }
6083 info->SetFunction(result); 6058 info->SetFunction(result);
6084 return (result != NULL); 6059 return (result != NULL);
6085 } 6060 }
6086 6061
6087 } } // namespace v8::internal 6062 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698