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

Side by Side Diff: runtime/vm/profiler.cc

Issue 92513002: Switch SetupIsolateForProfiling to use calloc instead of new [] (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <cstdio> 5 #include <cstdio>
6 6
7 #include "platform/utils.h" 7 #include "platform/utils.h"
8 8
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/json_stream.h" 10 #include "vm/json_stream.h"
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 572 }
573 vm_tags = kIdle; 573 vm_tags = kIdle;
574 runtime_tags = 0; 574 runtime_tags = 0;
575 } 575 }
576 576
577 577
578 SampleBuffer::SampleBuffer(intptr_t capacity) { 578 SampleBuffer::SampleBuffer(intptr_t capacity) {
579 start_ = 0; 579 start_ = 0;
580 end_ = 0; 580 end_ = 0;
581 capacity_ = capacity; 581 capacity_ = capacity;
582 samples_ = new Sample[capacity]; 582 samples_ = reinterpret_cast<Sample*>(calloc(capacity, sizeof(Sample)));
583 } 583 }
584 584
585 585
586 SampleBuffer::~SampleBuffer() { 586 SampleBuffer::~SampleBuffer() {
587 if (samples_ != NULL) { 587 if (samples_ != NULL) {
588 delete[] samples_; 588 free(samples_);
589 samples_ = NULL; 589 samples_ = NULL;
590 } 590 }
siva 2013/11/27 21:01:55 for completeness: start_ = 0; end_ = 0; capaci
Cutch 2013/11/27 21:48:56 Done.
591 } 591 }
592 592
593 593
594 Sample* SampleBuffer::ReserveSample() { 594 Sample* SampleBuffer::ReserveSample() {
595 ASSERT(samples_ != NULL); 595 ASSERT(samples_ != NULL);
596 intptr_t index = end_; 596 intptr_t index = end_;
597 end_ = WrapIncrement(end_); 597 end_ = WrapIncrement(end_);
598 if (end_ == start_) { 598 if (end_ == start_) {
599 start_ = WrapIncrement(start_); 599 start_ = WrapIncrement(start_);
600 } 600 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 return false; 698 return false;
699 } 699 }
700 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); 700 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp);
701 cursor += sizeof(fp); 701 cursor += sizeof(fp);
702 bool r = cursor >= lower_bound_ && cursor < stack_upper_; 702 bool r = cursor >= lower_bound_ && cursor < stack_upper_;
703 return r; 703 return r;
704 } 704 }
705 705
706 706
707 } // namespace dart 707 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698