Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index 604283075f47ddbd8908a73b68693be90913cf46..3a2b7cbac104846a7150d10f017922ab13e669f8 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -18596,13 +18596,20 @@ RawStacktrace* Stacktrace::New(const Array& code_array, |
| void Stacktrace::Append(const Array& code_list, |
| - const Array& pc_offset_list) const { |
| + const Array& pc_offset_list, |
| + const intptr_t offset) const { |
| intptr_t old_length = Length(); |
| - intptr_t new_length = old_length + pc_offset_list.Length(); |
| + intptr_t new_length = old_length + pc_offset_list.Length() - offset; |
| ASSERT(pc_offset_list.Length() == code_list.Length()); |
| + ASSERT(offset <= code_list.Length()); |
|
siva
2014/06/25 22:46:12
ASSERT(offset....) should be above the use of 'off
rmacnak
2014/06/25 23:00:43
Done
|
| + if (new_length == old_length) { |
| + // Nothing to append. Avoid work and an assert that growing arrays always |
| + // increases their size. |
| + return; |
| + } |
| - // Grow the arrays for function, code and pc_offset triplet to accommodate |
| - // the new stack frames. |
| + // Grow the arrays for code, pc_offset pairs to accommodate the new stack |
| + // frames. |
| Array& code_array = Array::Handle(raw_ptr()->code_array_); |
| Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); |
| code_array = Array::Grow(code_array, new_length); |
| @@ -18610,7 +18617,7 @@ void Stacktrace::Append(const Array& code_list, |
| set_code_array(code_array); |
| set_pc_offset_array(pc_offset_array); |
| // Now append the new function and code list to the existing arrays. |
| - intptr_t j = 0; |
| + intptr_t j = offset; |
| Object& obj = Object::Handle(); |
| for (intptr_t i = old_length; i < new_length; i++, j++) { |
| obj = code_list.At(j); |