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

Side by Side Diff: src/heap/heap.cc

Issue 1873443002: Improved diagnostic message for JS heap out of memory (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Code review fix, use ternary operator Created 4 years, 8 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 | « src/heap/heap.h ('k') | src/heap/mark-compact.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/heap/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/ast/scopeinfo.h" 9 #include "src/ast/scopeinfo.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 3973 matching lines...) Expand 10 before | Expand all | Expand 10 after
3984 3984
3985 elements->set_map_no_write_barrier(fixed_double_array_map()); 3985 elements->set_map_no_write_barrier(fixed_double_array_map());
3986 FixedDoubleArray::cast(elements)->set_length(length); 3986 FixedDoubleArray::cast(elements)->set_length(length);
3987 return elements; 3987 return elements;
3988 } 3988 }
3989 3989
3990 3990
3991 AllocationResult Heap::AllocateRawFixedDoubleArray(int length, 3991 AllocationResult Heap::AllocateRawFixedDoubleArray(int length,
3992 PretenureFlag pretenure) { 3992 PretenureFlag pretenure) {
3993 if (length < 0 || length > FixedDoubleArray::kMaxLength) { 3993 if (length < 0 || length > FixedDoubleArray::kMaxLength) {
3994 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", 3994 v8::internal::Heap::FatalProcessOutOfMemory("invalid array length", true);
3995 kDoubleAligned);
3996 } 3995 }
3997 int size = FixedDoubleArray::SizeFor(length); 3996 int size = FixedDoubleArray::SizeFor(length);
3998 AllocationSpace space = SelectSpace(pretenure); 3997 AllocationSpace space = SelectSpace(pretenure);
3999 3998
4000 HeapObject* object = nullptr; 3999 HeapObject* object = nullptr;
4001 { 4000 {
4002 AllocationResult allocation = AllocateRaw(size, space, kDoubleAligned); 4001 AllocationResult allocation = AllocateRaw(size, space, kDoubleAligned);
4003 if (!allocation.To(&object)) return allocation; 4002 if (!allocation.To(&object)) return allocation;
4004 } 4003 }
4005 4004
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
5616 new_length += 2; 5615 new_length += 2;
5617 } 5616 }
5618 number_of_disposed_maps_ = new_number_of_disposed_maps; 5617 number_of_disposed_maps_ = new_number_of_disposed_maps;
5619 Object* undefined = undefined_value(); 5618 Object* undefined = undefined_value();
5620 for (int i = new_length; i < length; i++) { 5619 for (int i = new_length; i < length; i++) {
5621 retained_maps->Clear(i, undefined); 5620 retained_maps->Clear(i, undefined);
5622 } 5621 }
5623 if (new_length != length) retained_maps->SetLength(new_length); 5622 if (new_length != length) retained_maps->SetLength(new_length);
5624 } 5623 }
5625 5624
5626 5625 void Heap::FatalProcessOutOfMemory(const char* location, bool is_heap_oom) {
5627 void Heap::FatalProcessOutOfMemory(const char* location, bool take_snapshot) { 5626 v8::internal::V8::FatalProcessOutOfMemory(location, is_heap_oom);
5628 v8::internal::V8::FatalProcessOutOfMemory(location, take_snapshot);
5629 } 5627 }
5630 5628
5631 #ifdef DEBUG 5629 #ifdef DEBUG
5632 5630
5633 class PrintHandleVisitor : public ObjectVisitor { 5631 class PrintHandleVisitor : public ObjectVisitor {
5634 public: 5632 public:
5635 void VisitPointers(Object** start, Object** end) override { 5633 void VisitPointers(Object** start, Object** end) override {
5636 for (Object** p = start; p < end; p++) 5634 for (Object** p = start; p < end; p++)
5637 PrintF(" handle %p to %p\n", reinterpret_cast<void*>(p), 5635 PrintF(" handle %p to %p\n", reinterpret_cast<void*>(p),
5638 reinterpret_cast<void*>(*p)); 5636 reinterpret_cast<void*>(*p));
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
6447 } 6445 }
6448 6446
6449 6447
6450 // static 6448 // static
6451 int Heap::GetStaticVisitorIdForMap(Map* map) { 6449 int Heap::GetStaticVisitorIdForMap(Map* map) {
6452 return StaticVisitorBase::GetVisitorId(map); 6450 return StaticVisitorBase::GetVisitorId(map);
6453 } 6451 }
6454 6452
6455 } // namespace internal 6453 } // namespace internal
6456 } // namespace v8 6454 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698