OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_JS_INLINING_HEURISTIC_H_ | 5 #ifndef V8_COMPILER_JS_INLINING_HEURISTIC_H_ |
6 #define V8_COMPILER_JS_INLINING_HEURISTIC_H_ | 6 #define V8_COMPILER_JS_INLINING_HEURISTIC_H_ |
7 | 7 |
8 #include "src/compiler/js-inlining.h" | 8 #include "src/compiler/js-inlining.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 19 matching lines...) Expand all Loading... |
30 // and inlines call sites that the heuristic determines to be important. | 30 // and inlines call sites that the heuristic determines to be important. |
31 void ProcessCandidates(); | 31 void ProcessCandidates(); |
32 | 32 |
33 private: | 33 private: |
34 struct Candidate { | 34 struct Candidate { |
35 Handle<JSFunction> function; // The call target being inlined. | 35 Handle<JSFunction> function; // The call target being inlined. |
36 Node* node; // The call site at which to inline. | 36 Node* node; // The call site at which to inline. |
37 int calls; // Number of times the call site was hit. | 37 int calls; // Number of times the call site was hit. |
38 }; | 38 }; |
39 | 39 |
40 static bool Compare(const Candidate& left, const Candidate& right); | 40 // Comparator for candidates. |
| 41 struct CandidateCompare { |
| 42 bool operator()(const Candidate& left, const Candidate& right) const; |
| 43 }; |
| 44 |
| 45 // Candidates are kept in a sorted set of unique candidates. |
| 46 typedef ZoneSet<Candidate, CandidateCompare> Candidates; |
| 47 |
| 48 // Dumps candidates to console. |
41 void PrintCandidates(); | 49 void PrintCandidates(); |
42 | 50 |
43 Mode const mode_; | 51 Mode const mode_; |
44 Zone* local_zone_; | 52 Zone* local_zone_; |
45 JSGraph* jsgraph_; | 53 JSGraph* jsgraph_; |
46 JSInliner inliner_; | 54 JSInliner inliner_; |
47 ZoneVector<Candidate> candidates_; | 55 Candidates candidates_; |
48 CompilationInfo* info_; | 56 CompilationInfo* info_; |
49 }; | 57 }; |
50 | 58 |
51 } // namespace compiler | 59 } // namespace compiler |
52 } // namespace internal | 60 } // namespace internal |
53 } // namespace v8 | 61 } // namespace v8 |
54 | 62 |
55 #endif // V8_COMPILER_JS_INLINING_HEURISTIC_H_ | 63 #endif // V8_COMPILER_JS_INLINING_HEURISTIC_H_ |
OLD | NEW |