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 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 return InstallFullCode(info); | 958 return InstallFullCode(info); |
959 } | 959 } |
960 } | 960 } |
961 } | 961 } |
962 | 962 |
963 ASSERT(info->code().is_null()); | 963 ASSERT(info->code().is_null()); |
964 return false; | 964 return false; |
965 } | 965 } |
966 | 966 |
967 | 967 |
968 void Compiler::RecompileParallel(Handle<JSFunction> closure) { | 968 void Compiler::RecompileConcurrent(Handle<JSFunction> closure) { |
969 ASSERT(closure->IsMarkedForParallelRecompilation()); | 969 ASSERT(closure->IsMarkedForConcurrentRecompilation()); |
970 | 970 |
971 Isolate* isolate = closure->GetIsolate(); | 971 Isolate* isolate = closure->GetIsolate(); |
972 // Here we prepare compile data for the parallel recompilation thread, but | 972 // Here we prepare compile data for the concurrent recompilation thread, but |
973 // this still happens synchronously and interrupts execution. | 973 // this still happens synchronously and interrupts execution. |
974 Logger::TimerEventScope timer( | 974 Logger::TimerEventScope timer( |
975 isolate, Logger::TimerEventScope::v8_recompile_synchronous); | 975 isolate, Logger::TimerEventScope::v8_recompile_synchronous); |
976 | 976 |
977 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { | 977 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { |
978 if (FLAG_trace_parallel_recompilation) { | 978 if (FLAG_trace_concurrent_recompilation) { |
979 PrintF(" ** Compilation queue full, will retry optimizing "); | 979 PrintF(" ** Compilation queue full, will retry optimizing "); |
980 closure->PrintName(); | 980 closure->PrintName(); |
981 PrintF(" on next run.\n"); | 981 PrintF(" on next run.\n"); |
982 } | 982 } |
983 return; | 983 return; |
984 } | 984 } |
985 | 985 |
986 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); | 986 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); |
987 VMState<COMPILER> state(isolate); | 987 VMState<COMPILER> state(isolate); |
988 PostponeInterruptsScope postpone(isolate); | 988 PostponeInterruptsScope postpone(isolate); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 } | 1039 } |
1040 | 1040 |
1041 | 1041 |
1042 void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) { | 1042 void Compiler::InstallOptimizedCode(OptimizingCompiler* optimizing_compiler) { |
1043 SmartPointer<CompilationInfo> info(optimizing_compiler->info()); | 1043 SmartPointer<CompilationInfo> info(optimizing_compiler->info()); |
1044 // The function may have already been optimized by OSR. Simply continue. | 1044 // The function may have already been optimized by OSR. Simply continue. |
1045 // Except when OSR already disabled optimization for some reason. | 1045 // Except when OSR already disabled optimization for some reason. |
1046 if (info->shared_info()->optimization_disabled()) { | 1046 if (info->shared_info()->optimization_disabled()) { |
1047 info->AbortOptimization(); | 1047 info->AbortOptimization(); |
1048 InstallFullCode(*info); | 1048 InstallFullCode(*info); |
1049 if (FLAG_trace_parallel_recompilation) { | 1049 if (FLAG_trace_concurrent_recompilation) { |
1050 PrintF(" ** aborting optimization for "); | 1050 PrintF(" ** aborting optimization for "); |
1051 info->closure()->PrintName(); | 1051 info->closure()->PrintName(); |
1052 PrintF(" as it has been disabled.\n"); | 1052 PrintF(" as it has been disabled.\n"); |
1053 } | 1053 } |
1054 ASSERT(!info->closure()->IsMarkedForInstallingRecompiledCode()); | 1054 ASSERT(!info->closure()->IsMarkedForInstallingRecompiledCode()); |
1055 return; | 1055 return; |
1056 } | 1056 } |
1057 | 1057 |
1058 Isolate* isolate = info->isolate(); | 1058 Isolate* isolate = info->isolate(); |
1059 VMState<COMPILER> state(isolate); | 1059 VMState<COMPILER> state(isolate); |
(...skipping 19 matching lines...) Expand all Loading... |
1079 | 1079 |
1080 InstallCodeCommon(*info); | 1080 InstallCodeCommon(*info); |
1081 if (status == OptimizingCompiler::SUCCEEDED) { | 1081 if (status == OptimizingCompiler::SUCCEEDED) { |
1082 Handle<Code> code = info->code(); | 1082 Handle<Code> code = info->code(); |
1083 ASSERT(info->shared_info()->scope_info() != ScopeInfo::Empty(isolate)); | 1083 ASSERT(info->shared_info()->scope_info() != ScopeInfo::Empty(isolate)); |
1084 info->closure()->ReplaceCode(*code); | 1084 info->closure()->ReplaceCode(*code); |
1085 if (info->shared_info()->SearchOptimizedCodeMap( | 1085 if (info->shared_info()->SearchOptimizedCodeMap( |
1086 info->closure()->context()->native_context()) == -1) { | 1086 info->closure()->context()->native_context()) == -1) { |
1087 InsertCodeIntoOptimizedCodeMap(*info); | 1087 InsertCodeIntoOptimizedCodeMap(*info); |
1088 } | 1088 } |
1089 if (FLAG_trace_parallel_recompilation) { | 1089 if (FLAG_trace_concurrent_recompilation) { |
1090 PrintF(" ** Optimized code for "); | 1090 PrintF(" ** Optimized code for "); |
1091 info->closure()->PrintName(); | 1091 info->closure()->PrintName(); |
1092 PrintF(" installed.\n"); | 1092 PrintF(" installed.\n"); |
1093 } | 1093 } |
1094 } else { | 1094 } else { |
1095 info->AbortOptimization(); | 1095 info->AbortOptimization(); |
1096 InstallFullCode(*info); | 1096 InstallFullCode(*info); |
1097 } | 1097 } |
1098 // Optimized code is finally replacing unoptimized code. Reset the latter's | 1098 // Optimized code is finally replacing unoptimized code. Reset the latter's |
1099 // profiler ticks to prevent too soon re-opt after a deopt. | 1099 // profiler ticks to prevent too soon re-opt after a deopt. |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 // Trace if the appropriate trace flag is set and the phase name's first | 1259 // Trace if the appropriate trace flag is set and the phase name's first |
1260 // character is in the FLAG_trace_phase command line parameter. | 1260 // character is in the FLAG_trace_phase command line parameter. |
1261 bool tracing_on = info()->IsStub() ? | 1261 bool tracing_on = info()->IsStub() ? |
1262 FLAG_trace_hydrogen_stubs : | 1262 FLAG_trace_hydrogen_stubs : |
1263 FLAG_trace_hydrogen; | 1263 FLAG_trace_hydrogen; |
1264 return (tracing_on && | 1264 return (tracing_on && |
1265 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1265 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1266 } | 1266 } |
1267 | 1267 |
1268 } } // namespace v8::internal | 1268 } } // namespace v8::internal |
OLD | NEW |