yangguo@chromium.org | 78d1ad4 | 2012-02-09 13:53:47 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #ifndef V8_FRAMES_INL_H_ |
| 29 | #define V8_FRAMES_INL_H_ |
| 30 | |
| 31 | #include "frames.h" |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 32 | #include "isolate.h" |
| 33 | #include "v8memory.h" |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 34 | |
| 35 | #if V8_TARGET_ARCH_IA32 |
| 36 | #include "ia32/frames-ia32.h" |
| 37 | #elif V8_TARGET_ARCH_X64 |
| 38 | #include "x64/frames-x64.h" |
titzer@chromium.org | f5a2454 | 2014-03-04 09:06:17 +0000 | [diff] [blame] | 39 | #elif V8_TARGET_ARCH_A64 |
| 40 | #include "a64/frames-a64.h" |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 41 | #elif V8_TARGET_ARCH_ARM |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 42 | #include "arm/frames-arm.h" |
ager@chromium.org | 5c83825 | 2010-02-19 08:53:10 +0000 | [diff] [blame] | 43 | #elif V8_TARGET_ARCH_MIPS |
| 44 | #include "mips/frames-mips.h" |
kasperl@chromium.org | 2abc450 | 2009-07-02 07:00:29 +0000 | [diff] [blame] | 45 | #else |
| 46 | #error Unsupported target architecture. |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 47 | #endif |
| 48 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 49 | namespace v8 { |
| 50 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 51 | |
| 52 | |
| 53 | inline Address StackHandler::address() const { |
ager@chromium.org | eadaf22 | 2009-06-16 09:43:10 +0000 | [diff] [blame] | 54 | return reinterpret_cast<Address>(const_cast<StackHandler*>(this)); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | |
| 58 | inline StackHandler* StackHandler::next() const { |
| 59 | const int offset = StackHandlerConstants::kNextOffset; |
| 60 | return FromAddress(Memory::Address_at(address() + offset)); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | inline bool StackHandler::includes(Address address) const { |
| 65 | Address start = this->address(); |
| 66 | Address end = start + StackHandlerConstants::kSize; |
| 67 | return start <= address && address <= end; |
| 68 | } |
| 69 | |
| 70 | |
ricow@chromium.org | d236f4d | 2010-09-01 06:52:08 +0000 | [diff] [blame] | 71 | inline void StackHandler::Iterate(ObjectVisitor* v, Code* holder) const { |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 72 | v->VisitPointer(context_address()); |
jkummerow@chromium.org | 04e4f1e | 2011-11-14 13:36:17 +0000 | [diff] [blame] | 73 | v->VisitPointer(code_address()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | |
| 77 | inline StackHandler* StackHandler::FromAddress(Address address) { |
| 78 | return reinterpret_cast<StackHandler*>(address); |
| 79 | } |
| 80 | |
| 81 | |
yangguo@chromium.org | 78d1ad4 | 2012-02-09 13:53:47 +0000 | [diff] [blame] | 82 | inline bool StackHandler::is_js_entry() const { |
| 83 | return kind() == JS_ENTRY; |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | |
yangguo@chromium.org | 78d1ad4 | 2012-02-09 13:53:47 +0000 | [diff] [blame] | 87 | inline bool StackHandler::is_catch() const { |
| 88 | return kind() == CATCH; |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | |
yangguo@chromium.org | 78d1ad4 | 2012-02-09 13:53:47 +0000 | [diff] [blame] | 92 | inline bool StackHandler::is_finally() const { |
| 93 | return kind() == FINALLY; |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | |
jkummerow@chromium.org | 04e4f1e | 2011-11-14 13:36:17 +0000 | [diff] [blame] | 97 | inline StackHandler::Kind StackHandler::kind() const { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 98 | const int offset = StackHandlerConstants::kStateOffset; |
jkummerow@chromium.org | 04e4f1e | 2011-11-14 13:36:17 +0000 | [diff] [blame] | 99 | return KindField::decode(Memory::unsigned_at(address() + offset)); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | |
ulan@chromium.org | 57ff881 | 2013-05-10 08:16:55 +0000 | [diff] [blame] | 103 | inline unsigned StackHandler::index() const { |
| 104 | const int offset = StackHandlerConstants::kStateOffset; |
| 105 | return IndexField::decode(Memory::unsigned_at(address() + offset)); |
| 106 | } |
| 107 | |
| 108 | |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 109 | inline Object** StackHandler::context_address() const { |
| 110 | const int offset = StackHandlerConstants::kContextOffset; |
| 111 | return reinterpret_cast<Object**>(address() + offset); |
| 112 | } |
| 113 | |
| 114 | |
jkummerow@chromium.org | 04e4f1e | 2011-11-14 13:36:17 +0000 | [diff] [blame] | 115 | inline Object** StackHandler::code_address() const { |
| 116 | const int offset = StackHandlerConstants::kCodeOffset; |
| 117 | return reinterpret_cast<Object**>(address() + offset); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 121 | inline StackFrame::StackFrame(StackFrameIteratorBase* iterator) |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 122 | : iterator_(iterator), isolate_(iterator_->isolate()) { |
| 123 | } |
| 124 | |
| 125 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 126 | inline StackHandler* StackFrame::top_handler() const { |
| 127 | return iterator_->handler(); |
| 128 | } |
| 129 | |
| 130 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 131 | inline Code* StackFrame::LookupCode() const { |
| 132 | return GetContainingCode(isolate(), pc()); |
| 133 | } |
| 134 | |
| 135 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 136 | inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) { |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 137 | return isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; |
| 138 | } |
| 139 | |
| 140 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 141 | inline Address* StackFrame::ResolveReturnAddressLocation(Address* pc_address) { |
| 142 | if (return_address_location_resolver_ == NULL) { |
| 143 | return pc_address; |
| 144 | } else { |
| 145 | return reinterpret_cast<Address*>( |
| 146 | return_address_location_resolver_( |
| 147 | reinterpret_cast<uintptr_t>(pc_address))); |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | |
| 152 | inline EntryFrame::EntryFrame(StackFrameIteratorBase* iterator) |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 153 | : StackFrame(iterator) { |
| 154 | } |
| 155 | |
| 156 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 157 | inline EntryConstructFrame::EntryConstructFrame( |
| 158 | StackFrameIteratorBase* iterator) |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 159 | : EntryFrame(iterator) { |
| 160 | } |
| 161 | |
| 162 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 163 | inline ExitFrame::ExitFrame(StackFrameIteratorBase* iterator) |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 164 | : StackFrame(iterator) { |
| 165 | } |
| 166 | |
| 167 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 168 | inline StandardFrame::StandardFrame(StackFrameIteratorBase* iterator) |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 169 | : StackFrame(iterator) { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 170 | } |
| 171 | |
| 172 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 173 | inline Object* StandardFrame::GetExpression(int index) const { |
| 174 | return Memory::Object_at(GetExpressionAddress(index)); |
| 175 | } |
| 176 | |
| 177 | |
| 178 | inline void StandardFrame::SetExpression(int index, Object* value) { |
| 179 | Memory::Object_at(GetExpressionAddress(index)) = value; |
| 180 | } |
| 181 | |
| 182 | |
| 183 | inline Object* StandardFrame::context() const { |
| 184 | const int offset = StandardFrameConstants::kContextOffset; |
| 185 | return Memory::Object_at(fp() + offset); |
| 186 | } |
| 187 | |
| 188 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 189 | inline Address StandardFrame::caller_fp() const { |
| 190 | return Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset); |
| 191 | } |
| 192 | |
| 193 | |
| 194 | inline Address StandardFrame::caller_pc() const { |
| 195 | return Memory::Address_at(ComputePCAddress(fp())); |
| 196 | } |
| 197 | |
| 198 | |
| 199 | inline Address StandardFrame::ComputePCAddress(Address fp) { |
| 200 | return fp + StandardFrameConstants::kCallerPCOffset; |
| 201 | } |
| 202 | |
| 203 | |
dslomov@chromium.org | 6b6df38 | 2014-03-14 16:14:53 +0000 | [diff] [blame^] | 204 | inline Address StandardFrame::ComputeConstantPoolAddress(Address fp) { |
| 205 | return fp + StandardFrameConstants::kConstantPoolOffset; |
| 206 | } |
| 207 | |
| 208 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 209 | inline bool StandardFrame::IsArgumentsAdaptorFrame(Address fp) { |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 210 | Object* marker = |
| 211 | Memory::Object_at(fp + StandardFrameConstants::kContextOffset); |
| 212 | return marker == Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | |
ager@chromium.org | 7c537e2 | 2008-10-16 08:43:32 +0000 | [diff] [blame] | 216 | inline bool StandardFrame::IsConstructFrame(Address fp) { |
| 217 | Object* marker = |
| 218 | Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset); |
ulan@chromium.org | 967e270 | 2012-02-28 09:49:15 +0000 | [diff] [blame] | 219 | return marker == Smi::FromInt(StackFrame::CONSTRUCT); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 223 | inline JavaScriptFrame::JavaScriptFrame(StackFrameIteratorBase* iterator) |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 224 | : StandardFrame(iterator) { |
| 225 | } |
| 226 | |
| 227 | |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 228 | Address JavaScriptFrame::GetParameterSlot(int index) const { |
| 229 | int param_count = ComputeParametersCount(); |
| 230 | ASSERT(-1 <= index && index < param_count); |
| 231 | int parameter_offset = (param_count - index - 1) * kPointerSize; |
| 232 | return caller_sp() + parameter_offset; |
| 233 | } |
| 234 | |
| 235 | |
| 236 | Object* JavaScriptFrame::GetParameter(int index) const { |
| 237 | return Memory::Object_at(GetParameterSlot(index)); |
| 238 | } |
| 239 | |
| 240 | |
danno@chromium.org | f005df6 | 2013-04-30 16:36:45 +0000 | [diff] [blame] | 241 | inline Address JavaScriptFrame::GetOperandSlot(int index) const { |
| 242 | Address base = fp() + JavaScriptFrameConstants::kLocal0Offset; |
| 243 | ASSERT(IsAddressAligned(base, kPointerSize)); |
ulan@chromium.org | 57ff881 | 2013-05-10 08:16:55 +0000 | [diff] [blame] | 244 | ASSERT_EQ(type(), JAVA_SCRIPT); |
| 245 | ASSERT_LT(index, ComputeOperandsCount()); |
| 246 | ASSERT_LE(0, index); |
danno@chromium.org | f005df6 | 2013-04-30 16:36:45 +0000 | [diff] [blame] | 247 | // Operand stack grows down. |
| 248 | return base - index * kPointerSize; |
| 249 | } |
| 250 | |
| 251 | |
| 252 | inline Object* JavaScriptFrame::GetOperand(int index) const { |
| 253 | return Memory::Object_at(GetOperandSlot(index)); |
| 254 | } |
| 255 | |
| 256 | |
| 257 | inline int JavaScriptFrame::ComputeOperandsCount() const { |
| 258 | Address base = fp() + JavaScriptFrameConstants::kLocal0Offset; |
| 259 | // Base points to low address of first operand and stack grows down, so add |
| 260 | // kPointerSize to get the actual stack size. |
| 261 | intptr_t stack_size_in_bytes = (base + kPointerSize) - sp(); |
| 262 | ASSERT(IsAligned(stack_size_in_bytes, kPointerSize)); |
| 263 | ASSERT(type() == JAVA_SCRIPT); |
| 264 | ASSERT(stack_size_in_bytes >= 0); |
| 265 | return static_cast<int>(stack_size_in_bytes >> kPointerSizeLog2); |
| 266 | } |
| 267 | |
| 268 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 269 | inline Object* JavaScriptFrame::receiver() const { |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 270 | return GetParameter(-1); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | |
| 274 | inline void JavaScriptFrame::set_receiver(Object* value) { |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 275 | Memory::Object_at(GetParameterSlot(-1)) = value; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 276 | } |
| 277 | |
| 278 | |
| 279 | inline bool JavaScriptFrame::has_adapted_arguments() const { |
| 280 | return IsArgumentsAdaptorFrame(caller_fp()); |
| 281 | } |
| 282 | |
| 283 | |
danno@chromium.org | 169691d | 2013-07-15 08:01:13 +0000 | [diff] [blame] | 284 | inline JSFunction* JavaScriptFrame::function() const { |
| 285 | return JSFunction::cast(function_slot_object()); |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 286 | } |
| 287 | |
| 288 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 289 | inline StubFrame::StubFrame(StackFrameIteratorBase* iterator) |
yangguo@chromium.org | a6bbcc8 | 2012-12-21 12:35:02 +0000 | [diff] [blame] | 290 | : StandardFrame(iterator) { |
| 291 | } |
| 292 | |
| 293 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 294 | inline OptimizedFrame::OptimizedFrame(StackFrameIteratorBase* iterator) |
jkummerow@chromium.org | 5323a9c | 2012-12-10 19:00:50 +0000 | [diff] [blame] | 295 | : JavaScriptFrame(iterator) { |
mstarzinger@chromium.org | 32280cf | 2012-12-06 17:32:37 +0000 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 299 | inline ArgumentsAdaptorFrame::ArgumentsAdaptorFrame( |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 300 | StackFrameIteratorBase* iterator) : JavaScriptFrame(iterator) { |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 304 | inline InternalFrame::InternalFrame(StackFrameIteratorBase* iterator) |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 305 | : StandardFrame(iterator) { |
| 306 | } |
| 307 | |
| 308 | |
mstarzinger@chromium.org | 068ea0a | 2013-01-30 09:39:44 +0000 | [diff] [blame] | 309 | inline StubFailureTrampolineFrame::StubFailureTrampolineFrame( |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 310 | StackFrameIteratorBase* iterator) : StandardFrame(iterator) { |
mstarzinger@chromium.org | 068ea0a | 2013-01-30 09:39:44 +0000 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 314 | inline ConstructFrame::ConstructFrame(StackFrameIteratorBase* iterator) |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 315 | : InternalFrame(iterator) { |
| 316 | } |
| 317 | |
| 318 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 319 | inline JavaScriptFrameIterator::JavaScriptFrameIterator( |
vegorov@chromium.org | 74f333b | 2011-04-06 11:17:46 +0000 | [diff] [blame] | 320 | Isolate* isolate) |
| 321 | : iterator_(isolate) { |
| 322 | if (!done()) Advance(); |
| 323 | } |
| 324 | |
rossberg@chromium.org | b4b2aa6 | 2011-10-13 09:49:59 +0000 | [diff] [blame] | 325 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 326 | inline JavaScriptFrameIterator::JavaScriptFrameIterator( |
rossberg@chromium.org | b4b2aa6 | 2011-10-13 09:49:59 +0000 | [diff] [blame] | 327 | Isolate* isolate, ThreadLocalTop* top) |
| 328 | : iterator_(isolate, top) { |
| 329 | if (!done()) Advance(); |
| 330 | } |
| 331 | |
| 332 | |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 333 | inline JavaScriptFrame* JavaScriptFrameIterator::frame() const { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 334 | // TODO(1233797): The frame hierarchy needs to change. It's |
| 335 | // problematic that we can't use the safe-cast operator to cast to |
| 336 | // the JavaScript frame type, because we may encounter arguments |
| 337 | // adaptor frames. |
| 338 | StackFrame* frame = iterator_.frame(); |
| 339 | ASSERT(frame->is_java_script() || frame->is_arguments_adaptor()); |
| 340 | return static_cast<JavaScriptFrame*>(frame); |
| 341 | } |
| 342 | |
| 343 | |
yangguo@chromium.org | c73d55b | 2013-07-24 08:18:28 +0000 | [diff] [blame] | 344 | inline StackFrame* SafeStackFrameIterator::frame() const { |
mstarzinger@chromium.org | 1510d58 | 2013-06-28 14:00:48 +0000 | [diff] [blame] | 345 | ASSERT(!done()); |
yangguo@chromium.org | c73d55b | 2013-07-24 08:18:28 +0000 | [diff] [blame] | 346 | ASSERT(frame_->is_java_script() || frame_->is_exit()); |
| 347 | return frame_; |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 351 | } } // namespace v8::internal |
| 352 | |
| 353 | #endif // V8_FRAMES_INL_H_ |