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

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

Issue 9480006: Fix issue 1857: code lookup was wrong when searching for exception handler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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') | tests/corelib/corelib-leg.status » ('j') | 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) 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/stack_frame.h" 5 #include "vm/stack_frame.h"
6 6
7 #include "vm/code_index_table.h" 7 #include "vm/code_index_table.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 RawFunction* DartFrame::LookupDartFunction() const { 46 RawFunction* DartFrame::LookupDartFunction() const {
47 // Get access to the code index table. 47 // Get access to the code index table.
48 ASSERT(Isolate::Current() != NULL); 48 ASSERT(Isolate::Current() != NULL);
49 CodeIndexTable* code_index_table = Isolate::Current()->code_index_table(); 49 CodeIndexTable* code_index_table = Isolate::Current()->code_index_table();
50 ASSERT(code_index_table != NULL); 50 ASSERT(code_index_table != NULL);
51 return code_index_table->LookupFunction(pc()); 51 return code_index_table->LookupFunction(pc());
52 } 52 }
53 53
54 54
55 RawCode* DartFrame::LookupDartCode() const {
56 // Get access to the code index table.
57 ASSERT(Isolate::Current() != NULL);
58 CodeIndexTable* code_index_table = Isolate::Current()->code_index_table();
59 ASSERT(code_index_table != NULL);
60 return code_index_table->LookupCode(pc());
61 }
62
63
55 bool DartFrame::FindExceptionHandler(uword* handler_pc) const { 64 bool DartFrame::FindExceptionHandler(uword* handler_pc) const {
56 const Function& function = Function::Handle(LookupDartFunction()); 65 const Code& code = Code::Handle(LookupDartCode());
57 ASSERT(!function.IsNull());
58 const Code& code = Code::Handle(function.code());
59 ASSERT(!code.IsNull()); 66 ASSERT(!code.IsNull());
60 67
61 // First try to find pc descriptor for the current pc. 68 // First try to find pc descriptor for the current pc.
62 intptr_t try_index = -1; 69 intptr_t try_index = -1;
63 const PcDescriptors& descriptors = 70 const PcDescriptors& descriptors =
64 PcDescriptors::Handle(code.pc_descriptors()); 71 PcDescriptors::Handle(code.pc_descriptors());
65 for (intptr_t i = 0; i < descriptors.Length(); i++) { 72 for (intptr_t i = 0; i < descriptors.Length(); i++) {
66 if (static_cast<uword>(descriptors.PC(i)) == pc() && 73 if (static_cast<uword>(descriptors.PC(i)) == pc() &&
67 descriptors.TryIndex(i) != -1) { 74 descriptors.TryIndex(i) != -1) {
68 try_index = descriptors.TryIndex(i); 75 try_index = descriptors.TryIndex(i);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 EntryFrame* StackFrameIterator::NextEntryFrame() { 187 EntryFrame* StackFrameIterator::NextEntryFrame() {
181 ASSERT(!frames_.HasNext()); 188 ASSERT(!frames_.HasNext());
182 entry_.sp_ = frames_.sp_; 189 entry_.sp_ = frames_.sp_;
183 entry_.fp_ = frames_.fp_; 190 entry_.fp_ = frames_.fp_;
184 SetupNextExitFrameData(); // Setup data for next exit frame in chain. 191 SetupNextExitFrameData(); // Setup data for next exit frame in chain.
185 ASSERT(entry_.IsValid()); 192 ASSERT(entry_.IsValid());
186 return &entry_; 193 return &entry_;
187 } 194 }
188 195
189 } // namespace dart 196 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/stack_frame.h ('k') | tests/corelib/corelib-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698