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

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

Issue 290013004: Add support for ES6 Symbol in heap profiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Symbol->symbol Created 6 years, 7 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 CHECK_EQ(v8::HeapGraphNode::kString, first_node->GetType()); 464 CHECK_EQ(v8::HeapGraphNode::kString, first_node->GetType());
465 465
466 const v8::HeapGraphNode* second_node = 466 const v8::HeapGraphNode* second_node =
467 GetProperty(string_node, v8::HeapGraphEdge::kInternal, "second"); 467 GetProperty(string_node, v8::HeapGraphEdge::kInternal, "second");
468 CHECK_EQ(v8::HeapGraphNode::kString, second_node->GetType()); 468 CHECK_EQ(v8::HeapGraphNode::kString, second_node->GetType());
469 469
470 heap_profiler->DeleteAllHeapSnapshots(); 470 heap_profiler->DeleteAllHeapSnapshots();
471 } 471 }
472 472
473 473
474 TEST(HeapSnapshotSymbol) {
475 i::FLAG_harmony_symbols = true;
476
477 LocalContext env;
478 v8::HandleScope scope(env->GetIsolate());
479 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
480
481 CompileRun("a = Symbol('mySymbol');\n");
482 const v8::HeapSnapshot* snapshot =
483 heap_profiler->TakeHeapSnapshot(v8_str("Symbol"));
484 CHECK(ValidateSnapshot(snapshot));
485 const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
486 const v8::HeapGraphNode* a =
487 GetProperty(global, v8::HeapGraphEdge::kProperty, "a");
488 CHECK_NE(NULL, a);
489 CHECK_EQ(a->GetType(), v8::HeapGraphNode::kSymbol);
490 CHECK_EQ(v8_str("symbol"), a->GetName());
491 const v8::HeapGraphNode* name =
492 GetProperty(a, v8::HeapGraphEdge::kInternal, "name");
493 CHECK_NE(NULL, name);
494 CHECK_EQ(v8_str("mySymbol"), name->GetName());
495 }
496
474 497
475 TEST(HeapSnapshotInternalReferences) { 498 TEST(HeapSnapshotInternalReferences) {
476 v8::Isolate* isolate = CcTest::isolate(); 499 v8::Isolate* isolate = CcTest::isolate();
477 v8::HandleScope scope(isolate); 500 v8::HandleScope scope(isolate);
478 v8::Local<v8::ObjectTemplate> global_template = 501 v8::Local<v8::ObjectTemplate> global_template =
479 v8::ObjectTemplate::New(isolate); 502 v8::ObjectTemplate::New(isolate);
480 global_template->SetInternalFieldCount(2); 503 global_template->SetInternalFieldCount(2);
481 LocalContext env(NULL, global_template); 504 LocalContext env(NULL, global_template);
482 v8::Handle<v8::Object> global_proxy = env->Global(); 505 v8::Handle<v8::Object> global_proxy = env->Global();
483 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); 506 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>();
(...skipping 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2590 map.AddRange(ToAddress(0x180), 0x80, 6U); 2613 map.AddRange(ToAddress(0x180), 0x80, 6U);
2591 map.AddRange(ToAddress(0x180), 0x80, 7U); 2614 map.AddRange(ToAddress(0x180), 0x80, 7U);
2592 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); 2615 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180)));
2593 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); 2616 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200)));
2594 CHECK_EQ(3, static_cast<int>(map.size())); 2617 CHECK_EQ(3, static_cast<int>(map.size()));
2595 2618
2596 map.Clear(); 2619 map.Clear();
2597 CHECK_EQ(0, static_cast<int>(map.size())); 2620 CHECK_EQ(0, static_cast<int>(map.size()));
2598 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); 2621 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400)));
2599 } 2622 }
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