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/compiler.h" |
7 #include "src/compiler/dead-code-elimination.h" // TODO(mstarzinger): Remove! | 8 #include "src/compiler/dead-code-elimination.h" // TODO(mstarzinger): Remove! |
8 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
9 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
10 | 11 |
11 namespace v8 { | 12 namespace v8 { |
12 namespace internal { | 13 namespace internal { |
13 namespace compiler { | 14 namespace compiler { |
14 | 15 |
15 Reduction JSInliningHeuristic::Reduce(Node* node) { | 16 Reduction JSInliningHeuristic::Reduce(Node* node) { |
16 if (node->opcode() != IrOpcode::kJSCallFunction) return NoChange(); | 17 if (node->opcode() != IrOpcode::kJSCallFunction) return NoChange(); |
(...skipping 30 matching lines...) Expand all Loading... |
47 // Quick check on source code length to avoid parsing large candidate. | 48 // Quick check on source code length to avoid parsing large candidate. |
48 if (function->shared()->SourceSize() > FLAG_max_inlined_source_size) { | 49 if (function->shared()->SourceSize() > FLAG_max_inlined_source_size) { |
49 return NoChange(); | 50 return NoChange(); |
50 } | 51 } |
51 | 52 |
52 // Quick check on the size of the AST to avoid parsing large candidate. | 53 // Quick check on the size of the AST to avoid parsing large candidate. |
53 if (function->shared()->ast_node_count() > FLAG_max_inlined_nodes) { | 54 if (function->shared()->ast_node_count() > FLAG_max_inlined_nodes) { |
54 return NoChange(); | 55 return NoChange(); |
55 } | 56 } |
56 | 57 |
| 58 // Avoid inlining within or across the boundary of asm.js code. |
| 59 if (info_->shared_info()->asm_function()) return NoChange(); |
| 60 if (function->shared()->asm_function()) return NoChange(); |
| 61 |
57 // Gather feedback on how often this call site has been hit before. | 62 // Gather feedback on how often this call site has been hit before. |
58 CallFunctionParameters p = CallFunctionParametersOf(node->op()); | 63 CallFunctionParameters p = CallFunctionParametersOf(node->op()); |
59 int calls = -1; // Same default as CallICNexus::ExtractCallCount. | 64 int calls = -1; // Same default as CallICNexus::ExtractCallCount. |
60 if (p.feedback().IsValid()) { | 65 if (p.feedback().IsValid()) { |
61 CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); | 66 CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); |
62 calls = nexus.ExtractCallCount(); | 67 calls = nexus.ExtractCallCount(); |
63 } | 68 } |
64 | 69 |
65 // --------------------------------------------------------------------------- | 70 // --------------------------------------------------------------------------- |
66 // Everything above this line is part of the inlining heuristic. | 71 // Everything above this line is part of the inlining heuristic. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 candidate.node->id(), candidate.calls, | 113 candidate.node->id(), candidate.calls, |
109 candidate.function->shared()->SourceSize(), | 114 candidate.function->shared()->SourceSize(), |
110 candidate.function->shared()->ast_node_count(), | 115 candidate.function->shared()->ast_node_count(), |
111 candidate.function->shared()->DebugName()->ToCString().get()); | 116 candidate.function->shared()->DebugName()->ToCString().get()); |
112 } | 117 } |
113 } | 118 } |
114 | 119 |
115 } // namespace compiler | 120 } // namespace compiler |
116 } // namespace internal | 121 } // namespace internal |
117 } // namespace v8 | 122 } // namespace v8 |
OLD | NEW |