Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1428)

Side by Side Diff: src/heap-profiler.cc

Issue 6626043: Add an interface for an embedder to provide information about native (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2009-2010 the V8 project authors. All rights reserved. 1 // Copyright 2009-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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 357
358 358
359 HeapSnapshot* HeapProfiler::TakeSnapshot(String* name, 359 HeapSnapshot* HeapProfiler::TakeSnapshot(String* name,
360 int type, 360 int type,
361 v8::ActivityControl* control) { 361 v8::ActivityControl* control) {
362 ASSERT(singleton_ != NULL); 362 ASSERT(singleton_ != NULL);
363 return singleton_->TakeSnapshotImpl(name, type, control); 363 return singleton_->TakeSnapshotImpl(name, type, control);
364 } 364 }
365 365
366 366
367 void HeapProfiler::DefineWrapperClass(
368 uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback) {
369 ASSERT(singleton_ != NULL);
370 if (singleton_->wrapper_callbacks_.length() <= class_id) {
371 singleton_->wrapper_callbacks_.AddBlock(
372 NULL, class_id - singleton_->wrapper_callbacks_.length() + 1);
373 }
374 singleton_->wrapper_callbacks_[class_id] = callback;
375 }
376
377
378 v8::RetainedObjectInfo* HeapProfiler::ExecuteWrapperClassCallback(
379 uint16_t class_id, Object** wrapper) {
380 ASSERT(singleton_ != NULL);
381 if (singleton_->wrapper_callbacks_.length() <= class_id) return NULL;
382 return singleton_->wrapper_callbacks_[class_id](
383 class_id, Utils::ToLocal(Handle<Object>(wrapper)));
384 }
385
386
367 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name, 387 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name,
368 int type, 388 int type,
369 v8::ActivityControl* control) { 389 v8::ActivityControl* control) {
370 HeapSnapshot::Type s_type = static_cast<HeapSnapshot::Type>(type); 390 HeapSnapshot::Type s_type = static_cast<HeapSnapshot::Type>(type);
371 HeapSnapshot* result = 391 HeapSnapshot* result =
372 snapshots_->NewSnapshot(s_type, name, next_snapshot_uid_++); 392 snapshots_->NewSnapshot(s_type, name, next_snapshot_uid_++);
373 bool generation_completed = true; 393 bool generation_completed = true;
374 switch (s_type) { 394 switch (s_type) {
375 case HeapSnapshot::kFull: { 395 case HeapSnapshot::kFull: {
376 Heap::CollectAllGarbage(true); 396 Heap::CollectAllGarbage(true);
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 GlobalHandles::MakeWeak(handle.location(), 1139 GlobalHandles::MakeWeak(handle.location(),
1120 static_cast<void*>(stack.start()), 1140 static_cast<void*>(stack.start()),
1121 StackWeakReferenceCallback); 1141 StackWeakReferenceCallback);
1122 } 1142 }
1123 1143
1124 1144
1125 #endif // ENABLE_LOGGING_AND_PROFILING 1145 #endif // ENABLE_LOGGING_AND_PROFILING
1126 1146
1127 1147
1128 } } // namespace v8::internal 1148 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698