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

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

Issue 326183002: Pass around the current isolate in exception handling code. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « 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"
11 #include "vm/object_store.h" 11 #include "vm/object_store.h"
12 #include "vm/os.h" 12 #include "vm/os.h"
13 #include "vm/parser.h" 13 #include "vm/parser.h"
14 #include "vm/raw_object.h" 14 #include "vm/raw_object.h"
15 #include "vm/reusable_handles.h"
15 #include "vm/stub_code.h" 16 #include "vm/stub_code.h"
16 #include "vm/visitor.h" 17 #include "vm/visitor.h"
17 18
18 namespace dart { 19 namespace dart {
19 20
20 21
21 bool StackFrame::IsStubFrame() const { 22 bool StackFrame::IsStubFrame() const {
22 ASSERT(!(IsEntryFrame() || IsExitFrame())); 23 ASSERT(!(IsEntryFrame() || IsExitFrame()));
23 uword saved_pc = 24 uword saved_pc =
24 *(reinterpret_cast<uword*>(fp() + (kPcMarkerSlotFromFp * kWordSize))); 25 *(reinterpret_cast<uword*>(fp() + (kPcMarkerSlotFromFp * kWordSize)));
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 (pc_marker - Assembler::kEntryPointToPcMarkerOffset); 190 (pc_marker - Assembler::kEntryPointToPcMarkerOffset);
190 RawInstructions* instr = Instructions::FromEntryPoint(entry_point); 191 RawInstructions* instr = Instructions::FromEntryPoint(entry_point);
191 if (instr != Instructions::null()) { 192 if (instr != Instructions::null()) {
192 return instr->ptr()->code_; 193 return instr->ptr()->code_;
193 } 194 }
194 } 195 }
195 return Code::null(); 196 return Code::null();
196 } 197 }
197 198
198 199
199 bool StackFrame::FindExceptionHandler(uword* handler_pc, 200 bool StackFrame::FindExceptionHandler(Isolate* isolate,
201 uword* handler_pc,
200 bool* needs_stacktrace, 202 bool* needs_stacktrace,
201 bool* has_catch_all) const { 203 bool* has_catch_all) const {
202 Isolate* isolate = Isolate::Current(); 204 REUSABLE_CODE_HANDLESCOPE(isolate);
203 Code& code = Code::Handle(isolate, LookupDartCode()); 205 Code& code = reused_code_handle.Handle();
206 code = LookupDartCode();
204 if (code.IsNull()) { 207 if (code.IsNull()) {
205 return false; // Stub frames do not have exception handlers. 208 return false; // Stub frames do not have exception handlers.
206 } 209 }
207 210
208 ExceptionHandlers& handlers = 211 REUSABLE_EXCEPTION_HANDLERS_HANDLESCOPE(isolate);
209 ExceptionHandlers::Handle(isolate, code.exception_handlers()); 212 ExceptionHandlers& handlers = reused_exception_handlers_handle.Handle();
213 handlers = code.exception_handlers();
210 if (handlers.Length() == 0) { 214 if (handlers.Length() == 0) {
211 return false; 215 return false;
212 } 216 }
217
213 // Find pc descriptor for the current pc. 218 // Find pc descriptor for the current pc.
214 const PcDescriptors& descriptors = 219 REUSABLE_PC_DESCRIPTORS_HANDLESCOPE(isolate);
215 PcDescriptors::Handle(isolate, code.pc_descriptors()); 220 PcDescriptors& descriptors = reused_pc_descriptors_handle.Handle();
221 descriptors = code.pc_descriptors();
216 const intptr_t len = descriptors.Length(); 222 const intptr_t len = descriptors.Length();
217 for (intptr_t i = 0; i < len; i++) { 223 for (intptr_t i = 0; i < len; i++) {
218 if ((static_cast<uword>(descriptors.PC(i)) == pc()) && 224 if ((static_cast<uword>(descriptors.PC(i)) == pc()) &&
219 (descriptors.TryIndex(i) != -1)) { 225 (descriptors.TryIndex(i) != -1)) {
220 const intptr_t try_index = descriptors.TryIndex(i); 226 const intptr_t try_index = descriptors.TryIndex(i);
221 RawExceptionHandlers::HandlerInfo handler_info; 227 RawExceptionHandlers::HandlerInfo handler_info;
222 handlers.GetHandlerInfo(try_index, &handler_info); 228 handlers.GetHandlerInfo(try_index, &handler_info);
223 *handler_pc = handler_info.handler_pc; 229 *handler_pc = handler_info.handler_pc;
224 *needs_stacktrace = handler_info.needs_stacktrace; 230 *needs_stacktrace = handler_info.needs_stacktrace;
225 *has_catch_all = handler_info.has_catch_all; 231 *has_catch_all = handler_info.has_catch_all;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { 456 if (deopt_instr->kind() == DeoptInstr::kCallerFp) {
451 return (index - num_materializations_); 457 return (index - num_materializations_);
452 } 458 }
453 } 459 }
454 UNREACHABLE(); 460 UNREACHABLE();
455 return 0; 461 return 0;
456 } 462 }
457 463
458 464
459 } // namespace dart 465 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/stack_frame.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698