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

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: 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
« no previous file with comments | « runtime/vm/object.h ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 604283075f47ddbd8908a73b68693be90913cf46..4e085acfd098c9392909e2bdb1ad67aa83accb72 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 {
- intptr_t old_length = Length();
- intptr_t new_length = old_length + pc_offset_list.Length();
+ const Array& pc_offset_list,
+ const intptr_t start_index) const {
+ ASSERT(start_index <= code_list.Length());
ASSERT(pc_offset_list.Length() == code_list.Length());
+ intptr_t old_length = Length();
+ intptr_t new_length = old_length + pc_offset_list.Length() - start_index;
+ 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 = start_index;
Object& obj = Object::Handle();
for (intptr_t i = old_length; i < new_length; i++, j++) {
obj = code_list.At(j);
« no previous file with comments | « runtime/vm/object.h ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698