Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/frames.h

Issue 8117001: Remove #include "isolate-inl.h" from v8.h. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/execution.cc ('k') | src/frames.cc » ('j') | src/jsregexp.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // Tells whether the given address is inside this handler. 99 // Tells whether the given address is inside this handler.
100 inline bool includes(Address address) const; 100 inline bool includes(Address address) const;
101 101
102 // Garbage collection support. 102 // Garbage collection support.
103 inline void Iterate(ObjectVisitor* v, Code* holder) const; 103 inline void Iterate(ObjectVisitor* v, Code* holder) const;
104 104
105 // Conversion support. 105 // Conversion support.
106 static inline StackHandler* FromAddress(Address address); 106 static inline StackHandler* FromAddress(Address address);
107 107
108 // Testers 108 // Testers
109 bool is_entry() { return state() == ENTRY; } 109 inline bool is_entry() const;
Kevin Millikin (Chromium) 2011/10/03 10:45:40 Removing isolate-inl.h from v8.h revealed a circul
110 bool is_try_catch() { return state() == TRY_CATCH; } 110 inline bool is_try_catch() const;
111 bool is_try_finally() { return state() == TRY_FINALLY; } 111 inline bool is_try_finally() const;
112 112
113 private: 113 private:
114 // Accessors. 114 // Accessors.
115 inline State state() const; 115 inline State state() const;
116 116
117 inline Object** context_address() const; 117 inline Object** context_address() const;
118 inline Address* pc_address() const; 118 inline Address* pc_address() const;
119 119
120 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); 120 DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler);
121 }; 121 };
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 bool HasHandler() const; 211 bool HasHandler() const;
212 212
213 // Get the type of this frame. 213 // Get the type of this frame.
214 virtual Type type() const = 0; 214 virtual Type type() const = 0;
215 215
216 // Get the code associated with this frame. 216 // Get the code associated with this frame.
217 // This method could be called during marking phase of GC. 217 // This method could be called during marking phase of GC.
218 virtual Code* unchecked_code() const = 0; 218 virtual Code* unchecked_code() const = 0;
219 219
220 // Get the code associated with this frame. 220 // Get the code associated with this frame.
221 Code* LookupCode() const { 221 inline Code* LookupCode() const;
222 return GetContainingCode(isolate(), pc());
223 }
224 222
225 // Get the code object that contains the given pc. 223 // Get the code object that contains the given pc.
226 static inline Code* GetContainingCode(Isolate* isolate, Address pc); 224 static inline Code* GetContainingCode(Isolate* isolate, Address pc);
227 225
228 // Get the code object containing the given pc and fill in the 226 // Get the code object containing the given pc and fill in the
229 // safepoint entry and the number of stack slots. The pc must be at 227 // safepoint entry and the number of stack slots. The pc must be at
230 // a safepoint. 228 // a safepoint.
231 static Code* GetSafepointData(Isolate* isolate, 229 static Code* GetSafepointData(Isolate* isolate,
232 Address pc, 230 Address pc,
233 SafepointEntry* safepoint_entry, 231 SafepointEntry* safepoint_entry,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // Garbage collection support. 293 // Garbage collection support.
296 virtual void Iterate(ObjectVisitor* v) const; 294 virtual void Iterate(ObjectVisitor* v) const;
297 295
298 static EntryFrame* cast(StackFrame* frame) { 296 static EntryFrame* cast(StackFrame* frame) {
299 ASSERT(frame->is_entry()); 297 ASSERT(frame->is_entry());
300 return static_cast<EntryFrame*>(frame); 298 return static_cast<EntryFrame*>(frame);
301 } 299 }
302 virtual void SetCallerFp(Address caller_fp); 300 virtual void SetCallerFp(Address caller_fp);
303 301
304 protected: 302 protected:
305 explicit EntryFrame(StackFrameIterator* iterator) : StackFrame(iterator) { } 303 inline explicit EntryFrame(StackFrameIterator* iterator);
306 304
307 // The caller stack pointer for entry frames is always zero. The 305 // The caller stack pointer for entry frames is always zero. The
308 // real information about the caller frame is available through the 306 // real information about the caller frame is available through the
309 // link to the top exit frame. 307 // link to the top exit frame.
310 virtual Address GetCallerStackPointer() const { return 0; } 308 virtual Address GetCallerStackPointer() const { return 0; }
311 309
312 private: 310 private:
313 virtual void ComputeCallerState(State* state) const; 311 virtual void ComputeCallerState(State* state) const;
314 virtual Type GetCallerState(State* state) const; 312 virtual Type GetCallerState(State* state) const;
315 313
316 friend class StackFrameIterator; 314 friend class StackFrameIterator;
317 }; 315 };
318 316
319 317
320 class EntryConstructFrame: public EntryFrame { 318 class EntryConstructFrame: public EntryFrame {
321 public: 319 public:
322 virtual Type type() const { return ENTRY_CONSTRUCT; } 320 virtual Type type() const { return ENTRY_CONSTRUCT; }
323 321
324 virtual Code* unchecked_code() const; 322 virtual Code* unchecked_code() const;
325 323
326 static EntryConstructFrame* cast(StackFrame* frame) { 324 static EntryConstructFrame* cast(StackFrame* frame) {
327 ASSERT(frame->is_entry_construct()); 325 ASSERT(frame->is_entry_construct());
328 return static_cast<EntryConstructFrame*>(frame); 326 return static_cast<EntryConstructFrame*>(frame);
329 } 327 }
330 328
331 protected: 329 protected:
332 explicit EntryConstructFrame(StackFrameIterator* iterator) 330 inline explicit EntryConstructFrame(StackFrameIterator* iterator);
333 : EntryFrame(iterator) { }
334 331
335 private: 332 private:
336 friend class StackFrameIterator; 333 friend class StackFrameIterator;
337 }; 334 };
338 335
339 336
340 // Exit frames are used to exit JavaScript execution and go to C. 337 // Exit frames are used to exit JavaScript execution and go to C.
341 class ExitFrame: public StackFrame { 338 class ExitFrame: public StackFrame {
342 public: 339 public:
343 virtual Type type() const { return EXIT; } 340 virtual Type type() const { return EXIT; }
(...skipping 13 matching lines...) Expand all
357 } 354 }
358 355
359 // Compute the state and type of an exit frame given a frame 356 // Compute the state and type of an exit frame given a frame
360 // pointer. Used when constructing the first stack frame seen by an 357 // pointer. Used when constructing the first stack frame seen by an
361 // iterator and the frames following entry frames. 358 // iterator and the frames following entry frames.
362 static Type GetStateForFramePointer(Address fp, State* state); 359 static Type GetStateForFramePointer(Address fp, State* state);
363 static Address ComputeStackPointer(Address fp); 360 static Address ComputeStackPointer(Address fp);
364 static void FillState(Address fp, Address sp, State* state); 361 static void FillState(Address fp, Address sp, State* state);
365 362
366 protected: 363 protected:
367 explicit ExitFrame(StackFrameIterator* iterator) : StackFrame(iterator) { } 364 inline explicit ExitFrame(StackFrameIterator* iterator);
368 365
369 virtual Address GetCallerStackPointer() const; 366 virtual Address GetCallerStackPointer() const;
370 367
371 private: 368 private:
372 virtual void ComputeCallerState(State* state) const; 369 virtual void ComputeCallerState(State* state) const;
373 370
374 friend class StackFrameIterator; 371 friend class StackFrameIterator;
375 }; 372 };
376 373
377 374
(...skipping 12 matching lines...) Expand all
390 static Object* GetExpression(Address fp, int index); 387 static Object* GetExpression(Address fp, int index);
391 388
392 virtual void SetCallerFp(Address caller_fp); 389 virtual void SetCallerFp(Address caller_fp);
393 390
394 static StandardFrame* cast(StackFrame* frame) { 391 static StandardFrame* cast(StackFrame* frame) {
395 ASSERT(frame->is_standard()); 392 ASSERT(frame->is_standard());
396 return static_cast<StandardFrame*>(frame); 393 return static_cast<StandardFrame*>(frame);
397 } 394 }
398 395
399 protected: 396 protected:
400 explicit StandardFrame(StackFrameIterator* iterator) 397 inline explicit StandardFrame(StackFrameIterator* iterator);
401 : StackFrame(iterator) { }
402 398
403 virtual void ComputeCallerState(State* state) const; 399 virtual void ComputeCallerState(State* state) const;
404 400
405 // Accessors. 401 // Accessors.
406 inline Address caller_fp() const; 402 inline Address caller_fp() const;
407 inline Address caller_pc() const; 403 inline Address caller_pc() const;
408 404
409 // Computes the address of the PC field in the standard frame given 405 // Computes the address of the PC field in the standard frame given
410 // by the provided frame pointer. 406 // by the provided frame pointer.
411 static inline Address ComputePCAddress(Address fp); 407 static inline Address ComputePCAddress(Address fp);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 506
511 // Build a list with summaries for this frame including all inlined frames. 507 // Build a list with summaries for this frame including all inlined frames.
512 virtual void Summarize(List<FrameSummary>* frames); 508 virtual void Summarize(List<FrameSummary>* frames);
513 509
514 static JavaScriptFrame* cast(StackFrame* frame) { 510 static JavaScriptFrame* cast(StackFrame* frame) {
515 ASSERT(frame->is_java_script()); 511 ASSERT(frame->is_java_script());
516 return static_cast<JavaScriptFrame*>(frame); 512 return static_cast<JavaScriptFrame*>(frame);
517 } 513 }
518 514
519 protected: 515 protected:
520 explicit JavaScriptFrame(StackFrameIterator* iterator) 516 inline explicit JavaScriptFrame(StackFrameIterator* iterator);
521 : StandardFrame(iterator) { }
522 517
523 virtual Address GetCallerStackPointer() const; 518 virtual Address GetCallerStackPointer() const;
524 519
525 virtual int GetNumberOfIncomingArguments() const; 520 virtual int GetNumberOfIncomingArguments() const;
526 521
527 // Garbage collection support. Iterates over incoming arguments, 522 // Garbage collection support. Iterates over incoming arguments,
528 // receiver, and any callee-saved registers. 523 // receiver, and any callee-saved registers.
529 void IterateArguments(ObjectVisitor* v) const; 524 void IterateArguments(ObjectVisitor* v) const;
530 525
531 private: 526 private:
(...skipping 16 matching lines...) Expand all
548 // Return a list with JSFunctions of this frame. 543 // Return a list with JSFunctions of this frame.
549 // The functions are ordered bottom-to-top (i.e. functions.last() 544 // The functions are ordered bottom-to-top (i.e. functions.last()
550 // is the top-most activation) 545 // is the top-most activation)
551 virtual void GetFunctions(List<JSFunction*>* functions); 546 virtual void GetFunctions(List<JSFunction*>* functions);
552 547
553 virtual void Summarize(List<FrameSummary>* frames); 548 virtual void Summarize(List<FrameSummary>* frames);
554 549
555 DeoptimizationInputData* GetDeoptimizationData(int* deopt_index); 550 DeoptimizationInputData* GetDeoptimizationData(int* deopt_index);
556 551
557 protected: 552 protected:
558 explicit OptimizedFrame(StackFrameIterator* iterator) 553 inline explicit OptimizedFrame(StackFrameIterator* iterator);
559 : JavaScriptFrame(iterator) { }
560 554
561 private: 555 private:
562 friend class StackFrameIterator; 556 friend class StackFrameIterator;
563 }; 557 };
564 558
565 559
566 // Arguments adaptor frames are automatically inserted below 560 // Arguments adaptor frames are automatically inserted below
567 // JavaScript frames when the actual number of parameters does not 561 // JavaScript frames when the actual number of parameters does not
568 // match the formal number of parameters. 562 // match the formal number of parameters.
569 class ArgumentsAdaptorFrame: public JavaScriptFrame { 563 class ArgumentsAdaptorFrame: public JavaScriptFrame {
570 public: 564 public:
571 virtual Type type() const { return ARGUMENTS_ADAPTOR; } 565 virtual Type type() const { return ARGUMENTS_ADAPTOR; }
572 566
573 // Determine the code for the frame. 567 // Determine the code for the frame.
574 virtual Code* unchecked_code() const; 568 virtual Code* unchecked_code() const;
575 569
576 static ArgumentsAdaptorFrame* cast(StackFrame* frame) { 570 static ArgumentsAdaptorFrame* cast(StackFrame* frame) {
577 ASSERT(frame->is_arguments_adaptor()); 571 ASSERT(frame->is_arguments_adaptor());
578 return static_cast<ArgumentsAdaptorFrame*>(frame); 572 return static_cast<ArgumentsAdaptorFrame*>(frame);
579 } 573 }
580 574
581 // Printing support. 575 // Printing support.
582 virtual void Print(StringStream* accumulator, 576 virtual void Print(StringStream* accumulator,
583 PrintMode mode, 577 PrintMode mode,
584 int index) const; 578 int index) const;
585 579
586 protected: 580 protected:
587 explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator) 581 inline explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator);
588 : JavaScriptFrame(iterator) { }
589 582
590 virtual int GetNumberOfIncomingArguments() const { 583 virtual int GetNumberOfIncomingArguments() const;
591 return Smi::cast(GetExpression(0))->value();
592 }
593 584
594 virtual Address GetCallerStackPointer() const; 585 virtual Address GetCallerStackPointer() const;
595 586
596 private: 587 private:
597 friend class StackFrameIterator; 588 friend class StackFrameIterator;
598 }; 589 };
599 590
600 591
601 class InternalFrame: public StandardFrame { 592 class InternalFrame: public StandardFrame {
602 public: 593 public:
603 virtual Type type() const { return INTERNAL; } 594 virtual Type type() const { return INTERNAL; }
604 595
605 // Garbage collection support. 596 // Garbage collection support.
606 virtual void Iterate(ObjectVisitor* v) const; 597 virtual void Iterate(ObjectVisitor* v) const;
607 598
608 // Determine the code for the frame. 599 // Determine the code for the frame.
609 virtual Code* unchecked_code() const; 600 virtual Code* unchecked_code() const;
610 601
611 static InternalFrame* cast(StackFrame* frame) { 602 static InternalFrame* cast(StackFrame* frame) {
612 ASSERT(frame->is_internal()); 603 ASSERT(frame->is_internal());
613 return static_cast<InternalFrame*>(frame); 604 return static_cast<InternalFrame*>(frame);
614 } 605 }
615 606
616 protected: 607 protected:
617 explicit InternalFrame(StackFrameIterator* iterator) 608 inline explicit InternalFrame(StackFrameIterator* iterator);
618 : StandardFrame(iterator) { }
619 609
620 virtual Address GetCallerStackPointer() const; 610 virtual Address GetCallerStackPointer() const;
621 611
622 private: 612 private:
623 friend class StackFrameIterator; 613 friend class StackFrameIterator;
624 }; 614 };
625 615
626 616
627 // Construct frames are special trampoline frames introduced to handle 617 // Construct frames are special trampoline frames introduced to handle
628 // function invocations through 'new'. 618 // function invocations through 'new'.
629 class ConstructFrame: public InternalFrame { 619 class ConstructFrame: public InternalFrame {
630 public: 620 public:
631 virtual Type type() const { return CONSTRUCT; } 621 virtual Type type() const { return CONSTRUCT; }
632 622
633 static ConstructFrame* cast(StackFrame* frame) { 623 static ConstructFrame* cast(StackFrame* frame) {
634 ASSERT(frame->is_construct()); 624 ASSERT(frame->is_construct());
635 return static_cast<ConstructFrame*>(frame); 625 return static_cast<ConstructFrame*>(frame);
636 } 626 }
637 627
638 protected: 628 protected:
639 explicit ConstructFrame(StackFrameIterator* iterator) 629 inline explicit ConstructFrame(StackFrameIterator* iterator);
640 : InternalFrame(iterator) { }
641 630
642 private: 631 private:
643 friend class StackFrameIterator; 632 friend class StackFrameIterator;
644 }; 633 };
645 634
646 635
647 class StackFrameIterator BASE_EMBEDDED { 636 class StackFrameIterator BASE_EMBEDDED {
648 public: 637 public:
649 // An iterator that iterates over the current thread's stack, 638 // An iterator that iterates over the current thread's stack,
650 // and uses current isolate. 639 // and uses current isolate.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 public: 700 public:
712 JavaScriptFrameIteratorTemp() { if (!done()) Advance(); } 701 JavaScriptFrameIteratorTemp() { if (!done()) Advance(); }
713 702
714 inline explicit JavaScriptFrameIteratorTemp(Isolate* isolate); 703 inline explicit JavaScriptFrameIteratorTemp(Isolate* isolate);
715 704
716 // Skip frames until the frame with the given id is reached. 705 // Skip frames until the frame with the given id is reached.
717 explicit JavaScriptFrameIteratorTemp(StackFrame::Id id) { AdvanceToId(id); } 706 explicit JavaScriptFrameIteratorTemp(StackFrame::Id id) { AdvanceToId(id); }
718 707
719 inline JavaScriptFrameIteratorTemp(Isolate* isolate, StackFrame::Id id); 708 inline JavaScriptFrameIteratorTemp(Isolate* isolate, StackFrame::Id id);
720 709
721 JavaScriptFrameIteratorTemp(Address fp, Address sp, 710 JavaScriptFrameIteratorTemp(Address fp,
722 Address low_bound, Address high_bound) : 711 Address sp,
712 Address low_bound,
713 Address high_bound) :
723 iterator_(fp, sp, low_bound, high_bound) { 714 iterator_(fp, sp, low_bound, high_bound) {
724 if (!done()) Advance(); 715 if (!done()) Advance();
725 } 716 }
726 717
727 JavaScriptFrameIteratorTemp(Isolate* isolate, 718 JavaScriptFrameIteratorTemp(Isolate* isolate,
728 Address fp, Address sp, 719 Address fp,
729 Address low_bound, Address high_bound) : 720 Address sp,
721 Address low_bound,
722 Address high_bound) :
730 iterator_(isolate, fp, sp, low_bound, high_bound) { 723 iterator_(isolate, fp, sp, low_bound, high_bound) {
731 if (!done()) Advance(); 724 if (!done()) Advance();
732 } 725 }
733 726
734 inline JavaScriptFrame* frame() const; 727 inline JavaScriptFrame* frame() const;
735 728
736 bool done() const { return iterator_.done(); } 729 bool done() const { return iterator_.done(); }
737 void Advance(); 730 void Advance();
738 731
739 // Advance to the frame holding the arguments for the current 732 // Advance to the frame holding the arguments for the current
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 }; 865 };
873 866
874 867
875 // Reads all frames on the current stack and copies them into the current 868 // Reads all frames on the current stack and copies them into the current
876 // zone memory. 869 // zone memory.
877 Vector<StackFrame*> CreateStackMap(); 870 Vector<StackFrame*> CreateStackMap();
878 871
879 } } // namespace v8::internal 872 } } // namespace v8::internal
880 873
881 #endif // V8_FRAMES_H_ 874 #endif // V8_FRAMES_H_
OLDNEW
« no previous file with comments | « src/execution.cc ('k') | src/frames.cc » ('j') | src/jsregexp.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698