| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 18578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18589 result.set_code_array(code_array); | 18589 result.set_code_array(code_array); |
| 18590 result.set_pc_offset_array(pc_offset_array); | 18590 result.set_pc_offset_array(pc_offset_array); |
| 18591 result.SetCatchStacktrace(Object::empty_array(), | 18591 result.SetCatchStacktrace(Object::empty_array(), |
| 18592 Object::empty_array()); | 18592 Object::empty_array()); |
| 18593 result.set_expand_inlined(true); // default. | 18593 result.set_expand_inlined(true); // default. |
| 18594 return result.raw(); | 18594 return result.raw(); |
| 18595 } | 18595 } |
| 18596 | 18596 |
| 18597 | 18597 |
| 18598 void Stacktrace::Append(const Array& code_list, | 18598 void Stacktrace::Append(const Array& code_list, |
| 18599 const Array& pc_offset_list) const { | 18599 const Array& pc_offset_list, |
| 18600 const intptr_t start_index) const { |
| 18601 ASSERT(start_index <= code_list.Length()); |
| 18602 ASSERT(pc_offset_list.Length() == code_list.Length()); |
| 18600 intptr_t old_length = Length(); | 18603 intptr_t old_length = Length(); |
| 18601 intptr_t new_length = old_length + pc_offset_list.Length(); | 18604 intptr_t new_length = old_length + pc_offset_list.Length() - start_index; |
| 18602 ASSERT(pc_offset_list.Length() == code_list.Length()); | 18605 if (new_length == old_length) { |
| 18606 // Nothing to append. Avoid work and an assert that growing arrays always |
| 18607 // increases their size. |
| 18608 return; |
| 18609 } |
| 18603 | 18610 |
| 18604 // Grow the arrays for function, code and pc_offset triplet to accommodate | 18611 // Grow the arrays for code, pc_offset pairs to accommodate the new stack |
| 18605 // the new stack frames. | 18612 // frames. |
| 18606 Array& code_array = Array::Handle(raw_ptr()->code_array_); | 18613 Array& code_array = Array::Handle(raw_ptr()->code_array_); |
| 18607 Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); | 18614 Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); |
| 18608 code_array = Array::Grow(code_array, new_length); | 18615 code_array = Array::Grow(code_array, new_length); |
| 18609 pc_offset_array = Array::Grow(pc_offset_array, new_length); | 18616 pc_offset_array = Array::Grow(pc_offset_array, new_length); |
| 18610 set_code_array(code_array); | 18617 set_code_array(code_array); |
| 18611 set_pc_offset_array(pc_offset_array); | 18618 set_pc_offset_array(pc_offset_array); |
| 18612 // Now append the new function and code list to the existing arrays. | 18619 // Now append the new function and code list to the existing arrays. |
| 18613 intptr_t j = 0; | 18620 intptr_t j = start_index; |
| 18614 Object& obj = Object::Handle(); | 18621 Object& obj = Object::Handle(); |
| 18615 for (intptr_t i = old_length; i < new_length; i++, j++) { | 18622 for (intptr_t i = old_length; i < new_length; i++, j++) { |
| 18616 obj = code_list.At(j); | 18623 obj = code_list.At(j); |
| 18617 code_array.SetAt(i, obj); | 18624 code_array.SetAt(i, obj); |
| 18618 obj = pc_offset_list.At(j); | 18625 obj = pc_offset_list.At(j); |
| 18619 pc_offset_array.SetAt(i, obj); | 18626 pc_offset_array.SetAt(i, obj); |
| 18620 } | 18627 } |
| 18621 } | 18628 } |
| 18622 | 18629 |
| 18623 | 18630 |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19077 return tag_label.ToCString(); | 19084 return tag_label.ToCString(); |
| 19078 } | 19085 } |
| 19079 | 19086 |
| 19080 | 19087 |
| 19081 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19088 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 19082 Instance::PrintJSONImpl(stream, ref); | 19089 Instance::PrintJSONImpl(stream, ref); |
| 19083 } | 19090 } |
| 19084 | 19091 |
| 19085 | 19092 |
| 19086 } // namespace dart | 19093 } // namespace dart |
| OLD | NEW |