OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
734 Handle<Context> native_context(function->context()->native_context()); | 734 Handle<Context> native_context(function->context()->native_context()); |
735 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 735 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
736 literals, info->osr_ast_id()); | 736 literals, info->osr_ast_id()); |
737 } | 737 } |
738 } | 738 } |
739 | 739 |
740 | 740 |
741 static bool Renumber(CompilationInfo* info) { | 741 static bool Renumber(CompilationInfo* info) { |
742 if (!AstNumbering::Renumber(info->function(), info->zone())) return false; | 742 if (!AstNumbering::Renumber(info->function(), info->zone())) return false; |
743 if (!info->shared_info().is_null()) { | 743 if (!info->shared_info().is_null()) { |
744 info->shared_info()->set_ast_node_count(info->function()->ast_node_count()); | 744 FunctionLiteral* lit = info->function(); |
745 info->shared_info()->set_ast_node_count(lit->ast_node_count()); | |
746 info->shared_info()->set_bailout_reason(lit->dont_optimize_reason()); | |
747 info->shared_info()->set_dont_cache(lit->flags()->Contains(kDontCache)); | |
745 } | 748 } |
746 return true; | 749 return true; |
747 } | 750 } |
748 | 751 |
749 | 752 |
750 bool Compiler::Analyze(CompilationInfo* info) { | 753 bool Compiler::Analyze(CompilationInfo* info) { |
751 DCHECK(info->function() != NULL); | 754 DCHECK(info->function() != NULL); |
752 if (!Rewriter::Rewrite(info)) return false; | 755 if (!Rewriter::Rewrite(info)) return false; |
753 if (!Scope::Analyze(info)) return false; | 756 if (!Scope::Analyze(info)) return false; |
754 if (!Renumber(info)) return false; | 757 if (!Renumber(info)) return false; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
921 // be generated lazily once deopt is triggered. | 924 // be generated lazily once deopt is triggered. |
922 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { | 925 bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) { |
923 if (!info->shared_info()->has_deoptimization_support()) { | 926 if (!info->shared_info()->has_deoptimization_support()) { |
924 CompilationInfoWithZone unoptimized(info->shared_info()); | 927 CompilationInfoWithZone unoptimized(info->shared_info()); |
925 // Note that we use the same AST that we will use for generating the | 928 // Note that we use the same AST that we will use for generating the |
926 // optimized code. | 929 // optimized code. |
927 unoptimized.SetFunction(info->function()); | 930 unoptimized.SetFunction(info->function()); |
928 unoptimized.PrepareForCompilation(info->scope()); | 931 unoptimized.PrepareForCompilation(info->scope()); |
929 unoptimized.SetContext(info->context()); | 932 unoptimized.SetContext(info->context()); |
930 unoptimized.EnableDeoptimizationSupport(); | 933 unoptimized.EnableDeoptimizationSupport(); |
934 if (!Renumber(&unoptimized)) return false; | |
wingo
2014/10/24 09:51:50
whoops, this crept back in
wingo
2014/10/24 10:36:42
Done.
| |
931 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; | 935 if (!FullCodeGenerator::MakeCode(&unoptimized)) return false; |
932 | 936 |
933 Handle<SharedFunctionInfo> shared = info->shared_info(); | 937 Handle<SharedFunctionInfo> shared = info->shared_info(); |
934 shared->EnableDeoptimizationSupport(*unoptimized.code()); | 938 shared->EnableDeoptimizationSupport(*unoptimized.code()); |
935 shared->set_feedback_vector(*unoptimized.feedback_vector()); | 939 shared->set_feedback_vector(*unoptimized.feedback_vector()); |
936 | 940 |
937 // The scope info might not have been set if a lazily compiled | 941 // The scope info might not have been set if a lazily compiled |
938 // function is inlined before being called for the first time. | 942 // function is inlined before being called for the first time. |
939 if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) { | 943 if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) { |
940 Handle<ScopeInfo> target_scope_info = | 944 Handle<ScopeInfo> target_scope_info = |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1467 AllowHandleDereference allow_deref; | 1471 AllowHandleDereference allow_deref; |
1468 bool tracing_on = info()->IsStub() | 1472 bool tracing_on = info()->IsStub() |
1469 ? FLAG_trace_hydrogen_stubs | 1473 ? FLAG_trace_hydrogen_stubs |
1470 : (FLAG_trace_hydrogen && | 1474 : (FLAG_trace_hydrogen && |
1471 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1475 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1472 return (tracing_on && | 1476 return (tracing_on && |
1473 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1477 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1474 } | 1478 } |
1475 | 1479 |
1476 } } // namespace v8::internal | 1480 } } // namespace v8::internal |
OLD | NEW |