|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
2 * vim: set ts=8 sts=4 et sw=4 tw=99: |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef jit_ParallelSafetyAnalysis_h |
|
8 #define jit_ParallelSafetyAnalysis_h |
|
9 |
|
10 #include "jit/MIR.h" |
|
11 |
|
12 namespace js { |
|
13 |
|
14 class InterpreterFrame; |
|
15 |
|
16 namespace jit { |
|
17 |
|
18 class MIRGraph; |
|
19 class AutoDestroyAllocator; |
|
20 |
|
21 // Determines whether a function is compatible for parallel execution. |
|
22 // Removes basic blocks containing unsafe MIR operations from the |
|
23 // graph and replaces them with MAbortPar blocks. |
|
24 class ParallelSafetyAnalysis |
|
25 { |
|
26 MIRGenerator *mir_; |
|
27 MIRGraph &graph_; |
|
28 |
|
29 bool removeResumePointOperands(); |
|
30 void replaceOperandsOnResumePoint(MResumePoint *resumePoint, MDefinition *withDef); |
|
31 |
|
32 public: |
|
33 ParallelSafetyAnalysis(MIRGenerator *mir, |
|
34 MIRGraph &graph) |
|
35 : mir_(mir), |
|
36 graph_(graph) |
|
37 {} |
|
38 |
|
39 bool analyze(); |
|
40 }; |
|
41 |
|
42 // Code to collect list of possible call targets by scraping through |
|
43 // TI and baseline data. Used to permit speculative transitive |
|
44 // compilation in vm/ForkJoin. |
|
45 // |
|
46 // This code may clone scripts and thus may invoke the GC. Hence only |
|
47 // run from the link phase, which executes on the main thread. |
|
48 typedef Vector<JSScript *, 4, IonAllocPolicy> CallTargetVector; |
|
49 bool AddPossibleCallees(JSContext *cx, MIRGraph &graph, CallTargetVector &targets); |
|
50 |
|
51 } // namespace jit |
|
52 } // namespace js |
|
53 |
|
54 #endif /* jit_ParallelSafetyAnalysis_h */ |