| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 TAG_OBJECT = 1 << 0, | 42 TAG_OBJECT = 1 << 0, |
| 43 // The content of the result register already contains the allocation top in | 43 // The content of the result register already contains the allocation top in |
| 44 // new space. | 44 // new space. |
| 45 RESULT_CONTAINS_TOP = 1 << 1 | 45 RESULT_CONTAINS_TOP = 1 << 1 |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // Convenience for platform-independent signatures. We do not normally | 48 // Convenience for platform-independent signatures. We do not normally |
| 49 // distinguish memory operands from other operands on ia32. | 49 // distinguish memory operands from other operands on ia32. |
| 50 typedef Operand MemOperand; | 50 typedef Operand MemOperand; |
| 51 | 51 |
| 52 // Forward declaration. | |
| 53 class PostCallGenerator; | |
| 54 | |
| 55 // MacroAssembler implements a collection of frequently used macros. | 52 // MacroAssembler implements a collection of frequently used macros. |
| 56 class MacroAssembler: public Assembler { | 53 class MacroAssembler: public Assembler { |
| 57 public: | 54 public: |
| 58 // The isolate parameter can be NULL if the macro assembler should | 55 // The isolate parameter can be NULL if the macro assembler should |
| 59 // not use isolate-dependent functionality. In this case, it's the | 56 // not use isolate-dependent functionality. In this case, it's the |
| 60 // responsibility of the caller to never invoke such function on the | 57 // responsibility of the caller to never invoke such function on the |
| 61 // macro assembler. | 58 // macro assembler. |
| 62 MacroAssembler(Isolate* isolate, void* buffer, int size); | 59 MacroAssembler(Isolate* isolate, void* buffer, int size); |
| 63 | 60 |
| 64 // --------------------------------------------------------------------------- | 61 // --------------------------------------------------------------------------- |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void LoadFromSafepointRegisterSlot(Register dst, Register src); | 150 void LoadFromSafepointRegisterSlot(Register dst, Register src); |
| 154 | 151 |
| 155 // --------------------------------------------------------------------------- | 152 // --------------------------------------------------------------------------- |
| 156 // JavaScript invokes | 153 // JavaScript invokes |
| 157 | 154 |
| 158 // Invoke the JavaScript function code by either calling or jumping. | 155 // Invoke the JavaScript function code by either calling or jumping. |
| 159 void InvokeCode(const Operand& code, | 156 void InvokeCode(const Operand& code, |
| 160 const ParameterCount& expected, | 157 const ParameterCount& expected, |
| 161 const ParameterCount& actual, | 158 const ParameterCount& actual, |
| 162 InvokeFlag flag, | 159 InvokeFlag flag, |
| 163 PostCallGenerator* post_call_generator = NULL); | 160 CallWrapper* call_wrapper = NULL); |
| 164 | 161 |
| 165 void InvokeCode(Handle<Code> code, | 162 void InvokeCode(Handle<Code> code, |
| 166 const ParameterCount& expected, | 163 const ParameterCount& expected, |
| 167 const ParameterCount& actual, | 164 const ParameterCount& actual, |
| 168 RelocInfo::Mode rmode, | 165 RelocInfo::Mode rmode, |
| 169 InvokeFlag flag, | 166 InvokeFlag flag, |
| 170 PostCallGenerator* post_call_generator = NULL); | 167 CallWrapper* call_wrapper = NULL); |
| 171 | 168 |
| 172 // Invoke the JavaScript function in the given register. Changes the | 169 // Invoke the JavaScript function in the given register. Changes the |
| 173 // current context to the context in the function before invoking. | 170 // current context to the context in the function before invoking. |
| 174 void InvokeFunction(Register function, | 171 void InvokeFunction(Register function, |
| 175 const ParameterCount& actual, | 172 const ParameterCount& actual, |
| 176 InvokeFlag flag, | 173 InvokeFlag flag, |
| 177 PostCallGenerator* post_call_generator = NULL); | 174 CallWrapper* call_wrapper = NULL); |
| 178 | 175 |
| 179 void InvokeFunction(JSFunction* function, | 176 void InvokeFunction(JSFunction* function, |
| 180 const ParameterCount& actual, | 177 const ParameterCount& actual, |
| 181 InvokeFlag flag, | 178 InvokeFlag flag, |
| 182 PostCallGenerator* post_call_generator = NULL); | 179 CallWrapper* call_wrapper = NULL); |
| 183 | 180 |
| 184 // Invoke specified builtin JavaScript function. Adds an entry to | 181 // Invoke specified builtin JavaScript function. Adds an entry to |
| 185 // the unresolved list if the name does not resolve. | 182 // the unresolved list if the name does not resolve. |
| 186 void InvokeBuiltin(Builtins::JavaScript id, | 183 void InvokeBuiltin(Builtins::JavaScript id, |
| 187 InvokeFlag flag, | 184 InvokeFlag flag, |
| 188 PostCallGenerator* post_call_generator = NULL); | 185 CallWrapper* call_wrapper = NULL); |
| 189 | 186 |
| 190 // Store the function for the given builtin in the target register. | 187 // Store the function for the given builtin in the target register. |
| 191 void GetBuiltinFunction(Register target, Builtins::JavaScript id); | 188 void GetBuiltinFunction(Register target, Builtins::JavaScript id); |
| 192 | 189 |
| 193 // Store the code object for the given builtin in the target register. | 190 // Store the code object for the given builtin in the target register. |
| 194 void GetBuiltinEntry(Register target, Builtins::JavaScript id); | 191 void GetBuiltinEntry(Register target, Builtins::JavaScript id); |
| 195 | 192 |
| 196 // Expression support | 193 // Expression support |
| 197 void Set(Register dst, const Immediate& x); | 194 void Set(Register dst, const Immediate& x); |
| 198 void Set(const Operand& dst, const Immediate& x); | 195 void Set(const Operand& dst, const Immediate& x); |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 // This handle will be patched with the code object on installation. | 642 // This handle will be patched with the code object on installation. |
| 646 Handle<Object> code_object_; | 643 Handle<Object> code_object_; |
| 647 | 644 |
| 648 // Helper functions for generating invokes. | 645 // Helper functions for generating invokes. |
| 649 void InvokePrologue(const ParameterCount& expected, | 646 void InvokePrologue(const ParameterCount& expected, |
| 650 const ParameterCount& actual, | 647 const ParameterCount& actual, |
| 651 Handle<Code> code_constant, | 648 Handle<Code> code_constant, |
| 652 const Operand& code_operand, | 649 const Operand& code_operand, |
| 653 NearLabel* done, | 650 NearLabel* done, |
| 654 InvokeFlag flag, | 651 InvokeFlag flag, |
| 655 PostCallGenerator* post_call_generator = NULL); | 652 CallWrapper* call_wrapper = NULL); |
| 656 | 653 |
| 657 // Activation support. | 654 // Activation support. |
| 658 void EnterFrame(StackFrame::Type type); | 655 void EnterFrame(StackFrame::Type type); |
| 659 void LeaveFrame(StackFrame::Type type); | 656 void LeaveFrame(StackFrame::Type type); |
| 660 | 657 |
| 661 void EnterExitFramePrologue(); | 658 void EnterExitFramePrologue(); |
| 662 void EnterExitFrameEpilogue(int argc, bool save_doubles); | 659 void EnterExitFrameEpilogue(int argc, bool save_doubles); |
| 663 | 660 |
| 664 void LeaveExitFrameEpilogue(); | 661 void LeaveExitFrameEpilogue(); |
| 665 | 662 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 // Macro assembler to emit code. | 724 // Macro assembler to emit code. |
| 728 MacroAssembler* masm() { return &masm_; } | 725 MacroAssembler* masm() { return &masm_; } |
| 729 | 726 |
| 730 private: | 727 private: |
| 731 byte* address_; // The address of the code being patched. | 728 byte* address_; // The address of the code being patched. |
| 732 int size_; // Number of bytes of the expected patch size. | 729 int size_; // Number of bytes of the expected patch size. |
| 733 MacroAssembler masm_; // Macro assembler used to generate the code. | 730 MacroAssembler masm_; // Macro assembler used to generate the code. |
| 734 }; | 731 }; |
| 735 | 732 |
| 736 | 733 |
| 737 // Helper class for generating code or data associated with the code | |
| 738 // right after a call instruction. As an example this can be used to | |
| 739 // generate safepoint data after calls for crankshaft. | |
| 740 class PostCallGenerator { | |
| 741 public: | |
| 742 PostCallGenerator() { } | |
| 743 virtual ~PostCallGenerator() { } | |
| 744 virtual void Generate() = 0; | |
| 745 }; | |
| 746 | |
| 747 | |
| 748 // ----------------------------------------------------------------------------- | 734 // ----------------------------------------------------------------------------- |
| 749 // Static helper functions. | 735 // Static helper functions. |
| 750 | 736 |
| 751 // Generate an Operand for loading a field from an object. | 737 // Generate an Operand for loading a field from an object. |
| 752 static inline Operand FieldOperand(Register object, int offset) { | 738 static inline Operand FieldOperand(Register object, int offset) { |
| 753 return Operand(object, offset - kHeapObjectTag); | 739 return Operand(object, offset - kHeapObjectTag); |
| 754 } | 740 } |
| 755 | 741 |
| 756 | 742 |
| 757 // Generate an Operand for loading an indexed field from an object. | 743 // Generate an Operand for loading an indexed field from an object. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 } \ | 781 } \ |
| 796 masm-> | 782 masm-> |
| 797 #else | 783 #else |
| 798 #define ACCESS_MASM(masm) masm-> | 784 #define ACCESS_MASM(masm) masm-> |
| 799 #endif | 785 #endif |
| 800 | 786 |
| 801 | 787 |
| 802 } } // namespace v8::internal | 788 } } // namespace v8::internal |
| 803 | 789 |
| 804 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ | 790 #endif // V8_IA32_MACRO_ASSEMBLER_IA32_H_ |
| OLD | NEW |