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

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

Issue 23445012: Mark exception handlers if they have a stacktrace specified. Do not build a stacktrace if the handl… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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
« runtime/vm/raw_object.h ('K') | « runtime/vm/stack_frame.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/stack_frame.h" 5 #include "vm/stack_frame.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/deopt_instructions.h" 8 #include "vm/deopt_instructions.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 (pc_marker - Assembler::kEntryPointToPcMarkerOffset); 147 (pc_marker - Assembler::kEntryPointToPcMarkerOffset);
148 RawInstructions* instr = Instructions::FromEntryPoint(entry_point); 148 RawInstructions* instr = Instructions::FromEntryPoint(entry_point);
149 if (instr != Instructions::null()) { 149 if (instr != Instructions::null()) {
150 return instr->ptr()->code_; 150 return instr->ptr()->code_;
151 } 151 }
152 } 152 }
153 return Code::null(); 153 return Code::null();
154 } 154 }
155 155
156 156
157 bool StackFrame::FindExceptionHandler(uword* handler_pc) const { 157 bool StackFrame::FindExceptionHandler(uword* handler_pc,
158 bool* needs_stacktrace) const {
158 const Code& code = Code::Handle(LookupDartCode()); 159 const Code& code = Code::Handle(LookupDartCode());
159 if (code.IsNull()) { 160 if (code.IsNull()) {
160 return false; // Stub frames do not have exception handlers. 161 return false; // Stub frames do not have exception handlers.
161 } 162 }
162 163
163 // Find pc descriptor for the current pc. 164 // Find pc descriptor for the current pc.
164 const PcDescriptors& descriptors = 165 const PcDescriptors& descriptors =
165 PcDescriptors::Handle(code.pc_descriptors()); 166 PcDescriptors::Handle(code.pc_descriptors());
167 ExceptionHandlers& handlers = ExceptionHandlers::Handle();
166 for (intptr_t i = 0; i < descriptors.Length(); i++) { 168 for (intptr_t i = 0; i < descriptors.Length(); i++) {
167 if ((static_cast<uword>(descriptors.PC(i)) == pc()) && 169 if ((static_cast<uword>(descriptors.PC(i)) == pc()) &&
168 (descriptors.TryIndex(i) != -1)) { 170 (descriptors.TryIndex(i) != -1)) {
169 const intptr_t try_index = descriptors.TryIndex(i); 171 const intptr_t try_index = descriptors.TryIndex(i);
170 const ExceptionHandlers& handlers = 172 handlers = code.exception_handlers();
171 ExceptionHandlers::Handle(code.exception_handlers());
172 *handler_pc = handlers.HandlerPC(try_index); 173 *handler_pc = handlers.HandlerPC(try_index);
174 *needs_stacktrace = handlers.NeedsStacktrace(try_index);
173 return true; 175 return true;
174 } 176 }
175 } 177 }
176 return false; 178 return false;
177 } 179 }
178 180
179 181
180 intptr_t StackFrame::GetTokenPos() const { 182 intptr_t StackFrame::GetTokenPos() const {
181 const Code& code = Code::Handle(LookupDartCode()); 183 const Code& code = Code::Handle(LookupDartCode());
182 if (code.IsNull()) { 184 if (code.IsNull()) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 pc_ = DeoptInstr::GetRetAddress(deopt_instr, object_table_, &func); 383 pc_ = DeoptInstr::GetRetAddress(deopt_instr, object_table_, &func);
382 code_ = func.unoptimized_code(); 384 code_ = func.unoptimized_code();
383 function_ = func.raw(); 385 function_ = func.raw();
384 return; 386 return;
385 } 387 }
386 } 388 }
387 SetDone(); 389 SetDone();
388 } 390 }
389 391
390 } // namespace dart 392 } // namespace dart
OLDNEW
« runtime/vm/raw_object.h ('K') | « runtime/vm/stack_frame.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698