OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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.h" | 5 #include "src/compiler/js-inlining.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/compiler/all-nodes.h" | 10 #include "src/compiler/all-nodes.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 jsgraph_->UndefinedConstant(), | 239 jsgraph_->UndefinedConstant(), |
240 call->jsfunction(), call->frame_state()); | 240 call->jsfunction(), call->frame_state()); |
241 } | 241 } |
242 | 242 |
243 | 243 |
244 Reduction JSInliner::Reduce(Node* node) { | 244 Reduction JSInliner::Reduce(Node* node) { |
245 if (node->opcode() != IrOpcode::kJSCallFunction) return NoChange(); | 245 if (node->opcode() != IrOpcode::kJSCallFunction) return NoChange(); |
246 | 246 |
247 JSCallFunctionAccessor call(node); | 247 JSCallFunctionAccessor call(node); |
248 HeapObjectMatcher match(call.jsfunction()); | 248 HeapObjectMatcher match(call.jsfunction()); |
249 if (!match.HasValue()) return NoChange(); | 249 if (!match.HasValue() || !match.Value()->IsJSFunction()) return NoChange(); |
| 250 Handle<JSFunction> function = Handle<JSFunction>::cast(match.Value()); |
250 | 251 |
251 if (!match.Value()->IsJSFunction()) return NoChange(); | 252 return ReduceJSCallFunction(node, function); |
252 Handle<JSFunction> function = Handle<JSFunction>::cast(match.Value()); | 253 } |
253 if (mode_ == kRestrictedInlining && !function->shared()->force_inline()) { | 254 |
254 return NoChange(); | 255 |
255 } | 256 Reduction JSInliner::ReduceJSCallFunction(Node* node, |
| 257 Handle<JSFunction> function) { |
| 258 DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode()); |
| 259 JSCallFunctionAccessor call(node); |
256 | 260 |
257 if (function->shared()->HasDebugInfo()) { | 261 if (function->shared()->HasDebugInfo()) { |
258 // Function contains break points. | 262 // Function contains break points. |
259 TRACE("Not inlining %s into %s because callee may contain break points\n", | 263 TRACE("Not inlining %s into %s because callee may contain break points\n", |
260 function->shared()->DebugName()->ToCString().get(), | 264 function->shared()->DebugName()->ToCString().get(), |
261 info_->shared_info()->DebugName()->ToCString().get()); | 265 info_->shared_info()->DebugName()->ToCString().get()); |
262 return NoChange(); | 266 return NoChange(); |
263 } | 267 } |
264 | 268 |
265 // Disallow cross native-context inlining for now. This means that all parts | 269 // Disallow cross native-context inlining for now. This means that all parts |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 359 |
356 // Remember that we inlined this function. | 360 // Remember that we inlined this function. |
357 info_->AddInlinedFunction(info.shared_info()); | 361 info_->AddInlinedFunction(info.shared_info()); |
358 | 362 |
359 return InlineCall(node, context, frame_state, start, end); | 363 return InlineCall(node, context, frame_state, start, end); |
360 } | 364 } |
361 | 365 |
362 } // namespace compiler | 366 } // namespace compiler |
363 } // namespace internal | 367 } // namespace internal |
364 } // namespace v8 | 368 } // namespace v8 |
OLD | NEW |