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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 } | 674 } |
675 | 675 |
676 | 676 |
677 HGraph::HGraph(CompilationInfo* info, Zone* zone) | 677 HGraph::HGraph(CompilationInfo* info, Zone* zone) |
678 : isolate_(info->isolate()), | 678 : isolate_(info->isolate()), |
679 next_block_id_(0), | 679 next_block_id_(0), |
680 entry_block_(NULL), | 680 entry_block_(NULL), |
681 blocks_(8, zone), | 681 blocks_(8, zone), |
682 values_(16, zone), | 682 values_(16, zone), |
683 phi_list_(NULL), | 683 phi_list_(NULL), |
684 zone_(zone) { | 684 zone_(zone), |
| 685 is_recursive_(false) { |
685 start_environment_ = | 686 start_environment_ = |
686 new(zone) HEnvironment(NULL, info->scope(), info->closure(), zone); | 687 new(zone) HEnvironment(NULL, info->scope(), info->closure(), zone); |
687 start_environment_->set_ast_id(AstNode::kFunctionEntryId); | 688 start_environment_->set_ast_id(AstNode::kFunctionEntryId); |
688 entry_block_ = CreateBasicBlock(); | 689 entry_block_ = CreateBasicBlock(); |
689 entry_block_->SetInitialEnvironment(start_environment_); | 690 entry_block_->SetInitialEnvironment(start_environment_); |
690 } | 691 } |
691 | 692 |
692 | 693 |
693 Handle<Code> HGraph::Compile(CompilationInfo* info, Zone* zone) { | 694 Handle<Code> HGraph::Compile(CompilationInfo* info, Zone* zone) { |
694 int values = GetMaximumValueID(); | 695 int values = GetMaximumValueID(); |
(...skipping 6225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6920 | 6921 |
6921 if (TryInlineBuiltinFunctionCall(expr, false)) { // Nothing to drop. | 6922 if (TryInlineBuiltinFunctionCall(expr, false)) { // Nothing to drop. |
6922 if (FLAG_trace_inlining) { | 6923 if (FLAG_trace_inlining) { |
6923 PrintF("Inlining builtin "); | 6924 PrintF("Inlining builtin "); |
6924 expr->target()->ShortPrint(); | 6925 expr->target()->ShortPrint(); |
6925 PrintF("\n"); | 6926 PrintF("\n"); |
6926 } | 6927 } |
6927 return; | 6928 return; |
6928 } | 6929 } |
6929 if (TryInlineCall(expr)) return; | 6930 if (TryInlineCall(expr)) return; |
| 6931 |
| 6932 if (expr->target().is_identical_to(info()->closure())) { |
| 6933 graph()->MarkRecursive(); |
| 6934 } |
| 6935 |
6930 call = PreProcessCall(new(zone()) HCallKnownGlobal(expr->target(), | 6936 call = PreProcessCall(new(zone()) HCallKnownGlobal(expr->target(), |
6931 argument_count)); | 6937 argument_count)); |
6932 } else { | 6938 } else { |
6933 HValue* context = environment()->LookupContext(); | 6939 HValue* context = environment()->LookupContext(); |
6934 HGlobalObject* receiver = new(zone()) HGlobalObject(context); | 6940 HGlobalObject* receiver = new(zone()) HGlobalObject(context); |
6935 AddInstruction(receiver); | 6941 AddInstruction(receiver); |
6936 PushAndAdd(new(zone()) HPushArgument(receiver)); | 6942 PushAndAdd(new(zone()) HPushArgument(receiver)); |
6937 CHECK_ALIVE(VisitArgumentList(expr->arguments())); | 6943 CHECK_ALIVE(VisitArgumentList(expr->arguments())); |
6938 | 6944 |
6939 call = new(zone()) HCallGlobal(context, var->name(), argument_count); | 6945 call = new(zone()) HCallGlobal(context, var->name(), argument_count); |
(...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9170 } | 9176 } |
9171 } | 9177 } |
9172 | 9178 |
9173 #ifdef DEBUG | 9179 #ifdef DEBUG |
9174 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 9180 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
9175 if (allocator_ != NULL) allocator_->Verify(); | 9181 if (allocator_ != NULL) allocator_->Verify(); |
9176 #endif | 9182 #endif |
9177 } | 9183 } |
9178 | 9184 |
9179 } } // namespace v8::internal | 9185 } } // namespace v8::internal |
OLD | NEW |