OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 "src/log.h" | 5 #include "src/log.h" |
6 | 6 |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include <memory> | 8 #include <memory> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1370 int compiled_funcs_count = 0; | 1370 int compiled_funcs_count = 0; |
1371 | 1371 |
1372 // Iterate the heap to find shared function info objects and record | 1372 // Iterate the heap to find shared function info objects and record |
1373 // the unoptimized code for them. | 1373 // the unoptimized code for them. |
1374 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1374 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1375 if (!obj->IsSharedFunctionInfo()) continue; | 1375 if (!obj->IsSharedFunctionInfo()) continue; |
1376 SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); | 1376 SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); |
1377 if (sfi->is_compiled() | 1377 if (sfi->is_compiled() |
1378 && (!sfi->script()->IsScript() | 1378 && (!sfi->script()->IsScript() |
1379 || Script::cast(sfi->script())->HasValidSource())) { | 1379 || Script::cast(sfi->script())->HasValidSource())) { |
1380 if (sfis != NULL) { | 1380 // In some cases, an SFI might have (and have executing!) both bytecode |
1381 sfis[compiled_funcs_count] = Handle<SharedFunctionInfo>(sfi); | 1381 // and baseline code, so check for both and add them both if needed. |
1382 | |
rmcilroy
2017/01/03 12:05:30
nit - drop the newline
Leszek Swirski
2017/01/03 12:22:45
Done.
| |
1383 if (sfi->HasBytecodeArray()) { | |
1384 if (sfis != NULL) { | |
1385 sfis[compiled_funcs_count] = Handle<SharedFunctionInfo>(sfi); | |
1386 } | |
1387 if (code_objects != NULL) { | |
1388 code_objects[compiled_funcs_count] = | |
1389 Handle<AbstractCode>(AbstractCode::cast(sfi->bytecode_array())); | |
1390 } | |
1391 ++compiled_funcs_count; | |
1382 } | 1392 } |
1383 if (code_objects != NULL) { | 1393 |
1384 code_objects[compiled_funcs_count] = | 1394 if (!sfi->IsInterpreted()) { |
rmcilroy
2017/01/03 12:05:30
This should be HasBaselineCode instead
Leszek Swirski
2017/01/03 12:22:45
This would change previous behaviour, which also i
| |
1385 Handle<AbstractCode>(sfi->abstract_code()); | 1395 if (sfis != NULL) { |
1396 sfis[compiled_funcs_count] = Handle<SharedFunctionInfo>(sfi); | |
1397 } | |
1398 if (code_objects != NULL) { | |
1399 code_objects[compiled_funcs_count] = | |
1400 Handle<AbstractCode>(AbstractCode::cast(sfi->code())); | |
1401 } | |
1402 ++compiled_funcs_count; | |
rmcilroy
2017/01/03 12:05:30
nit - could you pull the duplicate code out into a
Leszek Swirski
2017/01/03 12:22:45
Done.
| |
1386 } | 1403 } |
1387 ++compiled_funcs_count; | |
1388 } | 1404 } |
1389 } | 1405 } |
1390 | 1406 |
1391 // Iterate all optimized functions in all contexts. | 1407 // Iterate all optimized functions in all contexts. |
1392 EnumerateOptimizedFunctionsVisitor visitor(sfis, | 1408 EnumerateOptimizedFunctionsVisitor visitor(sfis, |
1393 code_objects, | 1409 code_objects, |
1394 &compiled_funcs_count); | 1410 &compiled_funcs_count); |
1395 Deoptimizer::VisitAllOptimizedFunctions(heap->isolate(), &visitor); | 1411 Deoptimizer::VisitAllOptimizedFunctions(heap->isolate(), &visitor); |
1396 | 1412 |
1397 return compiled_funcs_count; | 1413 return compiled_funcs_count; |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1780 | 1796 |
1781 if (profiler_listener_.get() != nullptr) { | 1797 if (profiler_listener_.get() != nullptr) { |
1782 removeCodeEventListener(profiler_listener_.get()); | 1798 removeCodeEventListener(profiler_listener_.get()); |
1783 } | 1799 } |
1784 | 1800 |
1785 return log_->Close(); | 1801 return log_->Close(); |
1786 } | 1802 } |
1787 | 1803 |
1788 } // namespace internal | 1804 } // namespace internal |
1789 } // namespace v8 | 1805 } // namespace v8 |
OLD | NEW |