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

Side by Side Diff: test/cctest/test-heap-profiler.cc

Issue 143343006: Add Box object to heap profiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added a test. Created 6 years, 10 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
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after
2352 const v8::HeapGraphNode* arr1_obj = 2352 const v8::HeapGraphNode* arr1_obj =
2353 GetProperty(global, v8::HeapGraphEdge::kProperty, "arr1"); 2353 GetProperty(global, v8::HeapGraphEdge::kProperty, "arr1");
2354 CHECK_NE(NULL, arr1_obj); 2354 CHECK_NE(NULL, arr1_obj);
2355 const v8::HeapGraphNode* arr1_buffer = 2355 const v8::HeapGraphNode* arr1_buffer =
2356 GetProperty(arr1_obj, v8::HeapGraphEdge::kInternal, "buffer"); 2356 GetProperty(arr1_obj, v8::HeapGraphEdge::kInternal, "buffer");
2357 CHECK_NE(NULL, arr1_buffer); 2357 CHECK_NE(NULL, arr1_buffer);
2358 const v8::HeapGraphNode* first_view = 2358 const v8::HeapGraphNode* first_view =
2359 GetProperty(arr1_buffer, v8::HeapGraphEdge::kWeak, "weak_first_view"); 2359 GetProperty(arr1_buffer, v8::HeapGraphEdge::kWeak, "weak_first_view");
2360 CHECK_NE(NULL, first_view); 2360 CHECK_NE(NULL, first_view);
2361 } 2361 }
2362
2363
2364 TEST(BoxObject) {
2365 LocalContext env;
2366 v8::HandleScope scope(env->GetIsolate());
2367 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
2368 CompileRun("1");
2369 const v8::HeapSnapshot* snapshot =
2370 heap_profiler->TakeHeapSnapshot(v8_str("snapshot"));
2371 CHECK(ValidateSnapshot(snapshot));
2372 const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
2373 const v8::HeapGraphNode* properties =
2374 GetProperty(global, v8::HeapGraphEdge::kInternal, "properties");
2375 int num_objects = properties->GetChildrenCount();
2376 int i;
2377 for (i = 0; i < num_objects; ++i) {
2378 const v8::HeapGraphEdge* prop = properties->GetChild(i);
2379 const v8::HeapGraphNode* node = prop->GetToNode();
2380 v8::String::Utf8Value node_name(node->GetName());
2381 if (strcmp(*node_name, "system / PropertyCell") != 0)
2382 continue;
2383 const v8::HeapGraphNode* type_node =
2384 GetProperty(node, v8::HeapGraphEdge::kInternal, "type");
2385 CHECK_NE(NULL, type_node);
2386 v8::String::Utf8Value type_node_name(type_node->GetName());
2387 if (strcmp(*type_node_name, "system / Box") != 0)
yurys 2014/01/30 13:34:34 This looks a bit fragile, would it be enough to se
2388 continue;
2389 const v8::HeapGraphNode* box_value =
2390 GetProperty(type_node, v8::HeapGraphEdge::kInternal, "value");
2391 CHECK_NE(NULL, box_value);
2392 break;
2393 }
2394 CHECK_NE(num_objects, i);
2395 }
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698