| 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 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 instr->Unlink(); | 1484 instr->Unlink(); |
| 1485 instr->InsertBefore(pre_header->end()); | 1485 instr->InsertBefore(pre_header->end()); |
| 1486 } | 1486 } |
| 1487 } | 1487 } |
| 1488 instr = next; | 1488 instr = next; |
| 1489 } | 1489 } |
| 1490 } | 1490 } |
| 1491 | 1491 |
| 1492 | 1492 |
| 1493 bool HGlobalValueNumberer::AllowCodeMotion() { | 1493 bool HGlobalValueNumberer::AllowCodeMotion() { |
| 1494 return info()->shared_info()->opt_count() + 1 < Compiler::kDefaultMaxOptCount; | 1494 int deopt_count = info()->shared_info()->deopt_count(); |
| 1495 return deopt_count + 1 < Compiler::kDefaultMaxDeoptCount; |
| 1495 } | 1496 } |
| 1496 | 1497 |
| 1497 | 1498 |
| 1498 bool HGlobalValueNumberer::ShouldMove(HInstruction* instr, | 1499 bool HGlobalValueNumberer::ShouldMove(HInstruction* instr, |
| 1499 HBasicBlock* loop_header) { | 1500 HBasicBlock* loop_header) { |
| 1500 // If we've disabled code motion or we're in a block that unconditionally | 1501 // If we've disabled code motion or we're in a block that unconditionally |
| 1501 // deoptimizes, don't move any instructions. | 1502 // deoptimizes, don't move any instructions. |
| 1502 return AllowCodeMotion() && !instr->block()->IsDeoptimizing(); | 1503 return AllowCodeMotion() && !instr->block()->IsDeoptimizing(); |
| 1503 } | 1504 } |
| 1504 | 1505 |
| (...skipping 3336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4841 | 4842 |
| 4842 int count_before = AstNode::Count(); | 4843 int count_before = AstNode::Count(); |
| 4843 | 4844 |
| 4844 // Parse and allocate variables. | 4845 // Parse and allocate variables. |
| 4845 CompilationInfo target_info(target); | 4846 CompilationInfo target_info(target); |
| 4846 if (!ParserApi::Parse(&target_info, kNoParsingFlags) || | 4847 if (!ParserApi::Parse(&target_info, kNoParsingFlags) || |
| 4847 !Scope::Analyze(&target_info)) { | 4848 !Scope::Analyze(&target_info)) { |
| 4848 if (target_info.isolate()->has_pending_exception()) { | 4849 if (target_info.isolate()->has_pending_exception()) { |
| 4849 // Parse or scope error, never optimize this function. | 4850 // Parse or scope error, never optimize this function. |
| 4850 SetStackOverflow(); | 4851 SetStackOverflow(); |
| 4851 target_shared->DisableOptimization(*target); | 4852 target_shared->DisableOptimization(); |
| 4852 } | 4853 } |
| 4853 TraceInline(target, caller, "parse failure"); | 4854 TraceInline(target, caller, "parse failure"); |
| 4854 return false; | 4855 return false; |
| 4855 } | 4856 } |
| 4856 | 4857 |
| 4857 if (target_info.scope()->num_heap_slots() > 0) { | 4858 if (target_info.scope()->num_heap_slots() > 0) { |
| 4858 TraceInline(target, caller, "target has context-allocated variables"); | 4859 TraceInline(target, caller, "target has context-allocated variables"); |
| 4859 return false; | 4860 return false; |
| 4860 } | 4861 } |
| 4861 FunctionLiteral* function = target_info.function(); | 4862 FunctionLiteral* function = target_info.function(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4955 set_current_block(body_entry); | 4956 set_current_block(body_entry); |
| 4956 AddInstruction(new(zone()) HEnterInlined(target, | 4957 AddInstruction(new(zone()) HEnterInlined(target, |
| 4957 function, | 4958 function, |
| 4958 call_kind)); | 4959 call_kind)); |
| 4959 VisitDeclarations(target_info.scope()->declarations()); | 4960 VisitDeclarations(target_info.scope()->declarations()); |
| 4960 VisitStatements(function->body()); | 4961 VisitStatements(function->body()); |
| 4961 if (HasStackOverflow()) { | 4962 if (HasStackOverflow()) { |
| 4962 // Bail out if the inline function did, as we cannot residualize a call | 4963 // Bail out if the inline function did, as we cannot residualize a call |
| 4963 // instead. | 4964 // instead. |
| 4964 TraceInline(target, caller, "inline graph construction failed"); | 4965 TraceInline(target, caller, "inline graph construction failed"); |
| 4965 target_shared->DisableOptimization(*target); | 4966 target_shared->DisableOptimization(); |
| 4966 inline_bailout_ = true; | 4967 inline_bailout_ = true; |
| 4967 delete target_state; | 4968 delete target_state; |
| 4968 return true; | 4969 return true; |
| 4969 } | 4970 } |
| 4970 | 4971 |
| 4971 // Update inlined nodes count. | 4972 // Update inlined nodes count. |
| 4972 inlined_count_ += nodes_added; | 4973 inlined_count_ += nodes_added; |
| 4973 | 4974 |
| 4974 TraceInline(target, caller, NULL); | 4975 TraceInline(target, caller, NULL); |
| 4975 | 4976 |
| (...skipping 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7388 } | 7389 } |
| 7389 } | 7390 } |
| 7390 | 7391 |
| 7391 #ifdef DEBUG | 7392 #ifdef DEBUG |
| 7392 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 7393 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 7393 if (allocator_ != NULL) allocator_->Verify(); | 7394 if (allocator_ != NULL) allocator_->Verify(); |
| 7394 #endif | 7395 #endif |
| 7395 } | 7396 } |
| 7396 | 7397 |
| 7397 } } // namespace v8::internal | 7398 } } // namespace v8::internal |
| OLD | NEW |