OLD | NEW |
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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 CHECK(a); | 475 CHECK(a); |
476 CHECK_EQ(a->GetType(), v8::HeapGraphNode::kSymbol); | 476 CHECK_EQ(a->GetType(), v8::HeapGraphNode::kSymbol); |
477 CHECK(v8_str("symbol")->Equals(a->GetName())); | 477 CHECK(v8_str("symbol")->Equals(a->GetName())); |
478 const v8::HeapGraphNode* name = | 478 const v8::HeapGraphNode* name = |
479 GetProperty(a, v8::HeapGraphEdge::kInternal, "name"); | 479 GetProperty(a, v8::HeapGraphEdge::kInternal, "name"); |
480 CHECK(name); | 480 CHECK(name); |
481 CHECK(v8_str("mySymbol")->Equals(name->GetName())); | 481 CHECK(v8_str("mySymbol")->Equals(name->GetName())); |
482 } | 482 } |
483 | 483 |
484 | 484 |
485 TEST(HeapSnapshotFloat32x4) { | 485 void CheckSimdSnapshot(const char* program, const char* var_name) { |
486 i::FLAG_harmony_simd = true; | 486 i::FLAG_harmony_simd = true; |
487 LocalContext env; | 487 LocalContext env; |
488 v8::HandleScope scope(env->GetIsolate()); | 488 v8::HandleScope scope(env->GetIsolate()); |
489 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); | 489 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); |
490 | 490 |
491 CompileRun("a = SIMD.Float32x4(1, 2, 3, 4);\n"); | 491 CompileRun(program); |
492 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); | 492 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); |
493 CHECK(ValidateSnapshot(snapshot)); | 493 CHECK(ValidateSnapshot(snapshot)); |
494 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); | 494 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
495 const v8::HeapGraphNode* a = | 495 const v8::HeapGraphNode* var = |
496 GetProperty(global, v8::HeapGraphEdge::kProperty, "a"); | 496 GetProperty(global, v8::HeapGraphEdge::kProperty, var_name); |
497 CHECK(a); | 497 CHECK(var); |
498 CHECK_EQ(a->GetType(), v8::HeapGraphNode::kSimdValue); | 498 CHECK_EQ(var->GetType(), v8::HeapGraphNode::kSimdValue); |
499 } | 499 } |
500 | 500 |
501 | 501 |
| 502 TEST(HeapSnapshotSimd) { |
| 503 CheckSimdSnapshot("a = SIMD.Float32x4();\n", "a"); |
| 504 CheckSimdSnapshot("a = SIMD.Int32x4();\n", "a"); |
| 505 CheckSimdSnapshot("a = SIMD.Bool32x4();\n", "a"); |
| 506 CheckSimdSnapshot("a = SIMD.Int16x8();\n", "a"); |
| 507 CheckSimdSnapshot("a = SIMD.Bool16x8();\n", "a"); |
| 508 CheckSimdSnapshot("a = SIMD.Int8x16();\n", "a"); |
| 509 CheckSimdSnapshot("a = SIMD.Bool8x16();\n", "a"); |
| 510 } |
| 511 |
| 512 |
502 TEST(HeapSnapshotWeakCollection) { | 513 TEST(HeapSnapshotWeakCollection) { |
503 LocalContext env; | 514 LocalContext env; |
504 v8::HandleScope scope(env->GetIsolate()); | 515 v8::HandleScope scope(env->GetIsolate()); |
505 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); | 516 v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); |
506 | 517 |
507 CompileRun( | 518 CompileRun( |
508 "k = {}; v = {}; s = 'str';\n" | 519 "k = {}; v = {}; s = 'str';\n" |
509 "ws = new WeakSet(); ws.add(k); ws.add(v); ws[s] = s;\n" | 520 "ws = new WeakSet(); ws.add(k); ws.add(v); ws[s] = s;\n" |
510 "wm = new WeakMap(); wm.set(k, v); wm[s] = s;\n"); | 521 "wm = new WeakMap(); wm.set(k, v); wm[s] = s;\n"); |
511 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); | 522 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); |
(...skipping 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 map.AddRange(ToAddress(0x180), 0x80, 6U); | 2789 map.AddRange(ToAddress(0x180), 0x80, 6U); |
2779 map.AddRange(ToAddress(0x180), 0x80, 7U); | 2790 map.AddRange(ToAddress(0x180), 0x80, 7U); |
2780 CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180))); | 2791 CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180))); |
2781 CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200))); | 2792 CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200))); |
2782 CHECK_EQ(3u, map.size()); | 2793 CHECK_EQ(3u, map.size()); |
2783 | 2794 |
2784 map.Clear(); | 2795 map.Clear(); |
2785 CHECK_EQ(0u, map.size()); | 2796 CHECK_EQ(0u, map.size()); |
2786 CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400))); | 2797 CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400))); |
2787 } | 2798 } |
OLD | NEW |