OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 v->VisitPointer(context_address()); | 70 v->VisitPointer(context_address()); |
71 StackFrame::IteratePc(v, pc_address(), holder); | 71 StackFrame::IteratePc(v, pc_address(), holder); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 inline StackHandler* StackHandler::FromAddress(Address address) { | 75 inline StackHandler* StackHandler::FromAddress(Address address) { |
76 return reinterpret_cast<StackHandler*>(address); | 76 return reinterpret_cast<StackHandler*>(address); |
77 } | 77 } |
78 | 78 |
79 | 79 |
| 80 inline bool StackHandler::is_entry() const { |
| 81 return state() == ENTRY; |
| 82 } |
| 83 |
| 84 |
| 85 inline bool StackHandler::is_try_catch() const { |
| 86 return state() == TRY_CATCH; |
| 87 } |
| 88 |
| 89 |
| 90 inline bool StackHandler::is_try_finally() const { |
| 91 return state() == TRY_FINALLY; |
| 92 } |
| 93 |
| 94 |
80 inline StackHandler::State StackHandler::state() const { | 95 inline StackHandler::State StackHandler::state() const { |
81 const int offset = StackHandlerConstants::kStateOffset; | 96 const int offset = StackHandlerConstants::kStateOffset; |
82 return static_cast<State>(Memory::int_at(address() + offset)); | 97 return static_cast<State>(Memory::int_at(address() + offset)); |
83 } | 98 } |
84 | 99 |
85 | 100 |
86 inline Object** StackHandler::context_address() const { | 101 inline Object** StackHandler::context_address() const { |
87 const int offset = StackHandlerConstants::kContextOffset; | 102 const int offset = StackHandlerConstants::kContextOffset; |
88 return reinterpret_cast<Object**>(address() + offset); | 103 return reinterpret_cast<Object**>(address() + offset); |
89 } | 104 } |
90 | 105 |
91 | 106 |
92 inline Address* StackHandler::pc_address() const { | 107 inline Address* StackHandler::pc_address() const { |
93 const int offset = StackHandlerConstants::kPCOffset; | 108 const int offset = StackHandlerConstants::kPCOffset; |
94 return reinterpret_cast<Address*>(address() + offset); | 109 return reinterpret_cast<Address*>(address() + offset); |
95 } | 110 } |
96 | 111 |
97 | 112 |
98 inline StackFrame::StackFrame(StackFrameIterator* iterator) | 113 inline StackFrame::StackFrame(StackFrameIterator* iterator) |
99 : iterator_(iterator), isolate_(iterator_->isolate()) { | 114 : iterator_(iterator), isolate_(iterator_->isolate()) { |
100 } | 115 } |
101 | 116 |
102 | 117 |
103 inline StackHandler* StackFrame::top_handler() const { | 118 inline StackHandler* StackFrame::top_handler() const { |
104 return iterator_->handler(); | 119 return iterator_->handler(); |
105 } | 120 } |
106 | 121 |
107 | 122 |
| 123 inline Code* StackFrame::LookupCode() const { |
| 124 return GetContainingCode(isolate(), pc()); |
| 125 } |
| 126 |
| 127 |
108 inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) { | 128 inline Code* StackFrame::GetContainingCode(Isolate* isolate, Address pc) { |
109 return isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; | 129 return isolate->inner_pointer_to_code_cache()->GetCacheEntry(pc)->code; |
110 } | 130 } |
111 | 131 |
112 | 132 |
| 133 inline EntryFrame::EntryFrame(StackFrameIterator* iterator) |
| 134 : StackFrame(iterator) { |
| 135 } |
| 136 |
| 137 |
| 138 inline EntryConstructFrame::EntryConstructFrame(StackFrameIterator* iterator) |
| 139 : EntryFrame(iterator) { |
| 140 } |
| 141 |
| 142 |
| 143 inline ExitFrame::ExitFrame(StackFrameIterator* iterator) |
| 144 : StackFrame(iterator) { |
| 145 } |
| 146 |
| 147 |
| 148 inline StandardFrame::StandardFrame(StackFrameIterator* iterator) |
| 149 : StackFrame(iterator) { |
| 150 } |
| 151 |
| 152 |
113 inline Object* StandardFrame::GetExpression(int index) const { | 153 inline Object* StandardFrame::GetExpression(int index) const { |
114 return Memory::Object_at(GetExpressionAddress(index)); | 154 return Memory::Object_at(GetExpressionAddress(index)); |
115 } | 155 } |
116 | 156 |
117 | 157 |
118 inline void StandardFrame::SetExpression(int index, Object* value) { | 158 inline void StandardFrame::SetExpression(int index, Object* value) { |
119 Memory::Object_at(GetExpressionAddress(index)) = value; | 159 Memory::Object_at(GetExpressionAddress(index)) = value; |
120 } | 160 } |
121 | 161 |
122 | 162 |
(...skipping 25 matching lines...) Expand all Loading... |
148 } | 188 } |
149 | 189 |
150 | 190 |
151 inline bool StandardFrame::IsConstructFrame(Address fp) { | 191 inline bool StandardFrame::IsConstructFrame(Address fp) { |
152 Object* marker = | 192 Object* marker = |
153 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset); | 193 Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset); |
154 return marker == Smi::FromInt(CONSTRUCT); | 194 return marker == Smi::FromInt(CONSTRUCT); |
155 } | 195 } |
156 | 196 |
157 | 197 |
| 198 inline JavaScriptFrame::JavaScriptFrame(StackFrameIterator* iterator) |
| 199 : StandardFrame(iterator) { |
| 200 } |
| 201 |
| 202 |
158 Address JavaScriptFrame::GetParameterSlot(int index) const { | 203 Address JavaScriptFrame::GetParameterSlot(int index) const { |
159 int param_count = ComputeParametersCount(); | 204 int param_count = ComputeParametersCount(); |
160 ASSERT(-1 <= index && index < param_count); | 205 ASSERT(-1 <= index && index < param_count); |
161 int parameter_offset = (param_count - index - 1) * kPointerSize; | 206 int parameter_offset = (param_count - index - 1) * kPointerSize; |
162 return caller_sp() + parameter_offset; | 207 return caller_sp() + parameter_offset; |
163 } | 208 } |
164 | 209 |
165 | 210 |
166 Object* JavaScriptFrame::GetParameter(int index) const { | 211 Object* JavaScriptFrame::GetParameter(int index) const { |
167 return Memory::Object_at(GetParameterSlot(index)); | 212 return Memory::Object_at(GetParameterSlot(index)); |
(...skipping 15 matching lines...) Expand all Loading... |
183 } | 228 } |
184 | 229 |
185 | 230 |
186 inline Object* JavaScriptFrame::function() const { | 231 inline Object* JavaScriptFrame::function() const { |
187 Object* result = function_slot_object(); | 232 Object* result = function_slot_object(); |
188 ASSERT(result->IsJSFunction()); | 233 ASSERT(result->IsJSFunction()); |
189 return result; | 234 return result; |
190 } | 235 } |
191 | 236 |
192 | 237 |
| 238 inline OptimizedFrame::OptimizedFrame(StackFrameIterator* iterator) |
| 239 : JavaScriptFrame(iterator) { |
| 240 } |
| 241 |
| 242 |
| 243 inline ArgumentsAdaptorFrame::ArgumentsAdaptorFrame( |
| 244 StackFrameIterator* iterator) : JavaScriptFrame(iterator) { |
| 245 } |
| 246 |
| 247 |
| 248 inline InternalFrame::InternalFrame(StackFrameIterator* iterator) |
| 249 : StandardFrame(iterator) { |
| 250 } |
| 251 |
| 252 |
| 253 inline ConstructFrame::ConstructFrame(StackFrameIterator* iterator) |
| 254 : InternalFrame(iterator) { |
| 255 } |
| 256 |
| 257 |
193 template<typename Iterator> | 258 template<typename Iterator> |
194 inline JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp( | 259 inline JavaScriptFrameIteratorTemp<Iterator>::JavaScriptFrameIteratorTemp( |
195 Isolate* isolate) | 260 Isolate* isolate) |
196 : iterator_(isolate) { | 261 : iterator_(isolate) { |
197 if (!done()) Advance(); | 262 if (!done()) Advance(); |
198 } | 263 } |
199 | 264 |
200 template<typename Iterator> | 265 template<typename Iterator> |
201 inline JavaScriptFrame* JavaScriptFrameIteratorTemp<Iterator>::frame() const { | 266 inline JavaScriptFrame* JavaScriptFrameIteratorTemp<Iterator>::frame() const { |
202 // TODO(1233797): The frame hierarchy needs to change. It's | 267 // TODO(1233797): The frame hierarchy needs to change. It's |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 template<typename Iterator> | 310 template<typename Iterator> |
246 void JavaScriptFrameIteratorTemp<Iterator>::Reset() { | 311 void JavaScriptFrameIteratorTemp<Iterator>::Reset() { |
247 iterator_.Reset(); | 312 iterator_.Reset(); |
248 if (!done()) Advance(); | 313 if (!done()) Advance(); |
249 } | 314 } |
250 | 315 |
251 | 316 |
252 } } // namespace v8::internal | 317 } } // namespace v8::internal |
253 | 318 |
254 #endif // V8_FRAMES_INL_H_ | 319 #endif // V8_FRAMES_INL_H_ |
OLD | NEW |