| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 223 } |
| 224 | 224 |
| 225 | 225 |
| 226 // Primitive functions are unlikely to be picked up by the stack-walking | 226 // Primitive functions are unlikely to be picked up by the stack-walking |
| 227 // profiler, so they trigger their own optimization when they're called | 227 // profiler, so they trigger their own optimization when they're called |
| 228 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. | 228 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. |
| 229 bool CompilationInfo::ShouldSelfOptimize() { | 229 bool CompilationInfo::ShouldSelfOptimize() { |
| 230 return FLAG_self_optimization && | 230 return FLAG_self_optimization && |
| 231 FLAG_crankshaft && | 231 FLAG_crankshaft && |
| 232 !function()->flags()->Contains(kDontSelfOptimize) && | 232 !function()->flags()->Contains(kDontSelfOptimize) && |
| 233 !function()->flags()->Contains(kDontOptimize) && | 233 !function()->dont_optimize() && |
| 234 function()->scope()->AllowsLazyCompilation() && | 234 function()->scope()->AllowsLazyCompilation() && |
| 235 (shared_info().is_null() || !shared_info()->optimization_disabled()); | 235 (shared_info().is_null() || !shared_info()->optimization_disabled()); |
| 236 } | 236 } |
| 237 | 237 |
| 238 | 238 |
| 239 // Determine whether to use the full compiler for all code. If the flag | 239 // Determine whether to use the full compiler for all code. If the flag |
| 240 // --always-full-compiler is specified this is the case. For the virtual frame | 240 // --always-full-compiler is specified this is the case. For the virtual frame |
| 241 // based compiler the full compiler is also used if a debugger is connected, as | 241 // based compiler the full compiler is also used if a debugger is connected, as |
| 242 // the code from the full compiler supports mode precise break points. For the | 242 // the code from the full compiler supports mode precise break points. For the |
| 243 // crankshaft adaptive compiler debugging the optimized code is not possible at | 243 // crankshaft adaptive compiler debugging the optimized code is not possible at |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 ASSERT(!function->IsOptimized()); | 833 ASSERT(!function->IsOptimized()); |
| 834 } | 834 } |
| 835 | 835 |
| 836 // Set the expected number of properties for instances. | 836 // Set the expected number of properties for instances. |
| 837 FunctionLiteral* lit = info->function(); | 837 FunctionLiteral* lit = info->function(); |
| 838 int expected = lit->expected_property_count(); | 838 int expected = lit->expected_property_count(); |
| 839 SetExpectedNofPropertiesFromEstimate(shared, expected); | 839 SetExpectedNofPropertiesFromEstimate(shared, expected); |
| 840 | 840 |
| 841 // Check the function has compiled code. | 841 // Check the function has compiled code. |
| 842 ASSERT(shared->is_compiled()); | 842 ASSERT(shared->is_compiled()); |
| 843 shared->set_dont_optimize(lit->flags()->Contains(kDontOptimize)); | 843 shared->set_dont_optimize_reason(lit->dont_optimize_reason()); |
| 844 shared->set_dont_inline(lit->flags()->Contains(kDontInline)); | 844 shared->set_dont_inline(lit->flags()->Contains(kDontInline)); |
| 845 shared->set_ast_node_count(lit->ast_node_count()); | 845 shared->set_ast_node_count(lit->ast_node_count()); |
| 846 | 846 |
| 847 if (info->isolate()->use_crankshaft() && | 847 if (info->isolate()->use_crankshaft() && |
| 848 !function.is_null() && | 848 !function.is_null() && |
| 849 !shared->optimization_disabled()) { | 849 !shared->optimization_disabled()) { |
| 850 // If we're asked to always optimize, we compile the optimized | 850 // If we're asked to always optimize, we compile the optimized |
| 851 // version of the function right away - unless the debugger is | 851 // version of the function right away - unless the debugger is |
| 852 // active as it makes no sense to compile optimized code then. | 852 // active as it makes no sense to compile optimized code then. |
| 853 if (FLAG_always_opt && | 853 if (FLAG_always_opt && |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1353 function_info->set_is_toplevel(is_toplevel); | 1353 function_info->set_is_toplevel(is_toplevel); |
| 1354 function_info->set_inferred_name(*lit->inferred_name()); | 1354 function_info->set_inferred_name(*lit->inferred_name()); |
| 1355 function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation()); | 1355 function_info->set_allows_lazy_compilation(lit->AllowsLazyCompilation()); |
| 1356 function_info->set_allows_lazy_compilation_without_context( | 1356 function_info->set_allows_lazy_compilation_without_context( |
| 1357 lit->AllowsLazyCompilationWithoutContext()); | 1357 lit->AllowsLazyCompilationWithoutContext()); |
| 1358 function_info->set_language_mode(lit->language_mode()); | 1358 function_info->set_language_mode(lit->language_mode()); |
| 1359 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); | 1359 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); |
| 1360 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); | 1360 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); |
| 1361 function_info->set_ast_node_count(lit->ast_node_count()); | 1361 function_info->set_ast_node_count(lit->ast_node_count()); |
| 1362 function_info->set_is_function(lit->is_function()); | 1362 function_info->set_is_function(lit->is_function()); |
| 1363 function_info->set_dont_optimize(lit->flags()->Contains(kDontOptimize)); | 1363 function_info->set_dont_optimize_reason(lit->dont_optimize_reason()); |
| 1364 function_info->set_dont_inline(lit->flags()->Contains(kDontInline)); | 1364 function_info->set_dont_inline(lit->flags()->Contains(kDontInline)); |
| 1365 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); | 1365 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); |
| 1366 function_info->set_is_generator(lit->is_generator()); | 1366 function_info->set_is_generator(lit->is_generator()); |
| 1367 } | 1367 } |
| 1368 | 1368 |
| 1369 | 1369 |
| 1370 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 1370 void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
| 1371 CompilationInfo* info, | 1371 CompilationInfo* info, |
| 1372 Handle<SharedFunctionInfo> shared) { | 1372 Handle<SharedFunctionInfo> shared) { |
| 1373 // SharedFunctionInfo is passed separately, because if CompilationInfo | 1373 // SharedFunctionInfo is passed separately, because if CompilationInfo |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1438 AllowHandleDereference allow_deref; | 1438 AllowHandleDereference allow_deref; |
| 1439 bool tracing_on = info()->IsStub() | 1439 bool tracing_on = info()->IsStub() |
| 1440 ? FLAG_trace_hydrogen_stubs | 1440 ? FLAG_trace_hydrogen_stubs |
| 1441 : (FLAG_trace_hydrogen && | 1441 : (FLAG_trace_hydrogen && |
| 1442 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1442 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1443 return (tracing_on && | 1443 return (tracing_on && |
| 1444 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1444 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1445 } | 1445 } |
| 1446 | 1446 |
| 1447 } } // namespace v8::internal | 1447 } } // namespace v8::internal |
| OLD | NEW |