| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
| (...skipping 8168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8179 int nodes_added = target_shared->ast_node_count(); | 8179 int nodes_added = target_shared->ast_node_count(); |
| 8180 return nodes_added; | 8180 return nodes_added; |
| 8181 } | 8181 } |
| 8182 | 8182 |
| 8183 bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target, | 8183 bool HOptimizedGraphBuilder::TryInline(Handle<JSFunction> target, |
| 8184 int arguments_count, | 8184 int arguments_count, |
| 8185 HValue* implicit_return_value, | 8185 HValue* implicit_return_value, |
| 8186 BailoutId ast_id, BailoutId return_id, | 8186 BailoutId ast_id, BailoutId return_id, |
| 8187 InliningKind inlining_kind, | 8187 InliningKind inlining_kind, |
| 8188 TailCallMode syntactic_tail_call_mode) { | 8188 TailCallMode syntactic_tail_call_mode) { |
| 8189 bool collect_feedback_from_ignition = !target->shared()->HasBaselineCode(); |
| 8189 if (target->context()->native_context() != | 8190 if (target->context()->native_context() != |
| 8190 top_info()->closure()->context()->native_context()) { | 8191 top_info()->closure()->context()->native_context()) { |
| 8191 return false; | 8192 return false; |
| 8192 } | 8193 } |
| 8193 int nodes_added = InliningAstSize(target); | 8194 int nodes_added = InliningAstSize(target); |
| 8194 if (nodes_added == kNotInlinable) return false; | 8195 if (nodes_added == kNotInlinable) return false; |
| 8195 | 8196 |
| 8196 Handle<JSFunction> caller = current_info()->closure(); | 8197 Handle<JSFunction> caller = current_info()->closure(); |
| 8197 if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) { | 8198 if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) { |
| 8198 TraceInline(target, caller, "target AST is too large [early]"); | 8199 TraceInline(target, caller, "target AST is too large [early]"); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8334 // After this point, we've made a decision to inline this function (so | 8335 // After this point, we've made a decision to inline this function (so |
| 8335 // TryInline should always return true). | 8336 // TryInline should always return true). |
| 8336 | 8337 |
| 8337 // If target was lazily compiled, it's literals array may not yet be set up. | 8338 // If target was lazily compiled, it's literals array may not yet be set up. |
| 8338 JSFunction::EnsureLiterals(target); | 8339 JSFunction::EnsureLiterals(target); |
| 8339 | 8340 |
| 8340 // Type-check the inlined function. | 8341 // Type-check the inlined function. |
| 8341 DCHECK(target_shared->has_deoptimization_support()); | 8342 DCHECK(target_shared->has_deoptimization_support()); |
| 8342 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), | 8343 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), |
| 8343 target_info.scope(), target_info.osr_ast_id(), target_info.literal(), | 8344 target_info.scope(), target_info.osr_ast_id(), target_info.literal(), |
| 8344 &bounds_) | 8345 &bounds_, collect_feedback_from_ignition) |
| 8345 .Run(); | 8346 .Run(); |
| 8346 | 8347 |
| 8347 int inlining_id = 0; | 8348 int inlining_id = 0; |
| 8348 if (top_info()->is_tracking_positions()) { | 8349 if (top_info()->is_tracking_positions()) { |
| 8349 inlining_id = TraceInlinedFunction(target_shared, source_position()); | 8350 inlining_id = TraceInlinedFunction(target_shared, source_position()); |
| 8350 } | 8351 } |
| 8351 | 8352 |
| 8352 // Save the pending call context. Set up new one for the inlined function. | 8353 // Save the pending call context. Set up new one for the inlined function. |
| 8353 // The function state is new-allocated because we need to delete it | 8354 // The function state is new-allocated because we need to delete it |
| 8354 // in two different places. | 8355 // in two different places. |
| (...skipping 4930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13285 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13286 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13286 } | 13287 } |
| 13287 | 13288 |
| 13288 #ifdef DEBUG | 13289 #ifdef DEBUG |
| 13289 graph_->Verify(false); // No full verify. | 13290 graph_->Verify(false); // No full verify. |
| 13290 #endif | 13291 #endif |
| 13291 } | 13292 } |
| 13292 | 13293 |
| 13293 } // namespace internal | 13294 } // namespace internal |
| 13294 } // namespace v8 | 13295 } // namespace v8 |
| OLD | NEW |