| 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/all-nodes.h" | 9 #include "src/compiler/all-nodes.h" |
| 10 #include "src/compiler/ast-graph-builder.h" | 10 #include "src/compiler/ast-graph-builder.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 HeapObjectMatcher match(call.jsfunction()); | 244 HeapObjectMatcher match(call.jsfunction()); |
| 245 if (!match.HasValue()) return NoChange(); | 245 if (!match.HasValue()) return NoChange(); |
| 246 | 246 |
| 247 if (!match.Value().handle()->IsJSFunction()) return NoChange(); | 247 if (!match.Value().handle()->IsJSFunction()) return NoChange(); |
| 248 Handle<JSFunction> function = | 248 Handle<JSFunction> function = |
| 249 Handle<JSFunction>::cast(match.Value().handle()); | 249 Handle<JSFunction>::cast(match.Value().handle()); |
| 250 if (mode_ == kRestrictedInlining && !function->shared()->force_inline()) { | 250 if (mode_ == kRestrictedInlining && !function->shared()->force_inline()) { |
| 251 return NoChange(); | 251 return NoChange(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 // TODO(turbofan): TranslatedState::GetAdaptedArguments() currently relies on |
| 255 // not inlining recursive functions. We might want to relax that at some |
| 256 // point. |
| 257 for (Node* frame_state = call.frame_state(); |
| 258 frame_state->opcode() == IrOpcode::kFrameState; |
| 259 frame_state = frame_state->InputAt(kFrameStateOuterStateInput)) { |
| 260 FrameStateInfo const& info = OpParameter<FrameStateInfo>(frame_state); |
| 261 Handle<SharedFunctionInfo> shared_info; |
| 262 if (info.shared_info().ToHandle(&shared_info) && |
| 263 *shared_info == function->shared()) { |
| 264 TRACE("Not inlining %s into %s because call is recursive\n", |
| 265 function->shared()->DebugName()->ToCString().get(), |
| 266 info_->shared_info()->DebugName()->ToCString().get()); |
| 267 return NoChange(); |
| 268 } |
| 269 } |
| 270 |
| 254 Zone zone; | 271 Zone zone; |
| 255 ParseInfo parse_info(&zone, function); | 272 ParseInfo parse_info(&zone, function); |
| 256 CompilationInfo info(&parse_info); | 273 CompilationInfo info(&parse_info); |
| 257 if (info_->is_deoptimization_enabled()) info.MarkAsDeoptimizationEnabled(); | 274 if (info_->is_deoptimization_enabled()) info.MarkAsDeoptimizationEnabled(); |
| 258 | 275 |
| 259 if (!Compiler::ParseAndAnalyze(info.parse_info())) return NoChange(); | 276 if (!Compiler::ParseAndAnalyze(info.parse_info())) return NoChange(); |
| 260 if (!Compiler::EnsureDeoptimizationSupport(&info)) return NoChange(); | 277 if (!Compiler::EnsureDeoptimizationSupport(&info)) return NoChange(); |
| 261 | 278 |
| 262 if (info.scope()->arguments() != NULL && is_sloppy(info.language_mode())) { | 279 if (info.scope()->arguments() != NULL && is_sloppy(info.language_mode())) { |
| 263 // For now do not inline functions that use their arguments array. | 280 // For now do not inline functions that use their arguments array. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 321 |
| 305 // Remember that we inlined this function. | 322 // Remember that we inlined this function. |
| 306 info_->AddInlinedFunction(info.shared_info()); | 323 info_->AddInlinedFunction(info.shared_info()); |
| 307 | 324 |
| 308 return InlineCall(node, frame_state, start, end); | 325 return InlineCall(node, frame_state, start, end); |
| 309 } | 326 } |
| 310 | 327 |
| 311 } // namespace compiler | 328 } // namespace compiler |
| 312 } // namespace internal | 329 } // namespace internal |
| 313 } // namespace v8 | 330 } // namespace v8 |
| OLD | NEW |