OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/extensions/statistics-extension.h" | 5 #include "src/extensions/statistics-extension.h" |
6 | 6 |
7 #include "src/counters.h" | 7 #include "src/counters.h" |
8 #include "src/heap/heap-inl.h" | 8 #include "src/heap/heap-inl.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 void StatisticsExtension::GetCounters( | 60 void StatisticsExtension::GetCounters( |
61 const v8::FunctionCallbackInfo<v8::Value>& args) { | 61 const v8::FunctionCallbackInfo<v8::Value>& args) { |
62 Isolate* isolate = reinterpret_cast<Isolate*>(args.GetIsolate()); | 62 Isolate* isolate = reinterpret_cast<Isolate*>(args.GetIsolate()); |
63 Heap* heap = isolate->heap(); | 63 Heap* heap = isolate->heap(); |
64 | 64 |
65 if (args.Length() > 0) { // GC if first argument evaluates to true. | 65 if (args.Length() > 0) { // GC if first argument evaluates to true. |
66 if (args[0]->IsBoolean() && | 66 if (args[0]->IsBoolean() && |
67 args[0] | 67 args[0] |
68 ->BooleanValue(args.GetIsolate()->GetCurrentContext()) | 68 ->BooleanValue(args.GetIsolate()->GetCurrentContext()) |
69 .FromMaybe(false)) { | 69 .FromMaybe(false)) { |
70 heap->CollectAllGarbage(Heap::kNoGCFlags, "counters extension"); | 70 heap->CollectAllGarbage(Heap::kNoGCFlags, |
| 71 GarbageCollectionReason::kCountersExtension); |
71 } | 72 } |
72 } | 73 } |
73 | 74 |
74 Counters* counters = isolate->counters(); | 75 Counters* counters = isolate->counters(); |
75 v8::Local<v8::Object> result = v8::Object::New(args.GetIsolate()); | 76 v8::Local<v8::Object> result = v8::Object::New(args.GetIsolate()); |
76 | 77 |
77 struct StatisticsCounter { | 78 struct StatisticsCounter { |
78 v8::internal::StatsCounter* counter; | 79 v8::internal::StatsCounter* counter; |
79 const char* name; | 80 const char* name; |
80 }; | 81 }; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 159 } |
159 | 160 |
160 AddNumber(args.GetIsolate(), result, reloc_info_total, | 161 AddNumber(args.GetIsolate(), result, reloc_info_total, |
161 "reloc_info_total_size"); | 162 "reloc_info_total_size"); |
162 AddNumber(args.GetIsolate(), result, source_position_table_total, | 163 AddNumber(args.GetIsolate(), result, source_position_table_total, |
163 "source_position_table_total_size"); | 164 "source_position_table_total_size"); |
164 } | 165 } |
165 | 166 |
166 } // namespace internal | 167 } // namespace internal |
167 } // namespace v8 | 168 } // namespace v8 |
OLD | NEW |