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 4718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4729 UNREACHABLE(); | 4729 UNREACHABLE(); |
4730 } | 4730 } |
4731 | 4731 |
4732 | 4732 |
4733 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { | 4733 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { |
4734 ASSERT(!HasStackOverflow()); | 4734 ASSERT(!HasStackOverflow()); |
4735 ASSERT(current_block() != NULL); | 4735 ASSERT(current_block() != NULL); |
4736 ASSERT(current_block()->HasPredecessor()); | 4736 ASSERT(current_block()->HasPredecessor()); |
4737 Handle<SharedFunctionInfo> shared_info = expr->shared_info(); | 4737 Handle<SharedFunctionInfo> shared_info = expr->shared_info(); |
4738 if (shared_info.is_null()) { | 4738 if (shared_info.is_null()) { |
4739 shared_info = Compiler::BuildFunctionInfo(expr, current_info()->script()); | 4739 shared_info = Compiler::BuildFunctionInfo(expr, |
| 4740 current_info()->script(), |
| 4741 false); |
4740 } | 4742 } |
4741 // We also have a stack overflow if the recursive compilation did. | 4743 // We also have a stack overflow if the recursive compilation did. |
4742 if (HasStackOverflow()) return; | 4744 if (HasStackOverflow()) return; |
4743 HFunctionLiteral* instr = | 4745 HFunctionLiteral* instr = |
4744 New<HFunctionLiteral>(shared_info, expr->pretenure()); | 4746 New<HFunctionLiteral>(shared_info, expr->pretenure()); |
4745 return ast_context()->ReturnInstruction(instr, expr->id()); | 4747 return ast_context()->ReturnInstruction(instr, expr->id()); |
4746 } | 4748 } |
4747 | 4749 |
4748 | 4750 |
4749 void HOptimizedGraphBuilder::VisitNativeFunctionLiteral( | 4751 void HOptimizedGraphBuilder::VisitNativeFunctionLiteral( |
(...skipping 2653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7403 if (!Parser::Parse(&target_info) || !Scope::Analyze(&target_info)) { | 7405 if (!Parser::Parse(&target_info) || !Scope::Analyze(&target_info)) { |
7404 if (target_info.isolate()->has_pending_exception()) { | 7406 if (target_info.isolate()->has_pending_exception()) { |
7405 // Parse or scope error, never optimize this function. | 7407 // Parse or scope error, never optimize this function. |
7406 SetStackOverflow(); | 7408 SetStackOverflow(); |
7407 target_shared->DisableOptimization(kParseScopeError); | 7409 target_shared->DisableOptimization(kParseScopeError); |
7408 } | 7410 } |
7409 TraceInline(target, caller, "parse failure"); | 7411 TraceInline(target, caller, "parse failure"); |
7410 return false; | 7412 return false; |
7411 } | 7413 } |
7412 | 7414 |
| 7415 target_info.ProcessFeedbackSlots(); |
| 7416 |
7413 if (target_info.scope()->num_heap_slots() > 0) { | 7417 if (target_info.scope()->num_heap_slots() > 0) { |
7414 TraceInline(target, caller, "target has context-allocated variables"); | 7418 TraceInline(target, caller, "target has context-allocated variables"); |
7415 return false; | 7419 return false; |
7416 } | 7420 } |
7417 FunctionLiteral* function = target_info.function(); | 7421 FunctionLiteral* function = target_info.function(); |
7418 | 7422 |
7419 // The following conditions must be checked again after re-parsing, because | 7423 // The following conditions must be checked again after re-parsing, because |
7420 // earlier the information might not have been complete due to lazy parsing. | 7424 // earlier the information might not have been complete due to lazy parsing. |
7421 nodes_added = function->ast_node_count(); | 7425 nodes_added = function->ast_node_count(); |
7422 if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) { | 7426 if (nodes_added > Min(FLAG_max_inlined_nodes, kUnlimitedMaxInlinedNodes)) { |
(...skipping 2848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10271 | 10275 |
10272 | 10276 |
10273 void HOptimizedGraphBuilder::VisitFunctionDeclaration( | 10277 void HOptimizedGraphBuilder::VisitFunctionDeclaration( |
10274 FunctionDeclaration* declaration) { | 10278 FunctionDeclaration* declaration) { |
10275 VariableProxy* proxy = declaration->proxy(); | 10279 VariableProxy* proxy = declaration->proxy(); |
10276 Variable* variable = proxy->var(); | 10280 Variable* variable = proxy->var(); |
10277 switch (variable->location()) { | 10281 switch (variable->location()) { |
10278 case Variable::UNALLOCATED: { | 10282 case Variable::UNALLOCATED: { |
10279 globals_.Add(variable->name(), zone()); | 10283 globals_.Add(variable->name(), zone()); |
10280 Handle<SharedFunctionInfo> function = Compiler::BuildFunctionInfo( | 10284 Handle<SharedFunctionInfo> function = Compiler::BuildFunctionInfo( |
10281 declaration->fun(), current_info()->script()); | 10285 declaration->fun(), current_info()->script(), false); |
10282 // Check for stack-overflow exception. | 10286 // Check for stack-overflow exception. |
10283 if (function.is_null()) return SetStackOverflow(); | 10287 if (function.is_null()) return SetStackOverflow(); |
10284 globals_.Add(function, zone()); | 10288 globals_.Add(function, zone()); |
10285 return; | 10289 return; |
10286 } | 10290 } |
10287 case Variable::PARAMETER: | 10291 case Variable::PARAMETER: |
10288 case Variable::LOCAL: { | 10292 case Variable::LOCAL: { |
10289 CHECK_ALIVE(VisitForValue(declaration->fun())); | 10293 CHECK_ALIVE(VisitForValue(declaration->fun())); |
10290 HValue* value = Pop(); | 10294 HValue* value = Pop(); |
10291 BindIfLive(variable, value); | 10295 BindIfLive(variable, value); |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11455 if (ShouldProduceTraceOutput()) { | 11459 if (ShouldProduceTraceOutput()) { |
11456 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11460 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11457 } | 11461 } |
11458 | 11462 |
11459 #ifdef DEBUG | 11463 #ifdef DEBUG |
11460 graph_->Verify(false); // No full verify. | 11464 graph_->Verify(false); // No full verify. |
11461 #endif | 11465 #endif |
11462 } | 11466 } |
11463 | 11467 |
11464 } } // namespace v8::internal | 11468 } } // namespace v8::internal |
OLD | NEW |