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

Unified Diff: test/cctest/test-heap-profiler.cc

Issue 143343006: Add Box object to heap profiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing comment. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap-profiler.cc
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc
index efb80453e02117724dd5a33b5c07d1fdb6eed7b9..a6b1b3724625aec7804b9d2ac81cd348b5ac14ce 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -2383,3 +2383,32 @@ TEST(ArrayBufferAndArrayBufferView) {
GetProperty(arr1_buffer, v8::HeapGraphEdge::kWeak, "weak_first_view");
CHECK_NE(NULL, first_view);
}
+
+
+TEST(BoxObject) {
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ LocalContext env;
+ v8::Handle<v8::Object> global_proxy = env->Global();
+ v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>();
+
+ i::Factory* factory = CcTest::i_isolate()->factory();
+ i::Handle<i::String> string =
+ factory->NewStringFromAscii(i::CStrVector("string"));
+ i::Handle<i::Object> box = factory->NewBox(string);
+ global->Set(0, v8::ToApiHandle<v8::Object>(box));
+
+ v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
+ const v8::HeapSnapshot* snapshot =
+ heap_profiler->TakeHeapSnapshot(v8_str("snapshot"));
+ CHECK(ValidateSnapshot(snapshot));
+ const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot);
+ const v8::HeapGraphNode* box_node =
+ GetProperty(global_node, v8::HeapGraphEdge::kElement, "0");
+ CHECK_NE(NULL, box_node);
+ v8::String::Utf8Value box_node_name(box_node->GetName());
+ CHECK_EQ("system / Box", *box_node_name);
+ const v8::HeapGraphNode* box_value =
+ GetProperty(box_node, v8::HeapGraphEdge::kInternal, "value");
+ CHECK_NE(NULL, box_value);
+}
« 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