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 19467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19478 isolate->counters()->array_buffer_big_allocations()->AddSample( | 19478 isolate->counters()->array_buffer_big_allocations()->AddSample( |
19479 sizeof(uint64_t) * kBitsPerByte - | 19479 sizeof(uint64_t) * kBitsPerByte - |
19480 base::bits::CountLeadingZeros64(allocated_length)); | 19480 base::bits::CountLeadingZeros64(allocated_length)); |
19481 } | 19481 } |
19482 if (initialize) { | 19482 if (initialize) { |
19483 data = isolate->array_buffer_allocator()->Allocate(allocated_length); | 19483 data = isolate->array_buffer_allocator()->Allocate(allocated_length); |
19484 } else { | 19484 } else { |
19485 data = isolate->array_buffer_allocator()->AllocateUninitialized( | 19485 data = isolate->array_buffer_allocator()->AllocateUninitialized( |
19486 allocated_length); | 19486 allocated_length); |
19487 } | 19487 } |
19488 if (data == NULL) return false; | 19488 if (data == NULL) { |
| 19489 isolate->counters()->array_buffer_new_size_failures()->AddSample( |
| 19490 sizeof(uint64_t) * kBitsPerByte - |
| 19491 base::bits::CountLeadingZeros64(allocated_length)); |
| 19492 return false; |
| 19493 } |
19489 } else { | 19494 } else { |
19490 data = NULL; | 19495 data = NULL; |
19491 } | 19496 } |
19492 | 19497 |
19493 JSArrayBuffer::Setup(array_buffer, isolate, false, data, allocated_length, | 19498 JSArrayBuffer::Setup(array_buffer, isolate, false, data, allocated_length, |
19494 shared); | 19499 shared); |
19495 return true; | 19500 return true; |
19496 } | 19501 } |
19497 | 19502 |
19498 | 19503 |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20415 // depend on this. | 20420 // depend on this. |
20416 return DICTIONARY_ELEMENTS; | 20421 return DICTIONARY_ELEMENTS; |
20417 } | 20422 } |
20418 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20423 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
20419 return kind; | 20424 return kind; |
20420 } | 20425 } |
20421 } | 20426 } |
20422 | 20427 |
20423 } // namespace internal | 20428 } // namespace internal |
20424 } // namespace v8 | 20429 } // namespace v8 |
OLD | NEW |