| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 219 } |
| 220 | 220 |
| 221 | 221 |
| 222 // Primitive functions are unlikely to be picked up by the stack-walking | 222 // Primitive functions are unlikely to be picked up by the stack-walking |
| 223 // profiler, so they trigger their own optimization when they're called | 223 // profiler, so they trigger their own optimization when they're called |
| 224 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. | 224 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. |
| 225 bool CompilationInfo::ShouldSelfOptimize() { | 225 bool CompilationInfo::ShouldSelfOptimize() { |
| 226 return FLAG_self_optimization && | 226 return FLAG_self_optimization && |
| 227 FLAG_crankshaft && | 227 FLAG_crankshaft && |
| 228 !function()->flags()->Contains(kDontSelfOptimize) && | 228 !function()->flags()->Contains(kDontSelfOptimize) && |
| 229 !function()->flags()->Contains(kDontOptimize) && | 229 !function()->dont_optimize() && |
| 230 function()->scope()->AllowsLazyCompilation() && | 230 function()->scope()->AllowsLazyCompilation() && |
| 231 (shared_info().is_null() || !shared_info()->optimization_disabled()); | 231 (shared_info().is_null() || !shared_info()->optimization_disabled()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 | 234 |
| 235 // Determine whether to use the full compiler for all code. If the flag | 235 // Determine whether to use the full compiler for all code. If the flag |
| 236 // --always-full-compiler is specified this is the case. For the virtual frame | 236 // --always-full-compiler is specified this is the case. For the virtual frame |
| 237 // based compiler the full compiler is also used if a debugger is connected, as | 237 // based compiler the full compiler is also used if a debugger is connected, as |
| 238 // the code from the full compiler supports mode precise break points. For the | 238 // the code from the full compiler supports mode precise break points. For the |
| 239 // crankshaft adaptive compiler debugging the optimized code is not possible at | 239 // crankshaft adaptive compiler debugging the optimized code is not possible at |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 ASSERT(!function->IsOptimized()); | 827 ASSERT(!function->IsOptimized()); |
| 828 } | 828 } |
| 829 | 829 |
| 830 // Set the expected number of properties for instances. | 830 // Set the expected number of properties for instances. |
| 831 FunctionLiteral* lit = info->function(); | 831 FunctionLiteral* lit = info->function(); |
| 832 int expected = lit->expected_property_count(); | 832 int expected = lit->expected_property_count(); |
| 833 SetExpectedNofPropertiesFromEstimate(shared, expected); | 833 SetExpectedNofPropertiesFromEstimate(shared, expected); |
| 834 | 834 |
| 835 // Check the function has compiled code. | 835 // Check the function has compiled code. |
| 836 ASSERT(shared->is_compiled()); | 836 ASSERT(shared->is_compiled()); |
| 837 shared->set_dont_optimize(lit->flags()->Contains(kDontOptimize)); | 837 shared->set_dont_optimize_reason(lit->dont_optimize_reason()); |
| 838 shared->set_dont_inline(lit->flags()->Contains(kDontInline)); | 838 shared->set_dont_inline(lit->flags()->Contains(kDontInline)); |
| 839 shared->set_ast_node_count(lit->ast_node_count()); | 839 shared->set_ast_node_count(lit->ast_node_count()); |
| 840 | 840 |
| 841 if (V8::UseCrankshaft() && | 841 if (V8::UseCrankshaft() && |
| 842 !function.is_null() && | 842 !function.is_null() && |
| 843 !shared->optimization_disabled()) { | 843 !shared->optimization_disabled()) { |
| 844 // If we're asked to always optimize, we compile the optimized | 844 // If we're asked to always optimize, we compile the optimized |
| 845 // version of the function right away - unless the debugger is | 845 // version of the function right away - unless the debugger is |
| 846 // active as it makes no sense to compile optimized code then. | 846 // active as it makes no sense to compile optimized code then. |
| 847 if (FLAG_always_opt && | 847 if (FLAG_always_opt && |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 function_info->set_is_toplevel(is_toplevel); | 1171 function_info->set_is_toplevel(is_toplevel); |
| 1172 function_info->set_inferred_name(*lit->inferred_name()); | 1172 function_info->set_inferred_name(*lit->inferred_name()); |
| 1173 function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation()); | 1173 function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation()); |
| 1174 function_info->set_allows_lazy_compilation_without_context( | 1174 function_info->set_allows_lazy_compilation_without_context( |
| 1175 lit->AllowsLazyCompilationWithoutContext()); | 1175 lit->AllowsLazyCompilationWithoutContext()); |
| 1176 function_info->set_language_mode(lit->language_mode()); | 1176 function_info->set_language_mode(lit->language_mode()); |
| 1177 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); | 1177 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); |
| 1178 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); | 1178 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); |
| 1179 function_info->set_ast_node_count(lit->ast_node_count()); | 1179 function_info->set_ast_node_count(lit->ast_node_count()); |
| 1180 function_info->set_is_function(lit->is_function()); | 1180 function_info->set_is_function(lit->is_function()); |
| 1181 function_info->set_dont_optimize(lit->flags()->Contains(kDontOptimize)); | 1181 function_info->set_dont_optimize_reason(lit->dont_optimize_reason()); |
| 1182 function_info->set_dont_inline(lit->flags()->Contains(kDontInline)); | 1182 function_info->set_dont_inline(lit->flags()->Contains(kDontInline)); |
| 1183 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); | 1183 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); |
| 1184 function_info->set_is_generator(lit->is_generator()); | 1184 function_info->set_is_generator(lit->is_generator()); |
| 1185 } | 1185 } |
| 1186 | 1186 |
| 1187 | 1187 |
| 1188 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 1188 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
| 1189 CompilationInfo* info, | 1189 CompilationInfo* info, |
| 1190 Handle<SharedFunctionInfo> shared) { | 1190 Handle<SharedFunctionInfo> shared) { |
| 1191 // SharedFunctionInfo is passed separately, because if CompilationInfo | 1191 // SharedFunctionInfo is passed separately, because if CompilationInfo |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 AllowHandleDereference allow_deref; | 1256 AllowHandleDereference allow_deref; |
| 1257 bool tracing_on = info()->IsStub() | 1257 bool tracing_on = info()->IsStub() |
| 1258 ? FLAG_trace_hydrogen_stubs | 1258 ? FLAG_trace_hydrogen_stubs |
| 1259 : (FLAG_trace_hydrogen && | 1259 : (FLAG_trace_hydrogen && |
| 1260 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1260 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1261 return (tracing_on && | 1261 return (tracing_on && |
| 1262 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1262 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1263 } | 1263 } |
| 1264 | 1264 |
| 1265 } } // namespace v8::internal | 1265 } } // namespace v8::internal |
| OLD | NEW |