1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit/ParallelSafetyAnalysis.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99: 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef jit_ParallelSafetyAnalysis_h 1.11 +#define jit_ParallelSafetyAnalysis_h 1.12 + 1.13 +#include "jit/MIR.h" 1.14 + 1.15 +namespace js { 1.16 + 1.17 +class InterpreterFrame; 1.18 + 1.19 +namespace jit { 1.20 + 1.21 +class MIRGraph; 1.22 +class AutoDestroyAllocator; 1.23 + 1.24 +// Determines whether a function is compatible for parallel execution. 1.25 +// Removes basic blocks containing unsafe MIR operations from the 1.26 +// graph and replaces them with MAbortPar blocks. 1.27 +class ParallelSafetyAnalysis 1.28 +{ 1.29 + MIRGenerator *mir_; 1.30 + MIRGraph &graph_; 1.31 + 1.32 + bool removeResumePointOperands(); 1.33 + void replaceOperandsOnResumePoint(MResumePoint *resumePoint, MDefinition *withDef); 1.34 + 1.35 + public: 1.36 + ParallelSafetyAnalysis(MIRGenerator *mir, 1.37 + MIRGraph &graph) 1.38 + : mir_(mir), 1.39 + graph_(graph) 1.40 + {} 1.41 + 1.42 + bool analyze(); 1.43 +}; 1.44 + 1.45 +// Code to collect list of possible call targets by scraping through 1.46 +// TI and baseline data. Used to permit speculative transitive 1.47 +// compilation in vm/ForkJoin. 1.48 +// 1.49 +// This code may clone scripts and thus may invoke the GC. Hence only 1.50 +// run from the link phase, which executes on the main thread. 1.51 +typedef Vector<JSScript *, 4, IonAllocPolicy> CallTargetVector; 1.52 +bool AddPossibleCallees(JSContext *cx, MIRGraph &graph, CallTargetVector &targets); 1.53 + 1.54 +} // namespace jit 1.55 +} // namespace js 1.56 + 1.57 +#endif /* jit_ParallelSafetyAnalysis_h */