Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: src/hydrogen.cc

Issue 9290044: Fix intermittent stack overflow in Hydrogen code generation in tests. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/hydrogen.h ('K') | « src/hydrogen.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 4780 matching lines...) Expand 10 before | Expand all | Expand 10 after
4791 : CALL_AS_METHOD; 4791 : CALL_AS_METHOD;
4792 4792
4793 // Precondition: call is monomorphic and we have found a target with the 4793 // Precondition: call is monomorphic and we have found a target with the
4794 // appropriate arity. 4794 // appropriate arity.
4795 Handle<JSFunction> caller = info()->closure(); 4795 Handle<JSFunction> caller = info()->closure();
4796 Handle<JSFunction> target = expr->target(); 4796 Handle<JSFunction> target = expr->target();
4797 Handle<SharedFunctionInfo> target_shared(target->shared()); 4797 Handle<SharedFunctionInfo> target_shared(target->shared());
4798 4798
4799 // Do a quick check on source code length to avoid parsing large 4799 // Do a quick check on source code length to avoid parsing large
4800 // inlining candidates. 4800 // inlining candidates.
4801 if (FLAG_limit_inlining && target->shared()->SourceSize() > kMaxSourceSize) { 4801 if ((FLAG_limit_inlining && target->shared()->SourceSize() > kSmallMaxSourceSi ze) ||
Vyacheslav Egorov (Chromium) 2012/01/26 10:42:57 long line
4802 target->shared()->SourceSize() > kBigMaxSourceSize) {
4802 TraceInline(target, caller, "target text too big"); 4803 TraceInline(target, caller, "target text too big");
4803 return false; 4804 return false;
4804 } 4805 }
4805 4806
4806 // Target must be inlineable. 4807 // Target must be inlineable.
4807 if (!target->IsInlineable()) { 4808 if (!target->IsInlineable()) {
4808 TraceInline(target, caller, "target not inlineable"); 4809 TraceInline(target, caller, "target not inlineable");
4809 return false; 4810 return false;
4810 } 4811 }
4811 4812
(...skipping 27 matching lines...) Expand all
4839 for (FunctionState* state = function_state(); 4840 for (FunctionState* state = function_state();
4840 state != NULL; 4841 state != NULL;
4841 state = state->outer()) { 4842 state = state->outer()) {
4842 if (state->compilation_info()->closure()->shared() == *target_shared) { 4843 if (state->compilation_info()->closure()->shared() == *target_shared) {
4843 TraceInline(target, caller, "target is recursive"); 4844 TraceInline(target, caller, "target is recursive");
4844 return false; 4845 return false;
4845 } 4846 }
4846 } 4847 }
4847 4848
4848 // We don't want to add more than a certain number of nodes from inlining. 4849 // We don't want to add more than a certain number of nodes from inlining.
4849 if (FLAG_limit_inlining && inlined_count_ > kMaxInlinedNodes) { 4850 if ((FLAG_limit_inlining && inlined_count_ > kSmallMaxInlinedNodes) ||
4851 inlined_count_ > kBigMaxInlinedNodes) {
4850 TraceInline(target, caller, "cumulative AST node limit reached"); 4852 TraceInline(target, caller, "cumulative AST node limit reached");
4851 return false; 4853 return false;
4852 } 4854 }
4853 4855
4854 int count_before = AstNode::Count(); 4856 int count_before = AstNode::Count();
4855 4857
4856 // Parse and allocate variables. 4858 // Parse and allocate variables.
4857 CompilationInfo target_info(target); 4859 CompilationInfo target_info(target);
4858 if (!ParserApi::Parse(&target_info, kNoParsingFlags) || 4860 if (!ParserApi::Parse(&target_info, kNoParsingFlags) ||
4859 !Scope::Analyze(&target_info)) { 4861 !Scope::Analyze(&target_info)) {
4860 if (target_info.isolate()->has_pending_exception()) { 4862 if (target_info.isolate()->has_pending_exception()) {
4861 // Parse or scope error, never optimize this function. 4863 // Parse or scope error, never optimize this function.
4862 SetStackOverflow(); 4864 SetStackOverflow();
4863 target_shared->DisableOptimization(*target); 4865 target_shared->DisableOptimization(*target);
4864 } 4866 }
4865 TraceInline(target, caller, "parse failure"); 4867 TraceInline(target, caller, "parse failure");
4866 return false; 4868 return false;
4867 } 4869 }
4868 4870
4869 if (target_info.scope()->num_heap_slots() > 0) { 4871 if (target_info.scope()->num_heap_slots() > 0) {
4870 TraceInline(target, caller, "target has context-allocated variables"); 4872 TraceInline(target, caller, "target has context-allocated variables");
4871 return false; 4873 return false;
4872 } 4874 }
4873 FunctionLiteral* function = target_info.function(); 4875 FunctionLiteral* function = target_info.function();
4874 4876
4875 // Count the number of AST nodes added by inlining this call. 4877 // Count the number of AST nodes added by inlining this call.
4876 int nodes_added = AstNode::Count() - count_before; 4878 int nodes_added = AstNode::Count() - count_before;
4877 if (FLAG_limit_inlining && nodes_added > kMaxInlinedSize) { 4879 if ((FLAG_limit_inlining && nodes_added > kSmallMaxInlinedSize) ||
4880 nodes_added > kBigMaxInlinedSize) {
4878 TraceInline(target, caller, "target AST is too large"); 4881 TraceInline(target, caller, "target AST is too large");
4879 return false; 4882 return false;
4880 } 4883 }
4881 4884
4882 // Don't inline functions that uses the arguments object. 4885 // Don't inline functions that uses the arguments object.
4883 if (function->scope()->arguments() != NULL) { 4886 if (function->scope()->arguments() != NULL) {
4884 TraceInline(target, caller, "target requires special argument handling"); 4887 TraceInline(target, caller, "target requires special argument handling");
4885 return false; 4888 return false;
4886 } 4889 }
4887 4890
(...skipping 2562 matching lines...) Expand 10 before | Expand all | Expand 10 after
7450 } 7453 }
7451 } 7454 }
7452 7455
7453 #ifdef DEBUG 7456 #ifdef DEBUG
7454 if (graph_ != NULL) graph_->Verify(false); // No full verify. 7457 if (graph_ != NULL) graph_->Verify(false); // No full verify.
7455 if (allocator_ != NULL) allocator_->Verify(); 7458 if (allocator_ != NULL) allocator_->Verify();
7456 #endif 7459 #endif
7457 } 7460 }
7458 7461
7459 } } // namespace v8::internal 7462 } } // namespace v8::internal
OLDNEW
« src/hydrogen.h ('K') | « src/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698