Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: src/api.cc

Issue 1997363002: Adds support for collecting statistics about code and its metadata. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments from Hannes. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/v8.h ('k') | src/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5486 matching lines...) Expand 10 before | Expand all | Expand 10 after
5497 space_available_size_(0), 5497 space_available_size_(0),
5498 physical_space_size_(0) { } 5498 physical_space_size_(0) { }
5499 5499
5500 5500
5501 HeapObjectStatistics::HeapObjectStatistics() 5501 HeapObjectStatistics::HeapObjectStatistics()
5502 : object_type_(nullptr), 5502 : object_type_(nullptr),
5503 object_sub_type_(nullptr), 5503 object_sub_type_(nullptr),
5504 object_count_(0), 5504 object_count_(0),
5505 object_size_(0) {} 5505 object_size_(0) {}
5506 5506
5507 HeapCodeStatistics::HeapCodeStatistics()
5508 : code_and_metadata_size_(0), bytecode_and_metadata_size_(0) {}
5507 5509
5508 bool v8::V8::InitializeICU(const char* icu_data_file) { 5510 bool v8::V8::InitializeICU(const char* icu_data_file) {
5509 return i::InitializeICU(icu_data_file); 5511 return i::InitializeICU(icu_data_file);
5510 } 5512 }
5511 5513
5512 5514
5513 void v8::V8::InitializeExternalStartupData(const char* directory_path) { 5515 void v8::V8::InitializeExternalStartupData(const char* directory_path) {
5514 i::InitializeExternalStartupData(directory_path); 5516 i::InitializeExternalStartupData(directory_path);
5515 } 5517 }
5516 5518
(...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after
7451 return false; 7453 return false;
7452 } 7454 }
7453 7455
7454 object_statistics->object_type_ = object_type; 7456 object_statistics->object_type_ = object_type;
7455 object_statistics->object_sub_type_ = object_sub_type; 7457 object_statistics->object_sub_type_ = object_sub_type;
7456 object_statistics->object_count_ = object_count; 7458 object_statistics->object_count_ = object_count;
7457 object_statistics->object_size_ = object_size; 7459 object_statistics->object_size_ = object_size;
7458 return true; 7460 return true;
7459 } 7461 }
7460 7462
7463 bool Isolate::GetHeapCodeAndMetadataStatistics(
7464 HeapCodeStatistics* code_statistics) {
7465 if (!code_statistics) return false;
7466
7467 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7468 isolate->heap()->CollectCodeStatistics();
7469
7470 code_statistics->code_and_metadata_size_ = isolate->code_and_metadata_size();
7471 code_statistics->bytecode_and_metadata_size_ =
7472 isolate->bytecode_and_metadata_size();
7473 return true;
7474 }
7461 7475
7462 void Isolate::GetStackSample(const RegisterState& state, void** frames, 7476 void Isolate::GetStackSample(const RegisterState& state, void** frames,
7463 size_t frames_limit, SampleInfo* sample_info) { 7477 size_t frames_limit, SampleInfo* sample_info) {
7464 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 7478 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
7465 #if defined(USE_SIMULATOR) 7479 #if defined(USE_SIMULATOR)
7466 RegisterState regs; 7480 RegisterState regs;
7467 regs.pc = state.pc; 7481 regs.pc = state.pc;
7468 regs.sp = state.sp; 7482 regs.sp = state.sp;
7469 regs.fp = state.fp; 7483 regs.fp = state.fp;
7470 i::SimulatorHelper::FillRegisters(isolate, &regs); 7484 i::SimulatorHelper::FillRegisters(isolate, &regs);
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
8798 Address callback_address = 8812 Address callback_address =
8799 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8813 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8800 VMState<EXTERNAL> state(isolate); 8814 VMState<EXTERNAL> state(isolate);
8801 ExternalCallbackScope call_scope(isolate, callback_address); 8815 ExternalCallbackScope call_scope(isolate, callback_address);
8802 callback(info); 8816 callback(info);
8803 } 8817 }
8804 8818
8805 8819
8806 } // namespace internal 8820 } // namespace internal
8807 } // namespace v8 8821 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698