OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_BACKGROUND_PARSING_TASK_H_ | 5 #ifndef V8_BACKGROUND_PARSING_TASK_H_ |
6 #define V8_BACKGROUND_PARSING_TASK_H_ | 6 #define V8_BACKGROUND_PARSING_TASK_H_ |
7 | 7 |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/base/platform/semaphore.h" | 9 #include "src/base/platform/semaphore.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
11 #include "src/parser.h" | 11 #include "src/parser.h" |
12 #include "src/smart-pointers.h" | 12 #include "src/smart-pointers.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 class Parser; | |
18 | |
19 // Internal representation of v8::ScriptCompiler::StreamedSource. Contains all | 17 // Internal representation of v8::ScriptCompiler::StreamedSource. Contains all |
20 // data which needs to be transmitted between threads for background parsing, | 18 // data which needs to be transmitted between threads for background parsing, |
21 // finalizing it on the main thread, and compiling on the main thread. | 19 // finalizing it on the main thread, and compiling on the main thread. |
22 struct StreamedSource { | 20 struct StreamedSource { |
23 StreamedSource(ScriptCompiler::ExternalSourceStream* source_stream, | 21 StreamedSource(ScriptCompiler::ExternalSourceStream* source_stream, |
24 ScriptCompiler::StreamedSource::Encoding encoding) | 22 ScriptCompiler::StreamedSource::Encoding encoding) |
25 : source_stream(source_stream), | 23 : source_stream(source_stream), |
26 encoding(encoding), | 24 encoding(encoding), |
27 hash_seed(0), | 25 hash_seed(0), |
28 allow_lazy(false) {} | 26 allow_lazy(false) {} |
29 | 27 |
30 // Internal implementation of v8::ScriptCompiler::StreamedSource. | 28 // Internal implementation of v8::ScriptCompiler::StreamedSource. |
31 SmartPointer<ScriptCompiler::ExternalSourceStream> source_stream; | 29 SmartPointer<ScriptCompiler::ExternalSourceStream> source_stream; |
32 ScriptCompiler::StreamedSource::Encoding encoding; | 30 ScriptCompiler::StreamedSource::Encoding encoding; |
33 SmartPointer<ScriptCompiler::CachedData> cached_data; | 31 SmartPointer<ScriptCompiler::CachedData> cached_data; |
34 | 32 |
35 // Data needed for parsing, and data needed to to be passed between thread | 33 // Data needed for parsing, and data needed to to be passed between thread |
36 // between parsing and compilation. These need to be initialized before the | 34 // between parsing and compilation. These need to be initialized before the |
37 // compilation starts. | 35 // compilation starts. |
38 UnicodeCache unicode_cache; | 36 UnicodeCache unicode_cache; |
39 SmartPointer<CompilationInfo> info; | 37 SmartPointer<ParseInfo> info; |
38 SmartPointer<Zone> zone; | |
marja
2015/03/05 10:52:55
Why is Zone needed separately, can't we get it fro
| |
40 uint32_t hash_seed; | 39 uint32_t hash_seed; |
41 bool allow_lazy; | 40 bool allow_lazy; |
42 SmartPointer<Parser> parser; | 41 SmartPointer<Parser> parser; |
43 | 42 |
44 private: | 43 private: |
45 // Prevent copying. Not implemented. | 44 // Prevent copying. Not implemented. |
46 StreamedSource(const StreamedSource&); | 45 StreamedSource(const StreamedSource&); |
47 StreamedSource& operator=(const StreamedSource&); | 46 StreamedSource& operator=(const StreamedSource&); |
48 }; | 47 }; |
49 | 48 |
50 | 49 |
51 class BackgroundParsingTask : public ScriptCompiler::ScriptStreamingTask { | 50 class BackgroundParsingTask : public ScriptCompiler::ScriptStreamingTask { |
52 public: | 51 public: |
53 BackgroundParsingTask(StreamedSource* source, | 52 BackgroundParsingTask(StreamedSource* source, |
54 ScriptCompiler::CompileOptions options, int stack_size, | 53 ScriptCompiler::CompileOptions options, int stack_size, |
55 Isolate* isolate); | 54 Isolate* isolate); |
56 | 55 |
57 virtual void Run(); | 56 virtual void Run(); |
58 | 57 |
59 private: | 58 private: |
60 StreamedSource* source_; // Not owned. | 59 StreamedSource* source_; // Not owned. |
61 ScriptCompiler::CompileOptions options_; | |
62 int stack_size_; | 60 int stack_size_; |
63 }; | 61 }; |
64 } | 62 } |
65 } // namespace v8::internal | 63 } // namespace v8::internal |
66 | 64 |
67 #endif // V8_BACKGROUND_PARSING_TASK_H_ | 65 #endif // V8_BACKGROUND_PARSING_TASK_H_ |
OLD | NEW |