8 #include <forward_list> 11 #include "src/allocation.h" 12 #include "src/bailout-reason.h" 13 #include "src/code-events.h" 14 #include "src/contexts.h" 15 #include "src/isolate.h" 16 #include "src/zone/zone.h" 23 class BackgroundCompileTask;
24 class JavaScriptFrame;
25 class OptimizedCompilationInfo;
26 class OptimizedCompilationJob;
30 struct ScriptStreamingData;
32 class UnoptimizedCompilationInfo;
33 class UnoptimizedCompilationJob;
34 class WorkerThreadRuntimeCallStats;
36 typedef std::forward_list<std::unique_ptr<UnoptimizedCompilationJob>>
37 UnoptimizedCompilationJobList;
51 enum ClearExceptionFlag { KEEP_EXCEPTION, CLEAR_EXCEPTION };
60 ClearExceptionFlag flag);
68 static bool FinalizeBackgroundCompileTask(
70 Isolate* isolate, ClearExceptionFlag flag);
82 static bool ParseAndAnalyze(
ParseInfo* parse_info,
86 static bool Analyze(
ParseInfo* parse_info);
101 ParseRestriction restriction,
int parameters_end_pos,
102 int eval_scope_position,
int eval_position);
107 : line_offset(0), column_offset(0), name_obj(script_name) {}
122 v8::ScriptCompiler::CompileOptions compile_options,
127 static bool CodeGenerationFromStringsAllowed(
Isolate* isolate,
134 ParseRestriction restriction,
int parameters_end_pos);
140 v8::Extension* extension,
ScriptData* cached_data,
141 ScriptCompiler::CompileOptions compile_options,
143 NativesFlag is_natives_code);
180 enum Status { SUCCEEDED, FAILED };
190 : state_(initial_state), stack_limit_(stack_limit) {}
193 void set_stack_limit(
uintptr_t stack_limit) { stack_limit_ = stack_limit; }
194 uintptr_t stack_limit()
const {
return stack_limit_; }
196 State state()
const {
return state_; }
199 V8_WARN_UNUSED_RESULT Status UpdateState(Status status, State next_state) {
200 if (status == SUCCEEDED) {
203 state_ = State::kFailed;
226 parse_info_(parse_info),
227 compilation_info_(compilation_info) {}
230 V8_WARN_UNUSED_RESULT Status ExecuteJob();
233 V8_WARN_UNUSED_RESULT Status
236 void RecordCompilationStats(
Isolate* isolate)
const;
237 void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag,
241 ParseInfo* parse_info()
const {
return parse_info_; }
243 return compilation_info_;
248 virtual Status ExecuteJobImpl() = 0;
272 const char* compiler_name,
273 State initial_state = State::kReadyToPrepare)
275 compilation_info_(compilation_info),
276 compiler_name_(compiler_name) {}
279 V8_WARN_UNUSED_RESULT Status PrepareJob(
Isolate* isolate);
283 V8_WARN_UNUSED_RESULT Status ExecuteJob();
286 V8_WARN_UNUSED_RESULT Status FinalizeJob(
Isolate* isolate);
290 Status RetryOptimization(BailoutReason reason);
294 Status AbortOptimization(BailoutReason reason);
296 void RecordCompilationStats()
const;
297 void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag,
301 return compilation_info_;
306 virtual Status PrepareJobImpl(
Isolate* isolate) = 0;
307 virtual Status ExecuteJobImpl() = 0;
308 virtual Status FinalizeJobImpl(
Isolate* isolate) = 0;
315 const char* compiler_name_;
339 ParseInfo* info() {
return info_.get(); }
340 Parser* parser() {
return parser_.get(); }
342 return outer_function_job_.get();
344 UnoptimizedCompilationJobList* inner_function_jobs() {
345 return &inner_function_jobs_;
352 std::unique_ptr<ParseInfo> info_;
353 std::unique_ptr<Parser> parser_;
356 std::unique_ptr<UnoptimizedCompilationJob> outer_function_job_;
357 UnoptimizedCompilationJobList inner_function_jobs_;
371 ScriptCompiler::StreamedSource::Encoding encoding);
377 std::unique_ptr<ScriptCompiler::ExternalSourceStream> source_stream;
378 ScriptCompiler::StreamedSource::Encoding encoding;
381 std::unique_ptr<BackgroundCompileTask> task;
389 #endif // V8_COMPILER_H_