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 11 matching lines...) Expand all Loading... |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 28 #ifndef V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
29 #define V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 29 #define V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
30 | 30 |
31 #include "assembler.h" | 31 #include "assembler.h" |
32 #include "frames.h" | |
33 #include "v8globals.h" | 32 #include "v8globals.h" |
34 | 33 |
35 namespace v8 { | 34 namespace v8 { |
36 namespace internal { | 35 namespace internal { |
37 | 36 |
38 // Flags used for the AllocateInNewSpace functions. | 37 // Flags used for the AllocateInNewSpace functions. |
39 enum AllocationFlags { | 38 enum AllocationFlags { |
40 // No special flags. | 39 // No special flags. |
41 NO_ALLOCATION_FLAGS = 0, | 40 NO_ALLOCATION_FLAGS = 0, |
42 // Return the pointer to the allocated already tagged as a heap object. | 41 // Return the pointer to the allocated already tagged as a heap object. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 Register address, | 98 Register address, |
100 Register value); | 99 Register value); |
101 | 100 |
102 #ifdef ENABLE_DEBUGGER_SUPPORT | 101 #ifdef ENABLE_DEBUGGER_SUPPORT |
103 // --------------------------------------------------------------------------- | 102 // --------------------------------------------------------------------------- |
104 // Debugger Support | 103 // Debugger Support |
105 | 104 |
106 void DebugBreak(); | 105 void DebugBreak(); |
107 #endif | 106 #endif |
108 | 107 |
| 108 // --------------------------------------------------------------------------- |
| 109 // Activation frames |
| 110 |
| 111 void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); } |
| 112 void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); } |
| 113 |
| 114 void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); } |
| 115 void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); } |
| 116 |
109 // Enter specific kind of exit frame. Expects the number of | 117 // Enter specific kind of exit frame. Expects the number of |
110 // arguments in register eax and sets up the number of arguments in | 118 // arguments in register eax and sets up the number of arguments in |
111 // register edi and the pointer to the first argument in register | 119 // register edi and the pointer to the first argument in register |
112 // esi. | 120 // esi. |
113 void EnterExitFrame(bool save_doubles); | 121 void EnterExitFrame(bool save_doubles); |
114 | 122 |
115 void EnterApiExitFrame(int argc); | 123 void EnterApiExitFrame(int argc); |
116 | 124 |
117 // Leave the current exit frame. Expects the return value in | 125 // Leave the current exit frame. Expects the return value in |
118 // register eax:edx (untouched) and the pointer to the first | 126 // register eax:edx (untouched) and the pointer to the first |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 void Abort(const char* msg); | 617 void Abort(const char* msg); |
610 | 618 |
611 // Check that the stack is aligned. | 619 // Check that the stack is aligned. |
612 void CheckStackAlignment(); | 620 void CheckStackAlignment(); |
613 | 621 |
614 // Verify restrictions about code generated in stubs. | 622 // Verify restrictions about code generated in stubs. |
615 void set_generating_stub(bool value) { generating_stub_ = value; } | 623 void set_generating_stub(bool value) { generating_stub_ = value; } |
616 bool generating_stub() { return generating_stub_; } | 624 bool generating_stub() { return generating_stub_; } |
617 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } | 625 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } |
618 bool allow_stub_calls() { return allow_stub_calls_; } | 626 bool allow_stub_calls() { return allow_stub_calls_; } |
619 void set_has_frame(bool value) { has_frame_ = value; } | |
620 bool has_frame() { return has_frame_; } | |
621 inline bool AllowThisStubCall(CodeStub* stub); | |
622 | 627 |
623 // --------------------------------------------------------------------------- | 628 // --------------------------------------------------------------------------- |
624 // String utilities. | 629 // String utilities. |
625 | 630 |
626 // Check whether the instance type represents a flat ascii string. Jump to the | 631 // Check whether the instance type represents a flat ascii string. Jump to the |
627 // label if not. If the instance type can be scratched specify same register | 632 // label if not. If the instance type can be scratched specify same register |
628 // for both instance type and scratch. | 633 // for both instance type and scratch. |
629 void JumpIfInstanceTypeIsNotSequentialAscii(Register instance_type, | 634 void JumpIfInstanceTypeIsNotSequentialAscii(Register instance_type, |
630 Register scratch, | 635 Register scratch, |
631 Label* on_not_flat_ascii_string); | 636 Label* on_not_flat_ascii_string); |
632 | 637 |
633 // Checks if both objects are sequential ASCII strings, and jumps to label | 638 // Checks if both objects are sequential ASCII strings, and jumps to label |
634 // if either is not. | 639 // if either is not. |
635 void JumpIfNotBothSequentialAsciiStrings(Register object1, | 640 void JumpIfNotBothSequentialAsciiStrings(Register object1, |
636 Register object2, | 641 Register object2, |
637 Register scratch1, | 642 Register scratch1, |
638 Register scratch2, | 643 Register scratch2, |
639 Label* on_not_flat_ascii_strings); | 644 Label* on_not_flat_ascii_strings); |
640 | 645 |
641 static int SafepointRegisterStackIndex(Register reg) { | 646 static int SafepointRegisterStackIndex(Register reg) { |
642 return SafepointRegisterStackIndex(reg.code()); | 647 return SafepointRegisterStackIndex(reg.code()); |
643 } | 648 } |
644 | 649 |
645 // Activation support. | |
646 void EnterFrame(StackFrame::Type type); | |
647 void LeaveFrame(StackFrame::Type type); | |
648 | |
649 private: | 650 private: |
650 bool generating_stub_; | 651 bool generating_stub_; |
651 bool allow_stub_calls_; | 652 bool allow_stub_calls_; |
652 bool has_frame_; | |
653 // This handle will be patched with the code object on installation. | 653 // This handle will be patched with the code object on installation. |
654 Handle<Object> code_object_; | 654 Handle<Object> code_object_; |
655 | 655 |
656 // Helper functions for generating invokes. | 656 // Helper functions for generating invokes. |
657 void InvokePrologue(const ParameterCount& expected, | 657 void InvokePrologue(const ParameterCount& expected, |
658 const ParameterCount& actual, | 658 const ParameterCount& actual, |
659 Handle<Code> code_constant, | 659 Handle<Code> code_constant, |
660 const Operand& code_operand, | 660 const Operand& code_operand, |
661 Label* done, | 661 Label* done, |
662 InvokeFlag flag, | 662 InvokeFlag flag, |
663 Label::Distance done_near = Label::kFar, | 663 Label::Distance done_near = Label::kFar, |
664 const CallWrapper& call_wrapper = NullCallWrapper(), | 664 const CallWrapper& call_wrapper = NullCallWrapper(), |
665 CallKind call_kind = CALL_AS_METHOD); | 665 CallKind call_kind = CALL_AS_METHOD); |
666 | 666 |
| 667 // Activation support. |
| 668 void EnterFrame(StackFrame::Type type); |
| 669 void LeaveFrame(StackFrame::Type type); |
| 670 |
667 void EnterExitFramePrologue(); | 671 void EnterExitFramePrologue(); |
668 void EnterExitFrameEpilogue(int argc, bool save_doubles); | 672 void EnterExitFrameEpilogue(int argc, bool save_doubles); |
669 | 673 |
670 void LeaveExitFrameEpilogue(); | 674 void LeaveExitFrameEpilogue(); |
671 | 675 |
672 // Allocation support helpers. | 676 // Allocation support helpers. |
673 void LoadAllocationTopHelper(Register result, | 677 void LoadAllocationTopHelper(Register result, |
674 Register scratch, | 678 Register scratch, |
675 AllocationFlags flags); | 679 AllocationFlags flags); |
676 void UpdateAllocationTopHelper(Register result_end, Register scratch); | 680 void UpdateAllocationTopHelper(Register result_end, Register scratch); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 } \ | 767 } \ |
764 masm-> | 768 masm-> |
765 #else | 769 #else |
766 #define ACCESS_MASM(masm) masm-> | 770 #define ACCESS_MASM(masm) masm-> |
767 #endif | 771 #endif |
768 | 772 |
769 | 773 |
770 } } // namespace v8::internal | 774 } } // namespace v8::internal |
771 | 775 |
772 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 776 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
OLD | NEW |