OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <memory> | 9 #include <memory> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 19543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19554 | 19554 |
19555 bool JSArrayBuffer::SetupAllocatingData(Handle<JSArrayBuffer> array_buffer, | 19555 bool JSArrayBuffer::SetupAllocatingData(Handle<JSArrayBuffer> array_buffer, |
19556 Isolate* isolate, | 19556 Isolate* isolate, |
19557 size_t allocated_length, | 19557 size_t allocated_length, |
19558 bool initialize, SharedFlag shared) { | 19558 bool initialize, SharedFlag shared) { |
19559 void* data; | 19559 void* data; |
19560 CHECK(isolate->array_buffer_allocator() != NULL); | 19560 CHECK(isolate->array_buffer_allocator() != NULL); |
19561 // Prevent creating array buffers when serializing. | 19561 // Prevent creating array buffers when serializing. |
19562 DCHECK(!isolate->serializer_enabled()); | 19562 DCHECK(!isolate->serializer_enabled()); |
19563 if (allocated_length != 0) { | 19563 if (allocated_length != 0) { |
19564 isolate->counters()->array_buffer_big_allocations()->AddSample( | 19564 if (allocated_length >= MB) |
19565 ConvertToMb(allocated_length)); | 19565 isolate->counters()->array_buffer_big_allocations()->AddSample( |
| 19566 ConvertToMb(allocated_length)); |
19566 if (initialize) { | 19567 if (initialize) { |
19567 data = isolate->array_buffer_allocator()->Allocate(allocated_length); | 19568 data = isolate->array_buffer_allocator()->Allocate(allocated_length); |
19568 } else { | 19569 } else { |
19569 data = isolate->array_buffer_allocator()->AllocateUninitialized( | 19570 data = isolate->array_buffer_allocator()->AllocateUninitialized( |
19570 allocated_length); | 19571 allocated_length); |
19571 } | 19572 } |
19572 if (data == NULL) { | 19573 if (data == NULL) { |
19573 isolate->counters()->array_buffer_new_size_failures()->AddSample( | 19574 isolate->counters()->array_buffer_new_size_failures()->AddSample( |
19574 ConvertToMb(allocated_length)); | 19575 ConvertToMb(allocated_length)); |
19575 return false; | 19576 return false; |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20499 // depend on this. | 20500 // depend on this. |
20500 return DICTIONARY_ELEMENTS; | 20501 return DICTIONARY_ELEMENTS; |
20501 } | 20502 } |
20502 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20503 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20503 return kind; | 20504 return kind; |
20504 } | 20505 } |
20505 } | 20506 } |
20506 | 20507 |
20507 } // namespace internal | 20508 } // namespace internal |
20508 } // namespace v8 | 20509 } // namespace v8 |
OLD | NEW |