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 4836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4847 #ifdef ENABLE_LOGGING_AND_PROFILING | 4847 #ifdef ENABLE_LOGGING_AND_PROFILING |
4848 return LOGGER->GetActiveProfilerModules() & PROFILER_MODULE_CPU; | 4848 return LOGGER->GetActiveProfilerModules() & PROFILER_MODULE_CPU; |
4849 #else | 4849 #else |
4850 return true; | 4850 return true; |
4851 #endif | 4851 #endif |
4852 } | 4852 } |
4853 | 4853 |
4854 | 4854 |
4855 void V8::ResumeProfilerEx(int flags, int tag) { | 4855 void V8::ResumeProfilerEx(int flags, int tag) { |
4856 #ifdef ENABLE_LOGGING_AND_PROFILING | 4856 #ifdef ENABLE_LOGGING_AND_PROFILING |
4857 i::Isolate* isolate = i::Isolate::Current(); | 4857 i::Isolate* isolate = i::Isolate::Current(); |
Søren Thygesen Gjesse
2011/06/24 11:30:05
Is it correct that there is no GC now?
mnaganov (inactive)
2011/06/24 11:37:59
Yes. GC was here to grap a heap snaphot (because t
| |
4858 if (flags & PROFILER_MODULE_HEAP_SNAPSHOT) { | 4858 isolate->logger()->ResumeProfiler(flags, tag); |
4859 // Snapshot mode: resume modules, perform GC, then pause only | |
4860 // those modules which haven't been started prior to making a | |
4861 // snapshot. | |
4862 | |
4863 // Make a GC prior to taking a snapshot. | |
4864 isolate->heap()->CollectAllGarbage(false); | |
4865 // Reset snapshot flag and CPU module flags. | |
4866 flags &= ~(PROFILER_MODULE_HEAP_SNAPSHOT | PROFILER_MODULE_CPU); | |
4867 const int current_flags = isolate->logger()->GetActiveProfilerModules(); | |
4868 isolate->logger()->ResumeProfiler(flags, tag); | |
4869 isolate->heap()->CollectAllGarbage(false); | |
4870 isolate->logger()->PauseProfiler(~current_flags & flags, tag); | |
4871 } else { | |
4872 isolate->logger()->ResumeProfiler(flags, tag); | |
4873 } | |
4874 #endif | 4859 #endif |
4875 } | 4860 } |
4876 | 4861 |
4877 | 4862 |
4878 void V8::PauseProfilerEx(int flags, int tag) { | 4863 void V8::PauseProfilerEx(int flags, int tag) { |
4879 #ifdef ENABLE_LOGGING_AND_PROFILING | 4864 #ifdef ENABLE_LOGGING_AND_PROFILING |
4880 LOGGER->PauseProfiler(flags, tag); | 4865 LOGGER->PauseProfiler(flags, tag); |
4881 #endif | 4866 #endif |
4882 } | 4867 } |
4883 | 4868 |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5713 #else | 5698 #else |
5714 return v8::String::Empty(); | 5699 return v8::String::Empty(); |
5715 #endif | 5700 #endif |
5716 } | 5701 } |
5717 | 5702 |
5718 | 5703 |
5719 uint64_t HeapGraphNode::GetId() const { | 5704 uint64_t HeapGraphNode::GetId() const { |
5720 #ifdef ENABLE_LOGGING_AND_PROFILING | 5705 #ifdef ENABLE_LOGGING_AND_PROFILING |
5721 i::Isolate* isolate = i::Isolate::Current(); | 5706 i::Isolate* isolate = i::Isolate::Current(); |
5722 IsDeadCheck(isolate, "v8::HeapGraphNode::GetId"); | 5707 IsDeadCheck(isolate, "v8::HeapGraphNode::GetId"); |
5723 ASSERT(ToInternal(this)->snapshot()->type() != i::HeapSnapshot::kAggregated); | |
5724 return ToInternal(this)->id(); | 5708 return ToInternal(this)->id(); |
5725 #else | 5709 #else |
5726 return 0; | 5710 return 0; |
5727 #endif | 5711 #endif |
5728 } | 5712 } |
5729 | 5713 |
5730 | 5714 |
5731 int HeapGraphNode::GetInstancesCount() const { | |
5732 #ifdef ENABLE_LOGGING_AND_PROFILING | |
5733 i::Isolate* isolate = i::Isolate::Current(); | |
5734 IsDeadCheck(isolate, "v8::HeapGraphNode::GetInstancesCount"); | |
5735 ASSERT(ToInternal(this)->snapshot()->type() == i::HeapSnapshot::kAggregated); | |
5736 return static_cast<int>(ToInternal(this)->id()); | |
5737 #else | |
5738 return 0; | |
5739 #endif | |
5740 } | |
5741 | |
5742 | |
5743 int HeapGraphNode::GetSelfSize() const { | 5715 int HeapGraphNode::GetSelfSize() const { |
5744 #ifdef ENABLE_LOGGING_AND_PROFILING | 5716 #ifdef ENABLE_LOGGING_AND_PROFILING |
5745 i::Isolate* isolate = i::Isolate::Current(); | 5717 i::Isolate* isolate = i::Isolate::Current(); |
5746 IsDeadCheck(isolate, "v8::HeapGraphNode::GetSelfSize"); | 5718 IsDeadCheck(isolate, "v8::HeapGraphNode::GetSelfSize"); |
5747 return ToInternal(this)->self_size(); | 5719 return ToInternal(this)->self_size(); |
5748 #else | 5720 #else |
5749 return 0; | 5721 return 0; |
5750 #endif | 5722 #endif |
5751 } | 5723 } |
5752 | 5724 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5980 HeapSnapshot::Type type, | 5952 HeapSnapshot::Type type, |
5981 ActivityControl* control) { | 5953 ActivityControl* control) { |
5982 #ifdef ENABLE_LOGGING_AND_PROFILING | 5954 #ifdef ENABLE_LOGGING_AND_PROFILING |
5983 i::Isolate* isolate = i::Isolate::Current(); | 5955 i::Isolate* isolate = i::Isolate::Current(); |
5984 IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot"); | 5956 IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot"); |
5985 i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull; | 5957 i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull; |
5986 switch (type) { | 5958 switch (type) { |
5987 case HeapSnapshot::kFull: | 5959 case HeapSnapshot::kFull: |
5988 internal_type = i::HeapSnapshot::kFull; | 5960 internal_type = i::HeapSnapshot::kFull; |
5989 break; | 5961 break; |
5990 case HeapSnapshot::kAggregated: | |
5991 internal_type = i::HeapSnapshot::kAggregated; | |
5992 break; | |
5993 default: | 5962 default: |
5994 UNREACHABLE(); | 5963 UNREACHABLE(); |
5995 } | 5964 } |
5996 return reinterpret_cast<const HeapSnapshot*>( | 5965 return reinterpret_cast<const HeapSnapshot*>( |
5997 i::HeapProfiler::TakeSnapshot( | 5966 i::HeapProfiler::TakeSnapshot( |
5998 *Utils::OpenHandle(*title), internal_type, control)); | 5967 *Utils::OpenHandle(*title), internal_type, control)); |
5999 #else | 5968 #else |
6000 return NULL; | 5969 return NULL; |
6001 #endif | 5970 #endif |
6002 } | 5971 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6148 | 6117 |
6149 | 6118 |
6150 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 6119 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
6151 HandleScopeImplementer* scope_implementer = | 6120 HandleScopeImplementer* scope_implementer = |
6152 reinterpret_cast<HandleScopeImplementer*>(storage); | 6121 reinterpret_cast<HandleScopeImplementer*>(storage); |
6153 scope_implementer->IterateThis(v); | 6122 scope_implementer->IterateThis(v); |
6154 return storage + ArchiveSpacePerThread(); | 6123 return storage + ArchiveSpacePerThread(); |
6155 } | 6124 } |
6156 | 6125 |
6157 } } // namespace v8::internal | 6126 } } // namespace v8::internal |
OLD | NEW |