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 #include "src/compiler/js-inlining-heuristic.h" | 5 #include "src/compiler/js-inlining-heuristic.h" |
6 | 6 |
7 #include "src/compilation-info.h" | 7 #include "src/compilation-info.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 return value_input_count; | 40 return value_input_count; |
41 } | 41 } |
42 return 0; | 42 return 0; |
43 } | 43 } |
44 | 44 |
45 bool CanInlineFunction(Handle<JSFunction> function) { | 45 bool CanInlineFunction(Handle<JSFunction> function) { |
46 // Built-in functions are handled by the JSBuiltinReducer. | 46 // Built-in functions are handled by the JSBuiltinReducer. |
47 if (function->shared()->HasBuiltinFunctionId()) return false; | 47 if (function->shared()->HasBuiltinFunctionId()) return false; |
48 | 48 |
49 // Don't inline builtins. | 49 // Only choose user code for inlining. |
50 if (function->shared()->IsBuiltin()) return false; | 50 if (!function->shared()->IsUserJavaScript()) return false; |
51 | 51 |
52 // Quick check on the size of the AST to avoid parsing large candidate. | 52 // Quick check on the size of the AST to avoid parsing large candidate. |
53 if (function->shared()->ast_node_count() > FLAG_max_inlined_nodes) { | 53 if (function->shared()->ast_node_count() > FLAG_max_inlined_nodes) { |
54 return false; | 54 return false; |
55 } | 55 } |
56 | 56 |
57 // Avoid inlining across the boundary of asm.js code. | 57 // Avoid inlining across the boundary of asm.js code. |
58 if (function->shared()->asm_function()) return false; | 58 if (function->shared()->asm_function()) return false; |
59 return true; | 59 return true; |
60 } | 60 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 return jsgraph()->common(); | 294 return jsgraph()->common(); |
295 } | 295 } |
296 | 296 |
297 SimplifiedOperatorBuilder* JSInliningHeuristic::simplified() const { | 297 SimplifiedOperatorBuilder* JSInliningHeuristic::simplified() const { |
298 return jsgraph()->simplified(); | 298 return jsgraph()->simplified(); |
299 } | 299 } |
300 | 300 |
301 } // namespace compiler | 301 } // namespace compiler |
302 } // namespace internal | 302 } // namespace internal |
303 } // namespace v8 | 303 } // namespace v8 |
OLD | NEW |