| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 6979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6990 int nodes_added = InliningAstSize(target); | 6990 int nodes_added = InliningAstSize(target); |
| 6991 if (nodes_added == kNotInlinable) return false; | 6991 if (nodes_added == kNotInlinable) return false; |
| 6992 | 6992 |
| 6993 Handle<JSFunction> caller = current_info()->closure(); | 6993 Handle<JSFunction> caller = current_info()->closure(); |
| 6994 | 6994 |
| 6995 if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) { | 6995 if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) { |
| 6996 TraceInline(target, caller, "target AST is too large [early]"); | 6996 TraceInline(target, caller, "target AST is too large [early]"); |
| 6997 return false; | 6997 return false; |
| 6998 } | 6998 } |
| 6999 | 6999 |
| 7000 #if V8_TARGET_ARCH_A64 |
| 7001 // Target must be able to use caller's context. |
| 7002 CompilationInfo* outer_info = current_info(); |
| 7003 if (target->context() != outer_info->closure()->context() || |
| 7004 outer_info->scope()->contains_with() || |
| 7005 outer_info->scope()->num_heap_slots() > 0) { |
| 7006 TraceInline(target, caller, "target requires context change"); |
| 7007 return false; |
| 7008 } |
| 7009 #endif |
| 7010 |
| 7000 // Don't inline deeper than the maximum number of inlining levels. | 7011 // Don't inline deeper than the maximum number of inlining levels. |
| 7001 HEnvironment* env = environment(); | 7012 HEnvironment* env = environment(); |
| 7002 int current_level = 1; | 7013 int current_level = 1; |
| 7003 while (env->outer() != NULL) { | 7014 while (env->outer() != NULL) { |
| 7004 if (current_level == FLAG_max_inlining_levels) { | 7015 if (current_level == FLAG_max_inlining_levels) { |
| 7005 TraceInline(target, caller, "inline depth limit reached"); | 7016 TraceInline(target, caller, "inline depth limit reached"); |
| 7006 return false; | 7017 return false; |
| 7007 } | 7018 } |
| 7008 if (env->outer()->frame_type() == JS_FUNCTION) { | 7019 if (env->outer()->frame_type() == JS_FUNCTION) { |
| 7009 current_level++; | 7020 current_level++; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7128 bool undefined_receiver = HEnvironment::UseUndefinedReceiver( | 7139 bool undefined_receiver = HEnvironment::UseUndefinedReceiver( |
| 7129 target, function, call_kind, inlining_kind); | 7140 target, function, call_kind, inlining_kind); |
| 7130 HEnvironment* inner_env = | 7141 HEnvironment* inner_env = |
| 7131 environment()->CopyForInlining(target, | 7142 environment()->CopyForInlining(target, |
| 7132 arguments_count, | 7143 arguments_count, |
| 7133 function, | 7144 function, |
| 7134 undefined, | 7145 undefined, |
| 7135 function_state()->inlining_kind(), | 7146 function_state()->inlining_kind(), |
| 7136 undefined_receiver); | 7147 undefined_receiver); |
| 7137 | 7148 |
| 7149 #if !V8_TARGET_ARCH_A64 |
| 7138 HConstant* context = Add<HConstant>(Handle<Context>(target->context())); | 7150 HConstant* context = Add<HConstant>(Handle<Context>(target->context())); |
| 7139 inner_env->BindContext(context); | 7151 inner_env->BindContext(context); |
| 7152 #endif |
| 7140 | 7153 |
| 7141 Add<HSimulate>(return_id); | 7154 Add<HSimulate>(return_id); |
| 7142 current_block()->UpdateEnvironment(inner_env); | 7155 current_block()->UpdateEnvironment(inner_env); |
| 7143 HArgumentsObject* arguments_object = NULL; | 7156 HArgumentsObject* arguments_object = NULL; |
| 7144 | 7157 |
| 7145 // If the function uses arguments object create and bind one, also copy | 7158 // If the function uses arguments object create and bind one, also copy |
| 7146 // current arguments values to use them for materialization. | 7159 // current arguments values to use them for materialization. |
| 7147 if (function->scope()->arguments() != NULL) { | 7160 if (function->scope()->arguments() != NULL) { |
| 7148 ASSERT(function->scope()->arguments()->IsStackAllocated()); | 7161 ASSERT(function->scope()->arguments()->IsStackAllocated()); |
| 7149 HEnvironment* arguments_env = inner_env->arguments_environment(); | 7162 HEnvironment* arguments_env = inner_env->arguments_environment(); |
| (...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10552 if (ShouldProduceTraceOutput()) { | 10565 if (ShouldProduceTraceOutput()) { |
| 10553 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10566 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 10554 } | 10567 } |
| 10555 | 10568 |
| 10556 #ifdef DEBUG | 10569 #ifdef DEBUG |
| 10557 graph_->Verify(false); // No full verify. | 10570 graph_->Verify(false); // No full verify. |
| 10558 #endif | 10571 #endif |
| 10559 } | 10572 } |
| 10560 | 10573 |
| 10561 } } // namespace v8::internal | 10574 } } // namespace v8::internal |
| OLD | NEW |