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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 | 209 |
210 bool CompilationInfo::is_this_defined() const { return !IsStub(); } | 210 bool CompilationInfo::is_this_defined() const { return !IsStub(); } |
211 | 211 |
212 | 212 |
213 int CompilationInfo::num_heap_slots() const { | 213 int CompilationInfo::num_heap_slots() const { |
214 return has_scope() ? scope()->num_heap_slots() : 0; | 214 return has_scope() ? scope()->num_heap_slots() : 0; |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 Code::Flags CompilationInfo::flags() const { | |
219 return code_stub() != nullptr | |
220 ? Code::ComputeFlags( | |
221 code_stub()->GetCodeKind(), code_stub()->GetICState(), | |
222 code_stub()->GetExtraICState(), code_stub()->GetStubType()) | |
223 : Code::ComputeFlags(Code::OPTIMIZED_FUNCTION); | |
224 } | |
225 | |
226 | |
227 // Primitive functions are unlikely to be picked up by the stack-walking | 218 // Primitive functions are unlikely to be picked up by the stack-walking |
228 // profiler, so they trigger their own optimization when they're called | 219 // profiler, so they trigger their own optimization when they're called |
229 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. | 220 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. |
230 bool CompilationInfo::ShouldSelfOptimize() { | 221 bool CompilationInfo::ShouldSelfOptimize() { |
231 return FLAG_crankshaft && | 222 return FLAG_crankshaft && |
232 !(literal()->flags() & AstProperties::kDontSelfOptimize) && | 223 !(literal()->flags() & AstProperties::kDontSelfOptimize) && |
233 !literal()->dont_optimize() && | 224 !literal()->dont_optimize() && |
234 literal()->scope()->AllowsLazyCompilation() && | 225 literal()->scope()->AllowsLazyCompilation() && |
235 (!has_shared_info() || !shared_info()->optimization_disabled()); | 226 (!has_shared_info() || !shared_info()->optimization_disabled()); |
236 } | 227 } |
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1727 | 1718 |
1728 | 1719 |
1729 #if DEBUG | 1720 #if DEBUG |
1730 void CompilationInfo::PrintAstForTesting() { | 1721 void CompilationInfo::PrintAstForTesting() { |
1731 PrintF("--- Source from AST ---\n%s\n", | 1722 PrintF("--- Source from AST ---\n%s\n", |
1732 PrettyPrinter(isolate(), zone()).PrintProgram(literal())); | 1723 PrettyPrinter(isolate(), zone()).PrintProgram(literal())); |
1733 } | 1724 } |
1734 #endif | 1725 #endif |
1735 } // namespace internal | 1726 } // namespace internal |
1736 } // namespace v8 | 1727 } // namespace v8 |
OLD | NEW |