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