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

Side by Side Diff: src/frames.cc

Issue 17579005: Merge SafeStackTraceFrameIterator into SafeStackFrameIterator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 SafeStackFrameIterator::SafeStackFrameIterator( 285 SafeStackFrameIterator::SafeStackFrameIterator(
286 Isolate* isolate, 286 Isolate* isolate,
287 Address fp, Address sp, Address low_bound, Address high_bound) : 287 Address fp, Address sp, Address low_bound, Address high_bound) :
288 maintainer_(isolate), 288 maintainer_(isolate),
289 stack_validator_(low_bound, high_bound), 289 stack_validator_(low_bound, high_bound),
290 is_valid_top_(IsValidTop(isolate, low_bound, high_bound)), 290 is_valid_top_(IsValidTop(isolate, low_bound, high_bound)),
291 is_valid_fp_(IsWithinBounds(low_bound, high_bound, fp)), 291 is_valid_fp_(IsWithinBounds(low_bound, high_bound, fp)),
292 iteration_done_(!is_valid_top_ && !is_valid_fp_), 292 iteration_done_(!is_valid_top_ && !is_valid_fp_),
293 iterator_(isolate, is_valid_top_, is_valid_fp_ ? fp : NULL, sp) { 293 iterator_(isolate, is_valid_top_, is_valid_fp_ ? fp : NULL, sp) {
294 if (!done()) Advance();
294 } 295 }
295 296
296 bool SafeStackFrameIterator::is_active(Isolate* isolate) { 297 bool SafeStackFrameIterator::is_active(Isolate* isolate) {
297 return isolate->safe_stack_iterator_counter() > 0; 298 return isolate->safe_stack_iterator_counter() > 0;
298 } 299 }
299 300
300 301
301 bool SafeStackFrameIterator::IsValidTop(Isolate* isolate, 302 bool SafeStackFrameIterator::IsValidTop(Isolate* isolate,
302 Address low_bound, Address high_bound) { 303 Address low_bound, Address high_bound) {
303 ThreadLocalTop* top = isolate->thread_local_top(); 304 ThreadLocalTop* top = isolate->thread_local_top();
304 Address fp = Isolate::c_entry_fp(top); 305 Address fp = Isolate::c_entry_fp(top);
305 ExitFrameValidator validator(low_bound, high_bound); 306 ExitFrameValidator validator(low_bound, high_bound);
306 if (!validator.IsValidFP(fp)) return false; 307 if (!validator.IsValidFP(fp)) return false;
307 return Isolate::handler(top) != NULL; 308 return Isolate::handler(top) != NULL;
308 } 309 }
309 310
310 311
311 void SafeStackFrameIterator::Advance() { 312 void SafeStackFrameIterator::AdvanceOneFrame() {
312 ASSERT(!done()); 313 ASSERT(!done());
313 StackFrame* last_frame = iterator_.frame(); 314 StackFrame* last_frame = iterator_.frame();
314 Address last_sp = last_frame->sp(), last_fp = last_frame->fp(); 315 Address last_sp = last_frame->sp(), last_fp = last_frame->fp();
315 // Before advancing to the next stack frame, perform pointer validity tests 316 // Before advancing to the next stack frame, perform pointer validity tests
316 iteration_done_ = !IsValidFrame(last_frame) || 317 iteration_done_ = !IsValidFrame(last_frame) ||
317 !CanIterateHandles(last_frame, iterator_.handler()) || 318 !CanIterateHandles(last_frame, iterator_.handler()) ||
318 !IsValidCaller(last_frame); 319 !IsValidCaller(last_frame);
319 if (iteration_done_) return; 320 if (iteration_done_) return;
320 321
321 iterator_.Advance(); 322 iterator_.Advance();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 if (!number_of_args->IsSmi()) { 360 if (!number_of_args->IsSmi()) {
360 return false; 361 return false;
361 } 362 }
362 } 363 }
363 frame->ComputeCallerState(&state); 364 frame->ComputeCallerState(&state);
364 return IsValidStackAddress(state.sp) && IsValidStackAddress(state.fp) && 365 return IsValidStackAddress(state.sp) && IsValidStackAddress(state.fp) &&
365 iterator_.SingletonFor(frame->GetCallerState(&state)) != NULL; 366 iterator_.SingletonFor(frame->GetCallerState(&state)) != NULL;
366 } 367 }
367 368
368 369
370 void SafeStackFrameIterator::Advance() {
371 while (true) {
372 AdvanceOneFrame();
373 if (done()) return;
374 if (iterator_.frame()->is_java_script()) return;
375 }
376 }
377
378
369 // ------------------------------------------------------------------------- 379 // -------------------------------------------------------------------------
370 380
371 381
372 SafeStackTraceFrameIterator::SafeStackTraceFrameIterator(
373 Isolate* isolate,
374 Address fp, Address sp, Address low_bound, Address high_bound)
375 : iterator_(isolate, fp, sp, low_bound, high_bound) {
376 if (!done()) Advance();
377 }
378
379
380 void SafeStackTraceFrameIterator::Advance() {
381 while (true) {
382 iterator_.Advance();
383 if (iterator_.done()) return;
384 if (iterator_.frame()->is_java_script()) return;
385 }
386 }
387
388
389 Code* StackFrame::GetSafepointData(Isolate* isolate, 382 Code* StackFrame::GetSafepointData(Isolate* isolate,
390 Address inner_pointer, 383 Address inner_pointer,
391 SafepointEntry* safepoint_entry, 384 SafepointEntry* safepoint_entry,
392 unsigned* stack_slots) { 385 unsigned* stack_slots) {
393 InnerPointerToCodeCache::InnerPointerToCodeCacheEntry* entry = 386 InnerPointerToCodeCache::InnerPointerToCodeCacheEntry* entry =
394 isolate->inner_pointer_to_code_cache()->GetCacheEntry(inner_pointer); 387 isolate->inner_pointer_to_code_cache()->GetCacheEntry(inner_pointer);
395 if (!entry->safepoint_entry.is_valid()) { 388 if (!entry->safepoint_entry.is_valid()) {
396 entry->safepoint_entry = entry->code->GetSafepointEntry(inner_pointer); 389 entry->safepoint_entry = entry->code->GetSafepointEntry(inner_pointer);
397 ASSERT(entry->safepoint_entry.is_valid()); 390 ASSERT(entry->safepoint_entry.is_valid());
398 } else { 391 } else {
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 ZoneList<StackFrame*> list(10, zone); 1629 ZoneList<StackFrame*> list(10, zone);
1637 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1630 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1638 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1631 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1639 list.Add(frame, zone); 1632 list.Add(frame, zone);
1640 } 1633 }
1641 return list.ToVector(); 1634 return list.ToVector();
1642 } 1635 }
1643 1636
1644 1637
1645 } } // namespace v8::internal 1638 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698