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

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

Issue 1435273002: Fix name shown by devtools for subclasses. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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
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 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 TEST(GetConstructorName) { 1811 TEST(GetConstructorName) {
1812 LocalContext env; 1812 LocalContext env;
1813 v8::HandleScope scope(env->GetIsolate()); 1813 v8::HandleScope scope(env->GetIsolate());
1814 1814
1815 CompileRun( 1815 CompileRun(
1816 "function Constructor1() {};\n" 1816 "function Constructor1() {};\n"
1817 "var obj1 = new Constructor1();\n" 1817 "var obj1 = new Constructor1();\n"
1818 "var Constructor2 = function() {};\n" 1818 "var Constructor2 = function() {};\n"
1819 "var obj2 = new Constructor2();\n" 1819 "var obj2 = new Constructor2();\n"
1820 "var obj3 = {};\n" 1820 "var obj3 = {};\n"
1821 "obj3.constructor = function Constructor3() {};\n" 1821 "obj3.__proto__ = { constructor: function Constructor3() {} };\n"
1822 "var obj4 = {};\n" 1822 "var obj4 = {};\n"
1823 "// Slow properties\n" 1823 "// Slow properties\n"
1824 "for (var i=0; i<2000; ++i) obj4[\"p\" + i] = i;\n" 1824 "for (var i=0; i<2000; ++i) obj4[\"p\" + i] = i;\n"
1825 "obj4.constructor = function Constructor4() {};\n" 1825 "obj4.__proto__ = { constructor: function Constructor4() {} };\n"
1826 "var obj5 = {};\n" 1826 "var obj5 = {};\n"
1827 "var obj6 = {};\n" 1827 "var obj6 = {};\n"
1828 "obj6.constructor = 6;"); 1828 "obj6.constructor = 6;");
1829 v8::Local<v8::Object> js_global = 1829 v8::Local<v8::Object> js_global =
1830 env->Global()->GetPrototype().As<v8::Object>(); 1830 env->Global()->GetPrototype().As<v8::Object>();
1831 v8::Local<v8::Object> obj1 = js_global->Get(v8_str("obj1")).As<v8::Object>(); 1831 v8::Local<v8::Object> obj1 = js_global->Get(v8_str("obj1")).As<v8::Object>();
1832 i::Handle<i::JSObject> js_obj1 = v8::Utils::OpenHandle(*obj1); 1832 i::Handle<i::JSObject> js_obj1 = v8::Utils::OpenHandle(*obj1);
1833 CHECK_EQ(0, StringCmp( 1833 CHECK_EQ(0, StringCmp(
1834 "Constructor1", i::V8HeapExplorer::GetConstructorName(*js_obj1))); 1834 "Constructor1", i::V8HeapExplorer::GetConstructorName(*js_obj1)));
1835 v8::Local<v8::Object> obj2 = js_global->Get(v8_str("obj2")).As<v8::Object>(); 1835 v8::Local<v8::Object> obj2 = js_global->Get(v8_str("obj2")).As<v8::Object>();
1836 i::Handle<i::JSObject> js_obj2 = v8::Utils::OpenHandle(*obj2); 1836 i::Handle<i::JSObject> js_obj2 = v8::Utils::OpenHandle(*obj2);
1837 CHECK_EQ(0, StringCmp( 1837 CHECK_EQ(0, StringCmp(
1838 "Constructor2", i::V8HeapExplorer::GetConstructorName(*js_obj2))); 1838 "Constructor2", i::V8HeapExplorer::GetConstructorName(*js_obj2)));
1839 v8::Local<v8::Object> obj3 = js_global->Get(v8_str("obj3")).As<v8::Object>(); 1839 v8::Local<v8::Object> obj3 = js_global->Get(v8_str("obj3")).As<v8::Object>();
1840 i::Handle<i::JSObject> js_obj3 = v8::Utils::OpenHandle(*obj3); 1840 i::Handle<i::JSObject> js_obj3 = v8::Utils::OpenHandle(*obj3);
1841 // TODO(verwaest): Restore to Constructor3 once supported by the 1841 CHECK_EQ(0, StringCmp("Constructor3",
1842 // heap-snapshot-generator. 1842 i::V8HeapExplorer::GetConstructorName(*js_obj3)));
1843 CHECK_EQ(
1844 0, StringCmp("Object", i::V8HeapExplorer::GetConstructorName(*js_obj3)));
1845 v8::Local<v8::Object> obj4 = js_global->Get(v8_str("obj4")).As<v8::Object>(); 1843 v8::Local<v8::Object> obj4 = js_global->Get(v8_str("obj4")).As<v8::Object>();
1846 i::Handle<i::JSObject> js_obj4 = v8::Utils::OpenHandle(*obj4); 1844 i::Handle<i::JSObject> js_obj4 = v8::Utils::OpenHandle(*obj4);
1847 // TODO(verwaest): Restore to Constructor4 once supported by the 1845 CHECK_EQ(0, StringCmp("Constructor4",
1848 // heap-snapshot-generator. 1846 i::V8HeapExplorer::GetConstructorName(*js_obj4)));
1849 CHECK_EQ(
1850 0, StringCmp("Object", i::V8HeapExplorer::GetConstructorName(*js_obj4)));
1851 v8::Local<v8::Object> obj5 = js_global->Get(v8_str("obj5")).As<v8::Object>(); 1847 v8::Local<v8::Object> obj5 = js_global->Get(v8_str("obj5")).As<v8::Object>();
1852 i::Handle<i::JSObject> js_obj5 = v8::Utils::OpenHandle(*obj5); 1848 i::Handle<i::JSObject> js_obj5 = v8::Utils::OpenHandle(*obj5);
1853 CHECK_EQ(0, StringCmp( 1849 CHECK_EQ(0, StringCmp(
1854 "Object", i::V8HeapExplorer::GetConstructorName(*js_obj5))); 1850 "Object", i::V8HeapExplorer::GetConstructorName(*js_obj5)));
1855 v8::Local<v8::Object> obj6 = js_global->Get(v8_str("obj6")).As<v8::Object>(); 1851 v8::Local<v8::Object> obj6 = js_global->Get(v8_str("obj6")).As<v8::Object>();
1856 i::Handle<i::JSObject> js_obj6 = v8::Utils::OpenHandle(*obj6); 1852 i::Handle<i::JSObject> js_obj6 = v8::Utils::OpenHandle(*obj6);
1857 CHECK_EQ(0, StringCmp( 1853 CHECK_EQ(0, StringCmp(
1858 "Object", i::V8HeapExplorer::GetConstructorName(*js_obj6))); 1854 "Object", i::V8HeapExplorer::GetConstructorName(*js_obj6)));
1859 } 1855 }
1860 1856
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
2796 map.AddRange(ToAddress(0x180), 0x80, 6U); 2792 map.AddRange(ToAddress(0x180), 0x80, 6U);
2797 map.AddRange(ToAddress(0x180), 0x80, 7U); 2793 map.AddRange(ToAddress(0x180), 0x80, 7U);
2798 CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180))); 2794 CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180)));
2799 CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200))); 2795 CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200)));
2800 CHECK_EQ(3u, map.size()); 2796 CHECK_EQ(3u, map.size());
2801 2797
2802 map.Clear(); 2798 map.Clear();
2803 CHECK_EQ(0u, map.size()); 2799 CHECK_EQ(0u, map.size());
2804 CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400))); 2800 CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400)));
2805 } 2801 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698