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

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

Issue 564433003: Add AccessorInfo handling into heap profiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 1969 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 CHECK(ValidateSnapshot(snapshot)); 1980 CHECK(ValidateSnapshot(snapshot));
1981 global = GetGlobalObject(snapshot); 1981 global = GetGlobalObject(snapshot);
1982 c = GetProperty(global, v8::HeapGraphEdge::kProperty, "c"); 1982 c = GetProperty(global, v8::HeapGraphEdge::kProperty, "c");
1983 CHECK_NE(NULL, c); 1983 CHECK_NE(NULL, c);
1984 hidden_props = GetProperty(c, v8::HeapGraphEdge::kInternal, 1984 hidden_props = GetProperty(c, v8::HeapGraphEdge::kInternal,
1985 "hidden_properties"); 1985 "hidden_properties");
1986 CHECK_NE(NULL, hidden_props); 1986 CHECK_NE(NULL, hidden_props);
1987 } 1987 }
1988 1988
1989 1989
1990 TEST(AccessorInfo) {
1991 LocalContext env;
1992 v8::HandleScope scope(env->GetIsolate());
1993 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
1994
1995 CompileRun("function foo(x) { }\n");
1996 const v8::HeapSnapshot* snapshot =
1997 heap_profiler->TakeHeapSnapshot(v8_str("AccessorInfoTest"));
1998 CHECK(ValidateSnapshot(snapshot));
1999 const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
2000 const v8::HeapGraphNode* foo =
2001 GetProperty(global, v8::HeapGraphEdge::kProperty, "foo");
2002 CHECK_NE(NULL, foo);
2003 const v8::HeapGraphNode* map =
2004 GetProperty(foo, v8::HeapGraphEdge::kInternal, "map");
2005 CHECK_NE(NULL, map);
2006 const v8::HeapGraphNode* descriptors =
2007 GetProperty(map, v8::HeapGraphEdge::kInternal, "descriptors");
2008 CHECK_NE(NULL, descriptors);
2009 const v8::HeapGraphNode* length_name =
2010 GetProperty(descriptors, v8::HeapGraphEdge::kInternal, "2");
2011 CHECK_NE(NULL, length_name);
2012 CHECK_EQ("length", *v8::String::Utf8Value(length_name->GetName()));
2013 const v8::HeapGraphNode* length_accessor =
2014 GetProperty(descriptors, v8::HeapGraphEdge::kInternal, "4");
2015 CHECK_NE(NULL, length_accessor);
2016 CHECK_EQ("system / ExecutableAccessorInfo",
2017 *v8::String::Utf8Value(length_accessor->GetName()));
2018 const v8::HeapGraphNode* name =
2019 GetProperty(length_accessor, v8::HeapGraphEdge::kInternal, "name");
2020 CHECK_NE(NULL, name);
2021 const v8::HeapGraphNode* getter =
2022 GetProperty(length_accessor, v8::HeapGraphEdge::kInternal, "getter");
2023 CHECK_NE(NULL, getter);
2024 const v8::HeapGraphNode* setter =
2025 GetProperty(length_accessor, v8::HeapGraphEdge::kInternal, "setter");
2026 CHECK_NE(NULL, setter);
2027 }
2028
2029
1990 bool HasWeakEdge(const v8::HeapGraphNode* node) { 2030 bool HasWeakEdge(const v8::HeapGraphNode* node) {
1991 for (int i = 0; i < node->GetChildrenCount(); ++i) { 2031 for (int i = 0; i < node->GetChildrenCount(); ++i) {
1992 const v8::HeapGraphEdge* handle_edge = node->GetChild(i); 2032 const v8::HeapGraphEdge* handle_edge = node->GetChild(i);
1993 if (handle_edge->GetType() == v8::HeapGraphEdge::kWeak) return true; 2033 if (handle_edge->GetType() == v8::HeapGraphEdge::kWeak) return true;
1994 } 2034 }
1995 return false; 2035 return false;
1996 } 2036 }
1997 2037
1998 2038
1999 bool HasWeakGlobalHandle() { 2039 bool HasWeakGlobalHandle() {
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
2760 map.AddRange(ToAddress(0x180), 0x80, 6U); 2800 map.AddRange(ToAddress(0x180), 0x80, 6U);
2761 map.AddRange(ToAddress(0x180), 0x80, 7U); 2801 map.AddRange(ToAddress(0x180), 0x80, 7U);
2762 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); 2802 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180)));
2763 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); 2803 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200)));
2764 CHECK_EQ(3, static_cast<int>(map.size())); 2804 CHECK_EQ(3, static_cast<int>(map.size()));
2765 2805
2766 map.Clear(); 2806 map.Clear();
2767 CHECK_EQ(0, static_cast<int>(map.size())); 2807 CHECK_EQ(0, static_cast<int>(map.size()));
2768 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); 2808 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400)));
2769 } 2809 }
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