Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: src/mips64/code-stubs-mips64.cc

Issue 1638303005: MIPS64: Eliminate ABI-dependent definitions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/handler-compiler.h" 10 #include "src/ic/handler-compiler.h"
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 1267
1268 // Save callee saved registers on the stack. 1268 // Save callee saved registers on the stack.
1269 __ MultiPush(kCalleeSaved | ra.bit()); 1269 __ MultiPush(kCalleeSaved | ra.bit());
1270 1270
1271 // Save callee-saved FPU registers. 1271 // Save callee-saved FPU registers.
1272 __ MultiPushFPU(kCalleeSavedFPU); 1272 __ MultiPushFPU(kCalleeSavedFPU);
1273 // Set up the reserved register for 0.0. 1273 // Set up the reserved register for 0.0.
1274 __ Move(kDoubleRegZero, 0.0); 1274 __ Move(kDoubleRegZero, 0.0);
1275 1275
1276 // Load argv in s0 register. 1276 // Load argv in s0 register.
1277 if (kMipsAbi == kN64) { 1277 __ mov(s0, a4); // 5th parameter in mips64 a4 (a4) register.
1278 __ mov(s0, a4); // 5th parameter in mips64 a4 (a4) register.
1279 } else { // Abi O32.
1280 // 5th parameter on stack for O32 abi.
1281 int offset_to_argv = (kNumCalleeSaved + 1) * kPointerSize;
1282 offset_to_argv += kNumCalleeSavedFPU * kDoubleSize;
1283 __ ld(s0, MemOperand(sp, offset_to_argv + kCArgsSlotsSize));
1284 }
1285 1278
1286 __ InitializeRootRegister(); 1279 __ InitializeRootRegister();
1287 1280
1288 // We build an EntryFrame. 1281 // We build an EntryFrame.
1289 __ li(a7, Operand(-1)); // Push a bad frame pointer to fail if it is used. 1282 __ li(a7, Operand(-1)); // Push a bad frame pointer to fail if it is used.
1290 int marker = type(); 1283 int marker = type();
1291 __ li(a6, Operand(Smi::FromInt(marker))); 1284 __ li(a6, Operand(Smi::FromInt(marker)));
1292 __ li(a5, Operand(Smi::FromInt(marker))); 1285 __ li(a5, Operand(Smi::FromInt(marker)));
1293 ExternalReference c_entry_fp(Isolate::kCEntryFPAddress, isolate); 1286 ExternalReference c_entry_fp(Isolate::kCEntryFPAddress, isolate);
1294 __ li(a4, Operand(c_entry_fp)); 1287 __ li(a4, Operand(c_entry_fp));
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
2203 // a3: encoding of subject string (1 if one_byte, 0 if two_byte); 2196 // a3: encoding of subject string (1 if one_byte, 0 if two_byte);
2204 // t9: code 2197 // t9: code
2205 // subject: Subject string 2198 // subject: Subject string
2206 // regexp_data: RegExp data (FixedArray) 2199 // regexp_data: RegExp data (FixedArray)
2207 // All checks done. Now push arguments for native regexp code. 2200 // All checks done. Now push arguments for native regexp code.
2208 __ IncrementCounter(isolate()->counters()->regexp_entry_native(), 2201 __ IncrementCounter(isolate()->counters()->regexp_entry_native(),
2209 1, a0, a2); 2202 1, a0, a2);
2210 2203
2211 // Isolates: note we add an additional parameter here (isolate pointer). 2204 // Isolates: note we add an additional parameter here (isolate pointer).
2212 const int kRegExpExecuteArguments = 9; 2205 const int kRegExpExecuteArguments = 9;
2213 const int kParameterRegisters = (kMipsAbi == kN64) ? 8 : 4; 2206 const int kParameterRegisters = 8;
2214 __ EnterExitFrame(false, kRegExpExecuteArguments - kParameterRegisters); 2207 __ EnterExitFrame(false, kRegExpExecuteArguments - kParameterRegisters);
2215 2208
2216 // Stack pointer now points to cell where return address is to be written. 2209 // Stack pointer now points to cell where return address is to be written.
2217 // Arguments are before that on the stack or in registers, meaning we 2210 // Arguments are before that on the stack or in registers, meaning we
2218 // treat the return address as argument 5. Thus every argument after that 2211 // treat the return address as argument 5. Thus every argument after that
2219 // needs to be shifted back by 1. Since DirectCEntryStub will handle 2212 // needs to be shifted back by 1. Since DirectCEntryStub will handle
2220 // allocating space for the c argument slots, we don't need to calculate 2213 // allocating space for the c argument slots, we don't need to calculate
2221 // that into the argument positions on the stack. This is how the stack will 2214 // that into the argument positions on the stack. This is how the stack will
2222 // look (sp meaning the value of sp at this moment): 2215 // look (sp meaning the value of sp at this moment):
2223 // Abi n64: 2216 // Abi n64:
2224 // [sp + 1] - Argument 9 2217 // [sp + 1] - Argument 9
2225 // [sp + 0] - saved ra 2218 // [sp + 0] - saved ra
2226 // Abi O32: 2219 // Abi O32:
2227 // [sp + 5] - Argument 9 2220 // [sp + 5] - Argument 9
2228 // [sp + 4] - Argument 8 2221 // [sp + 4] - Argument 8
2229 // [sp + 3] - Argument 7 2222 // [sp + 3] - Argument 7
2230 // [sp + 2] - Argument 6 2223 // [sp + 2] - Argument 6
2231 // [sp + 1] - Argument 5 2224 // [sp + 1] - Argument 5
2232 // [sp + 0] - saved ra 2225 // [sp + 0] - saved ra
2233 2226
2234 if (kMipsAbi == kN64) { 2227 // Argument 9: Pass current isolate address.
2235 // Argument 9: Pass current isolate address. 2228 __ li(a0, Operand(ExternalReference::isolate_address(isolate())));
2236 __ li(a0, Operand(ExternalReference::isolate_address(isolate()))); 2229 __ sd(a0, MemOperand(sp, 1 * kPointerSize));
2237 __ sd(a0, MemOperand(sp, 1 * kPointerSize));
2238 2230
2239 // Argument 8: Indicate that this is a direct call from JavaScript. 2231 // Argument 8: Indicate that this is a direct call from JavaScript.
2240 __ li(a7, Operand(1)); 2232 __ li(a7, Operand(1));
2241 2233
2242 // Argument 7: Start (high end) of backtracking stack memory area. 2234 // Argument 7: Start (high end) of backtracking stack memory area.
2243 __ li(a0, Operand(address_of_regexp_stack_memory_address)); 2235 __ li(a0, Operand(address_of_regexp_stack_memory_address));
2244 __ ld(a0, MemOperand(a0, 0)); 2236 __ ld(a0, MemOperand(a0, 0));
2245 __ li(a2, Operand(address_of_regexp_stack_memory_size)); 2237 __ li(a2, Operand(address_of_regexp_stack_memory_size));
2246 __ ld(a2, MemOperand(a2, 0)); 2238 __ ld(a2, MemOperand(a2, 0));
2247 __ daddu(a6, a0, a2); 2239 __ daddu(a6, a0, a2);
2248 2240
2249 // Argument 6: Set the number of capture registers to zero to force global 2241 // Argument 6: Set the number of capture registers to zero to force global
2250 // regexps to behave as non-global. This does not affect non-global regexps. 2242 // regexps to behave as non-global. This does not affect non-global regexps.
2251 __ mov(a5, zero_reg); 2243 __ mov(a5, zero_reg);
2252 2244
2253 // Argument 5: static offsets vector buffer. 2245 // Argument 5: static offsets vector buffer.
2254 __ li(a4, Operand( 2246 __ li(
2255 ExternalReference::address_of_static_offsets_vector(isolate()))); 2247 a4,
2256 } else { // O32. 2248 Operand(ExternalReference::address_of_static_offsets_vector(isolate())));
2257 DCHECK(kMipsAbi == kO32);
2258
2259 // Argument 9: Pass current isolate address.
2260 // CFunctionArgumentOperand handles MIPS stack argument slots.
2261 __ li(a0, Operand(ExternalReference::isolate_address(isolate())));
2262 __ sd(a0, MemOperand(sp, 5 * kPointerSize));
2263
2264 // Argument 8: Indicate that this is a direct call from JavaScript.
2265 __ li(a0, Operand(1));
2266 __ sd(a0, MemOperand(sp, 4 * kPointerSize));
2267
2268 // Argument 7: Start (high end) of backtracking stack memory area.
2269 __ li(a0, Operand(address_of_regexp_stack_memory_address));
2270 __ ld(a0, MemOperand(a0, 0));
2271 __ li(a2, Operand(address_of_regexp_stack_memory_size));
2272 __ ld(a2, MemOperand(a2, 0));
2273 __ daddu(a0, a0, a2);
2274 __ sd(a0, MemOperand(sp, 3 * kPointerSize));
2275
2276 // Argument 6: Set the number of capture registers to zero to force global
2277 // regexps to behave as non-global. This does not affect non-global regexps.
2278 __ mov(a0, zero_reg);
2279 __ sd(a0, MemOperand(sp, 2 * kPointerSize));
2280
2281 // Argument 5: static offsets vector buffer.
2282 __ li(a0, Operand(
2283 ExternalReference::address_of_static_offsets_vector(isolate())));
2284 __ sd(a0, MemOperand(sp, 1 * kPointerSize));
2285 }
2286 2249
2287 // For arguments 4 and 3 get string length, calculate start of string data 2250 // For arguments 4 and 3 get string length, calculate start of string data
2288 // and calculate the shift of the index (0 for one_byte and 1 for two byte). 2251 // and calculate the shift of the index (0 for one_byte and 1 for two byte).
2289 __ Daddu(t2, subject, Operand(SeqString::kHeaderSize - kHeapObjectTag)); 2252 __ Daddu(t2, subject, Operand(SeqString::kHeaderSize - kHeapObjectTag));
2290 __ Xor(a3, a3, Operand(1)); // 1 for 2-byte str, 0 for 1-byte. 2253 __ Xor(a3, a3, Operand(1)); // 1 for 2-byte str, 0 for 1-byte.
2291 // Load the length from the original subject string from the previous stack 2254 // Load the length from the original subject string from the previous stack
2292 // frame. Therefore we have to use fp, which points exactly to two pointer 2255 // frame. Therefore we have to use fp, which points exactly to two pointer
2293 // sizes below the previous sp. (Because creating a new stack frame pushes 2256 // sizes below the previous sp. (Because creating a new stack frame pushes
2294 // the previous fp onto the stack and moves up sp by 2 * kPointerSize.) 2257 // the previous fp onto the stack and moves up sp by 2 * kPointerSize.)
2295 __ ld(subject, MemOperand(fp, kSubjectOffset + 2 * kPointerSize)); 2258 __ ld(subject, MemOperand(fp, kSubjectOffset + 2 * kPointerSize));
(...skipping 3382 matching lines...) Expand 10 before | Expand all | Expand 10 after
5678 return_value_operand, NULL); 5641 return_value_operand, NULL);
5679 } 5642 }
5680 5643
5681 5644
5682 #undef __ 5645 #undef __
5683 5646
5684 } // namespace internal 5647 } // namespace internal
5685 } // namespace v8 5648 } // namespace v8
5686 5649
5687 #endif // V8_TARGET_ARCH_MIPS64 5650 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « no previous file | src/mips64/constants-mips64.h » ('j') | src/regexp/mips64/regexp-macro-assembler-mips64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698