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

Side by Side Diff: runtime/vm/exceptions.cc

Issue 12079071: Fix a crash bug when creating a stack trace from an optimized frame. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: correct optimization threshold Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/stack_frame.h » ('j') | runtime/vm/stack_frame.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/exceptions.h" 5 #include "vm/exceptions.h"
6 6
7 #include "vm/dart_api_impl.h" 7 #include "vm/dart_api_impl.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/debugger.h" 9 #include "vm/debugger.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 ASSERT(frame != NULL); // We expect to find a dart invocation frame. 48 ASSERT(frame != NULL); // We expect to find a dart invocation frame.
49 Function& func = Function::Handle(); 49 Function& func = Function::Handle();
50 Code& code = Code::Handle(); 50 Code& code = Code::Handle();
51 Smi& offset = Smi::Handle(); 51 Smi& offset = Smi::Handle();
52 while (!frame->IsEntryFrame()) { 52 while (!frame->IsEntryFrame()) {
53 if (frame->IsDartFrame()) { 53 if (frame->IsDartFrame()) {
54 code = frame->LookupDartCode(); 54 code = frame->LookupDartCode();
55 if (code.is_optimized()) { 55 if (code.is_optimized()) {
56 // For optimized frames, extract all the inlined functions if any 56 // For optimized frames, extract all the inlined functions if any
57 // into the stack trace. 57 // into the stack trace.
58 InlinedFunctionsInDartFrameIterator optimized_frames(frame); 58 InlinedFunctionsIterator optimized_frames(frame);
59 while (true) { 59 while (true) {
60 uword pc = 0; 60 uword pc = 0;
61 func = optimized_frames.GetNextFunction(&pc); 61 func = optimized_frames.GetNextFunctionAndCode(&pc, &code);
62 if (func.IsNull()) { 62 if (func.IsNull()) {
63 break; 63 break;
64 } 64 }
65 ASSERT(pc != 0); 65 ASSERT(pc != 0);
66 ASSERT(code.EntryPoint() <= pc);
67 ASSERT(pc < (code.EntryPoint() + code.Size()));
66 if (ShouldShowFunction(func)) { 68 if (ShouldShowFunction(func)) {
67 code = func.unoptimized_code();
68 offset = Smi::New(pc - code.EntryPoint()); 69 offset = Smi::New(pc - code.EntryPoint());
69 ASSERT(0 <= offset.Value() && offset.Value() < code.Size());
70 func_list.Add(func); 70 func_list.Add(func);
71 code_list.Add(code); 71 code_list.Add(code);
72 pc_offset_list.Add(offset); 72 pc_offset_list.Add(offset);
73 } 73 }
74 } 74 }
75 } else { 75 } else {
76 offset = Smi::New(frame->pc() - code.EntryPoint()); 76 offset = Smi::New(frame->pc() - code.EntryPoint());
77 func = code.function(); 77 func = code.function();
78 if (ShouldShowFunction(func)) { 78 if (ShouldShowFunction(func)) {
79 func_list.Add(func); 79 func_list.Add(func);
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 case kIsolateUnhandledException: 478 case kIsolateUnhandledException:
479 library = Library::IsolateLibrary(); 479 library = Library::IsolateLibrary();
480 class_name = &Symbols::IsolateUnhandledException(); 480 class_name = &Symbols::IsolateUnhandledException();
481 break; 481 break;
482 } 482 }
483 483
484 return DartLibraryCalls::ExceptionCreate(library, *class_name, arguments); 484 return DartLibraryCalls::ExceptionCreate(library, *class_name, arguments);
485 } 485 }
486 486
487 } // namespace dart 487 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/stack_frame.h » ('j') | runtime/vm/stack_frame.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698