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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
11 #include "src/base/platform/semaphore.h" | 11 #include "src/base/platform/semaphore.h" |
12 #include "src/compiler.h" | 12 #include "src/compiler.h" |
13 #include "src/parsing/parse-info.h" | 13 #include "src/parsing/parse-info.h" |
14 #include "src/parsing/parser.h" | 14 #include "src/parsing/parser.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 class ScriptData; | 19 class ScriptData; |
20 | 20 |
21 // Internal representation of v8::ScriptCompiler::StreamedSource. Contains all | 21 // Internal representation of v8::ScriptCompiler::StreamedSource. Contains all |
22 // data which needs to be transmitted between threads for background parsing, | 22 // data which needs to be transmitted between threads for background parsing, |
23 // finalizing it on the main thread, and compiling on the main thread. | 23 // finalizing it on the main thread, and compiling on the main thread. |
24 struct StreamedSource { | 24 struct StreamedSource { |
25 StreamedSource(ScriptCompiler::ExternalSourceStream* source_stream, | 25 StreamedSource(ScriptCompiler::ExternalSourceStream* source_stream, |
26 ScriptCompiler::StreamedSource::Encoding encoding) | 26 ScriptCompiler::StreamedSource::Encoding encoding) |
27 : source_stream(source_stream), encoding(encoding) {} | 27 : source_stream(source_stream), encoding(encoding) {} |
28 | 28 |
29 void Release() { | |
30 parser.reset(); | |
31 info.reset(); | |
32 zone.reset(); | |
33 cached_data.reset(); | |
34 source_stream.reset(); | |
35 } | |
36 | |
37 // Internal implementation of v8::ScriptCompiler::StreamedSource. | 29 // Internal implementation of v8::ScriptCompiler::StreamedSource. |
38 std::unique_ptr<ScriptCompiler::ExternalSourceStream> source_stream; | 30 std::unique_ptr<ScriptCompiler::ExternalSourceStream> source_stream; |
39 ScriptCompiler::StreamedSource::Encoding encoding; | 31 ScriptCompiler::StreamedSource::Encoding encoding; |
40 std::unique_ptr<ScriptCompiler::CachedData> cached_data; | 32 std::unique_ptr<ScriptCompiler::CachedData> cached_data; |
41 | 33 |
42 // Data needed for parsing, and data needed to to be passed between thread | 34 // Data needed for parsing, and data needed to to be passed between thread |
43 // between parsing and compilation. These need to be initialized before the | 35 // between parsing and compilation. These need to be initialized before the |
44 // compilation starts. | 36 // compilation starts. |
45 UnicodeCache unicode_cache; | 37 UnicodeCache unicode_cache; |
46 std::unique_ptr<Zone> zone; | 38 std::unique_ptr<Zone> zone; |
(...skipping 16 matching lines...) Expand all Loading... |
63 | 55 |
64 private: | 56 private: |
65 StreamedSource* source_; // Not owned. | 57 StreamedSource* source_; // Not owned. |
66 int stack_size_; | 58 int stack_size_; |
67 ScriptData* script_data_; | 59 ScriptData* script_data_; |
68 }; | 60 }; |
69 } // namespace internal | 61 } // namespace internal |
70 } // namespace v8 | 62 } // namespace v8 |
71 | 63 |
72 #endif // V8_BACKGROUND_PARSING_TASK_H_ | 64 #endif // V8_BACKGROUND_PARSING_TASK_H_ |
OLD | NEW |