| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "compiler.h" | 7 #include "compiler.h" |
| 8 | 8 |
| 9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
| 10 #include "codegen.h" | 10 #include "codegen.h" |
| (...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 log_tag, *code, *shared, info, script_name, line_num, column_num)); | 1265 log_tag, *code, *shared, info, script_name, line_num, column_num)); |
| 1266 } | 1266 } |
| 1267 | 1267 |
| 1268 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1268 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 1269 Handle<Script>(info->script()), | 1269 Handle<Script>(info->script()), |
| 1270 Handle<Code>(info->code()), | 1270 Handle<Code>(info->code()), |
| 1271 info)); | 1271 info)); |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 | 1274 |
| 1275 void Compiler::Optimize(JSFunction* function, const char* reason) { |
| 1276 ASSERT(function->IsOptimizable()); |
| 1277 |
| 1278 if (FLAG_trace_opt && function->PassesFilter(FLAG_hydrogen_filter)) { |
| 1279 PrintF("[marking "); |
| 1280 function->ShortPrint(); |
| 1281 PrintF(" for recompilation, reason: %s", reason); |
| 1282 if (FLAG_type_info_threshold > 0) { |
| 1283 int typeinfo, total, percentage; |
| 1284 Code* code = function->shared()->code(); |
| 1285 code->GetICCounts(&typeinfo, &total, &percentage); |
| 1286 PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, percentage); |
| 1287 } |
| 1288 PrintF("]\n"); |
| 1289 } |
| 1290 |
| 1291 Isolate* isolate = function->GetIsolate(); |
| 1292 |
| 1293 if (isolate->concurrent_recompilation_enabled() && |
| 1294 !isolate->bootstrapper()->IsActive()) { |
| 1295 if (isolate->concurrent_osr_enabled() && |
| 1296 isolate->optimizing_compiler_thread()->IsQueuedForOSR(function)) { |
| 1297 // Do not attempt regular recompilation if we already queued this for OSR. |
| 1298 // TODO(yangguo): This is necessary so that we don't install optimized |
| 1299 // code on a function that is already optimized, since OSR and regular |
| 1300 // recompilation race. This goes away as soon as OSR becomes one-shot. |
| 1301 return; |
| 1302 } |
| 1303 ASSERT(!function->IsInOptimizationQueue()); |
| 1304 function->MarkForConcurrentOptimization(); |
| 1305 } else { |
| 1306 // The next call to the function will trigger optimization. |
| 1307 function->MarkForOptimization(); |
| 1308 } |
| 1309 } |
| 1310 |
| 1311 |
| 1275 CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info) | 1312 CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info) |
| 1276 : name_(name), info_(info), zone_(info->isolate()) { | 1313 : name_(name), info_(info), zone_(info->isolate()) { |
| 1277 if (FLAG_hydrogen_stats) { | 1314 if (FLAG_hydrogen_stats) { |
| 1278 info_zone_start_allocation_size_ = info->zone()->allocation_size(); | 1315 info_zone_start_allocation_size_ = info->zone()->allocation_size(); |
| 1279 timer_.Start(); | 1316 timer_.Start(); |
| 1280 } | 1317 } |
| 1281 } | 1318 } |
| 1282 | 1319 |
| 1283 | 1320 |
| 1284 CompilationPhase::~CompilationPhase() { | 1321 CompilationPhase::~CompilationPhase() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1296 AllowHandleDereference allow_deref; | 1333 AllowHandleDereference allow_deref; |
| 1297 bool tracing_on = info()->IsStub() | 1334 bool tracing_on = info()->IsStub() |
| 1298 ? FLAG_trace_hydrogen_stubs | 1335 ? FLAG_trace_hydrogen_stubs |
| 1299 : (FLAG_trace_hydrogen && | 1336 : (FLAG_trace_hydrogen && |
| 1300 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1337 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1301 return (tracing_on && | 1338 return (tracing_on && |
| 1302 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1339 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1303 } | 1340 } |
| 1304 | 1341 |
| 1305 } } // namespace v8::internal | 1342 } } // namespace v8::internal |
| OLD | NEW |