OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1512 | 1512 |
1513 | 1513 |
1514 void Logger::LowLevelLogWriteBytes(const char* bytes, int size) { | 1514 void Logger::LowLevelLogWriteBytes(const char* bytes, int size) { |
1515 size_t rv = fwrite(bytes, 1, size, log_->ll_output_handle_); | 1515 size_t rv = fwrite(bytes, 1, size, log_->ll_output_handle_); |
1516 ASSERT(static_cast<size_t>(size) == rv); | 1516 ASSERT(static_cast<size_t>(size) == rv); |
1517 USE(rv); | 1517 USE(rv); |
1518 } | 1518 } |
1519 | 1519 |
1520 | 1520 |
1521 void Logger::LogCodeObjects() { | 1521 void Logger::LogCodeObjects() { |
1522 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask); | |
1522 HeapIterator iterator; | 1523 HeapIterator iterator; |
1523 AssertNoAllocation no_alloc; | 1524 AssertNoAllocation no_alloc; |
1524 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1525 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1525 if (obj->IsCode()) LogCodeObject(obj); | 1526 if (obj->IsCode()) LogCodeObject(obj); |
1526 } | 1527 } |
1527 } | 1528 } |
1528 | 1529 |
1529 | 1530 |
1530 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, | 1531 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, |
1531 Handle<Code> code) { | 1532 Handle<Code> code) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1566 } | 1567 } |
1567 } else { | 1568 } else { |
1568 PROFILE(ISOLATE, | 1569 PROFILE(ISOLATE, |
1569 CodeCreateEvent( | 1570 CodeCreateEvent( |
1570 Logger::LAZY_COMPILE_TAG, *code, *shared, *func_name)); | 1571 Logger::LAZY_COMPILE_TAG, *code, *shared, *func_name)); |
1571 } | 1572 } |
1572 } | 1573 } |
1573 | 1574 |
1574 | 1575 |
1575 void Logger::LogCompiledFunctions() { | 1576 void Logger::LogCompiledFunctions() { |
1577 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask); | |
1576 HandleScope scope; | 1578 HandleScope scope; |
1577 const int compiled_funcs_count = EnumerateCompiledFunctions(NULL, NULL); | 1579 const int compiled_funcs_count = EnumerateCompiledFunctions(NULL, NULL); |
Vyacheslav Egorov (Chromium)
2011/09/29 15:01:28
add
AssertNoAllocation no_alloc;
for the sake o
mnaganov (inactive)
2011/09/29 15:06:41
It's already stated in EnumerateCompiledFunctions.
| |
1578 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); | 1580 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); |
1579 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); | 1581 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); |
1580 EnumerateCompiledFunctions(sfis.start(), code_objects.start()); | 1582 EnumerateCompiledFunctions(sfis.start(), code_objects.start()); |
1581 | 1583 |
1582 // During iteration, there can be heap allocation due to | 1584 // During iteration, there can be heap allocation due to |
1583 // GetScriptLineNumber call. | 1585 // GetScriptLineNumber call. |
1584 for (int i = 0; i < compiled_funcs_count; ++i) { | 1586 for (int i = 0; i < compiled_funcs_count; ++i) { |
1585 if (*code_objects[i] == Isolate::Current()->builtins()->builtin( | 1587 if (*code_objects[i] == Isolate::Current()->builtins()->builtin( |
1586 Builtins::kLazyCompile)) | 1588 Builtins::kLazyCompile)) |
1587 continue; | 1589 continue; |
1588 LogExistingFunction(sfis[i], code_objects[i]); | 1590 LogExistingFunction(sfis[i], code_objects[i]); |
1589 } | 1591 } |
1590 } | 1592 } |
1591 | 1593 |
1592 | 1594 |
1593 void Logger::LogAccessorCallbacks() { | 1595 void Logger::LogAccessorCallbacks() { |
1596 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask); | |
1594 HeapIterator iterator; | 1597 HeapIterator iterator; |
1595 AssertNoAllocation no_alloc; | 1598 AssertNoAllocation no_alloc; |
1596 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1599 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1597 if (!obj->IsAccessorInfo()) continue; | 1600 if (!obj->IsAccessorInfo()) continue; |
1598 AccessorInfo* ai = AccessorInfo::cast(obj); | 1601 AccessorInfo* ai = AccessorInfo::cast(obj); |
1599 if (!ai->name()->IsString()) continue; | 1602 if (!ai->name()->IsString()) continue; |
1600 String* name = String::cast(ai->name()); | 1603 String* name = String::cast(ai->name()); |
1601 Address getter_entry = v8::ToCData<Address>(ai->getter()); | 1604 Address getter_entry = v8::ToCData<Address>(ai->getter()); |
1602 if (getter_entry != 0) { | 1605 if (getter_entry != 0) { |
1603 PROFILE(ISOLATE, GetterCallbackEvent(name, getter_entry)); | 1606 PROFILE(ISOLATE, GetterCallbackEvent(name, getter_entry)); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1764 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 1767 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
1765 ASSERT(sampler->IsActive()); | 1768 ASSERT(sampler->IsActive()); |
1766 ScopedLock lock(mutex_); | 1769 ScopedLock lock(mutex_); |
1767 ASSERT(active_samplers_ != NULL); | 1770 ASSERT(active_samplers_ != NULL); |
1768 bool removed = active_samplers_->RemoveElement(sampler); | 1771 bool removed = active_samplers_->RemoveElement(sampler); |
1769 ASSERT(removed); | 1772 ASSERT(removed); |
1770 USE(removed); | 1773 USE(removed); |
1771 } | 1774 } |
1772 | 1775 |
1773 } } // namespace v8::internal | 1776 } } // namespace v8::internal |
OLD | NEW |