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 3943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3954 } | 3954 } |
3955 | 3955 |
3956 | 3956 |
3957 HeapStatistics::HeapStatistics(): total_heap_size_(0), | 3957 HeapStatistics::HeapStatistics(): total_heap_size_(0), |
3958 total_heap_size_executable_(0), | 3958 total_heap_size_executable_(0), |
3959 used_heap_size_(0), | 3959 used_heap_size_(0), |
3960 heap_size_limit_(0) { } | 3960 heap_size_limit_(0) { } |
3961 | 3961 |
3962 | 3962 |
3963 void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) { | 3963 void v8::V8::GetHeapStatistics(HeapStatistics* heap_statistics) { |
| 3964 if (!i::Isolate::Current()->IsInitialized()) { |
| 3965 // Isolate is unitialized thus heap is not configured yet. |
| 3966 heap_statistics->set_total_heap_size(0); |
| 3967 heap_statistics->set_total_heap_size_executable(0); |
| 3968 heap_statistics->set_used_heap_size(0); |
| 3969 heap_statistics->set_heap_size_limit(0); |
| 3970 return; |
| 3971 } |
| 3972 |
3964 i::Heap* heap = i::Isolate::Current()->heap(); | 3973 i::Heap* heap = i::Isolate::Current()->heap(); |
3965 heap_statistics->set_total_heap_size(heap->CommittedMemory()); | 3974 heap_statistics->set_total_heap_size(heap->CommittedMemory()); |
3966 heap_statistics->set_total_heap_size_executable( | 3975 heap_statistics->set_total_heap_size_executable( |
3967 heap->CommittedMemoryExecutable()); | 3976 heap->CommittedMemoryExecutable()); |
3968 heap_statistics->set_used_heap_size(heap->SizeOfObjects()); | 3977 heap_statistics->set_used_heap_size(heap->SizeOfObjects()); |
3969 heap_statistics->set_heap_size_limit(heap->MaxReserved()); | 3978 heap_statistics->set_heap_size_limit(heap->MaxReserved()); |
3970 } | 3979 } |
3971 | 3980 |
3972 | 3981 |
3973 bool v8::V8::IdleNotification() { | 3982 bool v8::V8::IdleNotification() { |
(...skipping 2091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6065 | 6074 |
6066 | 6075 |
6067 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 6076 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
6068 HandleScopeImplementer* scope_implementer = | 6077 HandleScopeImplementer* scope_implementer = |
6069 reinterpret_cast<HandleScopeImplementer*>(storage); | 6078 reinterpret_cast<HandleScopeImplementer*>(storage); |
6070 scope_implementer->IterateThis(v); | 6079 scope_implementer->IterateThis(v); |
6071 return storage + ArchiveSpacePerThread(); | 6080 return storage + ArchiveSpacePerThread(); |
6072 } | 6081 } |
6073 | 6082 |
6074 } } // namespace v8::internal | 6083 } } // namespace v8::internal |
OLD | NEW |