| 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 7048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7059 int nodes_added = InliningAstSize(target); | 7059 int nodes_added = InliningAstSize(target); |
| 7060 if (nodes_added == kNotInlinable) return false; | 7060 if (nodes_added == kNotInlinable) return false; |
| 7061 | 7061 |
| 7062 Handle<JSFunction> caller = current_info()->closure(); | 7062 Handle<JSFunction> caller = current_info()->closure(); |
| 7063 | 7063 |
| 7064 if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) { | 7064 if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) { |
| 7065 TraceInline(target, caller, "target AST is too large [early]"); | 7065 TraceInline(target, caller, "target AST is too large [early]"); |
| 7066 return false; | 7066 return false; |
| 7067 } | 7067 } |
| 7068 | 7068 |
| 7069 #if V8_TARGET_ARCH_A64 | |
| 7070 // Target must be able to use caller's context. | |
| 7071 // TODO(jochen): Remove this block once A64's register allocator can allocate | |
| 7072 // cp. | |
| 7073 CompilationInfo* outer_info = current_info(); | |
| 7074 if (target->context() != outer_info->closure()->context() || | |
| 7075 outer_info->scope()->contains_with() || | |
| 7076 outer_info->scope()->num_heap_slots() > 0) { | |
| 7077 TraceInline(target, caller, "target requires context change"); | |
| 7078 return false; | |
| 7079 } | |
| 7080 #endif | |
| 7081 | |
| 7082 // Don't inline deeper than the maximum number of inlining levels. | 7069 // Don't inline deeper than the maximum number of inlining levels. |
| 7083 HEnvironment* env = environment(); | 7070 HEnvironment* env = environment(); |
| 7084 int current_level = 1; | 7071 int current_level = 1; |
| 7085 while (env->outer() != NULL) { | 7072 while (env->outer() != NULL) { |
| 7086 if (current_level == FLAG_max_inlining_levels) { | 7073 if (current_level == FLAG_max_inlining_levels) { |
| 7087 TraceInline(target, caller, "inline depth limit reached"); | 7074 TraceInline(target, caller, "inline depth limit reached"); |
| 7088 return false; | 7075 return false; |
| 7089 } | 7076 } |
| 7090 if (env->outer()->frame_type() == JS_FUNCTION) { | 7077 if (env->outer()->frame_type() == JS_FUNCTION) { |
| 7091 current_level++; | 7078 current_level++; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7208 | 7195 |
| 7209 HConstant* undefined = graph()->GetConstantUndefined(); | 7196 HConstant* undefined = graph()->GetConstantUndefined(); |
| 7210 | 7197 |
| 7211 HEnvironment* inner_env = | 7198 HEnvironment* inner_env = |
| 7212 environment()->CopyForInlining(target, | 7199 environment()->CopyForInlining(target, |
| 7213 arguments_count, | 7200 arguments_count, |
| 7214 function, | 7201 function, |
| 7215 undefined, | 7202 undefined, |
| 7216 function_state()->inlining_kind()); | 7203 function_state()->inlining_kind()); |
| 7217 | 7204 |
| 7218 // TODO(jochen): Remove this #ifdef once A64's register allocator can allocate | |
| 7219 // cp. | |
| 7220 #if !V8_TARGET_ARCH_A64 | |
| 7221 HConstant* context = Add<HConstant>(Handle<Context>(target->context())); | 7205 HConstant* context = Add<HConstant>(Handle<Context>(target->context())); |
| 7222 inner_env->BindContext(context); | 7206 inner_env->BindContext(context); |
| 7223 #endif | |
| 7224 | 7207 |
| 7225 Add<HSimulate>(return_id); | 7208 Add<HSimulate>(return_id); |
| 7226 current_block()->UpdateEnvironment(inner_env); | 7209 current_block()->UpdateEnvironment(inner_env); |
| 7227 HArgumentsObject* arguments_object = NULL; | 7210 HArgumentsObject* arguments_object = NULL; |
| 7228 | 7211 |
| 7229 // If the function uses arguments object create and bind one, also copy | 7212 // If the function uses arguments object create and bind one, also copy |
| 7230 // current arguments values to use them for materialization. | 7213 // current arguments values to use them for materialization. |
| 7231 if (function->scope()->arguments() != NULL) { | 7214 if (function->scope()->arguments() != NULL) { |
| 7232 ASSERT(function->scope()->arguments()->IsStackAllocated()); | 7215 ASSERT(function->scope()->arguments()->IsStackAllocated()); |
| 7233 HEnvironment* arguments_env = inner_env->arguments_environment(); | 7216 HEnvironment* arguments_env = inner_env->arguments_environment(); |
| (...skipping 3980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11214 if (ShouldProduceTraceOutput()) { | 11197 if (ShouldProduceTraceOutput()) { |
| 11215 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11198 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 11216 } | 11199 } |
| 11217 | 11200 |
| 11218 #ifdef DEBUG | 11201 #ifdef DEBUG |
| 11219 graph_->Verify(false); // No full verify. | 11202 graph_->Verify(false); // No full verify. |
| 11220 #endif | 11203 #endif |
| 11221 } | 11204 } |
| 11222 | 11205 |
| 11223 } } // namespace v8::internal | 11206 } } // namespace v8::internal |
| OLD | NEW |