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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), | 84 shared_info_(Handle<SharedFunctionInfo>(closure->shared())), |
85 script_(Handle<Script>(Script::cast(shared_info_->script()))), | 85 script_(Handle<Script>(Script::cast(shared_info_->script()))), |
86 context_(closure->context()), | 86 context_(closure->context()), |
87 osr_ast_id_(BailoutId::None()), | 87 osr_ast_id_(BailoutId::None()), |
88 osr_pc_offset_(0), | 88 osr_pc_offset_(0), |
89 parameter_count_(0) { | 89 parameter_count_(0) { |
90 Initialize(script_->GetIsolate(), BASE, zone); | 90 Initialize(script_->GetIsolate(), BASE, zone); |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 void CompilationInfo::CreateCodeObject() { | |
Toon Verwaest
2013/12/18 16:11:41
That's a funny name. It doesn't actually create a
Jarin
2013/12/30 15:15:47
I am sorry, the whole CodeObject business is not n
| |
95 closure_code_object_ = Handle<Object>(isolate()->heap()->undefined_value(), | |
96 isolate()); | |
Toon Verwaest
2013/12/18 16:11:41
isolate()->factory()->undefined_value() is already
| |
97 } | |
98 | |
94 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, | 99 CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, |
95 Isolate* isolate, | 100 Isolate* isolate, |
96 Zone* zone) | 101 Zone* zone) |
97 : flags_(LanguageModeField::encode(CLASSIC_MODE) | | 102 : flags_(LanguageModeField::encode(CLASSIC_MODE) | |
98 IsLazy::encode(true)), | 103 IsLazy::encode(true)), |
99 osr_ast_id_(BailoutId::None()), | 104 osr_ast_id_(BailoutId::None()), |
100 osr_pc_offset_(0), | 105 osr_pc_offset_(0), |
101 parameter_count_(0) { | 106 parameter_count_(0) { |
102 Initialize(isolate, STUB, zone); | 107 Initialize(isolate, STUB, zone); |
103 code_stub_ = stub; | 108 code_stub_ = stub; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 time_taken_to_optimize_, | 306 time_taken_to_optimize_, |
302 time_taken_to_codegen_); | 307 time_taken_to_codegen_); |
303 } | 308 } |
304 } | 309 } |
305 | 310 |
306 | 311 |
307 // A return value of true indicates the compilation pipeline is still | 312 // A return value of true indicates the compilation pipeline is still |
308 // going, not necessarily that we optimized the code. | 313 // going, not necessarily that we optimized the code. |
309 static bool MakeCrankshaftCode(CompilationInfo* info) { | 314 static bool MakeCrankshaftCode(CompilationInfo* info) { |
310 RecompileJob job(info); | 315 RecompileJob job(info); |
316 | |
317 info->CreateCodeObject(); | |
318 | |
311 RecompileJob::Status status = job.CreateGraph(); | 319 RecompileJob::Status status = job.CreateGraph(); |
312 | 320 |
313 if (status != RecompileJob::SUCCEEDED) { | 321 if (status != RecompileJob::SUCCEEDED) { |
314 return status != RecompileJob::FAILED; | 322 return status != RecompileJob::FAILED; |
315 } | 323 } |
316 status = job.OptimizeGraph(); | 324 status = job.OptimizeGraph(); |
317 if (status != RecompileJob::SUCCEEDED) { | 325 if (status != RecompileJob::SUCCEEDED) { |
318 status = job.AbortOptimization(); | 326 status = job.AbortOptimization(); |
319 return status != RecompileJob::FAILED; | 327 return status != RecompileJob::FAILED; |
320 } | 328 } |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1068 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { | 1076 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { |
1069 if (FLAG_trace_concurrent_recompilation) { | 1077 if (FLAG_trace_concurrent_recompilation) { |
1070 PrintF(" ** Compilation queue full, will retry optimizing "); | 1078 PrintF(" ** Compilation queue full, will retry optimizing "); |
1071 closure->PrintName(); | 1079 closure->PrintName(); |
1072 PrintF(" on next run.\n"); | 1080 PrintF(" on next run.\n"); |
1073 } | 1081 } |
1074 return false; | 1082 return false; |
1075 } | 1083 } |
1076 | 1084 |
1077 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); | 1085 SmartPointer<CompilationInfo> info(new CompilationInfoWithZone(closure)); |
1086 | |
1078 Handle<SharedFunctionInfo> shared = info->shared_info(); | 1087 Handle<SharedFunctionInfo> shared = info->shared_info(); |
1079 | 1088 |
1080 if (compiling_for_osr) { | 1089 if (compiling_for_osr) { |
1081 BailoutId osr_ast_id = unoptimized->TranslatePcOffsetToAstId(osr_pc_offset); | 1090 BailoutId osr_ast_id = unoptimized->TranslatePcOffsetToAstId(osr_pc_offset); |
1082 ASSERT(!osr_ast_id.IsNone()); | 1091 ASSERT(!osr_ast_id.IsNone()); |
1083 info->SetOptimizing(osr_ast_id); | 1092 info->SetOptimizing(osr_ast_id); |
1084 info->SetOsrInfo(unoptimized, osr_pc_offset); | 1093 info->SetOsrInfo(unoptimized, osr_pc_offset); |
1085 | 1094 |
1086 if (FLAG_trace_osr) { | 1095 if (FLAG_trace_osr) { |
1087 PrintF("[COSR - attempt to queue "); | 1096 PrintF("[COSR - attempt to queue "); |
(...skipping 15 matching lines...) Expand all Loading... | |
1103 | 1112 |
1104 if (!compiling_for_osr && InstallCodeFromOptimizedCodeMap(info.get())) { | 1113 if (!compiling_for_osr && InstallCodeFromOptimizedCodeMap(info.get())) { |
1105 return true; | 1114 return true; |
1106 } | 1115 } |
1107 | 1116 |
1108 if (Parser::Parse(info.get())) { | 1117 if (Parser::Parse(info.get())) { |
1109 LanguageMode language_mode = info->function()->language_mode(); | 1118 LanguageMode language_mode = info->function()->language_mode(); |
1110 info->SetLanguageMode(language_mode); | 1119 info->SetLanguageMode(language_mode); |
1111 shared->set_language_mode(language_mode); | 1120 shared->set_language_mode(language_mode); |
1112 info->SaveHandles(); | 1121 info->SaveHandles(); |
1122 info->CreateCodeObject(); | |
1113 | 1123 |
1114 if (Rewriter::Rewrite(info.get()) && Scope::Analyze(info.get())) { | 1124 if (Rewriter::Rewrite(info.get()) && Scope::Analyze(info.get())) { |
1115 RecompileJob* job = new(info->zone()) RecompileJob(info.get()); | 1125 RecompileJob* job = new(info->zone()) RecompileJob(info.get()); |
1116 RecompileJob::Status status = job->CreateGraph(); | 1126 RecompileJob::Status status = job->CreateGraph(); |
1117 if (status == RecompileJob::SUCCEEDED) { | 1127 if (status == RecompileJob::SUCCEEDED) { |
1118 info.Detach(); | 1128 info.Detach(); |
1119 unoptimized->set_profiler_ticks(0); | 1129 unoptimized->set_profiler_ticks(0); |
1120 isolate->optimizing_compiler_thread()->QueueForOptimization(job); | 1130 isolate->optimizing_compiler_thread()->QueueForOptimization(job); |
1121 ASSERT(!isolate->has_pending_exception()); | 1131 ASSERT(!isolate->has_pending_exception()); |
1122 return true; | 1132 return true; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1360 AllowHandleDereference allow_deref; | 1370 AllowHandleDereference allow_deref; |
1361 bool tracing_on = info()->IsStub() | 1371 bool tracing_on = info()->IsStub() |
1362 ? FLAG_trace_hydrogen_stubs | 1372 ? FLAG_trace_hydrogen_stubs |
1363 : (FLAG_trace_hydrogen && | 1373 : (FLAG_trace_hydrogen && |
1364 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1374 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1365 return (tracing_on && | 1375 return (tracing_on && |
1366 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1376 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1367 } | 1377 } |
1368 | 1378 |
1369 } } // namespace v8::internal | 1379 } } // namespace v8::internal |
OLD | NEW |