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 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 | 1514 |
1515 | 1515 |
1516 void Logger::LowLevelLogWriteBytes(const char* bytes, int size) { | 1516 void Logger::LowLevelLogWriteBytes(const char* bytes, int size) { |
1517 size_t rv = fwrite(bytes, 1, size, log_->ll_output_handle_); | 1517 size_t rv = fwrite(bytes, 1, size, log_->ll_output_handle_); |
1518 ASSERT(static_cast<size_t>(size) == rv); | 1518 ASSERT(static_cast<size_t>(size) == rv); |
1519 USE(rv); | 1519 USE(rv); |
1520 } | 1520 } |
1521 | 1521 |
1522 | 1522 |
1523 void Logger::LogCodeObjects() { | 1523 void Logger::LogCodeObjects() { |
1524 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask); | 1524 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 1525 "Logger::LogCodeObjects"); |
1525 HeapIterator iterator; | 1526 HeapIterator iterator; |
1526 AssertNoAllocation no_alloc; | 1527 AssertNoAllocation no_alloc; |
1527 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1528 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1528 if (obj->IsCode()) LogCodeObject(obj); | 1529 if (obj->IsCode()) LogCodeObject(obj); |
1529 } | 1530 } |
1530 } | 1531 } |
1531 | 1532 |
1532 | 1533 |
1533 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, | 1534 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, |
1534 Handle<Code> code) { | 1535 Handle<Code> code) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 } | 1570 } |
1570 } else { | 1571 } else { |
1571 PROFILE(ISOLATE, | 1572 PROFILE(ISOLATE, |
1572 CodeCreateEvent( | 1573 CodeCreateEvent( |
1573 Logger::LAZY_COMPILE_TAG, *code, *shared, *func_name)); | 1574 Logger::LAZY_COMPILE_TAG, *code, *shared, *func_name)); |
1574 } | 1575 } |
1575 } | 1576 } |
1576 | 1577 |
1577 | 1578 |
1578 void Logger::LogCompiledFunctions() { | 1579 void Logger::LogCompiledFunctions() { |
1579 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask); | 1580 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 1581 "Logger::LogCompiledFunctions"); |
1580 HandleScope scope; | 1582 HandleScope scope; |
1581 const int compiled_funcs_count = EnumerateCompiledFunctions(NULL, NULL); | 1583 const int compiled_funcs_count = EnumerateCompiledFunctions(NULL, NULL); |
1582 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); | 1584 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); |
1583 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); | 1585 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); |
1584 EnumerateCompiledFunctions(sfis.start(), code_objects.start()); | 1586 EnumerateCompiledFunctions(sfis.start(), code_objects.start()); |
1585 | 1587 |
1586 // During iteration, there can be heap allocation due to | 1588 // During iteration, there can be heap allocation due to |
1587 // GetScriptLineNumber call. | 1589 // GetScriptLineNumber call. |
1588 for (int i = 0; i < compiled_funcs_count; ++i) { | 1590 for (int i = 0; i < compiled_funcs_count; ++i) { |
1589 if (*code_objects[i] == Isolate::Current()->builtins()->builtin( | 1591 if (*code_objects[i] == Isolate::Current()->builtins()->builtin( |
1590 Builtins::kLazyCompile)) | 1592 Builtins::kLazyCompile)) |
1591 continue; | 1593 continue; |
1592 LogExistingFunction(sfis[i], code_objects[i]); | 1594 LogExistingFunction(sfis[i], code_objects[i]); |
1593 } | 1595 } |
1594 } | 1596 } |
1595 | 1597 |
1596 | 1598 |
1597 void Logger::LogAccessorCallbacks() { | 1599 void Logger::LogAccessorCallbacks() { |
1598 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask); | 1600 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 1601 "Logger::LogAccessorCallbacks"); |
1599 HeapIterator iterator; | 1602 HeapIterator iterator; |
1600 AssertNoAllocation no_alloc; | 1603 AssertNoAllocation no_alloc; |
1601 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1604 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1602 if (!obj->IsAccessorInfo()) continue; | 1605 if (!obj->IsAccessorInfo()) continue; |
1603 AccessorInfo* ai = AccessorInfo::cast(obj); | 1606 AccessorInfo* ai = AccessorInfo::cast(obj); |
1604 if (!ai->name()->IsString()) continue; | 1607 if (!ai->name()->IsString()) continue; |
1605 String* name = String::cast(ai->name()); | 1608 String* name = String::cast(ai->name()); |
1606 Address getter_entry = v8::ToCData<Address>(ai->getter()); | 1609 Address getter_entry = v8::ToCData<Address>(ai->getter()); |
1607 if (getter_entry != 0) { | 1610 if (getter_entry != 0) { |
1608 PROFILE(ISOLATE, GetterCallbackEvent(name, getter_entry)); | 1611 PROFILE(ISOLATE, GetterCallbackEvent(name, getter_entry)); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1769 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 1772 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
1770 ASSERT(sampler->IsActive()); | 1773 ASSERT(sampler->IsActive()); |
1771 ScopedLock lock(mutex_); | 1774 ScopedLock lock(mutex_); |
1772 ASSERT(active_samplers_ != NULL); | 1775 ASSERT(active_samplers_ != NULL); |
1773 bool removed = active_samplers_->RemoveElement(sampler); | 1776 bool removed = active_samplers_->RemoveElement(sampler); |
1774 ASSERT(removed); | 1777 ASSERT(removed); |
1775 USE(removed); | 1778 USE(removed); |
1776 } | 1779 } |
1777 | 1780 |
1778 } } // namespace v8::internal | 1781 } } // namespace v8::internal |
OLD | NEW |