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 19431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19442 size_t allocated_length, | 19442 size_t allocated_length, |
19443 bool initialize, SharedFlag shared) { | 19443 bool initialize, SharedFlag shared) { |
19444 void* data; | 19444 void* data; |
19445 CHECK(isolate->array_buffer_allocator() != NULL); | 19445 CHECK(isolate->array_buffer_allocator() != NULL); |
19446 // Prevent creating array buffers when serializing. | 19446 // Prevent creating array buffers when serializing. |
19447 DCHECK(!isolate->serializer_enabled()); | 19447 DCHECK(!isolate->serializer_enabled()); |
19448 if (allocated_length != 0) { | 19448 if (allocated_length != 0) { |
19449 if (allocated_length >= MB) | 19449 if (allocated_length >= MB) |
19450 isolate->counters()->array_buffer_big_allocations()->AddSample( | 19450 isolate->counters()->array_buffer_big_allocations()->AddSample( |
19451 ConvertToMb(allocated_length)); | 19451 ConvertToMb(allocated_length)); |
| 19452 if (shared == SharedFlag::kShared) |
| 19453 isolate->counters()->shared_array_allocations()->AddSample( |
| 19454 ConvertToMb(allocated_length)); |
19452 if (initialize) { | 19455 if (initialize) { |
19453 data = isolate->array_buffer_allocator()->Allocate(allocated_length); | 19456 data = isolate->array_buffer_allocator()->Allocate(allocated_length); |
19454 } else { | 19457 } else { |
19455 data = isolate->array_buffer_allocator()->AllocateUninitialized( | 19458 data = isolate->array_buffer_allocator()->AllocateUninitialized( |
19456 allocated_length); | 19459 allocated_length); |
19457 } | 19460 } |
19458 if (data == NULL) { | 19461 if (data == NULL) { |
19459 isolate->counters()->array_buffer_new_size_failures()->AddSample( | 19462 isolate->counters()->array_buffer_new_size_failures()->AddSample( |
19460 ConvertToMb(allocated_length)); | 19463 ConvertToMb(allocated_length)); |
19461 return false; | 19464 return false; |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20385 // not | 20388 // not |
20386 // depend on this. | 20389 // depend on this. |
20387 return DICTIONARY_ELEMENTS; | 20390 return DICTIONARY_ELEMENTS; |
20388 } | 20391 } |
20389 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20392 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20390 return kind; | 20393 return kind; |
20391 } | 20394 } |
20392 } | 20395 } |
20393 } // namespace internal | 20396 } // namespace internal |
20394 } // namespace v8 | 20397 } // namespace v8 |
OLD | NEW |