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

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

Issue 403643002: One more iteration of PcDescriptor iterator improvement: do not copy record but access individual … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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/object.cc ('K') | « runtime/vm/simulator_arm.cc ('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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (handlers.Length() == 0) { 219 if (handlers.Length() == 0) {
220 return false; 220 return false;
221 } 221 }
222 222
223 // Find pc descriptor for the current pc. 223 // Find pc descriptor for the current pc.
224 REUSABLE_PC_DESCRIPTORS_HANDLESCOPE(isolate); 224 REUSABLE_PC_DESCRIPTORS_HANDLESCOPE(isolate);
225 PcDescriptors& descriptors = reused_pc_descriptors_handle.Handle(); 225 PcDescriptors& descriptors = reused_pc_descriptors_handle.Handle();
226 descriptors = code.pc_descriptors(); 226 descriptors = code.pc_descriptors();
227 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); 227 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind);
228 while (iter.HasNext()) { 228 while (iter.HasNext()) {
229 RawPcDescriptors::PcDescriptorRec rec; 229 const uword current_pc = iter.NextPc();
230 iter.NextRec(&rec); 230 const intptr_t current_try_index = iter.current_try_index();
231 if ((rec.pc() == pc()) && (rec.try_index() != -1)) { 231 if ((current_pc == pc()) && (current_try_index != -1)) {
232 RawExceptionHandlers::HandlerInfo handler_info; 232 RawExceptionHandlers::HandlerInfo handler_info;
233 handlers.GetHandlerInfo(rec.try_index(), &handler_info); 233 handlers.GetHandlerInfo(current_try_index, &handler_info);
234 *handler_pc = handler_info.handler_pc; 234 *handler_pc = handler_info.handler_pc;
235 *needs_stacktrace = handler_info.needs_stacktrace; 235 *needs_stacktrace = handler_info.needs_stacktrace;
236 *has_catch_all = handler_info.has_catch_all; 236 *has_catch_all = handler_info.has_catch_all;
237 return true; 237 return true;
238 } 238 }
239 } 239 }
240 return false; 240 return false;
241 } 241 }
242 242
243 243
244 intptr_t StackFrame::GetTokenPos() const { 244 intptr_t StackFrame::GetTokenPos() const {
245 const Code& code = Code::Handle(LookupDartCode()); 245 const Code& code = Code::Handle(LookupDartCode());
246 if (code.IsNull()) { 246 if (code.IsNull()) {
247 return -1; // Stub frames do not have token_pos. 247 return -1; // Stub frames do not have token_pos.
248 } 248 }
249 const PcDescriptors& descriptors = 249 const PcDescriptors& descriptors =
250 PcDescriptors::Handle(code.pc_descriptors()); 250 PcDescriptors::Handle(code.pc_descriptors());
251 ASSERT(!descriptors.IsNull()); 251 ASSERT(!descriptors.IsNull());
252 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); 252 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind);
253 while (iter.HasNext()) { 253 while (iter.HasNext()) {
254 RawPcDescriptors::PcDescriptorRec rec; 254 const uword current_pc = iter.NextPc();
255 iter.NextRec(&rec); 255 if (current_pc == pc()) {
256 if (rec.pc() == pc()) { 256 return iter.current_token_pos();
257 return rec.token_pos();
258 } 257 }
259 } 258 }
260 return -1; 259 return -1;
261 } 260 }
262 261
263 262
264 263
265 bool StackFrame::IsValid() const { 264 bool StackFrame::IsValid() const {
266 if (IsEntryFrame() || IsExitFrame() || IsStubFrame()) { 265 if (IsEntryFrame() || IsExitFrame() || IsStubFrame()) {
267 return true; 266 return true;
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { 484 if (deopt_instr->kind() == DeoptInstr::kCallerFp) {
486 return (index - num_materializations_); 485 return (index - num_materializations_);
487 } 486 }
488 } 487 }
489 UNREACHABLE(); 488 UNREACHABLE();
490 return 0; 489 return 0;
491 } 490 }
492 491
493 492
494 } // namespace dart 493 } // namespace dart
OLDNEW
« runtime/vm/object.cc ('K') | « runtime/vm/simulator_arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698