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

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

Issue 10692058: Report "hidden properties" in heap profiler for fast properties case (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 5 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/profile-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 // 2 //
3 // Tests for heap profiler 3 // Tests for heap profiler
4 4
5 #include <ctype.h> 5 #include <ctype.h>
6 6
7 #include "v8.h" 7 #include "v8.h"
8 8
9 #include "cctest.h" 9 #include "cctest.h"
10 #include "hashmap.h" 10 #include "hashmap.h"
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 GetProperty(global, v8::HeapGraphEdge::kProperty, "obj1"); 1442 GetProperty(global, v8::HeapGraphEdge::kProperty, "obj1");
1443 CHECK_NE(NULL, obj1); 1443 CHECK_NE(NULL, obj1);
1444 const v8::HeapGraphNode* getterFunction = 1444 const v8::HeapGraphNode* getterFunction =
1445 GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get-propWithGetter"); 1445 GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get-propWithGetter");
1446 CHECK_NE(NULL, getterFunction); 1446 CHECK_NE(NULL, getterFunction);
1447 const v8::HeapGraphNode* setterFunction = 1447 const v8::HeapGraphNode* setterFunction =
1448 GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set-propWithSetter"); 1448 GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set-propWithSetter");
1449 CHECK_NE(NULL, setterFunction); 1449 CHECK_NE(NULL, setterFunction);
1450 } 1450 }
1451 1451
1452 TEST(HiddenPropertiesFastCase) {
1453 v8::HandleScope scope;
1454 LocalContext env;
1455
1456 CompileRun(
1457 "function C(x) { this.a = this; this.b = x; }\n"
1458 "c = new C(2012);\n");
1459 const v8::HeapSnapshot* snapshot =
1460 v8::HeapProfiler::TakeSnapshot(v8_str("HiddenPropertiesFastCase1"));
1461 const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
1462 const v8::HeapGraphNode* c =
1463 GetProperty(global, v8::HeapGraphEdge::kProperty, "c");
1464 CHECK_NE(NULL, c);
1465 const v8::HeapGraphNode* hidden_props =
1466 GetProperty(c, v8::HeapGraphEdge::kInternal, "hidden_properties");
1467 CHECK_EQ(NULL, hidden_props);
1468
1469 v8::Handle<v8::Value> cHandle = env->Global()->Get(v8::String::New("c"));
1470 CHECK(!cHandle.IsEmpty() && cHandle->IsObject());
1471 cHandle->ToObject()->GetIdentityHash();
1472
1473 snapshot = v8::HeapProfiler::TakeSnapshot(
1474 v8_str("HiddenPropertiesFastCase2"));
1475 global = GetGlobalObject(snapshot);
1476 c = GetProperty(global, v8::HeapGraphEdge::kProperty, "c");
1477 CHECK_NE(NULL, c);
1478 hidden_props = GetProperty(c, v8::HeapGraphEdge::kInternal,
1479 "hidden_properties");
1480 CHECK_NE(NULL, hidden_props);
1481 }
1452 1482
1453 bool HasWeakEdge(const v8::HeapGraphNode* node) { 1483 bool HasWeakEdge(const v8::HeapGraphNode* node) {
1454 for (int i = 0; i < node->GetChildrenCount(); ++i) { 1484 for (int i = 0; i < node->GetChildrenCount(); ++i) {
1455 const v8::HeapGraphEdge* handle_edge = node->GetChild(i); 1485 const v8::HeapGraphEdge* handle_edge = node->GetChild(i);
1456 if (handle_edge->GetType() == v8::HeapGraphEdge::kWeak) return true; 1486 if (handle_edge->GetType() == v8::HeapGraphEdge::kWeak) return true;
1457 } 1487 }
1458 return false; 1488 return false;
1459 } 1489 }
1460 1490
1461 1491
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 const v8::HeapGraphNode* global_object = 1649 const v8::HeapGraphNode* global_object =
1620 GetProperty(global, v8::HeapGraphEdge::kProperty, "global_object"); 1650 GetProperty(global, v8::HeapGraphEdge::kProperty, "global_object");
1621 CHECK_NE(NULL, global_object); 1651 CHECK_NE(NULL, global_object);
1622 const v8::HeapGraphNode* properties = 1652 const v8::HeapGraphNode* properties =
1623 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "properties"); 1653 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "properties");
1624 CHECK_EQ(NULL, properties); 1654 CHECK_EQ(NULL, properties);
1625 const v8::HeapGraphNode* elements = 1655 const v8::HeapGraphNode* elements =
1626 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "elements"); 1656 GetProperty(global_object, v8::HeapGraphEdge::kInternal, "elements");
1627 CHECK_EQ(NULL, elements); 1657 CHECK_EQ(NULL, elements);
1628 } 1658 }
OLDNEW
« no previous file with comments | « src/profile-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698