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 5026005: Move static scanner fields to scanner-base.h (Closed)
Patch Set: Created 10 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
« no previous file with comments | « src/objects.cc ('k') | src/scanner.h » ('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 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 18 matching lines...) Expand all
29 29
30 #include "api.h" 30 #include "api.h"
31 #include "ast.h" 31 #include "ast.h"
32 #include "bootstrapper.h" 32 #include "bootstrapper.h"
33 #include "codegen.h" 33 #include "codegen.h"
34 #include "compiler.h" 34 #include "compiler.h"
35 #include "func-name-inferrer.h" 35 #include "func-name-inferrer.h"
36 #include "messages.h" 36 #include "messages.h"
37 #include "parser.h" 37 #include "parser.h"
38 #include "platform.h" 38 #include "platform.h"
39 #include "prescanner.h"
39 #include "preparser.h" 40 #include "preparser.h"
40 #include "runtime.h" 41 #include "runtime.h"
41 #include "scopeinfo.h" 42 #include "scopeinfo.h"
42 #include "string-stream.h" 43 #include "string-stream.h"
43 44
44 #include "ast-inl.h" 45 #include "ast-inl.h"
45 #include "jump-target-inl.h" 46 #include "jump-target-inl.h"
46 47
47 namespace v8 { 48 namespace v8 {
48 namespace internal { 49 namespace internal {
(...skipping 4611 matching lines...) Expand 10 before | Expand all | Expand 10 after
4660 // contiguous vector that we are responsible for disposing. 4661 // contiguous vector that we are responsible for disposing.
4661 Vector<unsigned> store = recorder.ExtractData(); 4662 Vector<unsigned> store = recorder.ExtractData();
4662 return new ScriptDataImpl(store); 4663 return new ScriptDataImpl(store);
4663 } 4664 }
4664 4665
4665 4666
4666 ScriptDataImpl* ParserApi::PreParse(Handle<String> source, 4667 ScriptDataImpl* ParserApi::PreParse(Handle<String> source,
4667 unibrow::CharacterStream* stream, 4668 unibrow::CharacterStream* stream,
4668 v8::Extension* extension) { 4669 v8::Extension* extension) {
4669 Handle<Script> no_script; 4670 Handle<Script> no_script;
4670 preparser::PreParser<Scanner, CompleteParserRecorder> parser; 4671 int length = 0;
4671 Scanner scanner; 4672 SafeStringInputBuffer safe_stream;
4672 scanner.Initialize(source, stream, JAVASCRIPT); 4673 if (!source.is_null()) {
4674 length = source->length();
4675 safe_stream.Reset(source.location());
4676 stream = &safe_stream;
4677 } else {
4678 length = stream->Length();
4679 }
4680 typedef preparser::Scanner<CharacterStreamUTF16Buffer, UTF8Buffer> PreScanner;
4681 preparser::PreParser<PreScanner, CompleteParserRecorder> parser;
4682 CharacterStreamUTF16Buffer buffer;
4683 buffer.Initialize(source, stream, 0, length);
4684 PreScanner scanner;
4685 scanner.Initialize(&buffer);
4673 bool allow_lazy = FLAG_lazy && (extension == NULL); 4686 bool allow_lazy = FLAG_lazy && (extension == NULL);
4674 CompleteParserRecorder recorder; 4687 CompleteParserRecorder recorder;
4675 if (!parser.PreParseProgram(&scanner, &recorder, allow_lazy)) { 4688 if (!parser.PreParseProgram(&scanner, &recorder, allow_lazy)) {
4676 Top::StackOverflow(); 4689 Top::StackOverflow();
4677 return NULL; 4690 return NULL;
4678 } 4691 }
4679 // Extract the accumulated data from the recorder as a single 4692 // Extract the accumulated data from the recorder as a single
4680 // contiguous vector that we are responsible for disposing. 4693 // contiguous vector that we are responsible for disposing.
4681 Vector<unsigned> store = recorder.ExtractData(); 4694 Vector<unsigned> store = recorder.ExtractData();
4682 return new ScriptDataImpl(store); 4695 return new ScriptDataImpl(store);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
4732 Handle<String> source = Handle<String>(String::cast(script->source())); 4745 Handle<String> source = Handle<String>(String::cast(script->source()));
4733 result = parser.ParseProgram(source, info->is_global()); 4746 result = parser.ParseProgram(source, info->is_global());
4734 } 4747 }
4735 } 4748 }
4736 4749
4737 info->SetFunction(result); 4750 info->SetFunction(result);
4738 return (result != NULL); 4751 return (result != NULL);
4739 } 4752 }
4740 4753
4741 } } // namespace v8::internal 4754 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698