OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 4574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4585 | 4585 |
4586 Handle<String> HeapGraphNode::GetName() const { | 4586 Handle<String> HeapGraphNode::GetName() const { |
4587 IsDeadCheck("v8::HeapGraphNode::GetName"); | 4587 IsDeadCheck("v8::HeapGraphNode::GetName"); |
4588 return Handle<String>(ToApi<String>(i::Factory::LookupAsciiSymbol( | 4588 return Handle<String>(ToApi<String>(i::Factory::LookupAsciiSymbol( |
4589 ToInternal(this)->name()))); | 4589 ToInternal(this)->name()))); |
4590 } | 4590 } |
4591 | 4591 |
4592 | 4592 |
4593 uint64_t HeapGraphNode::GetId() const { | 4593 uint64_t HeapGraphNode::GetId() const { |
4594 IsDeadCheck("v8::HeapGraphNode::GetId"); | 4594 IsDeadCheck("v8::HeapGraphNode::GetId"); |
| 4595 ASSERT(ToInternal(this)->snapshot()->type() != i::HeapSnapshot::kAggregated); |
4595 return ToInternal(this)->id(); | 4596 return ToInternal(this)->id(); |
4596 } | 4597 } |
4597 | 4598 |
4598 | 4599 |
| 4600 int HeapGraphNode::GetInstancesCount() const { |
| 4601 IsDeadCheck("v8::HeapGraphNode::GetInstancesCount"); |
| 4602 ASSERT(ToInternal(this)->snapshot()->type() == i::HeapSnapshot::kAggregated); |
| 4603 return static_cast<int>(ToInternal(this)->id()); |
| 4604 } |
| 4605 |
| 4606 |
4599 int HeapGraphNode::GetSelfSize() const { | 4607 int HeapGraphNode::GetSelfSize() const { |
4600 IsDeadCheck("v8::HeapGraphNode::GetSelfSize"); | 4608 IsDeadCheck("v8::HeapGraphNode::GetSelfSize"); |
4601 return ToInternal(this)->self_size(); | 4609 return ToInternal(this)->self_size(); |
4602 } | 4610 } |
4603 | 4611 |
4604 | 4612 |
4605 int HeapGraphNode::GetReachableSize() const { | 4613 int HeapGraphNode::GetReachableSize() const { |
4606 IsDeadCheck("v8::HeapSnapshot::GetReachableSize"); | 4614 IsDeadCheck("v8::HeapSnapshot::GetReachableSize"); |
4607 return ToInternal(this)->ReachableSize(); | 4615 return ToInternal(this)->ReachableSize(); |
4608 } | 4616 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4670 return reinterpret_cast<const HeapGraphNode*>(diff->deletions_root()); | 4678 return reinterpret_cast<const HeapGraphNode*>(diff->deletions_root()); |
4671 } | 4679 } |
4672 | 4680 |
4673 | 4681 |
4674 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { | 4682 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { |
4675 return const_cast<i::HeapSnapshot*>( | 4683 return const_cast<i::HeapSnapshot*>( |
4676 reinterpret_cast<const i::HeapSnapshot*>(snapshot)); | 4684 reinterpret_cast<const i::HeapSnapshot*>(snapshot)); |
4677 } | 4685 } |
4678 | 4686 |
4679 | 4687 |
| 4688 HeapSnapshot::Type HeapSnapshot::GetType() const { |
| 4689 IsDeadCheck("v8::HeapSnapshot::GetType"); |
| 4690 return static_cast<HeapSnapshot::Type>(ToInternal(this)->type()); |
| 4691 } |
| 4692 |
| 4693 |
4680 unsigned HeapSnapshot::GetUid() const { | 4694 unsigned HeapSnapshot::GetUid() const { |
4681 IsDeadCheck("v8::HeapSnapshot::GetUid"); | 4695 IsDeadCheck("v8::HeapSnapshot::GetUid"); |
4682 return ToInternal(this)->uid(); | 4696 return ToInternal(this)->uid(); |
4683 } | 4697 } |
4684 | 4698 |
4685 | 4699 |
4686 Handle<String> HeapSnapshot::GetTitle() const { | 4700 Handle<String> HeapSnapshot::GetTitle() const { |
4687 IsDeadCheck("v8::HeapSnapshot::GetTitle"); | 4701 IsDeadCheck("v8::HeapSnapshot::GetTitle"); |
4688 return Handle<String>(ToApi<String>(i::Factory::LookupAsciiSymbol( | 4702 return Handle<String>(ToApi<String>(i::Factory::LookupAsciiSymbol( |
4689 ToInternal(this)->title()))); | 4703 ToInternal(this)->title()))); |
(...skipping 27 matching lines...) Expand all Loading... |
4717 } | 4731 } |
4718 | 4732 |
4719 | 4733 |
4720 const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { | 4734 const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { |
4721 IsDeadCheck("v8::HeapProfiler::FindSnapshot"); | 4735 IsDeadCheck("v8::HeapProfiler::FindSnapshot"); |
4722 return reinterpret_cast<const HeapSnapshot*>( | 4736 return reinterpret_cast<const HeapSnapshot*>( |
4723 i::HeapProfiler::FindSnapshot(uid)); | 4737 i::HeapProfiler::FindSnapshot(uid)); |
4724 } | 4738 } |
4725 | 4739 |
4726 | 4740 |
4727 const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title) { | 4741 const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title, |
| 4742 HeapSnapshot::Type type) { |
4728 IsDeadCheck("v8::HeapProfiler::TakeSnapshot"); | 4743 IsDeadCheck("v8::HeapProfiler::TakeSnapshot"); |
| 4744 i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull; |
| 4745 switch (type) { |
| 4746 case HeapSnapshot::kFull: |
| 4747 internal_type = i::HeapSnapshot::kFull; |
| 4748 break; |
| 4749 case HeapSnapshot::kAggregated: |
| 4750 internal_type = i::HeapSnapshot::kAggregated; |
| 4751 break; |
| 4752 default: |
| 4753 UNREACHABLE(); |
| 4754 } |
4729 return reinterpret_cast<const HeapSnapshot*>( | 4755 return reinterpret_cast<const HeapSnapshot*>( |
4730 i::HeapProfiler::TakeSnapshot(*Utils::OpenHandle(*title))); | 4756 i::HeapProfiler::TakeSnapshot(*Utils::OpenHandle(*title), internal_type)); |
4731 } | 4757 } |
4732 | 4758 |
4733 #endif // ENABLE_LOGGING_AND_PROFILING | 4759 #endif // ENABLE_LOGGING_AND_PROFILING |
4734 | 4760 |
4735 | 4761 |
4736 namespace internal { | 4762 namespace internal { |
4737 | 4763 |
4738 | 4764 |
4739 HandleScopeImplementer* HandleScopeImplementer::instance() { | 4765 HandleScopeImplementer* HandleScopeImplementer::instance() { |
4740 return &thread_local; | 4766 return &thread_local; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4809 | 4835 |
4810 | 4836 |
4811 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 4837 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
4812 HandleScopeImplementer* thread_local = | 4838 HandleScopeImplementer* thread_local = |
4813 reinterpret_cast<HandleScopeImplementer*>(storage); | 4839 reinterpret_cast<HandleScopeImplementer*>(storage); |
4814 thread_local->IterateThis(v); | 4840 thread_local->IterateThis(v); |
4815 return storage + ArchiveSpacePerThread(); | 4841 return storage + ArchiveSpacePerThread(); |
4816 } | 4842 } |
4817 | 4843 |
4818 } } // namespace v8::internal | 4844 } } // namespace v8::internal |
OLD | NEW |