OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3912 | 3912 |
3913 // No context change required. | 3913 // No context change required. |
3914 CompilationInfo* outer_info = info(); | 3914 CompilationInfo* outer_info = info(); |
3915 if (target->context() != outer_info->closure()->context() || | 3915 if (target->context() != outer_info->closure()->context() || |
3916 outer_info->scope()->contains_with() || | 3916 outer_info->scope()->contains_with() || |
3917 outer_info->scope()->num_heap_slots() > 0) { | 3917 outer_info->scope()->num_heap_slots() > 0) { |
3918 TraceInline(target, "target requires context change"); | 3918 TraceInline(target, "target requires context change"); |
3919 return false; | 3919 return false; |
3920 } | 3920 } |
3921 | 3921 |
3922 // Don't inline deeper than two calls. | 3922 // Don't inline deeper than kMaxInliningLevels calls. |
3923 HEnvironment* env = environment(); | 3923 HEnvironment* env = environment(); |
3924 if (env->outer() != NULL && env->outer()->outer() != NULL) { | 3924 int current_level = 1; |
3925 TraceInline(target, "inline depth limit reached"); | 3925 while (env->outer() != NULL) { |
3926 return false; | 3926 if (current_level == Compiler::kMaxInliningLevels) { |
| 3927 TraceInline(target, "inline depth limit reached"); |
| 3928 return false; |
| 3929 } |
| 3930 current_level++; |
| 3931 env = env->outer(); |
3927 } | 3932 } |
3928 | 3933 |
3929 // Don't inline recursive functions. | 3934 // Don't inline recursive functions. |
3930 if (target->shared() == outer_info->closure()->shared()) { | 3935 if (target->shared() == outer_info->closure()->shared()) { |
3931 TraceInline(target, "target is recursive"); | 3936 TraceInline(target, "target is recursive"); |
3932 return false; | 3937 return false; |
3933 } | 3938 } |
3934 | 3939 |
3935 // We don't want to add more than a certain number of nodes from inlining. | 3940 // We don't want to add more than a certain number of nodes from inlining. |
3936 if (FLAG_limit_inlining && inlined_count_ > kMaxInlinedNodes) { | 3941 if (FLAG_limit_inlining && inlined_count_ > kMaxInlinedNodes) { |
(...skipping 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5951 } | 5956 } |
5952 } | 5957 } |
5953 | 5958 |
5954 #ifdef DEBUG | 5959 #ifdef DEBUG |
5955 if (graph_ != NULL) graph_->Verify(); | 5960 if (graph_ != NULL) graph_->Verify(); |
5956 if (allocator_ != NULL) allocator_->Verify(); | 5961 if (allocator_ != NULL) allocator_->Verify(); |
5957 #endif | 5962 #endif |
5958 } | 5963 } |
5959 | 5964 |
5960 } } // namespace v8::internal | 5965 } } // namespace v8::internal |
OLD | NEW |