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

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

Issue 2674593003: [TypeFeedbackVector] Root feedback vectors at function literal site. (Closed)
Patch Set: REBASE+liveedit fix. Created 3 years, 10 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
« no previous file with comments | « test/cctest/test-feedback-vector.cc ('k') | test/cctest/test-serialize.cc » ('j') | 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 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 "fun = function () { var a = [3, 2, 1]; return a; }\n" 2245 "fun = function () { var a = [3, 2, 1]; return a; }\n"
2246 "fun();"); 2246 "fun();");
2247 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); 2247 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot();
2248 CHECK(ValidateSnapshot(snapshot)); 2248 CHECK(ValidateSnapshot(snapshot));
2249 2249
2250 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); 2250 const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
2251 CHECK(global); 2251 CHECK(global);
2252 const v8::HeapGraphNode* fun_code = 2252 const v8::HeapGraphNode* fun_code =
2253 GetProperty(global, v8::HeapGraphEdge::kProperty, "fun"); 2253 GetProperty(global, v8::HeapGraphEdge::kProperty, "fun");
2254 CHECK(fun_code); 2254 CHECK(fun_code);
2255 const v8::HeapGraphNode* literals = 2255 const v8::HeapGraphNode* vector_cell = GetProperty(
2256 GetProperty(fun_code, v8::HeapGraphEdge::kInternal, "literals"); 2256 fun_code, v8::HeapGraphEdge::kInternal, "feedback_vector_cell");
2257 CHECK(literals); 2257 // TODO(mvstanton): I'm not sure if this is the best way to expose
2258 CHECK_EQ(v8::HeapGraphNode::kArray, literals->GetType()); 2258 // literals. Is it too much to expose the Cell?
2259 CHECK_EQ(1, literals->GetChildrenCount()); 2259 CHECK(vector_cell);
2260 const v8::HeapGraphNode* vector =
2261 GetProperty(vector_cell, v8::HeapGraphEdge::kInternal, "value");
2262 CHECK_EQ(v8::HeapGraphNode::kArray, vector->GetType());
2263 CHECK_EQ(3, vector->GetChildrenCount());
2260 2264
2261 // The first value in the literals array should be the boilerplate, 2265 // The first value in the feedback vector should be the boilerplate,
2262 // after an AllocationSite. 2266 // after an AllocationSite.
2263 const v8::HeapGraphEdge* prop = literals->GetChild(0); 2267 const v8::HeapGraphEdge* prop = vector->GetChild(2);
2264 const v8::HeapGraphNode* allocation_site = prop->GetToNode(); 2268 const v8::HeapGraphNode* allocation_site = prop->GetToNode();
2265 v8::String::Utf8Value name(allocation_site->GetName()); 2269 v8::String::Utf8Value name(allocation_site->GetName());
2266 CHECK_EQ(0, strcmp("system / AllocationSite", *name)); 2270 CHECK_EQ(0, strcmp("system / AllocationSite", *name));
2267 const v8::HeapGraphNode* transition_info = 2271 const v8::HeapGraphNode* transition_info =
2268 GetProperty(allocation_site, v8::HeapGraphEdge::kInternal, 2272 GetProperty(allocation_site, v8::HeapGraphEdge::kInternal,
2269 "transition_info"); 2273 "transition_info");
2270 CHECK(transition_info); 2274 CHECK(transition_info);
2271 2275
2272 const v8::HeapGraphNode* elements = 2276 const v8::HeapGraphNode* elements =
2273 GetProperty(transition_info, v8::HeapGraphEdge::kInternal, 2277 GetProperty(transition_info, v8::HeapGraphEdge::kInternal,
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
3020 " a[i] = i;\n" 3024 " a[i] = i;\n"
3021 " for (var i = 0; i < 3; ++i)\n" 3025 " for (var i = 0; i < 3; ++i)\n"
3022 " a.shift();\n" 3026 " a.shift();\n"
3023 "}\n"); 3027 "}\n");
3024 3028
3025 CcTest::CollectGarbage(v8::internal::NEW_SPACE); 3029 CcTest::CollectGarbage(v8::internal::NEW_SPACE);
3026 // Should not crash. 3030 // Should not crash.
3027 3031
3028 heap_profiler->StopSamplingHeapProfiler(); 3032 heap_profiler->StopSamplingHeapProfiler();
3029 } 3033 }
OLDNEW
« no previous file with comments | « test/cctest/test-feedback-vector.cc ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698