Index: src/compiler/js-inlining-heuristic.cc |
diff --git a/src/compiler/js-inlining-heuristic.cc b/src/compiler/js-inlining-heuristic.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2abf611c89371388b98efe831992772c185b99ed |
--- /dev/null |
+++ b/src/compiler/js-inlining-heuristic.cc |
@@ -0,0 +1,34 @@ |
+// Copyright 2015 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "src/compiler/js-inlining-heuristic.h" |
+ |
+#include "src/compiler/node-matchers.h" |
+#include "src/objects-inl.h" |
+ |
+namespace v8 { |
+namespace internal { |
+namespace compiler { |
+ |
+Reduction JSInliningHeuristic::Reduce(Node* node) { |
+ if (node->opcode() != IrOpcode::kJSCallFunction) return NoChange(); |
+ |
+ Node* callee = node->InputAt(0); |
+ HeapObjectMatcher match(callee); |
+ if (!match.HasValue() || !match.Value()->IsJSFunction()) return NoChange(); |
+ Handle<JSFunction> function = Handle<JSFunction>::cast(match.Value()); |
+ |
+ // Functions marked with %SetForceInlineFlag are immediately inlined. |
+ if (function->shared()->force_inline()) { |
+ return inliner_.ReduceJSCallFunction(node, function); |
+ } |
+ |
+ // All other functions are only handled with general inlining. |
+ if (mode_ == kRestrictedInlining) return NoChange(); |
+ return inliner_.ReduceJSCallFunction(node, function); |
+} |
+ |
+} // namespace compiler |
+} // namespace internal |
+} // namespace v8 |