V8 crashes when profile generator allocates a buffer for HeapEntry'es bigger than 2Gb.
BUG=none TEST=profile-generator tests Review URL: https://chromiumcodereview.appspot.com/9632020 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10998 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
dd711075fa
commit
0b360fb519
@ -80,7 +80,7 @@ class AllStatic {
|
||||
|
||||
|
||||
template <typename T>
|
||||
T* NewArray(int size) {
|
||||
T* NewArray(size_t size) {
|
||||
T* result = new T[size];
|
||||
if (result == NULL) Malloced::FatalProcessOutOfMemory();
|
||||
return result;
|
||||
|
@ -1096,9 +1096,9 @@ const char* HeapEntry::TypeAsString() {
|
||||
}
|
||||
|
||||
|
||||
int HeapEntry::EntriesSize(int entries_count,
|
||||
int children_count,
|
||||
int retainers_count) {
|
||||
size_t HeapEntry::EntriesSize(int entries_count,
|
||||
int children_count,
|
||||
int retainers_count) {
|
||||
return sizeof(HeapEntry) * entries_count // NOLINT
|
||||
+ sizeof(HeapGraphEdge) * children_count // NOLINT
|
||||
+ sizeof(HeapGraphEdge*) * retainers_count; // NOLINT
|
||||
@ -1114,13 +1114,14 @@ template <size_t ptr_size> struct SnapshotSizeConstants;
|
||||
template <> struct SnapshotSizeConstants<4> {
|
||||
static const int kExpectedHeapGraphEdgeSize = 12;
|
||||
static const int kExpectedHeapEntrySize = 36;
|
||||
static const int kMaxSerializableSnapshotRawSize = 256 * MB;
|
||||
static const size_t kMaxSerializableSnapshotRawSize = 256 * MB;
|
||||
};
|
||||
|
||||
template <> struct SnapshotSizeConstants<8> {
|
||||
static const int kExpectedHeapGraphEdgeSize = 24;
|
||||
static const int kExpectedHeapEntrySize = 48;
|
||||
static const int kMaxSerializableSnapshotRawSize = 768 * MB;
|
||||
static const uint64_t kMaxSerializableSnapshotRawSize =
|
||||
static_cast<uint64_t>(6000) * MB;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
@ -3437,8 +3438,8 @@ HeapSnapshot* HeapSnapshotJSONSerializer::CreateFakeSnapshot() {
|
||||
HeapEntry* root = result->AddRootEntry(1);
|
||||
const char* text = snapshot_->collection()->names()->GetFormatted(
|
||||
"The snapshot is too big. "
|
||||
"Maximum snapshot size is %d MB. "
|
||||
"Actual snapshot size is %d MB.",
|
||||
"Maximum snapshot size is %" V8_PTR_PREFIX "u MB. "
|
||||
"Actual snapshot size is %" V8_PTR_PREFIX "u MB.",
|
||||
SnapshotSizeConstants<kPointerSize>::kMaxSerializableSnapshotRawSize / MB,
|
||||
(snapshot_->raw_entries_size() + MB - 1) / MB);
|
||||
HeapEntry* message = result->AddEntry(
|
||||
|
@ -577,16 +577,18 @@ class HeapEntry BASE_EMBEDDED {
|
||||
int retainer_index);
|
||||
void SetUnidirElementReference(int child_index, int index, HeapEntry* entry);
|
||||
|
||||
int EntrySize() { return EntriesSize(1, children_count_, retainers_count_); }
|
||||
size_t EntrySize() {
|
||||
return EntriesSize(1, children_count_, retainers_count_);
|
||||
}
|
||||
|
||||
void Print(
|
||||
const char* prefix, const char* edge_name, int max_depth, int indent);
|
||||
|
||||
Handle<HeapObject> GetHeapObject();
|
||||
|
||||
static int EntriesSize(int entries_count,
|
||||
int children_count,
|
||||
int retainers_count);
|
||||
static size_t EntriesSize(int entries_count,
|
||||
int children_count,
|
||||
int retainers_count);
|
||||
|
||||
private:
|
||||
HeapGraphEdge* children_arr() {
|
||||
@ -647,7 +649,7 @@ class HeapSnapshot {
|
||||
HeapEntry* natives_root() { return natives_root_entry_; }
|
||||
HeapEntry* gc_subroot(int index) { return gc_subroot_entries_[index]; }
|
||||
List<HeapEntry*>* entries() { return &entries_; }
|
||||
int raw_entries_size() { return raw_entries_size_; }
|
||||
size_t raw_entries_size() { return raw_entries_size_; }
|
||||
|
||||
void AllocateEntries(
|
||||
int entries_count, int children_count, int retainers_count);
|
||||
@ -687,7 +689,7 @@ class HeapSnapshot {
|
||||
char* raw_entries_;
|
||||
List<HeapEntry*> entries_;
|
||||
bool entries_sorted_;
|
||||
int raw_entries_size_;
|
||||
size_t raw_entries_size_;
|
||||
|
||||
friend class HeapSnapshotTester;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user