OLD | NEW |
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 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 CHECK_NE(NULL, global); | 1876 CHECK_NE(NULL, global); |
1877 const v8::HeapGraphNode* fun = | 1877 const v8::HeapGraphNode* fun = |
1878 GetProperty(global, v8::HeapGraphEdge::kProperty, "fun"); | 1878 GetProperty(global, v8::HeapGraphEdge::kProperty, "fun"); |
1879 CHECK(!HasWeakEdge(fun)); | 1879 CHECK(!HasWeakEdge(fun)); |
1880 const v8::HeapGraphNode* shared = | 1880 const v8::HeapGraphNode* shared = |
1881 GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared"); | 1881 GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared"); |
1882 CHECK(!HasWeakEdge(shared)); | 1882 CHECK(!HasWeakEdge(shared)); |
1883 } | 1883 } |
1884 | 1884 |
1885 | 1885 |
1886 #ifdef ENABLE_DEBUGGER_SUPPORT | |
1887 TEST(NoDebugObjectInSnapshot) { | 1886 TEST(NoDebugObjectInSnapshot) { |
1888 LocalContext env; | 1887 LocalContext env; |
1889 v8::HandleScope scope(env->GetIsolate()); | 1888 v8::HandleScope scope(env->GetIsolate()); |
1890 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); | 1889 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); |
1891 | 1890 |
1892 CcTest::i_isolate()->debug()->Load(); | 1891 CcTest::i_isolate()->debug()->Load(); |
1893 CompileRun("foo = {};"); | 1892 CompileRun("foo = {};"); |
1894 const v8::HeapSnapshot* snapshot = | 1893 const v8::HeapSnapshot* snapshot = |
1895 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); | 1894 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); |
1896 CHECK(ValidateSnapshot(snapshot)); | 1895 CHECK(ValidateSnapshot(snapshot)); |
1897 const v8::HeapGraphNode* root = snapshot->GetRoot(); | 1896 const v8::HeapGraphNode* root = snapshot->GetRoot(); |
1898 int globals_count = 0; | 1897 int globals_count = 0; |
1899 for (int i = 0; i < root->GetChildrenCount(); ++i) { | 1898 for (int i = 0; i < root->GetChildrenCount(); ++i) { |
1900 const v8::HeapGraphEdge* edge = root->GetChild(i); | 1899 const v8::HeapGraphEdge* edge = root->GetChild(i); |
1901 if (edge->GetType() == v8::HeapGraphEdge::kShortcut) { | 1900 if (edge->GetType() == v8::HeapGraphEdge::kShortcut) { |
1902 ++globals_count; | 1901 ++globals_count; |
1903 const v8::HeapGraphNode* global = edge->GetToNode(); | 1902 const v8::HeapGraphNode* global = edge->GetToNode(); |
1904 const v8::HeapGraphNode* foo = | 1903 const v8::HeapGraphNode* foo = |
1905 GetProperty(global, v8::HeapGraphEdge::kProperty, "foo"); | 1904 GetProperty(global, v8::HeapGraphEdge::kProperty, "foo"); |
1906 CHECK_NE(NULL, foo); | 1905 CHECK_NE(NULL, foo); |
1907 } | 1906 } |
1908 } | 1907 } |
1909 CHECK_EQ(1, globals_count); | 1908 CHECK_EQ(1, globals_count); |
1910 } | 1909 } |
1911 #endif // ENABLE_DEBUGGER_SUPPORT | |
1912 | 1910 |
1913 | 1911 |
1914 TEST(AllStrongGcRootsHaveNames) { | 1912 TEST(AllStrongGcRootsHaveNames) { |
1915 LocalContext env; | 1913 LocalContext env; |
1916 v8::HandleScope scope(env->GetIsolate()); | 1914 v8::HandleScope scope(env->GetIsolate()); |
1917 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); | 1915 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); |
1918 | 1916 |
1919 CompileRun("foo = {};"); | 1917 CompileRun("foo = {};"); |
1920 const v8::HeapSnapshot* snapshot = | 1918 const v8::HeapSnapshot* snapshot = |
1921 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); | 1919 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 map.AddRange(ToAddress(0x180), 0x80, 6U); | 2590 map.AddRange(ToAddress(0x180), 0x80, 6U); |
2593 map.AddRange(ToAddress(0x180), 0x80, 7U); | 2591 map.AddRange(ToAddress(0x180), 0x80, 7U); |
2594 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); | 2592 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); |
2595 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); | 2593 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); |
2596 CHECK_EQ(3, static_cast<int>(map.size())); | 2594 CHECK_EQ(3, static_cast<int>(map.size())); |
2597 | 2595 |
2598 map.Clear(); | 2596 map.Clear(); |
2599 CHECK_EQ(0, static_cast<int>(map.size())); | 2597 CHECK_EQ(0, static_cast<int>(map.size())); |
2600 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); | 2598 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); |
2601 } | 2599 } |
OLD | NEW |