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

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

Issue 427723002: Enable ES6 Map and Set by default (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove old test, fix BUILD.gn Created 6 years, 4 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 | « test/cctest/test-heap.cc ('k') | test/cctest/test-ordered-hash-table.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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 CHECK_EQ(a->GetType(), v8::HeapGraphNode::kSymbol); 487 CHECK_EQ(a->GetType(), v8::HeapGraphNode::kSymbol);
488 CHECK_EQ(v8_str("symbol"), a->GetName()); 488 CHECK_EQ(v8_str("symbol"), a->GetName());
489 const v8::HeapGraphNode* name = 489 const v8::HeapGraphNode* name =
490 GetProperty(a, v8::HeapGraphEdge::kInternal, "name"); 490 GetProperty(a, v8::HeapGraphEdge::kInternal, "name");
491 CHECK_NE(NULL, name); 491 CHECK_NE(NULL, name);
492 CHECK_EQ(v8_str("mySymbol"), name->GetName()); 492 CHECK_EQ(v8_str("mySymbol"), name->GetName());
493 } 493 }
494 494
495 495
496 TEST(HeapSnapshotWeakCollection) { 496 TEST(HeapSnapshotWeakCollection) {
497 i::FLAG_harmony_collections = true;
498
499 LocalContext env; 497 LocalContext env;
500 v8::HandleScope scope(env->GetIsolate()); 498 v8::HandleScope scope(env->GetIsolate());
501 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); 499 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
502 500
503 CompileRun( 501 CompileRun(
504 "k = {}; v = {}; s = 'str';\n" 502 "k = {}; v = {}; s = 'str';\n"
505 "ws = new WeakSet(); ws.add(k); ws.add(v); ws[s] = s;\n" 503 "ws = new WeakSet(); ws.add(k); ws.add(v); ws[s] = s;\n"
506 "wm = new WeakMap(); wm.set(k, v); wm[s] = s;\n"); 504 "wm = new WeakMap(); wm.set(k, v); wm[s] = s;\n");
507 const v8::HeapSnapshot* snapshot = 505 const v8::HeapSnapshot* snapshot =
508 heap_profiler->TakeHeapSnapshot(v8_str("WeakCollections")); 506 heap_profiler->TakeHeapSnapshot(v8_str("WeakCollections"));
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } 561 }
564 CHECK_EQ(2, weak_entries); 562 CHECK_EQ(2, weak_entries);
565 const v8::HeapGraphNode* wm_s = 563 const v8::HeapGraphNode* wm_s =
566 GetProperty(wm, v8::HeapGraphEdge::kProperty, "str"); 564 GetProperty(wm, v8::HeapGraphEdge::kProperty, "str");
567 CHECK_NE(NULL, wm_s); 565 CHECK_NE(NULL, wm_s);
568 CHECK_EQ(static_cast<int>(s->GetId()), static_cast<int>(wm_s->GetId())); 566 CHECK_EQ(static_cast<int>(s->GetId()), static_cast<int>(wm_s->GetId()));
569 } 567 }
570 568
571 569
572 TEST(HeapSnapshotCollection) { 570 TEST(HeapSnapshotCollection) {
573 i::FLAG_harmony_collections = true;
574
575 LocalContext env; 571 LocalContext env;
576 v8::HandleScope scope(env->GetIsolate()); 572 v8::HandleScope scope(env->GetIsolate());
577 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); 573 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
578 574
579 CompileRun( 575 CompileRun(
580 "k = {}; v = {}; s = 'str';\n" 576 "k = {}; v = {}; s = 'str';\n"
581 "set = new Set(); set.add(k); set.add(v); set[s] = s;\n" 577 "set = new Set(); set.add(k); set.add(v); set[s] = s;\n"
582 "map = new Map(); map.set(k, v); map[s] = s;\n"); 578 "map = new Map(); map.set(k, v); map[s] = s;\n");
583 const v8::HeapSnapshot* snapshot = 579 const v8::HeapSnapshot* snapshot =
584 heap_profiler->TakeHeapSnapshot(v8_str("Collections")); 580 heap_profiler->TakeHeapSnapshot(v8_str("Collections"));
(...skipping 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2760 map.AddRange(ToAddress(0x180), 0x80, 6U); 2756 map.AddRange(ToAddress(0x180), 0x80, 6U);
2761 map.AddRange(ToAddress(0x180), 0x80, 7U); 2757 map.AddRange(ToAddress(0x180), 0x80, 7U);
2762 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); 2758 CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180)));
2763 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); 2759 CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200)));
2764 CHECK_EQ(3, static_cast<int>(map.size())); 2760 CHECK_EQ(3, static_cast<int>(map.size()));
2765 2761
2766 map.Clear(); 2762 map.Clear();
2767 CHECK_EQ(0, static_cast<int>(map.size())); 2763 CHECK_EQ(0, static_cast<int>(map.size()));
2768 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); 2764 CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400)));
2769 } 2765 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-ordered-hash-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698