| OLD | NEW |
| 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 Loading... |
| 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 start_ = 0; |
| 591 end_ = 0; |
| 592 capacity_ = 0; |
| 590 } | 593 } |
| 591 } | 594 } |
| 592 | 595 |
| 593 | 596 |
| 594 Sample* SampleBuffer::ReserveSample() { | 597 Sample* SampleBuffer::ReserveSample() { |
| 595 ASSERT(samples_ != NULL); | 598 ASSERT(samples_ != NULL); |
| 596 intptr_t index = end_; | 599 intptr_t index = end_; |
| 597 end_ = WrapIncrement(end_); | 600 end_ = WrapIncrement(end_); |
| 598 if (end_ == start_) { | 601 if (end_ == start_) { |
| 599 start_ = WrapIncrement(start_); | 602 start_ = WrapIncrement(start_); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 return false; | 701 return false; |
| 699 } | 702 } |
| 700 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); | 703 uintptr_t cursor = reinterpret_cast<uintptr_t>(fp); |
| 701 cursor += sizeof(fp); | 704 cursor += sizeof(fp); |
| 702 bool r = cursor >= lower_bound_ && cursor < stack_upper_; | 705 bool r = cursor >= lower_bound_ && cursor < stack_upper_; |
| 703 return r; | 706 return r; |
| 704 } | 707 } |
| 705 | 708 |
| 706 | 709 |
| 707 } // namespace dart | 710 } // namespace dart |
| OLD | NEW |