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

Unified Diff: runtime/vm/object.cc

Issue 342473006: Don't add the catch frame at a rethrow to the stacktrace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: move skipping logic to stacktrace::append Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698