OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 18 matching lines...) Loading... |
29 #define V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 29 #define V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
30 | 30 |
31 #include "assembler.h" | 31 #include "assembler.h" |
32 #include "mips/assembler-mips.h" | 32 #include "mips/assembler-mips.h" |
33 | 33 |
34 namespace v8 { | 34 namespace v8 { |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 // Forward declaration. | 37 // Forward declaration. |
38 class JumpTarget; | 38 class JumpTarget; |
39 class PostCallGenerator; | |
40 | 39 |
41 // Reserved Register Usage Summary. | 40 // Reserved Register Usage Summary. |
42 // | 41 // |
43 // Registers t8, t9, and at are reserved for use by the MacroAssembler. | 42 // Registers t8, t9, and at are reserved for use by the MacroAssembler. |
44 // | 43 // |
45 // The programmer should know that the MacroAssembler may clobber these three, | 44 // The programmer should know that the MacroAssembler may clobber these three, |
46 // but won't touch other registers except in special cases. | 45 // but won't touch other registers except in special cases. |
47 // | 46 // |
48 // Per the MIPS ABI, register t9 must be used for indirect function call | 47 // Per the MIPS ABI, register t9 must be used for indirect function call |
49 // via 'jalr t9' or 'jr t9' instructions. This is relied upon by gcc when | 48 // via 'jalr t9' or 'jr t9' instructions. This is relied upon by gcc when |
(...skipping 531 matching lines...) Loading... |
581 Register scratch); | 580 Register scratch); |
582 | 581 |
583 // ------------------------------------------------------------------------- | 582 // ------------------------------------------------------------------------- |
584 // JavaScript invokes | 583 // JavaScript invokes |
585 | 584 |
586 // Invoke the JavaScript function code by either calling or jumping. | 585 // Invoke the JavaScript function code by either calling or jumping. |
587 void InvokeCode(Register code, | 586 void InvokeCode(Register code, |
588 const ParameterCount& expected, | 587 const ParameterCount& expected, |
589 const ParameterCount& actual, | 588 const ParameterCount& actual, |
590 InvokeFlag flag, | 589 InvokeFlag flag, |
591 PostCallGenerator* post_call_generator = NULL); | 590 CallWrapper* call_wrapper = NULL); |
592 | 591 |
593 void InvokeCode(Handle<Code> code, | 592 void InvokeCode(Handle<Code> code, |
594 const ParameterCount& expected, | 593 const ParameterCount& expected, |
595 const ParameterCount& actual, | 594 const ParameterCount& actual, |
596 RelocInfo::Mode rmode, | 595 RelocInfo::Mode rmode, |
597 InvokeFlag flag); | 596 InvokeFlag flag); |
598 | 597 |
599 // Invoke the JavaScript function in the given register. Changes the | 598 // Invoke the JavaScript function in the given register. Changes the |
600 // current context to the context in the function before invoking. | 599 // current context to the context in the function before invoking. |
601 void InvokeFunction(Register function, | 600 void InvokeFunction(Register function, |
602 const ParameterCount& actual, | 601 const ParameterCount& actual, |
603 InvokeFlag flag, | 602 InvokeFlag flag, |
604 PostCallGenerator* post_call_generator = NULL); | 603 CallWrapper* call_wrapper = NULL); |
605 | 604 |
606 void InvokeFunction(JSFunction* function, | 605 void InvokeFunction(JSFunction* function, |
607 const ParameterCount& actual, | 606 const ParameterCount& actual, |
608 InvokeFlag flag); | 607 InvokeFlag flag); |
609 | 608 |
610 | 609 |
611 void IsObjectJSObjectType(Register heap_object, | 610 void IsObjectJSObjectType(Register heap_object, |
612 Register map, | 611 Register map, |
613 Register scratch, | 612 Register scratch, |
614 Label* fail); | 613 Label* fail); |
(...skipping 149 matching lines...) Loading... |
764 void CallCFunction(ExternalReference function, int num_arguments); | 763 void CallCFunction(ExternalReference function, int num_arguments); |
765 void CallCFunction(Register function, Register scratch, int num_arguments); | 764 void CallCFunction(Register function, Register scratch, int num_arguments); |
766 | 765 |
767 // Jump to the builtin routine. | 766 // Jump to the builtin routine. |
768 void JumpToExternalReference(const ExternalReference& builtin); | 767 void JumpToExternalReference(const ExternalReference& builtin); |
769 | 768 |
770 // Invoke specified builtin JavaScript function. Adds an entry to | 769 // Invoke specified builtin JavaScript function. Adds an entry to |
771 // the unresolved list if the name does not resolve. | 770 // the unresolved list if the name does not resolve. |
772 void InvokeBuiltin(Builtins::JavaScript id, | 771 void InvokeBuiltin(Builtins::JavaScript id, |
773 InvokeFlag flag, | 772 InvokeFlag flag, |
774 PostCallGenerator* post_call_generator = NULL); | 773 CallWrapper* call_wrapper = NULL); |
775 | 774 |
776 // Store the code object for the given builtin in the target register and | 775 // Store the code object for the given builtin in the target register and |
777 // setup the function in a1. | 776 // setup the function in a1. |
778 void GetBuiltinEntry(Register target, Builtins::JavaScript id); | 777 void GetBuiltinEntry(Register target, Builtins::JavaScript id); |
779 | 778 |
780 // Store the function for the given builtin in the target register. | 779 // Store the function for the given builtin in the target register. |
781 void GetBuiltinFunction(Register target, Builtins::JavaScript id); | 780 void GetBuiltinFunction(Register target, Builtins::JavaScript id); |
782 | 781 |
783 struct Unresolved { | 782 struct Unresolved { |
784 int pc; | 783 int pc; |
(...skipping 162 matching lines...) Loading... |
947 Register r1 = zero_reg, const Operand& r2 = Operand(zero_reg), | 946 Register r1 = zero_reg, const Operand& r2 = Operand(zero_reg), |
948 BranchDelaySlot bd = PROTECT); | 947 BranchDelaySlot bd = PROTECT); |
949 | 948 |
950 // Helper functions for generating invokes. | 949 // Helper functions for generating invokes. |
951 void InvokePrologue(const ParameterCount& expected, | 950 void InvokePrologue(const ParameterCount& expected, |
952 const ParameterCount& actual, | 951 const ParameterCount& actual, |
953 Handle<Code> code_constant, | 952 Handle<Code> code_constant, |
954 Register code_reg, | 953 Register code_reg, |
955 Label* done, | 954 Label* done, |
956 InvokeFlag flag, | 955 InvokeFlag flag, |
957 PostCallGenerator* post_call_generator = NULL); | 956 CallWrapper* call_wrapper = NULL); |
958 | 957 |
959 // Get the code for the given builtin. Returns if able to resolve | 958 // Get the code for the given builtin. Returns if able to resolve |
960 // the function in the 'resolved' flag. | 959 // the function in the 'resolved' flag. |
961 Handle<Code> ResolveBuiltin(Builtins::JavaScript id, bool* resolved); | 960 Handle<Code> ResolveBuiltin(Builtins::JavaScript id, bool* resolved); |
962 | 961 |
963 // Activation support. | 962 // Activation support. |
964 void EnterFrame(StackFrame::Type type); | 963 void EnterFrame(StackFrame::Type type); |
965 void LeaveFrame(StackFrame::Type type); | 964 void LeaveFrame(StackFrame::Type type); |
966 | 965 |
967 void InitializeNewString(Register string, | 966 void InitializeNewString(Register string, |
(...skipping 32 matching lines...) Loading... |
1000 | 999 |
1001 private: | 1000 private: |
1002 byte* address_; // The address of the code being patched. | 1001 byte* address_; // The address of the code being patched. |
1003 int instructions_; // Number of instructions of the expected patch size. | 1002 int instructions_; // Number of instructions of the expected patch size. |
1004 int size_; // Number of bytes of the expected patch size. | 1003 int size_; // Number of bytes of the expected patch size. |
1005 MacroAssembler masm_; // Macro assembler used to generate the code. | 1004 MacroAssembler masm_; // Macro assembler used to generate the code. |
1006 }; | 1005 }; |
1007 #endif // ENABLE_DEBUGGER_SUPPORT | 1006 #endif // ENABLE_DEBUGGER_SUPPORT |
1008 | 1007 |
1009 | 1008 |
1010 // Helper class for generating code or data associated with the code | |
1011 // right after a call instruction. As an example this can be used to | |
1012 // generate safepoint data after calls for crankshaft. | |
1013 class PostCallGenerator { | |
1014 public: | |
1015 PostCallGenerator() { } | |
1016 virtual ~PostCallGenerator() { } | |
1017 virtual void Generate() = 0; | |
1018 }; | |
1019 | |
1020 | |
1021 // ----------------------------------------------------------------------------- | 1009 // ----------------------------------------------------------------------------- |
1022 // Static helper functions. | 1010 // Static helper functions. |
1023 | 1011 |
1024 static MemOperand ContextOperand(Register context, int index) { | 1012 static MemOperand ContextOperand(Register context, int index) { |
1025 return MemOperand(context, Context::SlotOffset(index)); | 1013 return MemOperand(context, Context::SlotOffset(index)); |
1026 } | 1014 } |
1027 | 1015 |
1028 | 1016 |
1029 static inline MemOperand GlobalObjectOperand() { | 1017 static inline MemOperand GlobalObjectOperand() { |
1030 return ContextOperand(cp, Context::GLOBAL_INDEX); | 1018 return ContextOperand(cp, Context::GLOBAL_INDEX); |
(...skipping 13 matching lines...) Loading... |
1044 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 1032 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
1045 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 1033 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
1046 #else | 1034 #else |
1047 #define ACCESS_MASM(masm) masm-> | 1035 #define ACCESS_MASM(masm) masm-> |
1048 #endif | 1036 #endif |
1049 | 1037 |
1050 } } // namespace v8::internal | 1038 } } // namespace v8::internal |
1051 | 1039 |
1052 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ | 1040 #endif // V8_MIPS_MACRO_ASSEMBLER_MIPS_H_ |
1053 | 1041 |
OLD | NEW |