OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "src/compiler/js-inlining-heuristic.h" |
| 6 |
| 7 #include "src/compiler/node-matchers.h" |
| 8 #include "src/objects-inl.h" |
| 9 |
| 10 namespace v8 { |
| 11 namespace internal { |
| 12 namespace compiler { |
| 13 |
| 14 Reduction JSInliningHeuristic::Reduce(Node* node) { |
| 15 if (node->opcode() != IrOpcode::kJSCallFunction) return NoChange(); |
| 16 |
| 17 Node* callee = node->InputAt(0); |
| 18 HeapObjectMatcher match(callee); |
| 19 if (!match.HasValue() || !match.Value()->IsJSFunction()) return NoChange(); |
| 20 Handle<JSFunction> function = Handle<JSFunction>::cast(match.Value()); |
| 21 |
| 22 // Functions marked with %SetForceInlineFlag are immediately inlined. |
| 23 if (function->shared()->force_inline()) { |
| 24 return inliner_.ReduceJSCallFunction(node, function); |
| 25 } |
| 26 |
| 27 // All other functions are only handled with general inlining. |
| 28 if (mode_ == kRestrictedInlining) return NoChange(); |
| 29 return inliner_.ReduceJSCallFunction(node, function); |
| 30 } |
| 31 |
| 32 } // namespace compiler |
| 33 } // namespace internal |
| 34 } // namespace v8 |
OLD | NEW |