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 2559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2570 CompileRun("arr1 = new Uint32Array(100);\n"); | 2570 CompileRun("arr1 = new Uint32Array(100);\n"); |
2571 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); | 2571 const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); |
2572 CHECK(ValidateSnapshot(snapshot)); | 2572 CHECK(ValidateSnapshot(snapshot)); |
2573 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); | 2573 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
2574 const v8::HeapGraphNode* arr1_obj = | 2574 const v8::HeapGraphNode* arr1_obj = |
2575 GetProperty(global, v8::HeapGraphEdge::kProperty, "arr1"); | 2575 GetProperty(global, v8::HeapGraphEdge::kProperty, "arr1"); |
2576 CHECK(arr1_obj); | 2576 CHECK(arr1_obj); |
2577 const v8::HeapGraphNode* arr1_buffer = | 2577 const v8::HeapGraphNode* arr1_buffer = |
2578 GetProperty(arr1_obj, v8::HeapGraphEdge::kInternal, "buffer"); | 2578 GetProperty(arr1_obj, v8::HeapGraphEdge::kInternal, "buffer"); |
2579 CHECK(arr1_buffer); | 2579 CHECK(arr1_buffer); |
2580 const v8::HeapGraphNode* first_view = | |
2581 GetProperty(arr1_buffer, v8::HeapGraphEdge::kWeak, "weak_first_view"); | |
2582 CHECK(first_view); | |
2583 const v8::HeapGraphNode* backing_store = | 2580 const v8::HeapGraphNode* backing_store = |
2584 GetProperty(arr1_buffer, v8::HeapGraphEdge::kInternal, "backing_store"); | 2581 GetProperty(arr1_buffer, v8::HeapGraphEdge::kInternal, "backing_store"); |
2585 CHECK(backing_store); | 2582 CHECK(backing_store); |
2586 CHECK_EQ(400, static_cast<int>(backing_store->GetShallowSize())); | 2583 CHECK_EQ(400, static_cast<int>(backing_store->GetShallowSize())); |
2587 } | 2584 } |
2588 | 2585 |
2589 | 2586 |
2590 static int GetRetainersCount(const v8::HeapSnapshot* snapshot, | 2587 static int GetRetainersCount(const v8::HeapSnapshot* snapshot, |
2591 const v8::HeapGraphNode* node) { | 2588 const v8::HeapGraphNode* node) { |
2592 int count = 0; | 2589 int count = 0; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2759 map.AddRange(ToAddress(0x180), 0x80, 6U); | 2756 map.AddRange(ToAddress(0x180), 0x80, 6U); |
2760 map.AddRange(ToAddress(0x180), 0x80, 7U); | 2757 map.AddRange(ToAddress(0x180), 0x80, 7U); |
2761 CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180))); | 2758 CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180))); |
2762 CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200))); | 2759 CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200))); |
2763 CHECK_EQ(3u, map.size()); | 2760 CHECK_EQ(3u, map.size()); |
2764 | 2761 |
2765 map.Clear(); | 2762 map.Clear(); |
2766 CHECK_EQ(0u, map.size()); | 2763 CHECK_EQ(0u, map.size()); |
2767 CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400))); | 2764 CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400))); |
2768 } | 2765 } |
OLD | NEW |