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/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 14 matching lines...) Expand all Loading... | |
25 #include "src/contexts.h" | 25 #include "src/contexts.h" |
26 #include "src/conversions-inl.h" | 26 #include "src/conversions-inl.h" |
27 #include "src/counters.h" | 27 #include "src/counters.h" |
28 #include "src/cpu-profiler.h" | 28 #include "src/cpu-profiler.h" |
29 #include "src/debug.h" | 29 #include "src/debug.h" |
30 #include "src/deoptimizer.h" | 30 #include "src/deoptimizer.h" |
31 #include "src/execution.h" | 31 #include "src/execution.h" |
32 #include "src/global-handles.h" | 32 #include "src/global-handles.h" |
33 #include "src/heap-profiler.h" | 33 #include "src/heap-profiler.h" |
34 #include "src/heap-snapshot-generator-inl.h" | 34 #include "src/heap-snapshot-generator-inl.h" |
35 #include "src/heap/spaces.h" | |
35 #include "src/icu_util.h" | 36 #include "src/icu_util.h" |
36 #include "src/json-parser.h" | 37 #include "src/json-parser.h" |
37 #include "src/messages.h" | 38 #include "src/messages.h" |
38 #include "src/parser.h" | 39 #include "src/parser.h" |
39 #include "src/pending-compilation-error-handler.h" | 40 #include "src/pending-compilation-error-handler.h" |
40 #include "src/profile-generator-inl.h" | 41 #include "src/profile-generator-inl.h" |
41 #include "src/property.h" | 42 #include "src/property.h" |
42 #include "src/property-details.h" | 43 #include "src/property-details.h" |
43 #include "src/prototype.h" | 44 #include "src/prototype.h" |
44 #include "src/runtime/runtime.h" | 45 #include "src/runtime/runtime.h" |
(...skipping 5411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5456 } | 5457 } |
5457 | 5458 |
5458 | 5459 |
5459 HeapStatistics::HeapStatistics(): total_heap_size_(0), | 5460 HeapStatistics::HeapStatistics(): total_heap_size_(0), |
5460 total_heap_size_executable_(0), | 5461 total_heap_size_executable_(0), |
5461 total_physical_size_(0), | 5462 total_physical_size_(0), |
5462 used_heap_size_(0), | 5463 used_heap_size_(0), |
5463 heap_size_limit_(0) { } | 5464 heap_size_limit_(0) { } |
5464 | 5465 |
5465 | 5466 |
5467 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), | |
5468 space_size_(0), | |
5469 space_used_size_(0), | |
5470 space_available_size_(0), | |
5471 physical_space_size_(0) { } | |
5472 | |
5473 | |
5466 bool v8::V8::InitializeICU(const char* icu_data_file) { | 5474 bool v8::V8::InitializeICU(const char* icu_data_file) { |
5467 return i::InitializeICU(icu_data_file); | 5475 return i::InitializeICU(icu_data_file); |
5468 } | 5476 } |
5469 | 5477 |
5470 | 5478 |
5471 const char* v8::V8::GetVersion() { | 5479 const char* v8::V8::GetVersion() { |
5472 return i::Version::GetVersion(); | 5480 return i::Version::GetVersion(); |
5473 } | 5481 } |
5474 | 5482 |
5475 | 5483 |
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6993 i::Heap* heap = isolate->heap(); | 7001 i::Heap* heap = isolate->heap(); |
6994 heap_statistics->total_heap_size_ = heap->CommittedMemory(); | 7002 heap_statistics->total_heap_size_ = heap->CommittedMemory(); |
6995 heap_statistics->total_heap_size_executable_ = | 7003 heap_statistics->total_heap_size_executable_ = |
6996 heap->CommittedMemoryExecutable(); | 7004 heap->CommittedMemoryExecutable(); |
6997 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); | 7005 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); |
6998 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); | 7006 heap_statistics->used_heap_size_ = heap->SizeOfObjects(); |
6999 heap_statistics->heap_size_limit_ = heap->MaxReserved(); | 7007 heap_statistics->heap_size_limit_ = heap->MaxReserved(); |
7000 } | 7008 } |
7001 | 7009 |
7002 | 7010 |
7011 int Isolate::NumberOfHeapSpaces() { | |
7012 return i::LAST_SPACE - i::FIRST_SPACE + 1; | |
7013 } | |
7014 | |
7015 | |
7016 bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, | |
7017 int index) { | |
7018 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | |
7019 i::Heap* heap = isolate->heap(); | |
7020 if (!space_statistics) | |
7021 return false; | |
7022 if (index > i::LAST_SPACE || index < i::FIRST_SPACE) | |
7023 return false; | |
7024 | |
7025 space_statistics->space_name_ = heap->GetSpaceName(index); | |
7026 i::Space* space = heap->space(index); | |
rmcilroy
2015/04/16 16:53:36
super nit - move up on line (just to keep all fill
| |
7027 space_statistics->space_size_ = space->CommittedMemory(); | |
7028 space_statistics->space_used_size_ = space->Size(); | |
7029 space_statistics->space_available_size_ = space->Available(); | |
7030 space_statistics->physical_space_size_ = space->CommittedPhysicalMemory(); | |
7031 return true; | |
7032 } | |
7033 | |
7034 | |
7003 void Isolate::GetStackSample(const RegisterState& state, void** frames, | 7035 void Isolate::GetStackSample(const RegisterState& state, void** frames, |
7004 size_t frames_limit, SampleInfo* sample_info) { | 7036 size_t frames_limit, SampleInfo* sample_info) { |
7005 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7037 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
7006 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame, | 7038 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame, |
7007 frames, frames_limit, sample_info); | 7039 frames, frames_limit, sample_info); |
7008 } | 7040 } |
7009 | 7041 |
7010 | 7042 |
7011 void Isolate::SetEventLogger(LogEventCallback that) { | 7043 void Isolate::SetEventLogger(LogEventCallback that) { |
7012 // Do not overwrite the event logger if we want to log explicitly. | 7044 // Do not overwrite the event logger if we want to log explicitly. |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8110 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8142 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8111 Address callback_address = | 8143 Address callback_address = |
8112 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8144 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8113 VMState<EXTERNAL> state(isolate); | 8145 VMState<EXTERNAL> state(isolate); |
8114 ExternalCallbackScope call_scope(isolate, callback_address); | 8146 ExternalCallbackScope call_scope(isolate, callback_address); |
8115 callback(info); | 8147 callback(info); |
8116 } | 8148 } |
8117 | 8149 |
8118 | 8150 |
8119 } } // namespace v8::internal | 8151 } } // namespace v8::internal |
OLD | NEW |