OLD | NEW |
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 3181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3192 | 3192 |
3193 | 3193 |
3194 #define CHECK_ALIVE(call) \ | 3194 #define CHECK_ALIVE(call) \ |
3195 do { \ | 3195 do { \ |
3196 call; \ | 3196 call; \ |
3197 if (HasStackOverflow() || current_block() == NULL) return; \ | 3197 if (HasStackOverflow() || current_block() == NULL) return; \ |
3198 } while (false) | 3198 } while (false) |
3199 | 3199 |
3200 | 3200 |
3201 void HGraphBuilder::Bailout(const char* reason) { | 3201 void HGraphBuilder::Bailout(const char* reason) { |
3202 if (FLAG_trace_bailout) { | 3202 info()->set_bailout_reason(reason); |
3203 SmartArrayPointer<char> name( | |
3204 info()->shared_info()->DebugName()->ToCString()); | |
3205 PrintF("Bailout in HGraphBuilder: @\"%s\": %s\n", *name, reason); | |
3206 } | |
3207 SetStackOverflow(); | 3203 SetStackOverflow(); |
3208 } | 3204 } |
3209 | 3205 |
3210 | 3206 |
3211 void HGraphBuilder::VisitForEffect(Expression* expr) { | 3207 void HGraphBuilder::VisitForEffect(Expression* expr) { |
3212 EffectContext for_effect(this); | 3208 EffectContext for_effect(this); |
3213 Visit(expr); | 3209 Visit(expr); |
3214 } | 3210 } |
3215 | 3211 |
3216 | 3212 |
(...skipping 3772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6989 return false; | 6985 return false; |
6990 } | 6986 } |
6991 | 6987 |
6992 // Parse and allocate variables. | 6988 // Parse and allocate variables. |
6993 CompilationInfo target_info(target, zone()); | 6989 CompilationInfo target_info(target, zone()); |
6994 if (!ParserApi::Parse(&target_info, kNoParsingFlags) || | 6990 if (!ParserApi::Parse(&target_info, kNoParsingFlags) || |
6995 !Scope::Analyze(&target_info)) { | 6991 !Scope::Analyze(&target_info)) { |
6996 if (target_info.isolate()->has_pending_exception()) { | 6992 if (target_info.isolate()->has_pending_exception()) { |
6997 // Parse or scope error, never optimize this function. | 6993 // Parse or scope error, never optimize this function. |
6998 SetStackOverflow(); | 6994 SetStackOverflow(); |
6999 target_shared->DisableOptimization(); | 6995 target_shared->DisableOptimization("parse/scope error"); |
7000 } | 6996 } |
7001 TraceInline(target, caller, "parse failure"); | 6997 TraceInline(target, caller, "parse failure"); |
7002 return false; | 6998 return false; |
7003 } | 6999 } |
7004 | 7000 |
7005 if (target_info.scope()->num_heap_slots() > 0) { | 7001 if (target_info.scope()->num_heap_slots() > 0) { |
7006 TraceInline(target, caller, "target has context-allocated variables"); | 7002 TraceInline(target, caller, "target has context-allocated variables"); |
7007 return false; | 7003 return false; |
7008 } | 7004 } |
7009 FunctionLiteral* function = target_info.function(); | 7005 FunctionLiteral* function = target_info.function(); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7144 graph()->GetArgumentsObject()); | 7140 graph()->GetArgumentsObject()); |
7145 } | 7141 } |
7146 | 7142 |
7147 | 7143 |
7148 VisitDeclarations(target_info.scope()->declarations()); | 7144 VisitDeclarations(target_info.scope()->declarations()); |
7149 VisitStatements(function->body()); | 7145 VisitStatements(function->body()); |
7150 if (HasStackOverflow()) { | 7146 if (HasStackOverflow()) { |
7151 // Bail out if the inline function did, as we cannot residualize a call | 7147 // Bail out if the inline function did, as we cannot residualize a call |
7152 // instead. | 7148 // instead. |
7153 TraceInline(target, caller, "inline graph construction failed"); | 7149 TraceInline(target, caller, "inline graph construction failed"); |
7154 target_shared->DisableOptimization(); | 7150 target_shared->DisableOptimization("inlining bailed out"); |
7155 inline_bailout_ = true; | 7151 inline_bailout_ = true; |
7156 delete target_state; | 7152 delete target_state; |
7157 return true; | 7153 return true; |
7158 } | 7154 } |
7159 | 7155 |
7160 // Update inlined nodes count. | 7156 // Update inlined nodes count. |
7161 inlined_count_ += nodes_added; | 7157 inlined_count_ += nodes_added; |
7162 | 7158 |
7163 ASSERT(unoptimized_code->kind() == Code::FUNCTION); | 7159 ASSERT(unoptimized_code->kind() == Code::FUNCTION); |
7164 Handle<Object> maybe_type_info(unoptimized_code->type_feedback_info()); | 7160 Handle<Object> maybe_type_info(unoptimized_code->type_feedback_info()); |
(...skipping 2808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9973 } | 9969 } |
9974 } | 9970 } |
9975 | 9971 |
9976 #ifdef DEBUG | 9972 #ifdef DEBUG |
9977 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9973 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
9978 if (allocator_ != NULL) allocator_->Verify(); | 9974 if (allocator_ != NULL) allocator_->Verify(); |
9979 #endif | 9975 #endif |
9980 } | 9976 } |
9981 | 9977 |
9982 } } // namespace v8::internal | 9978 } } // namespace v8::internal |
OLD | NEW |