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

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

Issue 19397002: Provide named links to code objects in heap snapshot. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added a test. Created 7 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/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 1945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 1956
1957 CHECK(transition_info->GetHeapValue()->IsArray()); 1957 CHECK(transition_info->GetHeapValue()->IsArray());
1958 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast( 1958 v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(
1959 transition_info->GetHeapValue()); 1959 transition_info->GetHeapValue());
1960 // Verify the array is "a" in the code above. 1960 // Verify the array is "a" in the code above.
1961 CHECK_EQ(3, array->Length()); 1961 CHECK_EQ(3, array->Length());
1962 CHECK_EQ(v8::Integer::New(3), array->Get(v8::Integer::New(0))); 1962 CHECK_EQ(v8::Integer::New(3), array->Get(v8::Integer::New(0)));
1963 CHECK_EQ(v8::Integer::New(2), array->Get(v8::Integer::New(1))); 1963 CHECK_EQ(v8::Integer::New(2), array->Get(v8::Integer::New(1)));
1964 CHECK_EQ(v8::Integer::New(1), array->Get(v8::Integer::New(2))); 1964 CHECK_EQ(v8::Integer::New(1), array->Get(v8::Integer::New(2)));
1965 } 1965 }
1966
1967
1968 TEST(JSFunctionHasCodeLink) {
1969 LocalContext env;
1970 v8::HandleScope scope(env->GetIsolate());
1971 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
1972 CompileRun("function foo(x, y) { return x + y; }\n");
1973 const v8::HeapSnapshot* snapshot =
1974 heap_profiler->TakeHeapSnapshot(v8_str("snapshot"));
1975 CHECK(ValidateSnapshot(snapshot, 3));
yurys 2013/07/17 10:24:01 Could you make 3 a default parameter please.
1976 const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
1977 const v8::HeapGraphNode* foo_func =
1978 GetProperty(global, v8::HeapGraphEdge::kProperty, "foo");
1979 CHECK_NE(NULL, foo_func);
1980 const v8::HeapGraphNode* code =
1981 GetProperty(foo_func, v8::HeapGraphEdge::kInternal, "code");
1982 CHECK_NE(NULL, code);
1983 }
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