OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 5270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5281 | 5281 |
5282 | 5282 |
5283 const HeapGraphNode* HeapGraphEdge::GetToNode() const { | 5283 const HeapGraphNode* HeapGraphEdge::GetToNode() const { |
5284 i::Isolate* isolate = i::Isolate::Current(); | 5284 i::Isolate* isolate = i::Isolate::Current(); |
5285 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetToNode"); | 5285 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetToNode"); |
5286 const i::HeapEntry* to = ToInternal(this)->to(); | 5286 const i::HeapEntry* to = ToInternal(this)->to(); |
5287 return reinterpret_cast<const HeapGraphNode*>(to); | 5287 return reinterpret_cast<const HeapGraphNode*>(to); |
5288 } | 5288 } |
5289 | 5289 |
5290 | 5290 |
5291 static i::HeapGraphPath* ToInternal(const HeapGraphPath* path) { | |
5292 return const_cast<i::HeapGraphPath*>( | |
5293 reinterpret_cast<const i::HeapGraphPath*>(path)); | |
5294 } | |
5295 | |
5296 | |
5297 int HeapGraphPath::GetEdgesCount() const { | |
5298 return ToInternal(this)->path()->length(); | |
5299 } | |
5300 | |
5301 | |
5302 const HeapGraphEdge* HeapGraphPath::GetEdge(int index) const { | |
5303 return reinterpret_cast<const HeapGraphEdge*>( | |
5304 ToInternal(this)->path()->at(index)); | |
5305 } | |
5306 | |
5307 | |
5308 const HeapGraphNode* HeapGraphPath::GetFromNode() const { | |
5309 return GetEdgesCount() > 0 ? GetEdge(0)->GetFromNode() : NULL; | |
5310 } | |
5311 | |
5312 | |
5313 const HeapGraphNode* HeapGraphPath::GetToNode() const { | |
5314 const int count = GetEdgesCount(); | |
5315 return count > 0 ? GetEdge(count - 1)->GetToNode() : NULL; | |
5316 } | |
5317 | |
5318 | |
5319 static i::HeapEntry* ToInternal(const HeapGraphNode* entry) { | 5291 static i::HeapEntry* ToInternal(const HeapGraphNode* entry) { |
5320 return const_cast<i::HeapEntry*>( | 5292 return const_cast<i::HeapEntry*>( |
5321 reinterpret_cast<const i::HeapEntry*>(entry)); | 5293 reinterpret_cast<const i::HeapEntry*>(entry)); |
5322 } | 5294 } |
5323 | 5295 |
5324 | 5296 |
5325 HeapGraphNode::Type HeapGraphNode::GetType() const { | 5297 HeapGraphNode::Type HeapGraphNode::GetType() const { |
5326 i::Isolate* isolate = i::Isolate::Current(); | 5298 i::Isolate* isolate = i::Isolate::Current(); |
5327 IsDeadCheck(isolate, "v8::HeapGraphNode::GetType"); | 5299 IsDeadCheck(isolate, "v8::HeapGraphNode::GetType"); |
5328 return static_cast<HeapGraphNode::Type>(ToInternal(this)->type()); | 5300 return static_cast<HeapGraphNode::Type>(ToInternal(this)->type()); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5390 | 5362 |
5391 | 5363 |
5392 const HeapGraphEdge* HeapGraphNode::GetRetainer(int index) const { | 5364 const HeapGraphEdge* HeapGraphNode::GetRetainer(int index) const { |
5393 i::Isolate* isolate = i::Isolate::Current(); | 5365 i::Isolate* isolate = i::Isolate::Current(); |
5394 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainer"); | 5366 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainer"); |
5395 return reinterpret_cast<const HeapGraphEdge*>( | 5367 return reinterpret_cast<const HeapGraphEdge*>( |
5396 ToInternal(this)->retainers()[index]); | 5368 ToInternal(this)->retainers()[index]); |
5397 } | 5369 } |
5398 | 5370 |
5399 | 5371 |
5400 int HeapGraphNode::GetRetainingPathsCount() const { | |
5401 i::Isolate* isolate = i::Isolate::Current(); | |
5402 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainingPathsCount"); | |
5403 return ToInternal(this)->GetRetainingPaths()->length(); | |
5404 } | |
5405 | |
5406 | |
5407 const HeapGraphPath* HeapGraphNode::GetRetainingPath(int index) const { | |
5408 i::Isolate* isolate = i::Isolate::Current(); | |
5409 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainingPath"); | |
5410 return reinterpret_cast<const HeapGraphPath*>( | |
5411 ToInternal(this)->GetRetainingPaths()->at(index)); | |
5412 } | |
5413 | |
5414 | |
5415 const HeapGraphNode* HeapGraphNode::GetDominatorNode() const { | 5372 const HeapGraphNode* HeapGraphNode::GetDominatorNode() const { |
5416 i::Isolate* isolate = i::Isolate::Current(); | 5373 i::Isolate* isolate = i::Isolate::Current(); |
5417 IsDeadCheck(isolate, "v8::HeapSnapshot::GetDominatorNode"); | 5374 IsDeadCheck(isolate, "v8::HeapSnapshot::GetDominatorNode"); |
5418 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->dominator()); | 5375 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->dominator()); |
5419 } | 5376 } |
5420 | 5377 |
5421 | 5378 |
5422 const HeapGraphNode* HeapSnapshotsDiff::GetAdditionsRoot() const { | |
5423 i::Isolate* isolate = i::Isolate::Current(); | |
5424 IsDeadCheck(isolate, "v8::HeapSnapshotsDiff::GetAdditionsRoot"); | |
5425 i::HeapSnapshotsDiff* diff = | |
5426 const_cast<i::HeapSnapshotsDiff*>( | |
5427 reinterpret_cast<const i::HeapSnapshotsDiff*>(this)); | |
5428 return reinterpret_cast<const HeapGraphNode*>(diff->additions_root()); | |
5429 } | |
5430 | |
5431 | |
5432 const HeapGraphNode* HeapSnapshotsDiff::GetDeletionsRoot() const { | |
5433 i::Isolate* isolate = i::Isolate::Current(); | |
5434 IsDeadCheck(isolate, "v8::HeapSnapshotsDiff::GetDeletionsRoot"); | |
5435 i::HeapSnapshotsDiff* diff = | |
5436 const_cast<i::HeapSnapshotsDiff*>( | |
5437 reinterpret_cast<const i::HeapSnapshotsDiff*>(this)); | |
5438 return reinterpret_cast<const HeapGraphNode*>(diff->deletions_root()); | |
5439 } | |
5440 | |
5441 | |
5442 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { | 5379 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { |
5443 return const_cast<i::HeapSnapshot*>( | 5380 return const_cast<i::HeapSnapshot*>( |
5444 reinterpret_cast<const i::HeapSnapshot*>(snapshot)); | 5381 reinterpret_cast<const i::HeapSnapshot*>(snapshot)); |
5445 } | 5382 } |
5446 | 5383 |
5447 | 5384 |
5448 void HeapSnapshot::Delete() { | 5385 void HeapSnapshot::Delete() { |
5449 i::Isolate* isolate = i::Isolate::Current(); | 5386 i::Isolate* isolate = i::Isolate::Current(); |
5450 IsDeadCheck(isolate, "v8::HeapSnapshot::Delete"); | 5387 IsDeadCheck(isolate, "v8::HeapSnapshot::Delete"); |
5451 if (i::HeapProfiler::GetSnapshotsCount() > 1) { | 5388 if (i::HeapProfiler::GetSnapshotsCount() > 1) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5487 | 5424 |
5488 | 5425 |
5489 const HeapGraphNode* HeapSnapshot::GetNodeById(uint64_t id) const { | 5426 const HeapGraphNode* HeapSnapshot::GetNodeById(uint64_t id) const { |
5490 i::Isolate* isolate = i::Isolate::Current(); | 5427 i::Isolate* isolate = i::Isolate::Current(); |
5491 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodeById"); | 5428 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodeById"); |
5492 return reinterpret_cast<const HeapGraphNode*>( | 5429 return reinterpret_cast<const HeapGraphNode*>( |
5493 ToInternal(this)->GetEntryById(id)); | 5430 ToInternal(this)->GetEntryById(id)); |
5494 } | 5431 } |
5495 | 5432 |
5496 | 5433 |
5497 const HeapSnapshotsDiff* HeapSnapshot::CompareWith( | |
5498 const HeapSnapshot* snapshot) const { | |
5499 i::Isolate* isolate = i::Isolate::Current(); | |
5500 IsDeadCheck(isolate, "v8::HeapSnapshot::CompareWith"); | |
5501 return reinterpret_cast<const HeapSnapshotsDiff*>( | |
5502 ToInternal(this)->CompareWith(ToInternal(snapshot))); | |
5503 } | |
5504 | |
5505 | |
5506 void HeapSnapshot::Serialize(OutputStream* stream, | 5434 void HeapSnapshot::Serialize(OutputStream* stream, |
5507 HeapSnapshot::SerializationFormat format) const { | 5435 HeapSnapshot::SerializationFormat format) const { |
5508 i::Isolate* isolate = i::Isolate::Current(); | 5436 i::Isolate* isolate = i::Isolate::Current(); |
5509 IsDeadCheck(isolate, "v8::HeapSnapshot::Serialize"); | 5437 IsDeadCheck(isolate, "v8::HeapSnapshot::Serialize"); |
5510 ApiCheck(format == kJSON, | 5438 ApiCheck(format == kJSON, |
5511 "v8::HeapSnapshot::Serialize", | 5439 "v8::HeapSnapshot::Serialize", |
5512 "Unknown serialization format"); | 5440 "Unknown serialization format"); |
5513 ApiCheck(stream->GetOutputEncoding() == OutputStream::kAscii, | 5441 ApiCheck(stream->GetOutputEncoding() == OutputStream::kAscii, |
5514 "v8::HeapSnapshot::Serialize", | 5442 "v8::HeapSnapshot::Serialize", |
5515 "Unsupported output encoding"); | 5443 "Unsupported output encoding"); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5703 | 5631 |
5704 void HandleScopeImplementer::Iterate(ObjectVisitor* v) { | 5632 void HandleScopeImplementer::Iterate(ObjectVisitor* v) { |
5705 v8::ImplementationUtilities::HandleScopeData* current = | 5633 v8::ImplementationUtilities::HandleScopeData* current = |
5706 Isolate::Current()->handle_scope_data(); | 5634 Isolate::Current()->handle_scope_data(); |
5707 handle_scope_data_ = *current; | 5635 handle_scope_data_ = *current; |
5708 IterateThis(v); | 5636 IterateThis(v); |
5709 } | 5637 } |
5710 | 5638 |
5711 | 5639 |
5712 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5640 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
5713 HandleScopeImplementer* thread_local = | 5641 HandleScopeImplementer* scope_implementer = |
5714 reinterpret_cast<HandleScopeImplementer*>(storage); | 5642 reinterpret_cast<HandleScopeImplementer*>(storage); |
5715 thread_local->IterateThis(v); | 5643 scope_implementer->IterateThis(v); |
5716 return storage + ArchiveSpacePerThread(); | 5644 return storage + ArchiveSpacePerThread(); |
5717 } | 5645 } |
5718 | 5646 |
5719 } } // namespace v8::internal | 5647 } } // namespace v8::internal |
OLD | NEW |