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 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 | 1349 |
1350 private: | 1350 private: |
1351 Handle<SharedFunctionInfo>* sfis_; | 1351 Handle<SharedFunctionInfo>* sfis_; |
1352 Handle<Code>* code_objects_; | 1352 Handle<Code>* code_objects_; |
1353 int* count_; | 1353 int* count_; |
1354 }; | 1354 }; |
1355 | 1355 |
1356 | 1356 |
1357 static int EnumerateCompiledFunctions(Handle<SharedFunctionInfo>* sfis, | 1357 static int EnumerateCompiledFunctions(Handle<SharedFunctionInfo>* sfis, |
1358 Handle<Code>* code_objects) { | 1358 Handle<Code>* code_objects) { |
| 1359 HeapIterator iterator; |
1359 AssertNoAllocation no_alloc; | 1360 AssertNoAllocation no_alloc; |
1360 int compiled_funcs_count = 0; | 1361 int compiled_funcs_count = 0; |
1361 | 1362 |
1362 // Iterate the heap to find shared function info objects and record | 1363 // Iterate the heap to find shared function info objects and record |
1363 // the unoptimized code for them. | 1364 // the unoptimized code for them. |
1364 HeapIterator iterator; | |
1365 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1365 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1366 if (!obj->IsSharedFunctionInfo()) continue; | 1366 if (!obj->IsSharedFunctionInfo()) continue; |
1367 SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); | 1367 SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); |
1368 if (sfi->is_compiled() | 1368 if (sfi->is_compiled() |
1369 && (!sfi->script()->IsScript() | 1369 && (!sfi->script()->IsScript() |
1370 || Script::cast(sfi->script())->HasValidSource())) { | 1370 || Script::cast(sfi->script())->HasValidSource())) { |
1371 if (sfis != NULL) { | 1371 if (sfis != NULL) { |
1372 sfis[compiled_funcs_count] = Handle<SharedFunctionInfo>(sfi); | 1372 sfis[compiled_funcs_count] = Handle<SharedFunctionInfo>(sfi); |
1373 } | 1373 } |
1374 if (code_objects != NULL) { | 1374 if (code_objects != NULL) { |
(...skipping 137 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 HeapIterator iterator; |
1522 AssertNoAllocation no_alloc; | 1523 AssertNoAllocation no_alloc; |
1523 HeapIterator iterator; | |
1524 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1524 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1525 if (obj->IsCode()) LogCodeObject(obj); | 1525 if (obj->IsCode()) LogCodeObject(obj); |
1526 } | 1526 } |
1527 } | 1527 } |
1528 | 1528 |
1529 | 1529 |
1530 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, | 1530 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, |
1531 Handle<Code> code) { | 1531 Handle<Code> code) { |
1532 Handle<String> func_name(shared->DebugName()); | 1532 Handle<String> func_name(shared->DebugName()); |
1533 if (shared->script()->IsScript()) { | 1533 if (shared->script()->IsScript()) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1584 for (int i = 0; i < compiled_funcs_count; ++i) { | 1584 for (int i = 0; i < compiled_funcs_count; ++i) { |
1585 if (*code_objects[i] == Isolate::Current()->builtins()->builtin( | 1585 if (*code_objects[i] == Isolate::Current()->builtins()->builtin( |
1586 Builtins::kLazyCompile)) | 1586 Builtins::kLazyCompile)) |
1587 continue; | 1587 continue; |
1588 LogExistingFunction(sfis[i], code_objects[i]); | 1588 LogExistingFunction(sfis[i], code_objects[i]); |
1589 } | 1589 } |
1590 } | 1590 } |
1591 | 1591 |
1592 | 1592 |
1593 void Logger::LogAccessorCallbacks() { | 1593 void Logger::LogAccessorCallbacks() { |
| 1594 HeapIterator iterator; |
1594 AssertNoAllocation no_alloc; | 1595 AssertNoAllocation no_alloc; |
1595 HeapIterator iterator; | |
1596 i::Isolate* isolate = ISOLATE; | |
1597 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 1596 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
1598 if (!obj->IsAccessorInfo()) continue; | 1597 if (!obj->IsAccessorInfo()) continue; |
1599 AccessorInfo* ai = AccessorInfo::cast(obj); | 1598 AccessorInfo* ai = AccessorInfo::cast(obj); |
1600 if (!ai->name()->IsString()) continue; | 1599 if (!ai->name()->IsString()) continue; |
1601 String* name = String::cast(ai->name()); | 1600 String* name = String::cast(ai->name()); |
1602 Address getter_entry = v8::ToCData<Address>(ai->getter()); | 1601 Address getter_entry = v8::ToCData<Address>(ai->getter()); |
1603 if (getter_entry != 0) { | 1602 if (getter_entry != 0) { |
1604 PROFILE(isolate, GetterCallbackEvent(name, getter_entry)); | 1603 PROFILE(ISOLATE, GetterCallbackEvent(name, getter_entry)); |
1605 } | 1604 } |
1606 Address setter_entry = v8::ToCData<Address>(ai->setter()); | 1605 Address setter_entry = v8::ToCData<Address>(ai->setter()); |
1607 if (setter_entry != 0) { | 1606 if (setter_entry != 0) { |
1608 PROFILE(isolate, SetterCallbackEvent(name, setter_entry)); | 1607 PROFILE(ISOLATE, SetterCallbackEvent(name, setter_entry)); |
1609 } | 1608 } |
1610 } | 1609 } |
1611 } | 1610 } |
1612 | 1611 |
1613 | 1612 |
1614 bool Logger::Setup() { | 1613 bool Logger::Setup() { |
1615 // Tests and EnsureInitialize() can call this twice in a row. It's harmless. | 1614 // Tests and EnsureInitialize() can call this twice in a row. It's harmless. |
1616 if (is_initialized_) return true; | 1615 if (is_initialized_) return true; |
1617 is_initialized_ = true; | 1616 is_initialized_ = true; |
1618 | 1617 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 1764 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
1766 ASSERT(sampler->IsActive()); | 1765 ASSERT(sampler->IsActive()); |
1767 ScopedLock lock(mutex_); | 1766 ScopedLock lock(mutex_); |
1768 ASSERT(active_samplers_ != NULL); | 1767 ASSERT(active_samplers_ != NULL); |
1769 bool removed = active_samplers_->RemoveElement(sampler); | 1768 bool removed = active_samplers_->RemoveElement(sampler); |
1770 ASSERT(removed); | 1769 ASSERT(removed); |
1771 USE(removed); | 1770 USE(removed); |
1772 } | 1771 } |
1773 | 1772 |
1774 } } // namespace v8::internal | 1773 } } // namespace v8::internal |
OLD | NEW |