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

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

Issue 23531008: Last round of cleanups in exception handler, before going to the next stage. (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
« no previous file with comments | « runtime/vm/raw_object.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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, 157 bool StackFrame::FindExceptionHandler(uword* handler_pc,
158 bool* needs_stacktrace, 158 bool* needs_stacktrace,
159 bool* is_catch_all) const { 159 bool* has_catch_all) const {
160 const Code& code = Code::Handle(LookupDartCode()); 160 Isolate* isolate = Isolate::Current();
161 Code& code = Code::Handle(isolate, LookupDartCode());
161 if (code.IsNull()) { 162 if (code.IsNull()) {
162 return false; // Stub frames do not have exception handlers. 163 return false; // Stub frames do not have exception handlers.
163 } 164 }
164 165
165 ExceptionHandlers& handlers = 166 ExceptionHandlers& handlers =
166 ExceptionHandlers::Handle(code.exception_handlers()); 167 ExceptionHandlers::Handle(isolate, code.exception_handlers());
167 if (handlers.Length() == 0) { 168 if (handlers.Length() == 0) {
168 return false; 169 return false;
169 } 170 }
170 // Find pc descriptor for the current pc. 171 // Find pc descriptor for the current pc.
171 const PcDescriptors& descriptors = 172 const PcDescriptors& descriptors =
172 PcDescriptors::Handle(code.pc_descriptors()); 173 PcDescriptors::Handle(isolate, code.pc_descriptors());
173 for (intptr_t i = 0; i < descriptors.Length(); i++) { 174 const intptr_t len = descriptors.Length();
175 for (intptr_t i = 0; i < len; i++) {
174 if ((static_cast<uword>(descriptors.PC(i)) == pc()) && 176 if ((static_cast<uword>(descriptors.PC(i)) == pc()) &&
175 (descriptors.TryIndex(i) != -1)) { 177 (descriptors.TryIndex(i) != -1)) {
176 const intptr_t try_index = descriptors.TryIndex(i); 178 const intptr_t try_index = descriptors.TryIndex(i);
177 handlers = code.exception_handlers(); 179 RawExceptionHandlers::HandlerInfo handler_info;
178 *handler_pc = handlers.HandlerPC(try_index); 180 handlers.GetHandlerInfo(try_index, &handler_info);
179 *needs_stacktrace = handlers.NeedsStacktrace(try_index); 181 *handler_pc = handler_info.handler_pc;
180 *is_catch_all = handlers.HasCatchAll(try_index); 182 *needs_stacktrace = handler_info.needs_stacktrace;
183 *has_catch_all = handler_info.has_catch_all;
181 return true; 184 return true;
182 } 185 }
183 } 186 }
184 return false; 187 return false;
185 } 188 }
186 189
187 190
188 intptr_t StackFrame::GetTokenPos() const { 191 intptr_t StackFrame::GetTokenPos() const {
189 const Code& code = Code::Handle(LookupDartCode()); 192 const Code& code = Code::Handle(LookupDartCode());
190 if (code.IsNull()) { 193 if (code.IsNull()) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 pc_ = DeoptInstr::GetRetAddress(deopt_instr, object_table_, &func); 392 pc_ = DeoptInstr::GetRetAddress(deopt_instr, object_table_, &func);
390 code_ = func.unoptimized_code(); 393 code_ = func.unoptimized_code();
391 function_ = func.raw(); 394 function_ = func.raw();
392 return; 395 return;
393 } 396 }
394 } 397 }
395 SetDone(); 398 SetDone();
396 } 399 }
397 400
398 } // namespace dart 401 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698