| 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 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2561 reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker(); | 2561 reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker(); |
| 2562 CHECK(tracker); | 2562 CHECK(tracker); |
| 2563 // Resolve all function locations. | 2563 // Resolve all function locations. |
| 2564 tracker->PrepareForSerialization(); | 2564 tracker->PrepareForSerialization(); |
| 2565 // Print for better diagnostics in case of failure. | 2565 // Print for better diagnostics in case of failure. |
| 2566 tracker->trace_tree()->Print(tracker); | 2566 tracker->trace_tree()->Print(tracker); |
| 2567 | 2567 |
| 2568 const char* names[] = {"", "start", "f_0_0"}; | 2568 const char* names[] = {"", "start", "f_0_0"}; |
| 2569 AllocationTraceNode* node = FindNode(tracker, ArrayVector(names)); | 2569 AllocationTraceNode* node = FindNode(tracker, ArrayVector(names)); |
| 2570 CHECK(node); | 2570 CHECK(node); |
| 2571 CHECK_GE(node->allocation_count(), 12u); | 2571 CHECK_GE(node->allocation_count(), 10u); |
| 2572 CHECK_GE(node->allocation_size(), 4 * node->allocation_count()); | 2572 CHECK_GE(node->allocation_size(), 4 * node->allocation_count()); |
| 2573 heap_profiler->StopTrackingHeapObjects(); | 2573 heap_profiler->StopTrackingHeapObjects(); |
| 2574 } | 2574 } |
| 2575 | 2575 |
| 2576 TEST(TrackHeapAllocationsWithoutInlining) { | 2576 TEST(TrackHeapAllocationsWithoutInlining) { |
| 2577 i::FLAG_turbo_inlining = false; | 2577 i::FLAG_turbo_inlining = false; |
| 2578 i::FLAG_max_inlined_source_size = 0; // Disable inlining | 2578 i::FLAG_max_inlined_source_size = 0; // Disable inlining |
| 2579 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 2579 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 2580 LocalContext env; | 2580 LocalContext env; |
| 2581 | 2581 |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3102 " a[i] = i;\n" | 3102 " a[i] = i;\n" |
| 3103 " for (var i = 0; i < 3; ++i)\n" | 3103 " for (var i = 0; i < 3; ++i)\n" |
| 3104 " a.shift();\n" | 3104 " a.shift();\n" |
| 3105 "}\n"); | 3105 "}\n"); |
| 3106 | 3106 |
| 3107 CcTest::CollectGarbage(v8::internal::NEW_SPACE); | 3107 CcTest::CollectGarbage(v8::internal::NEW_SPACE); |
| 3108 // Should not crash. | 3108 // Should not crash. |
| 3109 | 3109 |
| 3110 heap_profiler->StopSamplingHeapProfiler(); | 3110 heap_profiler->StopSamplingHeapProfiler(); |
| 3111 } | 3111 } |
| OLD | NEW |