| 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 15 matching lines...) Expand all Loading... |
| 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 | 28 |
| 29 | 29 |
| 30 #include "v8.h" | 30 #include "v8.h" |
| 31 | 31 |
| 32 #if defined(V8_TARGET_ARCH_MIPS) | 32 #if defined(V8_TARGET_ARCH_MIPS) |
| 33 | 33 |
| 34 #include "codegen-inl.h" | 34 #include "codegen-inl.h" |
| 35 #include "debug.h" | 35 #include "debug.h" |
| 36 #include "deoptimizer.h" |
| 37 #include "full-codegen.h" |
| 36 #include "runtime.h" | 38 #include "runtime.h" |
| 37 | 39 |
| 38 namespace v8 { | 40 namespace v8 { |
| 39 namespace internal { | 41 namespace internal { |
| 40 | 42 |
| 41 | 43 |
| 42 #define __ ACCESS_MASM(masm) | 44 #define __ ACCESS_MASM(masm) |
| 43 | 45 |
| 44 | 46 |
| 45 void Builtins::Generate_Adaptor(MacroAssembler* masm, | 47 void Builtins::Generate_Adaptor(MacroAssembler* masm, |
| 46 CFunctionId id, | 48 CFunctionId id, |
| 47 BuiltinExtraArguments extra_args) { | 49 BuiltinExtraArguments extra_args) { |
| 48 UNIMPLEMENTED_MIPS(); | 50 UNIMPLEMENTED_MIPS(); |
| 49 } | 51 } |
| 50 | 52 |
| 51 | 53 |
| 52 void Builtins::Generate_ArrayCode(MacroAssembler* masm) { | 54 void Builtins::Generate_ArrayCode(MacroAssembler* masm) { |
| 53 UNIMPLEMENTED_MIPS(); | 55 UNIMPLEMENTED_MIPS(); |
| 54 } | 56 } |
| 55 | 57 |
| 56 | 58 |
| 57 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { | 59 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { |
| 58 UNIMPLEMENTED_MIPS(); | 60 UNIMPLEMENTED_MIPS(); |
| 59 } | 61 } |
| 60 | 62 |
| 61 | 63 |
| 64 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { |
| 65 UNIMPLEMENTED_MIPS(); |
| 66 } |
| 67 |
| 68 |
| 62 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { | 69 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { |
| 63 UNIMPLEMENTED_MIPS(); | 70 UNIMPLEMENTED_MIPS(); |
| 64 } | 71 } |
| 65 | 72 |
| 66 | 73 |
| 74 void Builtins::Generate_JSConstructStubCountdown(MacroAssembler* masm) { |
| 75 UNIMPLEMENTED_MIPS(); |
| 76 } |
| 77 |
| 78 |
| 67 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 79 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
| 68 UNIMPLEMENTED_MIPS(); | 80 UNIMPLEMENTED_MIPS(); |
| 69 } | 81 } |
| 70 | 82 |
| 71 | 83 |
| 72 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 84 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
| 73 UNIMPLEMENTED_MIPS(); | 85 UNIMPLEMENTED_MIPS(); |
| 74 } | 86 } |
| 75 | 87 |
| 76 | 88 |
| 77 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | |
| 78 bool is_construct) { | |
| 79 // Called from JSEntryStub::GenerateBody | |
| 80 | |
| 81 // Registers: | |
| 82 // a0: entry_address | |
| 83 // a1: function | |
| 84 // a2: reveiver_pointer | |
| 85 // a3: argc | |
| 86 // s0: argv | |
| 87 // | |
| 88 // Stack: | |
| 89 // arguments slots | |
| 90 // handler frame | |
| 91 // entry frame | |
| 92 // callee saved registers + ra | |
| 93 // 4 args slots | |
| 94 // args | |
| 95 | |
| 96 // Clear the context before we push it when entering the JS frame. | |
| 97 __ li(cp, Operand(0, RelocInfo::NONE)); | |
| 98 | |
| 99 // Enter an internal frame. | |
| 100 __ EnterInternalFrame(); | |
| 101 | |
| 102 // Set up the context from the function argument. | |
| 103 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | |
| 104 | |
| 105 // Set up the roots register. | |
| 106 ExternalReference roots_address = ExternalReference::roots_address(); | |
| 107 __ li(s6, Operand(roots_address)); | |
| 108 | |
| 109 // Push the function and the receiver onto the stack. | |
| 110 __ MultiPushReversed(a1.bit() | a2.bit()); | |
| 111 | |
| 112 // Copy arguments to the stack in a loop. | |
| 113 // a3: argc | |
| 114 // s0: argv, ie points to first arg | |
| 115 Label loop, entry; | |
| 116 __ sll(t0, a3, kPointerSizeLog2); | |
| 117 __ add(t2, s0, t0); | |
| 118 __ b(&entry); | |
| 119 __ nop(); // Branch delay slot nop. | |
| 120 // t2 points past last arg. | |
| 121 __ bind(&loop); | |
| 122 __ lw(t0, MemOperand(s0)); // Read next parameter. | |
| 123 __ addiu(s0, s0, kPointerSize); | |
| 124 __ lw(t0, MemOperand(t0)); // Dereference handle. | |
| 125 __ Push(t0); // Push parameter. | |
| 126 __ bind(&entry); | |
| 127 __ Branch(ne, &loop, s0, Operand(t2)); | |
| 128 | |
| 129 // Registers: | |
| 130 // a0: entry_address | |
| 131 // a1: function | |
| 132 // a2: reveiver_pointer | |
| 133 // a3: argc | |
| 134 // s0: argv | |
| 135 // s6: roots_address | |
| 136 // | |
| 137 // Stack: | |
| 138 // arguments | |
| 139 // receiver | |
| 140 // function | |
| 141 // arguments slots | |
| 142 // handler frame | |
| 143 // entry frame | |
| 144 // callee saved registers + ra | |
| 145 // 4 args slots | |
| 146 // args | |
| 147 | |
| 148 // Initialize all JavaScript callee-saved registers, since they will be seen | |
| 149 // by the garbage collector as part of handlers. | |
| 150 __ LoadRoot(t4, Heap::kUndefinedValueRootIndex); | |
| 151 __ mov(s1, t4); | |
| 152 __ mov(s2, t4); | |
| 153 __ mov(s3, t4); | |
| 154 __ mov(s4, s4); | |
| 155 __ mov(s5, t4); | |
| 156 // s6 holds the root address. Do not clobber. | |
| 157 // s7 is cp. Do not init. | |
| 158 | |
| 159 // Invoke the code and pass argc as a0. | |
| 160 __ mov(a0, a3); | |
| 161 if (is_construct) { | |
| 162 UNIMPLEMENTED_MIPS(); | |
| 163 __ break_(0x164); | |
| 164 } else { | |
| 165 ParameterCount actual(a0); | |
| 166 __ InvokeFunction(a1, actual, CALL_FUNCTION); | |
| 167 } | |
| 168 | |
| 169 __ LeaveInternalFrame(); | |
| 170 | |
| 171 __ Jump(ra); | |
| 172 } | |
| 173 | |
| 174 | |
| 175 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { | 89 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { |
| 176 Generate_JSEntryTrampolineHelper(masm, false); | 90 UNIMPLEMENTED_MIPS(); |
| 177 } | 91 } |
| 178 | 92 |
| 179 | 93 |
| 180 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 94 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
| 181 Generate_JSEntryTrampolineHelper(masm, true); | 95 UNIMPLEMENTED_MIPS(); |
| 182 } | 96 } |
| 183 | 97 |
| 184 | 98 |
| 99 void Builtins::Generate_LazyCompile(MacroAssembler* masm) { |
| 100 UNIMPLEMENTED_MIPS(); |
| 101 } |
| 102 |
| 103 |
| 104 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { |
| 105 UNIMPLEMENTED_MIPS(); |
| 106 } |
| 107 |
| 108 |
| 109 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { |
| 110 UNIMPLEMENTED_MIPS(); |
| 111 } |
| 112 |
| 113 |
| 114 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { |
| 115 UNIMPLEMENTED_MIPS(); |
| 116 } |
| 117 |
| 118 |
| 119 void Builtins::Generate_NotifyOSR(MacroAssembler* masm) { |
| 120 UNIMPLEMENTED_MIPS(); |
| 121 } |
| 122 |
| 123 |
| 124 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 125 UNIMPLEMENTED_MIPS(); |
| 126 } |
| 127 |
| 128 |
| 185 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { | 129 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
| 186 UNIMPLEMENTED_MIPS(); | 130 UNIMPLEMENTED_MIPS(); |
| 187 } | 131 } |
| 188 | 132 |
| 189 | 133 |
| 190 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 134 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
| 191 UNIMPLEMENTED_MIPS(); | 135 UNIMPLEMENTED_MIPS(); |
| 192 } | 136 } |
| 193 | 137 |
| 194 | 138 |
| 195 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 139 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
| 196 UNIMPLEMENTED_MIPS(); | 140 UNIMPLEMENTED_MIPS(); |
| 197 __ break_(0x201); | |
| 198 } | 141 } |
| 199 | 142 |
| 200 | 143 |
| 201 #undef __ | 144 #undef __ |
| 202 | 145 |
| 203 } } // namespace v8::internal | 146 } } // namespace v8::internal |
| 204 | 147 |
| 205 #endif // V8_TARGET_ARCH_MIPS | 148 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |