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

Side by Side Diff: src/objects.cc

Issue 2792623002: Track large array buffer allocations. (Closed)
Patch Set: Simplify conversion to log2 value. Created 3 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/counters.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19455 matching lines...) Expand 10 before | Expand all | Expand 10 after
19466 19466
19467 bool JSArrayBuffer::SetupAllocatingData(Handle<JSArrayBuffer> array_buffer, 19467 bool JSArrayBuffer::SetupAllocatingData(Handle<JSArrayBuffer> array_buffer,
19468 Isolate* isolate, 19468 Isolate* isolate,
19469 size_t allocated_length, 19469 size_t allocated_length,
19470 bool initialize, SharedFlag shared) { 19470 bool initialize, SharedFlag shared) {
19471 void* data; 19471 void* data;
19472 CHECK(isolate->array_buffer_allocator() != NULL); 19472 CHECK(isolate->array_buffer_allocator() != NULL);
19473 // Prevent creating array buffers when serializing. 19473 // Prevent creating array buffers when serializing.
19474 DCHECK(!isolate->serializer_enabled()); 19474 DCHECK(!isolate->serializer_enabled());
19475 if (allocated_length != 0) { 19475 if (allocated_length != 0) {
19476 constexpr size_t kMinBigAllocation = 1 << 20;
19477 if (allocated_length >= kMinBigAllocation) {
19478 isolate->counters()->array_buffer_big_allocations()->AddSample(
19479 sizeof(uint64_t) * kBitsPerByte -
19480 base::bits::CountLeadingZeros64(allocated_length));
19481 }
19476 if (initialize) { 19482 if (initialize) {
19477 data = isolate->array_buffer_allocator()->Allocate(allocated_length); 19483 data = isolate->array_buffer_allocator()->Allocate(allocated_length);
19478 } else { 19484 } else {
19479 data = isolate->array_buffer_allocator()->AllocateUninitialized( 19485 data = isolate->array_buffer_allocator()->AllocateUninitialized(
19480 allocated_length); 19486 allocated_length);
19481 } 19487 }
19482 if (data == NULL) return false; 19488 if (data == NULL) return false;
19483 } else { 19489 } else {
19484 data = NULL; 19490 data = NULL;
19485 } 19491 }
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
20409 // depend on this. 20415 // depend on this.
20410 return DICTIONARY_ELEMENTS; 20416 return DICTIONARY_ELEMENTS;
20411 } 20417 }
20412 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 20418 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
20413 return kind; 20419 return kind;
20414 } 20420 }
20415 } 20421 }
20416 20422
20417 } // namespace internal 20423 } // namespace internal
20418 } // namespace v8 20424 } // namespace v8
OLDNEW
« no previous file with comments | « src/counters.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698