OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 | 673 |
674 // Calculate the number of stack slots to reserve for arguments when calling a | 674 // Calculate the number of stack slots to reserve for arguments when calling a |
675 // C function. | 675 // C function. |
676 int ArgumentStackSlotsForCFunctionCall(int num_arguments); | 676 int ArgumentStackSlotsForCFunctionCall(int num_arguments); |
677 | 677 |
678 // --------------------------------------------------------------------------- | 678 // --------------------------------------------------------------------------- |
679 // Utilities | 679 // Utilities |
680 | 680 |
681 void Ret(); | 681 void Ret(); |
682 | 682 |
683 struct Unresolved { | |
684 int pc; | |
685 uint32_t flags; // see Bootstrapper::FixupFlags decoders/encoders. | |
686 const char* name; | |
687 }; | |
688 List<Unresolved>* unresolved() { return &unresolved_; } | |
689 | |
690 Handle<Object> CodeObject() { return code_object_; } | 683 Handle<Object> CodeObject() { return code_object_; } |
691 | 684 |
692 | 685 |
693 // --------------------------------------------------------------------------- | 686 // --------------------------------------------------------------------------- |
694 // StatsCounter support | 687 // StatsCounter support |
695 | 688 |
696 void SetCounter(StatsCounter* counter, int value); | 689 void SetCounter(StatsCounter* counter, int value); |
697 void IncrementCounter(StatsCounter* counter, int value); | 690 void IncrementCounter(StatsCounter* counter, int value); |
698 void DecrementCounter(StatsCounter* counter, int value); | 691 void DecrementCounter(StatsCounter* counter, int value); |
699 | 692 |
(...skipping 11 matching lines...) Expand all Loading... |
711 // Print a message to stdout and abort execution. | 704 // Print a message to stdout and abort execution. |
712 void Abort(const char* msg); | 705 void Abort(const char* msg); |
713 | 706 |
714 // Verify restrictions about code generated in stubs. | 707 // Verify restrictions about code generated in stubs. |
715 void set_generating_stub(bool value) { generating_stub_ = value; } | 708 void set_generating_stub(bool value) { generating_stub_ = value; } |
716 bool generating_stub() { return generating_stub_; } | 709 bool generating_stub() { return generating_stub_; } |
717 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } | 710 void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; } |
718 bool allow_stub_calls() { return allow_stub_calls_; } | 711 bool allow_stub_calls() { return allow_stub_calls_; } |
719 | 712 |
720 private: | 713 private: |
721 List<Unresolved> unresolved_; | |
722 bool generating_stub_; | 714 bool generating_stub_; |
723 bool allow_stub_calls_; | 715 bool allow_stub_calls_; |
724 // This handle will be patched with the code object on installation. | 716 // This handle will be patched with the code object on installation. |
725 Handle<Object> code_object_; | 717 Handle<Object> code_object_; |
726 | 718 |
727 // Helper functions for generating invokes. | 719 // Helper functions for generating invokes. |
728 void InvokePrologue(const ParameterCount& expected, | 720 void InvokePrologue(const ParameterCount& expected, |
729 const ParameterCount& actual, | 721 const ParameterCount& actual, |
730 Handle<Code> code_constant, | 722 Handle<Code> code_constant, |
731 Register code_register, | 723 Register code_register, |
732 Label* done, | 724 Label* done, |
733 InvokeFlag flag); | 725 InvokeFlag flag); |
734 | 726 |
735 // Prepares for a call or jump to a builtin by doing two things: | |
736 // 1. Emits code that fetches the builtin's function object from the context | |
737 // at runtime, and puts it in the register rdi. | |
738 // 2. Fetches the builtin's code object, and returns it in a handle, at | |
739 // compile time, so that later code can emit instructions to jump or call | |
740 // the builtin directly. If the code object has not yet been created, it | |
741 // returns the builtin code object for IllegalFunction, and sets the | |
742 // output parameter "resolved" to false. Code that uses the return value | |
743 // should then add the address and the builtin name to the list of fixups | |
744 // called unresolved_, which is fixed up by the bootstrapper. | |
745 Handle<Code> ResolveBuiltin(Builtins::JavaScript id, bool* resolved); | |
746 | |
747 // Activation support. | 727 // Activation support. |
748 void EnterFrame(StackFrame::Type type); | 728 void EnterFrame(StackFrame::Type type); |
749 void LeaveFrame(StackFrame::Type type); | 729 void LeaveFrame(StackFrame::Type type); |
750 | 730 |
751 // Allocation support helpers. | 731 // Allocation support helpers. |
752 void LoadAllocationTopHelper(Register result, | 732 void LoadAllocationTopHelper(Register result, |
753 Register result_end, | 733 Register result_end, |
754 Register scratch, | 734 Register scratch, |
755 AllocationFlags flags); | 735 AllocationFlags flags); |
756 void UpdateAllocationTopHelper(Register result_end, Register scratch); | 736 void UpdateAllocationTopHelper(Register result_end, Register scratch); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 } \ | 793 } \ |
814 masm-> | 794 masm-> |
815 #else | 795 #else |
816 #define ACCESS_MASM(masm) masm-> | 796 #define ACCESS_MASM(masm) masm-> |
817 #endif | 797 #endif |
818 | 798 |
819 | 799 |
820 } } // namespace v8::internal | 800 } } // namespace v8::internal |
821 | 801 |
822 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 802 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |