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/compiler.h" | 5 #include "src/compiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 code_stub()->GetCodeKind(), code_stub()->GetICState(), | 196 code_stub()->GetCodeKind(), code_stub()->GetICState(), |
197 code_stub()->GetExtraICState(), code_stub()->GetStubType()) | 197 code_stub()->GetExtraICState(), code_stub()->GetStubType()) |
198 : Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); | 198 : Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); |
199 } | 199 } |
200 | 200 |
201 | 201 |
202 // Primitive functions are unlikely to be picked up by the stack-walking | 202 // Primitive functions are unlikely to be picked up by the stack-walking |
203 // profiler, so they trigger their own optimization when they're called | 203 // profiler, so they trigger their own optimization when they're called |
204 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. | 204 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. |
205 bool CompilationInfo::ShouldSelfOptimize() { | 205 bool CompilationInfo::ShouldSelfOptimize() { |
206 return FLAG_crankshaft && !function()->flags()->Contains(kDontSelfOptimize) && | 206 return FLAG_crankshaft && |
| 207 !(function()->flags() & AstProperties::kDontSelfOptimize) && |
207 !function()->dont_optimize() && | 208 !function()->dont_optimize() && |
208 function()->scope()->AllowsLazyCompilation() && | 209 function()->scope()->AllowsLazyCompilation() && |
209 (!has_shared_info() || !shared_info()->optimization_disabled()); | 210 (!has_shared_info() || !shared_info()->optimization_disabled()); |
210 } | 211 } |
211 | 212 |
212 | 213 |
213 void CompilationInfo::EnsureFeedbackVector() { | 214 void CompilationInfo::EnsureFeedbackVector() { |
214 if (feedback_vector_.is_null() || | 215 if (feedback_vector_.is_null() || |
215 feedback_vector_->SpecDiffersFrom(function()->feedback_vector_spec())) { | 216 feedback_vector_->SpecDiffersFrom(function()->feedback_vector_spec())) { |
216 feedback_vector_ = isolate()->factory()->NewTypeFeedbackVector( | 217 feedback_vector_ = isolate()->factory()->NewTypeFeedbackVector( |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 static bool Renumber(ParseInfo* parse_info) { | 747 static bool Renumber(ParseInfo* parse_info) { |
747 if (!AstNumbering::Renumber(parse_info->isolate(), parse_info->zone(), | 748 if (!AstNumbering::Renumber(parse_info->isolate(), parse_info->zone(), |
748 parse_info->function())) { | 749 parse_info->function())) { |
749 return false; | 750 return false; |
750 } | 751 } |
751 Handle<SharedFunctionInfo> shared_info = parse_info->shared_info(); | 752 Handle<SharedFunctionInfo> shared_info = parse_info->shared_info(); |
752 if (!shared_info.is_null()) { | 753 if (!shared_info.is_null()) { |
753 FunctionLiteral* lit = parse_info->function(); | 754 FunctionLiteral* lit = parse_info->function(); |
754 shared_info->set_ast_node_count(lit->ast_node_count()); | 755 shared_info->set_ast_node_count(lit->ast_node_count()); |
755 MaybeDisableOptimization(shared_info, lit->dont_optimize_reason()); | 756 MaybeDisableOptimization(shared_info, lit->dont_optimize_reason()); |
756 shared_info->set_dont_crankshaft(lit->flags()->Contains(kDontCrankshaft)); | 757 shared_info->set_dont_crankshaft(lit->flags() & |
| 758 AstProperties::kDontCrankshaft); |
757 } | 759 } |
758 return true; | 760 return true; |
759 } | 761 } |
760 | 762 |
761 | 763 |
762 bool Compiler::Analyze(ParseInfo* info) { | 764 bool Compiler::Analyze(ParseInfo* info) { |
763 DCHECK(info->function() != NULL); | 765 DCHECK(info->function() != NULL); |
764 if (!Rewriter::Rewrite(info)) return false; | 766 if (!Rewriter::Rewrite(info)) return false; |
765 if (!Scope::Analyze(info)) return false; | 767 if (!Scope::Analyze(info)) return false; |
766 if (!Renumber(info)) return false; | 768 if (!Renumber(info)) return false; |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 | 1633 |
1632 | 1634 |
1633 #if DEBUG | 1635 #if DEBUG |
1634 void CompilationInfo::PrintAstForTesting() { | 1636 void CompilationInfo::PrintAstForTesting() { |
1635 PrintF("--- Source from AST ---\n%s\n", | 1637 PrintF("--- Source from AST ---\n%s\n", |
1636 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1638 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1637 } | 1639 } |
1638 #endif | 1640 #endif |
1639 } // namespace internal | 1641 } // namespace internal |
1640 } // namespace v8 | 1642 } // namespace v8 |
OLD | NEW |