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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 211 } |
212 | 212 |
213 | 213 |
214 // ------------------------------------------------------------------------- | 214 // ------------------------------------------------------------------------- |
215 | 215 |
216 | 216 |
217 SafeStackFrameIterator::SafeStackFrameIterator( | 217 SafeStackFrameIterator::SafeStackFrameIterator( |
218 Isolate* isolate, | 218 Isolate* isolate, |
219 Address fp, Address sp, Address low_bound, Address high_bound) : | 219 Address fp, Address sp, Address low_bound, Address high_bound) : |
220 StackFrameIteratorBase(isolate, false), | 220 StackFrameIteratorBase(isolate, false), |
221 low_bound_(low_bound), high_bound_(high_bound) { | 221 low_bound_(low_bound), high_bound_(high_bound), |
| 222 top_frame_type_(StackFrame::NONE) { |
222 StackFrame::State state; | 223 StackFrame::State state; |
223 StackFrame::Type type; | 224 StackFrame::Type type; |
224 ThreadLocalTop* top = isolate->thread_local_top(); | 225 ThreadLocalTop* top = isolate->thread_local_top(); |
225 if (IsValidTop(top)) { | 226 if (IsValidTop(top)) { |
226 type = ExitFrame::GetStateForFramePointer(Isolate::c_entry_fp(top), &state); | 227 type = ExitFrame::GetStateForFramePointer(Isolate::c_entry_fp(top), &state); |
| 228 top_frame_type_ = type; |
227 } else if (IsValidStackAddress(fp)) { | 229 } else if (IsValidStackAddress(fp)) { |
228 ASSERT(fp != NULL); | 230 ASSERT(fp != NULL); |
229 state.fp = fp; | 231 state.fp = fp; |
230 state.sp = sp; | 232 state.sp = sp; |
231 state.pc_address = StackFrame::ResolveReturnAddressLocation( | 233 state.pc_address = StackFrame::ResolveReturnAddressLocation( |
232 reinterpret_cast<Address*>(StandardFrame::ComputePCAddress(fp))); | 234 reinterpret_cast<Address*>(StandardFrame::ComputePCAddress(fp))); |
233 type = StackFrame::ComputeType(this, &state); | 235 // StackFrame::ComputeType will read both kContextOffset and kMarkerOffset, |
| 236 // we check only that kMarkerOffset is within the stack bounds and do |
| 237 // compile time check that kContextOffset slot is pushed on the stack before |
| 238 // kMarkerOffset. |
| 239 STATIC_ASSERT(StandardFrameConstants::kMarkerOffset < |
| 240 StandardFrameConstants::kContextOffset); |
| 241 Address frame_marker = fp + StandardFrameConstants::kMarkerOffset; |
| 242 if (IsValidStackAddress(frame_marker)) { |
| 243 type = StackFrame::ComputeType(this, &state); |
| 244 top_frame_type_ = type; |
| 245 } else { |
| 246 // Mark the frame as JAVA_SCRIPT if we cannot determine its type. |
| 247 // The frame anyways will be skipped. |
| 248 type = StackFrame::JAVA_SCRIPT; |
| 249 // Top frame is incomplete so we cannot reliably determine its type. |
| 250 top_frame_type_ = StackFrame::NONE; |
| 251 } |
234 } else { | 252 } else { |
235 return; | 253 return; |
236 } | 254 } |
237 if (SingletonFor(type) == NULL) return; | 255 if (SingletonFor(type) == NULL) return; |
238 frame_ = SingletonFor(type, &state); | 256 frame_ = SingletonFor(type, &state); |
239 | 257 |
240 if (!done()) Advance(); | 258 if (!done()) Advance(); |
241 } | 259 } |
242 | 260 |
243 | 261 |
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 ZoneList<StackFrame*> list(10, zone); | 1603 ZoneList<StackFrame*> list(10, zone); |
1586 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1604 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
1587 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1605 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1588 list.Add(frame, zone); | 1606 list.Add(frame, zone); |
1589 } | 1607 } |
1590 return list.ToVector(); | 1608 return list.ToVector(); |
1591 } | 1609 } |
1592 | 1610 |
1593 | 1611 |
1594 } } // namespace v8::internal | 1612 } } // namespace v8::internal |
OLD | NEW |