OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Get the id of this stack frame. | 151 // Get the id of this stack frame. |
152 Id id() const { return static_cast<Id>(OffsetFrom(caller_sp())); } | 152 Id id() const { return static_cast<Id>(OffsetFrom(caller_sp())); } |
153 | 153 |
154 // Checks if this frame includes any stack handlers. | 154 // Checks if this frame includes any stack handlers. |
155 bool HasHandler() const; | 155 bool HasHandler() const; |
156 | 156 |
157 // Get the type of this frame. | 157 // Get the type of this frame. |
158 virtual Type type() const = 0; | 158 virtual Type type() const = 0; |
159 | 159 |
160 // Get the code associated with this frame. | 160 // Get the code associated with this frame. |
161 virtual Code* code() const = 0; | 161 // This method could be called during marking phase of GC. |
| 162 virtual Code* unchecked_code() const = 0; |
| 163 |
| 164 // Get the code associated with this frame. |
| 165 inline Code* code() const { |
| 166 return Code::cast(unchecked_code()); |
| 167 } |
162 | 168 |
163 // Garbage collection support. | 169 // Garbage collection support. |
164 static void CookFramesForThread(ThreadLocalTop* thread); | 170 static void CookFramesForThread(ThreadLocalTop* thread); |
165 static void UncookFramesForThread(ThreadLocalTop* thread); | 171 static void UncookFramesForThread(ThreadLocalTop* thread); |
166 | 172 |
167 virtual void Iterate(ObjectVisitor* v) const { } | 173 virtual void Iterate(ObjectVisitor* v) const { } |
168 | 174 |
169 // Printing support. | 175 // Printing support. |
170 enum PrintMode { OVERVIEW, DETAILS }; | 176 enum PrintMode { OVERVIEW, DETAILS }; |
171 virtual void Print(StringStream* accumulator, | 177 virtual void Print(StringStream* accumulator, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 private: | 223 private: |
218 void operator=(const StackFrame& original); | 224 void operator=(const StackFrame& original); |
219 }; | 225 }; |
220 | 226 |
221 | 227 |
222 // Entry frames are used to enter JavaScript execution from C. | 228 // Entry frames are used to enter JavaScript execution from C. |
223 class EntryFrame: public StackFrame { | 229 class EntryFrame: public StackFrame { |
224 public: | 230 public: |
225 virtual Type type() const { return ENTRY; } | 231 virtual Type type() const { return ENTRY; } |
226 | 232 |
227 virtual Code* code() const; | 233 virtual Code* unchecked_code() const; |
228 | 234 |
229 // Garbage collection support. | 235 // Garbage collection support. |
230 virtual void Iterate(ObjectVisitor* v) const; | 236 virtual void Iterate(ObjectVisitor* v) const; |
231 | 237 |
232 static EntryFrame* cast(StackFrame* frame) { | 238 static EntryFrame* cast(StackFrame* frame) { |
233 ASSERT(frame->is_entry()); | 239 ASSERT(frame->is_entry()); |
234 return static_cast<EntryFrame*>(frame); | 240 return static_cast<EntryFrame*>(frame); |
235 } | 241 } |
236 virtual void SetCallerFp(Address caller_fp); | 242 virtual void SetCallerFp(Address caller_fp); |
237 | 243 |
(...skipping 10 matching lines...) Expand all Loading... |
248 virtual Type GetCallerState(State* state) const; | 254 virtual Type GetCallerState(State* state) const; |
249 | 255 |
250 friend class StackFrameIterator; | 256 friend class StackFrameIterator; |
251 }; | 257 }; |
252 | 258 |
253 | 259 |
254 class EntryConstructFrame: public EntryFrame { | 260 class EntryConstructFrame: public EntryFrame { |
255 public: | 261 public: |
256 virtual Type type() const { return ENTRY_CONSTRUCT; } | 262 virtual Type type() const { return ENTRY_CONSTRUCT; } |
257 | 263 |
258 virtual Code* code() const; | 264 virtual Code* unchecked_code() const; |
259 | 265 |
260 static EntryConstructFrame* cast(StackFrame* frame) { | 266 static EntryConstructFrame* cast(StackFrame* frame) { |
261 ASSERT(frame->is_entry_construct()); | 267 ASSERT(frame->is_entry_construct()); |
262 return static_cast<EntryConstructFrame*>(frame); | 268 return static_cast<EntryConstructFrame*>(frame); |
263 } | 269 } |
264 | 270 |
265 protected: | 271 protected: |
266 explicit EntryConstructFrame(StackFrameIterator* iterator) | 272 explicit EntryConstructFrame(StackFrameIterator* iterator) |
267 : EntryFrame(iterator) { } | 273 : EntryFrame(iterator) { } |
268 | 274 |
269 private: | 275 private: |
270 friend class StackFrameIterator; | 276 friend class StackFrameIterator; |
271 }; | 277 }; |
272 | 278 |
273 | 279 |
274 // Exit frames are used to exit JavaScript execution and go to C. | 280 // Exit frames are used to exit JavaScript execution and go to C. |
275 class ExitFrame: public StackFrame { | 281 class ExitFrame: public StackFrame { |
276 public: | 282 public: |
277 enum Mode { MODE_NORMAL, MODE_DEBUG }; | 283 enum Mode { MODE_NORMAL, MODE_DEBUG }; |
278 virtual Type type() const { return EXIT; } | 284 virtual Type type() const { return EXIT; } |
279 | 285 |
280 virtual Code* code() const; | 286 virtual Code* unchecked_code() const; |
281 | 287 |
282 Object*& code_slot() const; | 288 Object*& code_slot() const; |
283 | 289 |
284 // Garbage collection support. | 290 // Garbage collection support. |
285 virtual void Iterate(ObjectVisitor* v) const; | 291 virtual void Iterate(ObjectVisitor* v) const; |
286 | 292 |
287 virtual void SetCallerFp(Address caller_fp); | 293 virtual void SetCallerFp(Address caller_fp); |
288 | 294 |
289 static ExitFrame* cast(StackFrame* frame) { | 295 static ExitFrame* cast(StackFrame* frame) { |
290 ASSERT(frame->is_exit()); | 296 ASSERT(frame->is_exit()); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 402 |
397 // Garbage collection support. | 403 // Garbage collection support. |
398 virtual void Iterate(ObjectVisitor* v) const; | 404 virtual void Iterate(ObjectVisitor* v) const; |
399 | 405 |
400 // Printing support. | 406 // Printing support. |
401 virtual void Print(StringStream* accumulator, | 407 virtual void Print(StringStream* accumulator, |
402 PrintMode mode, | 408 PrintMode mode, |
403 int index) const; | 409 int index) const; |
404 | 410 |
405 // Determine the code for the frame. | 411 // Determine the code for the frame. |
406 virtual Code* code() const; | 412 virtual Code* unchecked_code() const; |
407 | 413 |
408 static JavaScriptFrame* cast(StackFrame* frame) { | 414 static JavaScriptFrame* cast(StackFrame* frame) { |
409 ASSERT(frame->is_java_script()); | 415 ASSERT(frame->is_java_script()); |
410 return static_cast<JavaScriptFrame*>(frame); | 416 return static_cast<JavaScriptFrame*>(frame); |
411 } | 417 } |
412 | 418 |
413 protected: | 419 protected: |
414 explicit JavaScriptFrame(StackFrameIterator* iterator) | 420 explicit JavaScriptFrame(StackFrameIterator* iterator) |
415 : StandardFrame(iterator), disable_heap_access_(false) { } | 421 : StandardFrame(iterator), disable_heap_access_(false) { } |
416 | 422 |
(...skipping 15 matching lines...) Expand all Loading... |
432 | 438 |
433 | 439 |
434 // Arguments adaptor frames are automatically inserted below | 440 // Arguments adaptor frames are automatically inserted below |
435 // JavaScript frames when the actual number of parameters does not | 441 // JavaScript frames when the actual number of parameters does not |
436 // match the formal number of parameters. | 442 // match the formal number of parameters. |
437 class ArgumentsAdaptorFrame: public JavaScriptFrame { | 443 class ArgumentsAdaptorFrame: public JavaScriptFrame { |
438 public: | 444 public: |
439 virtual Type type() const { return ARGUMENTS_ADAPTOR; } | 445 virtual Type type() const { return ARGUMENTS_ADAPTOR; } |
440 | 446 |
441 // Determine the code for the frame. | 447 // Determine the code for the frame. |
442 virtual Code* code() const; | 448 virtual Code* unchecked_code() const; |
443 | 449 |
444 static ArgumentsAdaptorFrame* cast(StackFrame* frame) { | 450 static ArgumentsAdaptorFrame* cast(StackFrame* frame) { |
445 ASSERT(frame->is_arguments_adaptor()); | 451 ASSERT(frame->is_arguments_adaptor()); |
446 return static_cast<ArgumentsAdaptorFrame*>(frame); | 452 return static_cast<ArgumentsAdaptorFrame*>(frame); |
447 } | 453 } |
448 | 454 |
449 // Printing support. | 455 // Printing support. |
450 virtual void Print(StringStream* accumulator, | 456 virtual void Print(StringStream* accumulator, |
451 PrintMode mode, | 457 PrintMode mode, |
452 int index) const; | 458 int index) const; |
453 protected: | 459 protected: |
454 explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator) | 460 explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator) |
455 : JavaScriptFrame(iterator) { } | 461 : JavaScriptFrame(iterator) { } |
456 | 462 |
457 virtual Address GetCallerStackPointer() const; | 463 virtual Address GetCallerStackPointer() const; |
458 | 464 |
459 private: | 465 private: |
460 friend class StackFrameIterator; | 466 friend class StackFrameIterator; |
461 }; | 467 }; |
462 | 468 |
463 | 469 |
464 class InternalFrame: public StandardFrame { | 470 class InternalFrame: public StandardFrame { |
465 public: | 471 public: |
466 virtual Type type() const { return INTERNAL; } | 472 virtual Type type() const { return INTERNAL; } |
467 | 473 |
468 // Garbage collection support. | 474 // Garbage collection support. |
469 virtual void Iterate(ObjectVisitor* v) const; | 475 virtual void Iterate(ObjectVisitor* v) const; |
470 | 476 |
471 // Determine the code for the frame. | 477 // Determine the code for the frame. |
472 virtual Code* code() const; | 478 virtual Code* unchecked_code() const; |
473 | 479 |
474 static InternalFrame* cast(StackFrame* frame) { | 480 static InternalFrame* cast(StackFrame* frame) { |
475 ASSERT(frame->is_internal()); | 481 ASSERT(frame->is_internal()); |
476 return static_cast<InternalFrame*>(frame); | 482 return static_cast<InternalFrame*>(frame); |
477 } | 483 } |
478 | 484 |
479 protected: | 485 protected: |
480 explicit InternalFrame(StackFrameIterator* iterator) | 486 explicit InternalFrame(StackFrameIterator* iterator) |
481 : StandardFrame(iterator) { } | 487 : StandardFrame(iterator) { } |
482 | 488 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 }; | 685 }; |
680 | 686 |
681 | 687 |
682 // Reads all frames on the current stack and copies them into the current | 688 // Reads all frames on the current stack and copies them into the current |
683 // zone memory. | 689 // zone memory. |
684 Vector<StackFrame*> CreateStackMap(); | 690 Vector<StackFrame*> CreateStackMap(); |
685 | 691 |
686 } } // namespace v8::internal | 692 } } // namespace v8::internal |
687 | 693 |
688 #endif // V8_FRAMES_H_ | 694 #endif // V8_FRAMES_H_ |
OLD | NEW |