| 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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 } | 1049 } |
| 1050 } | 1050 } |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 ASSERT(info->code().is_null()); | 1053 ASSERT(info->code().is_null()); |
| 1054 return false; | 1054 return false; |
| 1055 } | 1055 } |
| 1056 | 1056 |
| 1057 | 1057 |
| 1058 bool Compiler::RecompileConcurrent(Handle<JSFunction> closure, | 1058 bool Compiler::RecompileConcurrent(Handle<JSFunction> closure, |
| 1059 Handle<Code> unoptimized, |
| 1059 uint32_t osr_pc_offset) { | 1060 uint32_t osr_pc_offset) { |
| 1060 bool compiling_for_osr = (osr_pc_offset != 0); | 1061 bool compiling_for_osr = (osr_pc_offset != 0); |
| 1061 | 1062 |
| 1062 Isolate* isolate = closure->GetIsolate(); | 1063 Isolate* isolate = closure->GetIsolate(); |
| 1063 // Here we prepare compile data for the concurrent recompilation thread, but | 1064 // Here we prepare compile data for the concurrent recompilation thread, but |
| 1064 // this still happens synchronously and interrupts execution. | 1065 // this still happens synchronously and interrupts execution. |
| 1065 Logger::TimerEventScope timer( | 1066 Logger::TimerEventScope timer( |
| 1066 isolate, Logger::TimerEventScope::v8_recompile_synchronous); | 1067 isolate, Logger::TimerEventScope::v8_recompile_synchronous); |
| 1067 | 1068 |
| 1068 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { | 1069 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { |
| 1069 if (FLAG_trace_concurrent_recompilation) { | 1070 if (FLAG_trace_concurrent_recompilation) { |
| 1070 PrintF(" ** Compilation queue full, will retry optimizing "); | 1071 PrintF(" ** Compilation queue full, will retry optimizing "); |
| 1071 closure->PrintName(); | 1072 closure->PrintName(); |
| 1072 PrintF(" on next run.\n"); | 1073 PrintF(" on next run.\n"); |
| 1073 } | 1074 } |
| 1074 return false; | 1075 return false; |
| 1075 } | 1076 } |
| 1076 | 1077 |
| 1077 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); | 1078 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); |
| 1078 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1079 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 1079 | 1080 |
| 1080 if (compiling_for_osr) { | 1081 if (compiling_for_osr) { |
| 1081 BailoutId osr_ast_id = | 1082 BailoutId osr_ast_id = unoptimized->TranslatePcOffsetToAstId(osr_pc_offset); |
| 1082 shared->code()->TranslatePcOffsetToAstId(osr_pc_offset); | |
| 1083 ASSERT(!osr_ast_id.IsNone()); | 1083 ASSERT(!osr_ast_id.IsNone()); |
| 1084 info->SetOptimizing(osr_ast_id); | 1084 info->SetOptimizing(osr_ast_id); |
| 1085 info->set_osr_pc_offset(osr_pc_offset); | 1085 info->SetOsrInfo(unoptimized, osr_pc_offset); |
| 1086 | 1086 |
| 1087 if (FLAG_trace_osr) { | 1087 if (FLAG_trace_osr) { |
| 1088 PrintF("[COSR - attempt to queue "); | 1088 PrintF("[COSR - attempt to queue "); |
| 1089 closure->PrintName(); | 1089 closure->PrintName(); |
| 1090 PrintF(" at AST id %d]\n", osr_ast_id.ToInt()); | 1090 PrintF(" at AST id %d]\n", osr_ast_id.ToInt()); |
| 1091 } | 1091 } |
| 1092 } else { | 1092 } else { |
| 1093 info->SetOptimizing(BailoutId::None()); | 1093 info->SetOptimizing(BailoutId::None()); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1110 LanguageMode language_mode = info->function()->language_mode(); | 1110 LanguageMode language_mode = info->function()->language_mode(); |
| 1111 info->SetLanguageMode(language_mode); | 1111 info->SetLanguageMode(language_mode); |
| 1112 shared->set_language_mode(language_mode); | 1112 shared->set_language_mode(language_mode); |
| 1113 info->SaveHandles(); | 1113 info->SaveHandles(); |
| 1114 | 1114 |
| 1115 if (Rewriter::Rewrite(*info) && Scope::Analyze(*info)) { | 1115 if (Rewriter::Rewrite(*info) && Scope::Analyze(*info)) { |
| 1116 RecompileJob* job = new(info->zone()) RecompileJob(*info); | 1116 RecompileJob* job = new(info->zone()) RecompileJob(*info); |
| 1117 RecompileJob::Status status = job->CreateGraph(); | 1117 RecompileJob::Status status = job->CreateGraph(); |
| 1118 if (status == RecompileJob::SUCCEEDED) { | 1118 if (status == RecompileJob::SUCCEEDED) { |
| 1119 info.Detach(); | 1119 info.Detach(); |
| 1120 shared->code()->set_profiler_ticks(0); | 1120 unoptimized->set_profiler_ticks(0); |
| 1121 isolate->optimizing_compiler_thread()->QueueForOptimization(job); | 1121 isolate->optimizing_compiler_thread()->QueueForOptimization(job); |
| 1122 ASSERT(!isolate->has_pending_exception()); | 1122 ASSERT(!isolate->has_pending_exception()); |
| 1123 return true; | 1123 return true; |
| 1124 } else if (status == RecompileJob::BAILED_OUT) { | 1124 } else if (status == RecompileJob::BAILED_OUT) { |
| 1125 isolate->clear_pending_exception(); | 1125 isolate->clear_pending_exception(); |
| 1126 InstallFullCode(*info); | 1126 InstallFullCode(*info); |
| 1127 } | 1127 } |
| 1128 } | 1128 } |
| 1129 } | 1129 } |
| 1130 } | 1130 } |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 AllowHandleDereference allow_deref; | 1361 AllowHandleDereference allow_deref; |
| 1362 bool tracing_on = info()->IsStub() | 1362 bool tracing_on = info()->IsStub() |
| 1363 ? FLAG_trace_hydrogen_stubs | 1363 ? FLAG_trace_hydrogen_stubs |
| 1364 : (FLAG_trace_hydrogen && | 1364 : (FLAG_trace_hydrogen && |
| 1365 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1365 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1366 return (tracing_on && | 1366 return (tracing_on && |
| 1367 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1367 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 } } // namespace v8::internal | 1370 } } // namespace v8::internal |
| OLD | NEW |