| 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 #include "src/objects-inl.h" // TODO(mstarzinger): Temporary cycle breaker! | 10 #include "src/objects-inl.h" // TODO(mstarzinger): Temporary cycle breaker! |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 void StatisticsExtension::GetCounters( | 61 void StatisticsExtension::GetCounters( |
| 62 const v8::FunctionCallbackInfo<v8::Value>& args) { | 62 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 63 Isolate* isolate = reinterpret_cast<Isolate*>(args.GetIsolate()); | 63 Isolate* isolate = reinterpret_cast<Isolate*>(args.GetIsolate()); |
| 64 Heap* heap = isolate->heap(); | 64 Heap* heap = isolate->heap(); |
| 65 | 65 |
| 66 if (args.Length() > 0) { // GC if first argument evaluates to true. | 66 if (args.Length() > 0) { // GC if first argument evaluates to true. |
| 67 if (args[0]->IsBoolean() && | 67 if (args[0]->IsBoolean() && |
| 68 args[0] | 68 args[0] |
| 69 ->BooleanValue(args.GetIsolate()->GetCurrentContext()) | 69 ->BooleanValue(args.GetIsolate()->GetCurrentContext()) |
| 70 .FromMaybe(false)) { | 70 .FromMaybe(false)) { |
| 71 heap->CollectAllGarbage(Heap::kNoGCFlags, "counters extension"); | 71 heap->CollectAllGarbage("counters extension", Heap::kNoGCFlags); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 Counters* counters = isolate->counters(); | 75 Counters* counters = isolate->counters(); |
| 76 v8::Local<v8::Object> result = v8::Object::New(args.GetIsolate()); | 76 v8::Local<v8::Object> result = v8::Object::New(args.GetIsolate()); |
| 77 | 77 |
| 78 struct StatisticsCounter { | 78 struct StatisticsCounter { |
| 79 v8::internal::StatsCounter* counter; | 79 v8::internal::StatsCounter* counter; |
| 80 const char* name; | 80 const char* name; |
| 81 }; | 81 }; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 137 } |
| 138 | 138 |
| 139 AddNumber64(args.GetIsolate(), result, | 139 AddNumber64(args.GetIsolate(), result, |
| 140 heap->amount_of_external_allocated_memory(), | 140 heap->amount_of_external_allocated_memory(), |
| 141 "amount_of_external_allocated_memory"); | 141 "amount_of_external_allocated_memory"); |
| 142 args.GetReturnValue().Set(result); | 142 args.GetReturnValue().Set(result); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace internal | 145 } // namespace internal |
| 146 } // namespace v8 | 146 } // namespace v8 |
| OLD | NEW |