| 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 <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
| 10 #include "src/ast-numbering.h" | 10 #include "src/ast-numbering.h" |
| (...skipping 8393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8404 // All declarations must be inlineable. | 8404 // All declarations must be inlineable. |
| 8405 ZoneList<Declaration*>* decls = target_info.scope()->declarations(); | 8405 ZoneList<Declaration*>* decls = target_info.scope()->declarations(); |
| 8406 int decl_count = decls->length(); | 8406 int decl_count = decls->length(); |
| 8407 for (int i = 0; i < decl_count; ++i) { | 8407 for (int i = 0; i < decl_count; ++i) { |
| 8408 if (!decls->at(i)->IsInlineable()) { | 8408 if (!decls->at(i)->IsInlineable()) { |
| 8409 TraceInline(target, caller, "target has non-trivial declaration"); | 8409 TraceInline(target, caller, "target has non-trivial declaration"); |
| 8410 return false; | 8410 return false; |
| 8411 } | 8411 } |
| 8412 } | 8412 } |
| 8413 | 8413 |
| 8414 // Generate the deoptimization data for the unoptimized version of | |
| 8415 // the target function if we don't already have it. | |
| 8416 if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { | |
| 8417 TraceInline(target, caller, "could not generate deoptimization info"); | |
| 8418 return false; | |
| 8419 } | |
| 8420 | |
| 8421 // In strong mode it is an error to call a function with too few arguments. | 8414 // In strong mode it is an error to call a function with too few arguments. |
| 8422 // In that case do not inline because then the arity check would be skipped. | 8415 // In that case do not inline because then the arity check would be skipped. |
| 8423 if (is_strong(function->language_mode()) && | 8416 if (is_strong(function->language_mode()) && |
| 8424 arguments_count < function->parameter_count()) { | 8417 arguments_count < function->parameter_count()) { |
| 8425 TraceInline(target, caller, | 8418 TraceInline(target, caller, |
| 8426 "too few arguments passed to a strong function"); | 8419 "too few arguments passed to a strong function"); |
| 8427 return false; | 8420 return false; |
| 8428 } | 8421 } |
| 8429 | 8422 |
| 8423 // Generate the deoptimization data for the unoptimized version of |
| 8424 // the target function if we don't already have it. |
| 8425 if (!Compiler::EnsureDeoptimizationSupport(&target_info)) { |
| 8426 TraceInline(target, caller, "could not generate deoptimization info"); |
| 8427 return false; |
| 8428 } |
| 8429 // Remember that we inlined this function. This needs to be called right |
| 8430 // after the EnsureDeoptimizationSupport call so that the code flusher |
| 8431 // does not remove the code with the deoptimization support. |
| 8432 top_info()->AddInlinedFunction(target_info.shared_info()); |
| 8433 |
| 8430 // ---------------------------------------------------------------- | 8434 // ---------------------------------------------------------------- |
| 8431 // After this point, we've made a decision to inline this function (so | 8435 // After this point, we've made a decision to inline this function (so |
| 8432 // TryInline should always return true). | 8436 // TryInline should always return true). |
| 8433 | 8437 |
| 8434 // Type-check the inlined function. | 8438 // Type-check the inlined function. |
| 8435 DCHECK(target_shared->has_deoptimization_support()); | 8439 DCHECK(target_shared->has_deoptimization_support()); |
| 8436 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), | 8440 AstTyper(target_info.isolate(), target_info.zone(), target_info.closure(), |
| 8437 target_info.scope(), target_info.osr_ast_id(), target_info.literal()) | 8441 target_info.scope(), target_info.osr_ast_id(), target_info.literal()) |
| 8438 .Run(); | 8442 .Run(); |
| 8439 | 8443 |
| (...skipping 5256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13696 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13700 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13697 } | 13701 } |
| 13698 | 13702 |
| 13699 #ifdef DEBUG | 13703 #ifdef DEBUG |
| 13700 graph_->Verify(false); // No full verify. | 13704 graph_->Verify(false); // No full verify. |
| 13701 #endif | 13705 #endif |
| 13702 } | 13706 } |
| 13703 | 13707 |
| 13704 } // namespace internal | 13708 } // namespace internal |
| 13705 } // namespace v8 | 13709 } // namespace v8 |
| OLD | NEW |