| OLD | NEW |
| 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 25 matching lines...) Expand all Loading... |
| 36 #include "safepoint-table.h" | 36 #include "safepoint-table.h" |
| 37 #include "scopeinfo.h" | 37 #include "scopeinfo.h" |
| 38 #include "string-stream.h" | 38 #include "string-stream.h" |
| 39 | 39 |
| 40 #include "allocation-inl.h" | 40 #include "allocation-inl.h" |
| 41 | 41 |
| 42 namespace v8 { | 42 namespace v8 { |
| 43 namespace internal { | 43 namespace internal { |
| 44 | 44 |
| 45 | 45 |
| 46 ReturnAddressLocationResolver | 46 static ReturnAddressLocationResolver return_address_location_resolver = NULL; |
| 47 StackFrame::return_address_location_resolver_ = NULL; | 47 |
| 48 |
| 49 // Resolves pc_address through the resolution address function if one is set. |
| 50 static inline Address* ResolveReturnAddressLocation(Address* pc_address) { |
| 51 if (return_address_location_resolver == NULL) { |
| 52 return pc_address; |
| 53 } else { |
| 54 return reinterpret_cast<Address*>( |
| 55 return_address_location_resolver( |
| 56 reinterpret_cast<uintptr_t>(pc_address))); |
| 57 } |
| 58 } |
| 48 | 59 |
| 49 | 60 |
| 50 // Iterator that supports traversing the stack handlers of a | 61 // Iterator that supports traversing the stack handlers of a |
| 51 // particular frame. Needs to know the top of the handler chain. | 62 // particular frame. Needs to know the top of the handler chain. |
| 52 class StackHandlerIterator BASE_EMBEDDED { | 63 class StackHandlerIterator BASE_EMBEDDED { |
| 53 public: | 64 public: |
| 54 StackHandlerIterator(const StackFrame* frame, StackHandler* handler) | 65 StackHandlerIterator(const StackFrame* frame, StackHandler* handler) |
| 55 : limit_(frame->fp()), handler_(handler) { | 66 : limit_(frame->fp()), handler_(handler) { |
| 56 // Make sure the handler has already been unwound to this frame. | 67 // Make sure the handler has already been unwound to this frame. |
| 57 ASSERT(frame->sp() <= handler->address()); | 68 ASSERT(frame->sp() <= handler->address()); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 low_bound_(low_bound), high_bound_(high_bound) { | 232 low_bound_(low_bound), high_bound_(high_bound) { |
| 222 StackFrame::State state; | 233 StackFrame::State state; |
| 223 StackFrame::Type type; | 234 StackFrame::Type type; |
| 224 ThreadLocalTop* top = isolate->thread_local_top(); | 235 ThreadLocalTop* top = isolate->thread_local_top(); |
| 225 if (IsValidTop(top)) { | 236 if (IsValidTop(top)) { |
| 226 type = ExitFrame::GetStateForFramePointer(Isolate::c_entry_fp(top), &state); | 237 type = ExitFrame::GetStateForFramePointer(Isolate::c_entry_fp(top), &state); |
| 227 } else if (IsValidStackAddress(fp)) { | 238 } else if (IsValidStackAddress(fp)) { |
| 228 ASSERT(fp != NULL); | 239 ASSERT(fp != NULL); |
| 229 state.fp = fp; | 240 state.fp = fp; |
| 230 state.sp = sp; | 241 state.sp = sp; |
| 231 state.pc_address = StackFrame::ResolveReturnAddressLocation( | 242 state.pc_address = ResolveReturnAddressLocation( |
| 232 reinterpret_cast<Address*>(StandardFrame::ComputePCAddress(fp))); | 243 reinterpret_cast<Address*>(StandardFrame::ComputePCAddress(fp))); |
| 233 type = StackFrame::ComputeType(this, &state); | 244 type = StackFrame::ComputeType(this, &state); |
| 234 } else { | 245 } else { |
| 235 return; | 246 return; |
| 236 } | 247 } |
| 237 if (SingletonFor(type) == NULL) return; | 248 if (SingletonFor(type) == NULL) return; |
| 238 frame_ = SingletonFor(type, &state); | 249 frame_ = SingletonFor(type, &state); |
| 239 | 250 |
| 240 if (!done()) Advance(); | 251 if (!done()) Advance(); |
| 241 } | 252 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 if (code != holder) { | 382 if (code != holder) { |
| 372 holder = reinterpret_cast<Code*>(code); | 383 holder = reinterpret_cast<Code*>(code); |
| 373 pc = holder->instruction_start() + pc_offset; | 384 pc = holder->instruction_start() + pc_offset; |
| 374 *pc_address = pc; | 385 *pc_address = pc; |
| 375 } | 386 } |
| 376 } | 387 } |
| 377 | 388 |
| 378 | 389 |
| 379 void StackFrame::SetReturnAddressLocationResolver( | 390 void StackFrame::SetReturnAddressLocationResolver( |
| 380 ReturnAddressLocationResolver resolver) { | 391 ReturnAddressLocationResolver resolver) { |
| 381 ASSERT(return_address_location_resolver_ == NULL); | 392 ASSERT(return_address_location_resolver == NULL); |
| 382 return_address_location_resolver_ = resolver; | 393 return_address_location_resolver = resolver; |
| 383 } | 394 } |
| 384 | 395 |
| 385 | 396 |
| 386 StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator, | 397 StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator, |
| 387 State* state) { | 398 State* state) { |
| 388 ASSERT(state->fp != NULL); | 399 ASSERT(state->fp != NULL); |
| 389 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { | 400 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) { |
| 390 return ARGUMENTS_ADAPTOR; | 401 return ARGUMENTS_ADAPTOR; |
| 391 } | 402 } |
| 392 // The marker and function offsets overlap. If the marker isn't a | 403 // The marker and function offsets overlap. If the marker isn't a |
| (...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 ZoneList<StackFrame*> list(10, zone); | 1596 ZoneList<StackFrame*> list(10, zone); |
| 1586 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1597 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 1587 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1598 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 1588 list.Add(frame, zone); | 1599 list.Add(frame, zone); |
| 1589 } | 1600 } |
| 1590 return list.ToVector(); | 1601 return list.ToVector(); |
| 1591 } | 1602 } |
| 1592 | 1603 |
| 1593 | 1604 |
| 1594 } } // namespace v8::internal | 1605 } } // namespace v8::internal |
| OLD | NEW |