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/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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |