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 14 matching lines...) Expand all Loading... |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "compiler.h" | 30 #include "compiler.h" |
31 | 31 |
32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
33 #include "codegen.h" | 33 #include "codegen.h" |
34 #include "compilation-cache.h" | 34 #include "compilation-cache.h" |
| 35 #include "cpu-profiler.h" |
35 #include "debug.h" | 36 #include "debug.h" |
36 #include "deoptimizer.h" | 37 #include "deoptimizer.h" |
37 #include "full-codegen.h" | 38 #include "full-codegen.h" |
38 #include "gdb-jit.h" | 39 #include "gdb-jit.h" |
39 #include "typing.h" | 40 #include "typing.h" |
40 #include "hydrogen.h" | 41 #include "hydrogen.h" |
41 #include "isolate-inl.h" | 42 #include "isolate-inl.h" |
42 #include "lithium.h" | 43 #include "lithium.h" |
43 #include "liveedit.h" | 44 #include "liveedit.h" |
44 #include "parser.h" | 45 #include "parser.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 info_->AbortOptimization(); | 451 info_->AbortOptimization(); |
451 return SetLastStatus(BAILED_OUT); | 452 return SetLastStatus(BAILED_OUT); |
452 } else { | 453 } else { |
453 return AbortOptimization(); | 454 return AbortOptimization(); |
454 } | 455 } |
455 } | 456 } |
456 | 457 |
457 return SetLastStatus(SUCCEEDED); | 458 return SetLastStatus(SUCCEEDED); |
458 } | 459 } |
459 | 460 |
| 461 |
460 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() { | 462 OptimizingCompiler::Status OptimizingCompiler::OptimizeGraph() { |
461 DisallowHeapAllocation no_allocation; | 463 DisallowHeapAllocation no_allocation; |
462 DisallowHandleAllocation no_handles; | 464 DisallowHandleAllocation no_handles; |
463 DisallowHandleDereference no_deref; | 465 DisallowHandleDereference no_deref; |
464 | 466 |
465 ASSERT(last_status() == SUCCEEDED); | 467 ASSERT(last_status() == SUCCEEDED); |
466 Timer t(this, &time_taken_to_optimize_); | 468 Timer t(this, &time_taken_to_optimize_); |
467 ASSERT(graph_ != NULL); | 469 ASSERT(graph_ != NULL); |
468 SmartArrayPointer<char> bailout_reason; | 470 SmartArrayPointer<char> bailout_reason; |
469 if (!graph_->Optimize(&bailout_reason)) { | 471 if (!graph_->Optimize(&bailout_reason)) { |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 isolate, Logger::TimerEventScope::v8_recompile_synchronous); | 1062 isolate, Logger::TimerEventScope::v8_recompile_synchronous); |
1061 // If crankshaft succeeded, install the optimized code else install | 1063 // If crankshaft succeeded, install the optimized code else install |
1062 // the unoptimized code. | 1064 // the unoptimized code. |
1063 OptimizingCompiler::Status status = optimizing_compiler->last_status(); | 1065 OptimizingCompiler::Status status = optimizing_compiler->last_status(); |
1064 if (info->HasAbortedDueToDependencyChange()) { | 1066 if (info->HasAbortedDueToDependencyChange()) { |
1065 info->set_bailout_reason("bailed out due to dependent map"); | 1067 info->set_bailout_reason("bailed out due to dependent map"); |
1066 status = optimizing_compiler->AbortOptimization(); | 1068 status = optimizing_compiler->AbortOptimization(); |
1067 } else if (status != OptimizingCompiler::SUCCEEDED) { | 1069 } else if (status != OptimizingCompiler::SUCCEEDED) { |
1068 info->set_bailout_reason("failed/bailed out last time"); | 1070 info->set_bailout_reason("failed/bailed out last time"); |
1069 status = optimizing_compiler->AbortOptimization(); | 1071 status = optimizing_compiler->AbortOptimization(); |
| 1072 } else if (isolate->DebuggerHasBreakPoints()) { |
| 1073 info->set_bailout_reason("debugger is active"); |
| 1074 status = optimizing_compiler->AbortOptimization(); |
1070 } else { | 1075 } else { |
1071 status = optimizing_compiler->GenerateAndInstallCode(); | 1076 status = optimizing_compiler->GenerateAndInstallCode(); |
1072 ASSERT(status == OptimizingCompiler::SUCCEEDED || | 1077 ASSERT(status == OptimizingCompiler::SUCCEEDED || |
1073 status == OptimizingCompiler::BAILED_OUT); | 1078 status == OptimizingCompiler::BAILED_OUT); |
1074 } | 1079 } |
1075 | 1080 |
1076 InstallCodeCommon(*info); | 1081 InstallCodeCommon(*info); |
1077 if (status == OptimizingCompiler::SUCCEEDED) { | 1082 if (status == OptimizingCompiler::SUCCEEDED) { |
1078 Handle<Code> code = info->code(); | 1083 Handle<Code> code = info->code(); |
1079 ASSERT(info->shared_info()->scope_info() != ScopeInfo::Empty(isolate)); | 1084 ASSERT(info->shared_info()->scope_info() != ScopeInfo::Empty(isolate)); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 | 1202 |
1198 // Log the code generation. If source information is available include | 1203 // Log the code generation. If source information is available include |
1199 // script name and line number. Check explicitly whether logging is | 1204 // script name and line number. Check explicitly whether logging is |
1200 // enabled as finding the line number is not free. | 1205 // enabled as finding the line number is not free. |
1201 if (info->isolate()->logger()->is_logging_code_events() || | 1206 if (info->isolate()->logger()->is_logging_code_events() || |
1202 info->isolate()->cpu_profiler()->is_profiling()) { | 1207 info->isolate()->cpu_profiler()->is_profiling()) { |
1203 Handle<Script> script = info->script(); | 1208 Handle<Script> script = info->script(); |
1204 Handle<Code> code = info->code(); | 1209 Handle<Code> code = info->code(); |
1205 if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) | 1210 if (*code == info->isolate()->builtins()->builtin(Builtins::kLazyCompile)) |
1206 return; | 1211 return; |
| 1212 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; |
| 1213 USE(line_num); |
1207 if (script->name()->IsString()) { | 1214 if (script->name()->IsString()) { |
1208 int line_num = GetScriptLineNumber(script, shared->start_position()) + 1; | |
1209 USE(line_num); | |
1210 PROFILE(info->isolate(), | 1215 PROFILE(info->isolate(), |
1211 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 1216 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
1212 *code, | 1217 *code, |
1213 *shared, | 1218 *shared, |
1214 info, | 1219 info, |
1215 String::cast(script->name()), | 1220 String::cast(script->name()), |
1216 line_num)); | 1221 line_num)); |
1217 } else { | 1222 } else { |
1218 PROFILE(info->isolate(), | 1223 PROFILE(info->isolate(), |
1219 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 1224 CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
1220 *code, | 1225 *code, |
1221 *shared, | 1226 *shared, |
1222 info, | 1227 info, |
1223 shared->DebugName())); | 1228 info->isolate()->heap()->empty_string(), |
| 1229 line_num)); |
1224 } | 1230 } |
1225 } | 1231 } |
1226 | 1232 |
1227 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1233 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
1228 Handle<Script>(info->script()), | 1234 Handle<Script>(info->script()), |
1229 Handle<Code>(info->code()), | 1235 Handle<Code>(info->code()), |
1230 info)); | 1236 info)); |
1231 } | 1237 } |
1232 | 1238 |
1233 | 1239 |
(...skipping 17 matching lines...) Expand all Loading... |
1251 | 1257 |
1252 | 1258 |
1253 bool CompilationPhase::ShouldProduceTraceOutput() const { | 1259 bool CompilationPhase::ShouldProduceTraceOutput() const { |
1254 // Produce trace output if flag is set so that the first letter of the | 1260 // Produce trace output if flag is set so that the first letter of the |
1255 // phase name matches the command line parameter FLAG_trace_phase. | 1261 // phase name matches the command line parameter FLAG_trace_phase. |
1256 return (FLAG_trace_hydrogen && | 1262 return (FLAG_trace_hydrogen && |
1257 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1263 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1258 } | 1264 } |
1259 | 1265 |
1260 } } // namespace v8::internal | 1266 } } // namespace v8::internal |
OLD | NEW |