Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(709)

Side by Side Diff: src/compiler.h

Issue 2399463008: Create multiple compilation jobs for ignition if compiling multiple literals (Closed)
Patch Set: updates Created 4 years, 2 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
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | src/interpreter/interpreter.cc » ('J')
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 // 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_COMPILER_H_ 5 #ifndef V8_COMPILER_H_
6 #define V8_COMPILER_H_ 6 #define V8_COMPILER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector>
9 10
10 #include "src/allocation.h" 11 #include "src/allocation.h"
11 #include "src/bailout-reason.h" 12 #include "src/bailout-reason.h"
12 #include "src/contexts.h" 13 #include "src/contexts.h"
13 #include "src/isolate.h" 14 #include "src/isolate.h"
14 #include "src/zone/zone.h" 15 #include "src/zone/zone.h"
15 16
16 namespace v8 { 17 namespace v8 {
17 namespace internal { 18 namespace internal {
18 19
19 // Forward declarations. 20 // Forward declarations.
20 class CompilationInfo; 21 class CompilationInfo;
21 class CompilationJob; 22 class CompilationJob;
22 class JavaScriptFrame; 23 class JavaScriptFrame;
23 class ParseInfo; 24 class ParseInfo;
24 class ScriptData; 25 class ScriptData;
25 26
27 enum class ShouldCompile { kIfNecessary, kNever };
28
26 // The V8 compiler API. 29 // The V8 compiler API.
27 // 30 //
28 // This is the central hub for dispatching to the various compilers within V8. 31 // This is the central hub for dispatching to the various compilers within V8.
29 // Logic for which compiler to choose and how to wire compilation results into 32 // Logic for which compiler to choose and how to wire compilation results into
30 // the object heap should be kept inside this class. 33 // the object heap should be kept inside this class.
31 // 34 //
32 // General strategy: Scripts are translated into anonymous functions w/o 35 // General strategy: Scripts are translated into anonymous functions w/o
33 // parameters which then can be executed. If the source code contains other 36 // parameters which then can be executed. If the source code contains other
34 // functions, they might be compiled and allocated as part of the compilation 37 // functions, they might be compiled and allocated as part of the compilation
35 // of the source code or deferred for lazy compilation at a later point. 38 // of the source code or deferred for lazy compilation at a later point.
(...skipping 10 matching lines...) Expand all
46 // given function holds (except for live-edit, which compiles the world). 49 // given function holds (except for live-edit, which compiles the world).
47 50
48 static bool Compile(Handle<JSFunction> function, ClearExceptionFlag flag); 51 static bool Compile(Handle<JSFunction> function, ClearExceptionFlag flag);
49 static bool CompileBaseline(Handle<JSFunction> function); 52 static bool CompileBaseline(Handle<JSFunction> function);
50 static bool CompileOptimized(Handle<JSFunction> function, ConcurrencyMode); 53 static bool CompileOptimized(Handle<JSFunction> function, ConcurrencyMode);
51 static bool CompileDebugCode(Handle<JSFunction> function); 54 static bool CompileDebugCode(Handle<JSFunction> function);
52 static bool CompileDebugCode(Handle<SharedFunctionInfo> shared); 55 static bool CompileDebugCode(Handle<SharedFunctionInfo> shared);
53 static MaybeHandle<JSArray> CompileForLiveEdit(Handle<Script> script); 56 static MaybeHandle<JSArray> CompileForLiveEdit(Handle<Script> script);
54 57
55 // Prepare a compilation job for unoptimized code. Requires ParseAndAnalyse. 58 // Prepare a compilation job for unoptimized code. Requires ParseAndAnalyse.
56 static CompilationJob* PrepareUnoptimizedCompilationJob( 59 static std::vector<std::unique_ptr<CompilationJob>>
57 CompilationInfo* info); 60 PrepareUnoptimizedCompilationJob(CompilationInfo* info);
58 61
59 // Generate and install code from previously queued compilation job. 62 // Generate and install code from previously queued compilation job.
60 static bool FinalizeCompilationJob(CompilationJob* job); 63 static bool FinalizeCompilationJob(CompilationJob* job);
61 64
62 // Give the compiler a chance to perform low-latency initialization tasks of 65 // Give the compiler a chance to perform low-latency initialization tasks of
63 // the given {function} on its instantiation. Note that only the runtime will 66 // the given {function} on its instantiation. Note that only the runtime will
64 // offer this chance, optimized closure instantiation will not call this. 67 // offer this chance, optimized closure instantiation will not call this.
65 static void PostInstantiation(Handle<JSFunction> function, PretenureFlag); 68 static void PostInstantiation(Handle<JSFunction> function, PretenureFlag);
66 69
67 // Parser::Parse, then Compiler::Analyze. 70 // Parser::Parse, then Compiler::Analyze.
68 static bool ParseAndAnalyze(ParseInfo* info); 71 static bool ParseAndAnalyze(ParseInfo* info);
69 // Rewrite, analyze scopes, and renumber. 72 // Rewrite, analyze scopes, and renumber.
70 static bool Analyze(ParseInfo* info); 73 static bool Analyze(ParseInfo* info);
74 // Renumber.
75 static bool Renumber(ParseInfo* info);
71 // Adds deoptimization support, requires ParseAndAnalyze. 76 // Adds deoptimization support, requires ParseAndAnalyze.
72 static bool EnsureDeoptimizationSupport(CompilationInfo* info); 77 static bool EnsureDeoptimizationSupport(CompilationInfo* info);
73 // Ensures that bytecode is generated, calls ParseAndAnalyze internally. 78 // Ensures that bytecode is generated, calls ParseAndAnalyze internally.
74 static bool EnsureBytecode(CompilationInfo* info); 79 static bool EnsureBytecode(CompilationInfo* info);
75 80
76 // The next compilation tier which the function should be compiled to for 81 // The next compilation tier which the function should be compiled to for
77 // optimization. This is used as a hint by the runtime profiler. 82 // optimization. This is used as a hint by the runtime profiler.
78 static CompilationTier NextCompilationTier(JSFunction* function); 83 static CompilationTier NextCompilationTier(JSFunction* function);
79 84
80 // =========================================================================== 85 // ===========================================================================
(...skipping 28 matching lines...) Expand all
109 ScriptCompiler::CompileOptions compile_options, 114 ScriptCompiler::CompileOptions compile_options,
110 NativesFlag is_natives_code, bool is_module); 115 NativesFlag is_natives_code, bool is_module);
111 116
112 // Create a shared function info object for a Script that has already been 117 // Create a shared function info object for a Script that has already been
113 // parsed while the script was being loaded from a streamed source. 118 // parsed while the script was being loaded from a streamed source.
114 static Handle<SharedFunctionInfo> GetSharedFunctionInfoForStreamedScript( 119 static Handle<SharedFunctionInfo> GetSharedFunctionInfoForStreamedScript(
115 Handle<Script> script, ParseInfo* info, int source_length); 120 Handle<Script> script, ParseInfo* info, int source_length);
116 121
117 // Create a shared function info object (the code may be lazily compiled). 122 // Create a shared function info object (the code may be lazily compiled).
118 static Handle<SharedFunctionInfo> GetSharedFunctionInfo( 123 static Handle<SharedFunctionInfo> GetSharedFunctionInfo(
119 FunctionLiteral* node, Handle<Script> script, CompilationInfo* outer); 124 FunctionLiteral* node, Handle<Script> script, CompilationInfo* outer,
125 ShouldCompile should_compile = ShouldCompile::kIfNecessary);
120 126
121 // Create a shared function info object for a native function literal. 127 // Create a shared function info object for a native function literal.
122 static Handle<SharedFunctionInfo> GetSharedFunctionInfoForNative( 128 static Handle<SharedFunctionInfo> GetSharedFunctionInfoForNative(
123 v8::Extension* extension, Handle<String> name); 129 v8::Extension* extension, Handle<String> name);
124 130
125 // =========================================================================== 131 // ===========================================================================
126 // The following family of methods provides support for OSR. Code generated 132 // The following family of methods provides support for OSR. Code generated
127 // for entry via OSR might not be suitable for normal entry, hence will be 133 // for entry via OSR might not be suitable for normal entry, hence will be
128 // returned directly to the caller. 134 // returned directly to the caller.
129 // 135 //
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 state_ = State::kFailed; 228 state_ = State::kFailed;
223 } 229 }
224 return status; 230 return status;
225 } 231 }
226 }; 232 };
227 233
228 } // namespace internal 234 } // namespace internal
229 } // namespace v8 235 } // namespace v8
230 236
231 #endif // V8_COMPILER_H_ 237 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | src/interpreter/interpreter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698