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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 void Abort(const char* msg); | 609 void Abort(const char* msg); |
618 | 610 |
619 // Check that the stack is aligned. | 611 // Check that the stack is aligned. |
620 void CheckStackAlignment(); | 612 void CheckStackAlignment(); |
621 | 613 |
622 // Verify restrictions about code generated in stubs. | 614 // Verify restrictions about code generated in stubs. |
623 void set_generating_stub(bool value) { generating_stub_ = value; } | 615 void set_generating_stub(bool value) { generating_stub_ = value; } |
624 bool generating_stub() { return generating_stub_; } | 616 bool generating_stub() { return generating_stub_; } |
625 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } | 617 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } |
626 bool allow_stub_calls() { return allow_stub_calls_; } | 618 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); |
627 | 622 |
628 // --------------------------------------------------------------------------- | 623 // --------------------------------------------------------------------------- |
629 // String utilities. | 624 // String utilities. |
630 | 625 |
631 // Check whether the instance type represents a flat ascii string. Jump to the | 626 // Check whether the instance type represents a flat ascii string. Jump to the |
632 // label if not. If the instance type can be scratched specify same register | 627 // label if not. If the instance type can be scratched specify same register |
633 // for both instance type and scratch. | 628 // for both instance type and scratch. |
634 void JumpIfInstanceTypeIsNotSequentialAscii(Register instance_type, | 629 void JumpIfInstanceTypeIsNotSequentialAscii(Register instance_type, |
635 Register scratch, | 630 Register scratch, |
636 Label* on_not_flat_ascii_string); | 631 Label* on_not_flat_ascii_string); |
637 | 632 |
638 // Checks if both objects are sequential ASCII strings, and jumps to label | 633 // Checks if both objects are sequential ASCII strings, and jumps to label |
639 // if either is not. | 634 // if either is not. |
640 void JumpIfNotBothSequentialAsciiStrings(Register object1, | 635 void JumpIfNotBothSequentialAsciiStrings(Register object1, |
641 Register object2, | 636 Register object2, |
642 Register scratch1, | 637 Register scratch1, |
643 Register scratch2, | 638 Register scratch2, |
644 Label* on_not_flat_ascii_strings); | 639 Label* on_not_flat_ascii_strings); |
645 | 640 |
646 static int SafepointRegisterStackIndex(Register reg) { | 641 static int SafepointRegisterStackIndex(Register reg) { |
647 return SafepointRegisterStackIndex(reg.code()); | 642 return SafepointRegisterStackIndex(reg.code()); |
648 } | 643 } |
649 | 644 |
| 645 // Activation support. |
| 646 void EnterFrame(StackFrame::Type type); |
| 647 void LeaveFrame(StackFrame::Type type); |
| 648 |
650 private: | 649 private: |
651 bool generating_stub_; | 650 bool generating_stub_; |
652 bool allow_stub_calls_; | 651 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 | |
671 void EnterExitFramePrologue(); | 667 void EnterExitFramePrologue(); |
672 void EnterExitFrameEpilogue(int argc, bool save_doubles); | 668 void EnterExitFrameEpilogue(int argc, bool save_doubles); |
673 | 669 |
674 void LeaveExitFrameEpilogue(); | 670 void LeaveExitFrameEpilogue(); |
675 | 671 |
676 // Allocation support helpers. | 672 // Allocation support helpers. |
677 void LoadAllocationTopHelper(Register result, | 673 void LoadAllocationTopHelper(Register result, |
678 Register scratch, | 674 Register scratch, |
679 AllocationFlags flags); | 675 AllocationFlags flags); |
680 void UpdateAllocationTopHelper(Register result_end, Register scratch); | 676 void UpdateAllocationTopHelper(Register result_end, Register scratch); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 } \ | 763 } \ |
768 masm-> | 764 masm-> |
769 #else | 765 #else |
770 #define ACCESS_MASM(masm) masm-> | 766 #define ACCESS_MASM(masm) masm-> |
771 #endif | 767 #endif |
772 | 768 |
773 | 769 |
774 } } // namespace v8::internal | 770 } } // namespace v8::internal |
775 | 771 |
776 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 772 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
OLD | NEW |