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" |
32 #include "v8globals.h" | 33 #include "v8globals.h" |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
35 namespace internal { | 36 namespace internal { |
36 | 37 |
37 // Flags used for the AllocateInNewSpace functions. | 38 // Flags used for the AllocateInNewSpace functions. |
38 enum AllocationFlags { | 39 enum AllocationFlags { |
39 // No special flags. | 40 // No special flags. |
40 NO_ALLOCATION_FLAGS = 0, | 41 NO_ALLOCATION_FLAGS = 0, |
41 // Return the pointer to the allocated already tagged as a heap object. | 42 // 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... |
98 Register address, | 99 Register address, |
99 Register value); | 100 Register value); |
100 | 101 |
101 #ifdef ENABLE_DEBUGGER_SUPPORT | 102 #ifdef ENABLE_DEBUGGER_SUPPORT |
102 // --------------------------------------------------------------------------- | 103 // --------------------------------------------------------------------------- |
103 // Debugger Support | 104 // Debugger Support |
104 | 105 |
105 void DebugBreak(); | 106 void DebugBreak(); |
106 #endif | 107 #endif |
107 | 108 |
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 | |
117 // Enter specific kind of exit frame. Expects the number of | 109 // Enter specific kind of exit frame. Expects the number of |
118 // arguments in register eax and sets up the number of arguments in | 110 // arguments in register eax and sets up the number of arguments in |
119 // register edi and the pointer to the first argument in register | 111 // register edi and the pointer to the first argument in register |
120 // esi. | 112 // esi. |
121 void EnterExitFrame(bool save_doubles); | 113 void EnterExitFrame(bool save_doubles); |
122 | 114 |
123 void EnterApiExitFrame(int argc); | 115 void EnterApiExitFrame(int argc); |
124 | 116 |
125 // Leave the current exit frame. Expects the return value in | 117 // Leave the current exit frame. Expects the return value in |
126 // register eax:edx (untouched) and the pointer to the first | 118 // register eax:edx (untouched) and the pointer to the first |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 void Abort(const char* msg); | 652 void Abort(const char* msg); |
661 | 653 |
662 // Check that the stack is aligned. | 654 // Check that the stack is aligned. |
663 void CheckStackAlignment(); | 655 void CheckStackAlignment(); |
664 | 656 |
665 // Verify restrictions about code generated in stubs. | 657 // Verify restrictions about code generated in stubs. |
666 void set_generating_stub(bool value) { generating_stub_ = value; } | 658 void set_generating_stub(bool value) { generating_stub_ = value; } |
667 bool generating_stub() { return generating_stub_; } | 659 bool generating_stub() { return generating_stub_; } |
668 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } | 660 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } |
669 bool allow_stub_calls() { return allow_stub_calls_; } | 661 bool allow_stub_calls() { return allow_stub_calls_; } |
| 662 void set_has_frame(bool value) { has_frame_ = value; } |
| 663 bool has_frame() { return has_frame_; } |
| 664 inline bool AllowThisStubCall(CodeStub* stub); |
670 | 665 |
671 // --------------------------------------------------------------------------- | 666 // --------------------------------------------------------------------------- |
672 // String utilities. | 667 // String utilities. |
673 | 668 |
674 // Check whether the instance type represents a flat ascii string. Jump to the | 669 // Check whether the instance type represents a flat ascii string. Jump to the |
675 // label if not. If the instance type can be scratched specify same register | 670 // label if not. If the instance type can be scratched specify same register |
676 // for both instance type and scratch. | 671 // for both instance type and scratch. |
677 void JumpIfInstanceTypeIsNotSequentialAscii(Register instance_type, | 672 void JumpIfInstanceTypeIsNotSequentialAscii(Register instance_type, |
678 Register scratch, | 673 Register scratch, |
679 Label* on_not_flat_ascii_string); | 674 Label* on_not_flat_ascii_string); |
680 | 675 |
681 // Checks if both objects are sequential ASCII strings, and jumps to label | 676 // Checks if both objects are sequential ASCII strings, and jumps to label |
682 // if either is not. | 677 // if either is not. |
683 void JumpIfNotBothSequentialAsciiStrings(Register object1, | 678 void JumpIfNotBothSequentialAsciiStrings(Register object1, |
684 Register object2, | 679 Register object2, |
685 Register scratch1, | 680 Register scratch1, |
686 Register scratch2, | 681 Register scratch2, |
687 Label* on_not_flat_ascii_strings); | 682 Label* on_not_flat_ascii_strings); |
688 | 683 |
689 static int SafepointRegisterStackIndex(Register reg) { | 684 static int SafepointRegisterStackIndex(Register reg) { |
690 return SafepointRegisterStackIndex(reg.code()); | 685 return SafepointRegisterStackIndex(reg.code()); |
691 } | 686 } |
692 | 687 |
| 688 // Activation support. |
| 689 void EnterFrame(StackFrame::Type type); |
| 690 void LeaveFrame(StackFrame::Type type); |
| 691 |
693 private: | 692 private: |
694 bool generating_stub_; | 693 bool generating_stub_; |
695 bool allow_stub_calls_; | 694 bool allow_stub_calls_; |
| 695 bool has_frame_; |
696 // This handle will be patched with the code object on installation. | 696 // This handle will be patched with the code object on installation. |
697 Handle<Object> code_object_; | 697 Handle<Object> code_object_; |
698 | 698 |
699 // Helper functions for generating invokes. | 699 // Helper functions for generating invokes. |
700 void InvokePrologue(const ParameterCount& expected, | 700 void InvokePrologue(const ParameterCount& expected, |
701 const ParameterCount& actual, | 701 const ParameterCount& actual, |
702 Handle<Code> code_constant, | 702 Handle<Code> code_constant, |
703 const Operand& code_operand, | 703 const Operand& code_operand, |
704 Label* done, | 704 Label* done, |
705 InvokeFlag flag, | 705 InvokeFlag flag, |
706 Label::Distance done_near = Label::kFar, | 706 Label::Distance done_near = Label::kFar, |
707 const CallWrapper& call_wrapper = NullCallWrapper(), | 707 const CallWrapper& call_wrapper = NullCallWrapper(), |
708 CallKind call_kind = CALL_AS_METHOD); | 708 CallKind call_kind = CALL_AS_METHOD); |
709 | 709 |
710 // Activation support. | |
711 void EnterFrame(StackFrame::Type type); | |
712 void LeaveFrame(StackFrame::Type type); | |
713 | |
714 void EnterExitFramePrologue(); | 710 void EnterExitFramePrologue(); |
715 void EnterExitFrameEpilogue(int argc, bool save_doubles); | 711 void EnterExitFrameEpilogue(int argc, bool save_doubles); |
716 | 712 |
717 void LeaveExitFrameEpilogue(); | 713 void LeaveExitFrameEpilogue(); |
718 | 714 |
719 // Allocation support helpers. | 715 // Allocation support helpers. |
720 void LoadAllocationTopHelper(Register result, | 716 void LoadAllocationTopHelper(Register result, |
721 Register scratch, | 717 Register scratch, |
722 AllocationFlags flags); | 718 AllocationFlags flags); |
723 void UpdateAllocationTopHelper(Register result_end, Register scratch); | 719 void UpdateAllocationTopHelper(Register result_end, Register scratch); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 } \ | 806 } \ |
811 masm-> | 807 masm-> |
812 #else | 808 #else |
813 #define ACCESS_MASM(masm) masm-> | 809 #define ACCESS_MASM(masm) masm-> |
814 #endif | 810 #endif |
815 | 811 |
816 | 812 |
817 } } // namespace v8::internal | 813 } } // namespace v8::internal |
818 | 814 |
819 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 815 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
OLD | NEW |