Chromium Code Reviews| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 RecordOptimizationStats(); | 390 RecordOptimizationStats(); |
| 391 return SetLastStatus(SUCCEEDED); | 391 return SetLastStatus(SUCCEEDED); |
| 392 } | 392 } |
| 393 | 393 |
| 394 | 394 |
| 395 static bool GenerateCode(CompilationInfo* info) { | 395 static bool GenerateCode(CompilationInfo* info) { |
| 396 bool is_optimizing = V8::UseCrankshaft() && | 396 bool is_optimizing = V8::UseCrankshaft() && |
| 397 !info->IsCompilingForDebugging() && | 397 !info->IsCompilingForDebugging() && |
| 398 info->IsOptimizing(); | 398 info->IsOptimizing(); |
| 399 if (is_optimizing) { | 399 if (is_optimizing) { |
| 400 HistogramTimerScope timer( | |
| 401 info->isolate()->counters()->recompile_synchronous()); | |
| 400 return MakeCrankshaftCode(info); | 402 return MakeCrankshaftCode(info); |
| 401 } else { | 403 } else { |
| 402 if (info->IsOptimizing()) { | 404 if (info->IsOptimizing()) { |
| 403 // Have the CompilationInfo decide if the compilation should be | 405 // Have the CompilationInfo decide if the compilation should be |
| 404 // BASE or NONOPT. | 406 // BASE or NONOPT. |
| 405 info->DisableOptimization(); | 407 info->DisableOptimization(); |
| 406 } | 408 } |
| 409 HistogramTimerScope timer(info->isolate()->counters()->compile_full_code()); | |
| 407 return FullCodeGenerator::MakeCode(info); | 410 return FullCodeGenerator::MakeCode(info); |
| 408 } | 411 } |
| 409 } | 412 } |
| 410 | 413 |
| 411 | 414 |
| 412 static bool MakeCode(CompilationInfo* info) { | 415 static bool MakeCode(CompilationInfo* info) { |
| 413 // Precondition: code has been parsed. Postcondition: the code field in | 416 // Precondition: code has been parsed. Postcondition: the code field in |
| 414 // the compilation info is set if compilation succeeded. | 417 // the compilation info is set if compilation succeeded. |
| 415 ASSERT(info->function() != NULL); | 418 ASSERT(info->function() != NULL); |
| 416 return Rewriter::Rewrite(info) && Scope::Analyze(info) && GenerateCode(info); | 419 return Rewriter::Rewrite(info) && Scope::Analyze(info) && GenerateCode(info); |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 845 ASSERT(info->code().is_null()); | 848 ASSERT(info->code().is_null()); |
| 846 return false; | 849 return false; |
| 847 } | 850 } |
| 848 | 851 |
| 849 | 852 |
| 850 void Compiler::RecompileParallel(Handle<JSFunction> closure) { | 853 void Compiler::RecompileParallel(Handle<JSFunction> closure) { |
| 851 if (closure->IsInRecompileQueue()) return; | 854 if (closure->IsInRecompileQueue()) return; |
| 852 ASSERT(closure->IsMarkedForParallelRecompilation()); | 855 ASSERT(closure->IsMarkedForParallelRecompilation()); |
| 853 | 856 |
| 854 Isolate* isolate = closure->GetIsolate(); | 857 Isolate* isolate = closure->GetIsolate(); |
| 858 HistogramTimerScope timer(isolate->counters()->recompile_synchronous()); | |
|
Jakob Kummerow
2012/11/22 10:56:08
Adding the run time of a method named RecompilePar
Yang
2012/11/22 13:04:20
Done.
| |
| 859 | |
| 855 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { | 860 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { |
| 856 if (FLAG_trace_parallel_recompilation) { | 861 if (FLAG_trace_parallel_recompilation) { |
| 857 PrintF(" ** Compilation queue, will retry opting on next run.\n"); | 862 PrintF(" ** Compilation queue, will retry opting on next run.\n"); |
| 858 } | 863 } |
| 859 return; | 864 return; |
| 860 } | 865 } |
| 861 | 866 |
| 862 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); | 867 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); |
| 863 VMState state(isolate, PARALLEL_COMPILER_PROLOGUE); | 868 VMState state(isolate, PARALLEL_COMPILER); |
| 864 PostponeInterruptsScope postpone(isolate); | 869 PostponeInterruptsScope postpone(isolate); |
| 865 | 870 |
| 866 Handle<SharedFunctionInfo> shared = info->shared_info(); | 871 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 867 int compiled_size = shared->end_position() - shared->start_position(); | 872 int compiled_size = shared->end_position() - shared->start_position(); |
| 868 isolate->counters()->total_compile_size()->Increment(compiled_size); | 873 isolate->counters()->total_compile_size()->Increment(compiled_size); |
| 869 info->SetOptimizing(BailoutId::None()); | 874 info->SetOptimizing(BailoutId::None()); |
| 870 | 875 |
| 871 { | 876 { |
| 872 CompilationHandleScope handle_scope(*info); | 877 CompilationHandleScope handle_scope(*info); |
| 873 | 878 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 901 } | 906 } |
| 902 | 907 |
| 903 if (isolate->has_pending_exception()) { | 908 if (isolate->has_pending_exception()) { |
| 904 isolate->clear_pending_exception(); | 909 isolate->clear_pending_exception(); |
| 905 } | 910 } |
| 906 } | 911 } |
| 907 | 912 |
| 908 | 913 |
| 909 void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) { | 914 void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) { |
| 910 SmartPointer<CompilationInfo> info(optimizing_compiler->info()); | 915 SmartPointer<CompilationInfo> info(optimizing_compiler->info()); |
| 916 Isolate* isolate = info->isolate(); | |
| 917 VMState state(isolate, PARALLEL_COMPILER); | |
| 918 HistogramTimerScope timer(isolate->counters()->recompile_synchronous()); | |
| 911 // If crankshaft succeeded, install the optimized code else install | 919 // If crankshaft succeeded, install the optimized code else install |
| 912 // the unoptimized code. | 920 // the unoptimized code. |
| 913 OptimizingCompiler::Status status = optimizing_compiler->last_status(); | 921 OptimizingCompiler::Status status = optimizing_compiler->last_status(); |
| 914 if (status != OptimizingCompiler::SUCCEEDED) { | 922 if (status != OptimizingCompiler::SUCCEEDED) { |
| 915 optimizing_compiler->info()->set_bailout_reason( | 923 optimizing_compiler->info()->set_bailout_reason( |
| 916 "failed/bailed out last time"); | 924 "failed/bailed out last time"); |
| 917 status = optimizing_compiler->AbortOptimization(); | 925 status = optimizing_compiler->AbortOptimization(); |
| 918 } else { | 926 } else { |
| 919 status = optimizing_compiler->GenerateAndInstallCode(); | 927 status = optimizing_compiler->GenerateAndInstallCode(); |
| 920 ASSERT(status == OptimizingCompiler::SUCCEEDED || | 928 ASSERT(status == OptimizingCompiler::SUCCEEDED || |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1061 } | 1069 } |
| 1062 } | 1070 } |
| 1063 | 1071 |
| 1064 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1072 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 1065 Handle<Script>(info->script()), | 1073 Handle<Script>(info->script()), |
| 1066 Handle<Code>(info->code()), | 1074 Handle<Code>(info->code()), |
| 1067 info)); | 1075 info)); |
| 1068 } | 1076 } |
| 1069 | 1077 |
| 1070 } } // namespace v8::internal | 1078 } } // namespace v8::internal |
| OLD | NEW |