| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 return reinterpret_cast<Object**>(address() + offset); | 109 return reinterpret_cast<Object**>(address() + offset); |
| 110 } | 110 } |
| 111 | 111 |
| 112 | 112 |
| 113 inline Object** StackHandler::code_address() const { | 113 inline Object** StackHandler::code_address() const { |
| 114 const int offset = StackHandlerConstants::kCodeOffset; | 114 const int offset = StackHandlerConstants::kCodeOffset; |
| 115 return reinterpret_cast<Object**>(address() + offset); | 115 return reinterpret_cast<Object**>(address() + offset); |
| 116 } | 116 } |
| 117 | 117 |
| 118 | 118 |
| 119 inline StackFrame::StackFrame(StackFrameIterator* iterator) | 119 inline StackFrame::StackFrame(StackFrameIteratorBase* iterator) |
| 120 : iterator_(iterator), isolate_(iterator_->isolate()) { | 120 : iterator_(iterator), isolate_(iterator_->isolate()) { |
| 121 } | 121 } |
| 122 | 122 |
| 123 | 123 |
| 124 inline StackHandler* StackFrame::top_handler() const { | 124 inline StackHandler* StackFrame::top_handler() const { |
| 125 return iterator_->handler(); | 125 return iterator_->handler(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 | 128 |
| 129 inline Code* StackFrame::LookupCode() const { | 129 inline Code* StackFrame::LookupCode() const { |
| 130 return GetContainingCode(isolate(), pc()); | 130 return GetContainingCode(isolate(), pc()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 | 133 |
| 134 inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) { | 134 inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) { |
| 135 return isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; | 135 return isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; |
| 136 } | 136 } |
| 137 | 137 |
| 138 | 138 |
| 139 inline EntryFrame::EntryFrame(StackFrameIterator* iterator) | 139 inline EntryFrame::EntryFrame(StackFrameIteratorBase* iterator) |
| 140 : StackFrame(iterator) { | 140 : StackFrame(iterator) { |
| 141 } | 141 } |
| 142 | 142 |
| 143 | 143 |
| 144 inline EntryConstructFrame::EntryConstructFrame(StackFrameIterator* iterator) | 144 inline EntryConstructFrame::EntryConstructFrame( |
| 145 StackFrameIteratorBase* iterator) |
| 145 : EntryFrame(iterator) { | 146 : EntryFrame(iterator) { |
| 146 } | 147 } |
| 147 | 148 |
| 148 | 149 |
| 149 inline ExitFrame::ExitFrame(StackFrameIterator* iterator) | 150 inline ExitFrame::ExitFrame(StackFrameIteratorBase* iterator) |
| 150 : StackFrame(iterator) { | 151 : StackFrame(iterator) { |
| 151 } | 152 } |
| 152 | 153 |
| 153 | 154 |
| 154 inline StandardFrame::StandardFrame(StackFrameIterator* iterator) | 155 inline StandardFrame::StandardFrame(StackFrameIteratorBase* iterator) |
| 155 : StackFrame(iterator) { | 156 : StackFrame(iterator) { |
| 156 } | 157 } |
| 157 | 158 |
| 158 | 159 |
| 159 inline Object* StandardFrame::GetExpression(int index) const { | 160 inline Object* StandardFrame::GetExpression(int index) const { |
| 160 return Memory::Object_at(GetExpressionAddress(index)); | 161 return Memory::Object_at(GetExpressionAddress(index)); |
| 161 } | 162 } |
| 162 | 163 |
| 163 | 164 |
| 164 inline void StandardFrame::SetExpression(int index, Object* value) { | 165 inline void StandardFrame::SetExpression(int index, Object* value) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 194 } | 195 } |
| 195 | 196 |
| 196 | 197 |
| 197 inline bool StandardFrame::IsConstructFrame(Address fp) { | 198 inline bool StandardFrame::IsConstructFrame(Address fp) { |
| 198 Object* marker = | 199 Object* marker = |
| 199 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset); | 200 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset); |
| 200 return marker == Smi::FromInt(StackFrame::CONSTRUCT); | 201 return marker == Smi::FromInt(StackFrame::CONSTRUCT); |
| 201 } | 202 } |
| 202 | 203 |
| 203 | 204 |
| 204 inline JavaScriptFrame::JavaScriptFrame(StackFrameIterator* iterator) | 205 inline JavaScriptFrame::JavaScriptFrame(StackFrameIteratorBase* iterator) |
| 205 : StandardFrame(iterator) { | 206 : StandardFrame(iterator) { |
| 206 } | 207 } |
| 207 | 208 |
| 208 | 209 |
| 209 Address JavaScriptFrame::GetParameterSlot(int index) const { | 210 Address JavaScriptFrame::GetParameterSlot(int index) const { |
| 210 int param_count = ComputeParametersCount(); | 211 int param_count = ComputeParametersCount(); |
| 211 ASSERT(-1 <= index && index < param_count); | 212 ASSERT(-1 <= index && index < param_count); |
| 212 int parameter_offset = (param_count - index - 1) * kPointerSize; | 213 int parameter_offset = (param_count - index - 1) * kPointerSize; |
| 213 return caller_sp() + parameter_offset; | 214 return caller_sp() + parameter_offset; |
| 214 } | 215 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 263 } |
| 263 | 264 |
| 264 | 265 |
| 265 inline Object* JavaScriptFrame::function() const { | 266 inline Object* JavaScriptFrame::function() const { |
| 266 Object* result = function_slot_object(); | 267 Object* result = function_slot_object(); |
| 267 ASSERT(result->IsJSFunction()); | 268 ASSERT(result->IsJSFunction()); |
| 268 return result; | 269 return result; |
| 269 } | 270 } |
| 270 | 271 |
| 271 | 272 |
| 272 inline StubFrame::StubFrame(StackFrameIterator* iterator) | 273 inline StubFrame::StubFrame(StackFrameIteratorBase* iterator) |
| 273 : StandardFrame(iterator) { | 274 : StandardFrame(iterator) { |
| 274 } | 275 } |
| 275 | 276 |
| 276 | 277 |
| 277 inline OptimizedFrame::OptimizedFrame(StackFrameIterator* iterator) | 278 inline OptimizedFrame::OptimizedFrame(StackFrameIteratorBase* iterator) |
| 278 : JavaScriptFrame(iterator) { | 279 : JavaScriptFrame(iterator) { |
| 279 } | 280 } |
| 280 | 281 |
| 281 | 282 |
| 282 inline ArgumentsAdaptorFrame::ArgumentsAdaptorFrame( | 283 inline ArgumentsAdaptorFrame::ArgumentsAdaptorFrame( |
| 283 StackFrameIterator* iterator) : JavaScriptFrame(iterator) { | 284 StackFrameIteratorBase* iterator) : JavaScriptFrame(iterator) { |
| 284 } | 285 } |
| 285 | 286 |
| 286 | 287 |
| 287 inline InternalFrame::InternalFrame(StackFrameIterator* iterator) | 288 inline InternalFrame::InternalFrame(StackFrameIteratorBase* iterator) |
| 288 : StandardFrame(iterator) { | 289 : StandardFrame(iterator) { |
| 289 } | 290 } |
| 290 | 291 |
| 291 | 292 |
| 292 inline StubFailureTrampolineFrame::StubFailureTrampolineFrame( | 293 inline StubFailureTrampolineFrame::StubFailureTrampolineFrame( |
| 293 StackFrameIterator* iterator) : StandardFrame(iterator) { | 294 StackFrameIteratorBase* iterator) : StandardFrame(iterator) { |
| 294 } | 295 } |
| 295 | 296 |
| 296 | 297 |
| 297 inline ConstructFrame::ConstructFrame(StackFrameIterator* iterator) | 298 inline ConstructFrame::ConstructFrame(StackFrameIteratorBase* iterator) |
| 298 : InternalFrame(iterator) { | 299 : InternalFrame(iterator) { |
| 299 } | 300 } |
| 300 | 301 |
| 301 | 302 |
| 302 inline JavaScriptFrameIterator::JavaScriptFrameIterator( | 303 inline JavaScriptFrameIterator::JavaScriptFrameIterator( |
| 303 Isolate* isolate) | 304 Isolate* isolate) |
| 304 : iterator_(isolate) { | 305 : iterator_(isolate) { |
| 305 if (!done()) Advance(); | 306 if (!done()) Advance(); |
| 306 } | 307 } |
| 307 | 308 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 318 // problematic that we can't use the safe-cast operator to cast to | 319 // problematic that we can't use the safe-cast operator to cast to |
| 319 // the JavaScript frame type, because we may encounter arguments | 320 // the JavaScript frame type, because we may encounter arguments |
| 320 // adaptor frames. | 321 // adaptor frames. |
| 321 StackFrame* frame = iterator_.frame(); | 322 StackFrame* frame = iterator_.frame(); |
| 322 ASSERT(frame->is_java_script() || frame->is_arguments_adaptor()); | 323 ASSERT(frame->is_java_script() || frame->is_arguments_adaptor()); |
| 323 return static_cast<JavaScriptFrame*>(frame); | 324 return static_cast<JavaScriptFrame*>(frame); |
| 324 } | 325 } |
| 325 | 326 |
| 326 | 327 |
| 327 inline JavaScriptFrame* SafeStackFrameIterator::frame() const { | 328 inline JavaScriptFrame* SafeStackFrameIterator::frame() const { |
| 328 ASSERT(!iteration_done_); | 329 ASSERT(!done()); |
| 329 // TODO(1233797): The frame hierarchy needs to change. It's | 330 ASSERT(frame_->is_java_script()); |
| 330 // problematic that we can't use the safe-cast operator to cast to | 331 return static_cast<JavaScriptFrame*>(frame_); |
| 331 // the JavaScript frame type, because we may encounter arguments | |
| 332 // adaptor frames. | |
| 333 StackFrame* frame = iterator_.frame(); | |
| 334 ASSERT(frame->is_java_script()); | |
| 335 return static_cast<JavaScriptFrame*>(frame); | |
| 336 } | 332 } |
| 337 | 333 |
| 338 | 334 |
| 339 } } // namespace v8::internal | 335 } } // namespace v8::internal |
| 340 | 336 |
| 341 #endif // V8_FRAMES_INL_H_ | 337 #endif // V8_FRAMES_INL_H_ |
| OLD | NEW |