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

Side by Side Diff: src/mips64/codegen-mips64.cc

Issue 1334793004: MIPS64: Add big-endian support for mips64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase ToT. Created 5 years, 2 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
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/mips64/constants-mips64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "src/mips64/codegen-mips64.h" 5 #include "src/mips64/codegen-mips64.h"
6 6
7 #if V8_TARGET_ARCH_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 27 matching lines...) Expand all
38 38
39 { 39 {
40 DoubleRegister input = f12; 40 DoubleRegister input = f12;
41 DoubleRegister result = f0; 41 DoubleRegister result = f0;
42 DoubleRegister double_scratch1 = f4; 42 DoubleRegister double_scratch1 = f4;
43 DoubleRegister double_scratch2 = f6; 43 DoubleRegister double_scratch2 = f6;
44 Register temp1 = a4; 44 Register temp1 = a4;
45 Register temp2 = a5; 45 Register temp2 = a5;
46 Register temp3 = a6; 46 Register temp3 = a6;
47 47
48 if (!IsMipsSoftFloatABI) { 48 __ MovFromFloatParameter(input);
49 // Input value is in f12 anyway, nothing to do.
50 } else {
51 __ Move(input, a0, a1);
52 }
53 __ Push(temp3, temp2, temp1); 49 __ Push(temp3, temp2, temp1);
54 MathExpGenerator::EmitMathExp( 50 MathExpGenerator::EmitMathExp(
55 &masm, input, result, double_scratch1, double_scratch2, 51 &masm, input, result, double_scratch1, double_scratch2,
56 temp1, temp2, temp3); 52 temp1, temp2, temp3);
57 __ Pop(temp3, temp2, temp1); 53 __ Pop(temp3, temp2, temp1);
58 if (!IsMipsSoftFloatABI) { 54 __ MovToFloatResult(result);
59 // Result is already in f0, nothing to do.
60 } else {
61 __ Move(v0, v1, result);
62 }
63 __ Ret(); 55 __ Ret();
64 } 56 }
65 57
66 CodeDesc desc; 58 CodeDesc desc;
67 masm.GetCode(&desc); 59 masm.GetCode(&desc);
68 DCHECK(!RelocInfo::RequiresRelocation(desc)); 60 DCHECK(!RelocInfo::RequiresRelocation(desc));
69 61
70 CpuFeatures::FlushICache(buffer, actual_size); 62 CpuFeatures::FlushICache(buffer, actual_size);
71 base::OS::ProtectCode(buffer, actual_size); 63 base::OS::ProtectCode(buffer, actual_size);
72 64
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // we can start copying at aligned. 126 // we can start copying at aligned.
135 __ xor_(t8, a1, a0); 127 __ xor_(t8, a1, a0);
136 __ andi(t8, t8, loadstore_chunk - 1); // t8 is a0/a1 word-displacement. 128 __ andi(t8, t8, loadstore_chunk - 1); // t8 is a0/a1 word-displacement.
137 __ bne(t8, zero_reg, &unaligned); 129 __ bne(t8, zero_reg, &unaligned);
138 __ subu(a3, zero_reg, a0); // In delay slot. 130 __ subu(a3, zero_reg, a0); // In delay slot.
139 131
140 __ andi(a3, a3, loadstore_chunk - 1); // Copy a3 bytes to align a0/a1. 132 __ andi(a3, a3, loadstore_chunk - 1); // Copy a3 bytes to align a0/a1.
141 __ beq(a3, zero_reg, &aligned); // Already aligned. 133 __ beq(a3, zero_reg, &aligned); // Already aligned.
142 __ subu(a2, a2, a3); // In delay slot. a2 is the remining bytes count. 134 __ subu(a2, a2, a3); // In delay slot. a2 is the remining bytes count.
143 135
144 __ lwr(t8, MemOperand(a1)); 136 if (kArchEndian == kLittle) {
145 __ addu(a1, a1, a3); 137 __ lwr(t8, MemOperand(a1));
146 __ swr(t8, MemOperand(a0)); 138 __ addu(a1, a1, a3);
147 __ addu(a0, a0, a3); 139 __ swr(t8, MemOperand(a0));
140 __ addu(a0, a0, a3);
141 } else {
142 __ lwl(t8, MemOperand(a1));
143 __ addu(a1, a1, a3);
144 __ swl(t8, MemOperand(a0));
145 __ addu(a0, a0, a3);
146 }
148 147
149 // Now dst/src are both aligned to (word) aligned addresses. Set a2 to 148 // Now dst/src are both aligned to (word) aligned addresses. Set a2 to
150 // count how many bytes we have to copy after all the 64 byte chunks are 149 // count how many bytes we have to copy after all the 64 byte chunks are
151 // copied and a3 to the dst pointer after all the 64 byte chunks have been 150 // copied and a3 to the dst pointer after all the 64 byte chunks have been
152 // copied. We will loop, incrementing a0 and a1 until a0 equals a3. 151 // copied. We will loop, incrementing a0 and a1 until a0 equals a3.
153 __ bind(&aligned); 152 __ bind(&aligned);
154 __ andi(t8, a2, 0x3f); 153 __ andi(t8, a2, 0x3f);
155 __ beq(a2, t8, &chkw); // Less than 64? 154 __ beq(a2, t8, &chkw); // Less than 64?
156 __ subu(a3, a2, t8); // In delay slot. 155 __ subu(a3, a2, t8); // In delay slot.
157 __ addu(a3, a0, a3); // Now a3 is the final dst after loop. 156 __ addu(a3, a0, a3); // Now a3 is the final dst after loop.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 __ nop(); 289 __ nop();
291 290
292 // Unaligned case. Only the dst gets aligned so we need to do partial 291 // Unaligned case. Only the dst gets aligned so we need to do partial
293 // loads of the source followed by normal stores to the dst (once we 292 // loads of the source followed by normal stores to the dst (once we
294 // have aligned the destination). 293 // have aligned the destination).
295 __ bind(&unaligned); 294 __ bind(&unaligned);
296 __ andi(a3, a3, loadstore_chunk - 1); // Copy a3 bytes to align a0/a1. 295 __ andi(a3, a3, loadstore_chunk - 1); // Copy a3 bytes to align a0/a1.
297 __ beq(a3, zero_reg, &ua_chk16w); 296 __ beq(a3, zero_reg, &ua_chk16w);
298 __ subu(a2, a2, a3); // In delay slot. 297 __ subu(a2, a2, a3); // In delay slot.
299 298
300 __ lwr(v1, MemOperand(a1)); 299 if (kArchEndian == kLittle) {
301 __ lwl(v1, 300 __ lwr(v1, MemOperand(a1));
302 MemOperand(a1, 1, loadstore_chunk, MemOperand::offset_minus_one)); 301 __ lwl(v1,
303 __ addu(a1, a1, a3); 302 MemOperand(a1, 1, loadstore_chunk, MemOperand::offset_minus_one));
304 __ swr(v1, MemOperand(a0)); 303 __ addu(a1, a1, a3);
305 __ addu(a0, a0, a3); 304 __ swr(v1, MemOperand(a0));
305 __ addu(a0, a0, a3);
306 } else {
307 __ lwl(v1, MemOperand(a1));
308 __ lwr(v1,
309 MemOperand(a1, 1, loadstore_chunk, MemOperand::offset_minus_one));
310 __ addu(a1, a1, a3);
311 __ swl(v1, MemOperand(a0));
312 __ addu(a0, a0, a3);
313 }
306 314
307 // Now the dst (but not the source) is aligned. Set a2 to count how many 315 // Now the dst (but not the source) is aligned. Set a2 to count how many
308 // bytes we have to copy after all the 64 byte chunks are copied and a3 to 316 // bytes we have to copy after all the 64 byte chunks are copied and a3 to
309 // the dst pointer after all the 64 byte chunks have been copied. We will 317 // the dst pointer after all the 64 byte chunks have been copied. We will
310 // loop, incrementing a0 and a1 until a0 equals a3. 318 // loop, incrementing a0 and a1 until a0 equals a3.
311 __ bind(&ua_chk16w); 319 __ bind(&ua_chk16w);
312 __ andi(t8, a2, 0x3f); 320 __ andi(t8, a2, 0x3f);
313 __ beq(a2, t8, &ua_chkw); 321 __ beq(a2, t8, &ua_chkw);
314 __ subu(a3, a2, t8); // In delay slot. 322 __ subu(a3, a2, t8); // In delay slot.
315 __ addu(a3, a0, a3); 323 __ addu(a3, a0, a3);
316 324
317 if (pref_hint_store == kPrefHintPrepareForStore) { 325 if (pref_hint_store == kPrefHintPrepareForStore) {
318 __ addu(a4, a0, a2); 326 __ addu(a4, a0, a2);
319 __ Subu(t9, a4, pref_limit); 327 __ Subu(t9, a4, pref_limit);
320 } 328 }
321 329
322 __ Pref(pref_hint_load, MemOperand(a1, 0 * pref_chunk)); 330 __ Pref(pref_hint_load, MemOperand(a1, 0 * pref_chunk));
323 __ Pref(pref_hint_load, MemOperand(a1, 1 * pref_chunk)); 331 __ Pref(pref_hint_load, MemOperand(a1, 1 * pref_chunk));
324 __ Pref(pref_hint_load, MemOperand(a1, 2 * pref_chunk)); 332 __ Pref(pref_hint_load, MemOperand(a1, 2 * pref_chunk));
325 333
326 if (pref_hint_store != kPrefHintPrepareForStore) { 334 if (pref_hint_store != kPrefHintPrepareForStore) {
327 __ Pref(pref_hint_store, MemOperand(a0, 1 * pref_chunk)); 335 __ Pref(pref_hint_store, MemOperand(a0, 1 * pref_chunk));
328 __ Pref(pref_hint_store, MemOperand(a0, 2 * pref_chunk)); 336 __ Pref(pref_hint_store, MemOperand(a0, 2 * pref_chunk));
329 __ Pref(pref_hint_store, MemOperand(a0, 3 * pref_chunk)); 337 __ Pref(pref_hint_store, MemOperand(a0, 3 * pref_chunk));
330 } 338 }
331 339
332 __ bind(&ua_loop16w); 340 __ bind(&ua_loop16w);
333 __ Pref(pref_hint_load, MemOperand(a1, 3 * pref_chunk)); 341 if (kArchEndian == kLittle) {
334 __ lwr(a4, MemOperand(a1)); 342 __ Pref(pref_hint_load, MemOperand(a1, 3 * pref_chunk));
335 __ lwr(a5, MemOperand(a1, 1, loadstore_chunk)); 343 __ lwr(a4, MemOperand(a1));
336 __ lwr(a6, MemOperand(a1, 2, loadstore_chunk)); 344 __ lwr(a5, MemOperand(a1, 1, loadstore_chunk));
345 __ lwr(a6, MemOperand(a1, 2, loadstore_chunk));
337 346
338 if (pref_hint_store == kPrefHintPrepareForStore) { 347 if (pref_hint_store == kPrefHintPrepareForStore) {
339 __ sltu(v1, t9, a0); 348 __ sltu(v1, t9, a0);
340 __ Branch(USE_DELAY_SLOT, &ua_skip_pref, gt, v1, Operand(zero_reg)); 349 __ Branch(USE_DELAY_SLOT, &ua_skip_pref, gt, v1, Operand(zero_reg));
350 }
351 __ lwr(a7, MemOperand(a1, 3, loadstore_chunk)); // Maybe in delay slot.
352
353 __ Pref(pref_hint_store, MemOperand(a0, 4 * pref_chunk));
354 __ Pref(pref_hint_store, MemOperand(a0, 5 * pref_chunk));
355
356 __ bind(&ua_skip_pref);
357 __ lwr(t0, MemOperand(a1, 4, loadstore_chunk));
358 __ lwr(t1, MemOperand(a1, 5, loadstore_chunk));
359 __ lwr(t2, MemOperand(a1, 6, loadstore_chunk));
360 __ lwr(t3, MemOperand(a1, 7, loadstore_chunk));
361 __ lwl(a4,
362 MemOperand(a1, 1, loadstore_chunk, MemOperand::offset_minus_one));
363 __ lwl(a5,
364 MemOperand(a1, 2, loadstore_chunk, MemOperand::offset_minus_one));
365 __ lwl(a6,
366 MemOperand(a1, 3, loadstore_chunk, MemOperand::offset_minus_one));
367 __ lwl(a7,
368 MemOperand(a1, 4, loadstore_chunk, MemOperand::offset_minus_one));
369 __ lwl(t0,
370 MemOperand(a1, 5, loadstore_chunk, MemOperand::offset_minus_one));
371 __ lwl(t1,
372 MemOperand(a1, 6, loadstore_chunk, MemOperand::offset_minus_one));
373 __ lwl(t2,
374 MemOperand(a1, 7, loadstore_chunk, MemOperand::offset_minus_one));
375 __ lwl(t3,
376 MemOperand(a1, 8, loadstore_chunk, MemOperand::offset_minus_one));
377 } else {
378 __ Pref(pref_hint_load, MemOperand(a1, 3 * pref_chunk));
379 __ lwl(a4, MemOperand(a1));
380 __ lwl(a5, MemOperand(a1, 1, loadstore_chunk));
381 __ lwl(a6, MemOperand(a1, 2, loadstore_chunk));
382
383 if (pref_hint_store == kPrefHintPrepareForStore) {
384 __ sltu(v1, t9, a0);
385 __ Branch(USE_DELAY_SLOT, &ua_skip_pref, gt, v1, Operand(zero_reg));
386 }
387 __ lwl(a7, MemOperand(a1, 3, loadstore_chunk)); // Maybe in delay slot.
388
389 __ Pref(pref_hint_store, MemOperand(a0, 4 * pref_chunk));
390 __ Pref(pref_hint_store, MemOperand(a0, 5 * pref_chunk));
391
392 __ bind(&ua_skip_pref);
393 __ lwl(t0, MemOperand(a1, 4, loadstore_chunk));
394 __ lwl(t1, MemOperand(a1, 5, loadstore_chunk));
395 __ lwl(t2, MemOperand(a1, 6, loadstore_chunk));
396 __ lwl(t3, MemOperand(a1, 7, loadstore_chunk));
397 __ lwr(a4,
398 MemOperand(a1, 1, loadstore_chunk, MemOperand::offset_minus_one));
399 __ lwr(a5,
400 MemOperand(a1, 2, loadstore_chunk, MemOperand::offset_minus_one));
401 __ lwr(a6,
402 MemOperand(a1, 3, loadstore_chunk, MemOperand::offset_minus_one));
403 __ lwr(a7,
404 MemOperand(a1, 4, loadstore_chunk, MemOperand::offset_minus_one));
405 __ lwr(t0,
406 MemOperand(a1, 5, loadstore_chunk, MemOperand::offset_minus_one));
407 __ lwr(t1,
408 MemOperand(a1, 6, loadstore_chunk, MemOperand::offset_minus_one));
409 __ lwr(t2,
410 MemOperand(a1, 7, loadstore_chunk, MemOperand::offset_minus_one));
411 __ lwr(t3,
412 MemOperand(a1, 8, loadstore_chunk, MemOperand::offset_minus_one));
341 } 413 }
342 __ lwr(a7, MemOperand(a1, 3, loadstore_chunk)); // Maybe in delay slot.
343
344 __ Pref(pref_hint_store, MemOperand(a0, 4 * pref_chunk));
345 __ Pref(pref_hint_store, MemOperand(a0, 5 * pref_chunk));
346
347 __ bind(&ua_skip_pref);
348 __ lwr(t0, MemOperand(a1, 4, loadstore_chunk));
349 __ lwr(t1, MemOperand(a1, 5, loadstore_chunk));
350 __ lwr(t2, MemOperand(a1, 6, loadstore_chunk));
351 __ lwr(t3, MemOperand(a1, 7, loadstore_chunk));
352 __ lwl(a4,
353 MemOperand(a1, 1, loadstore_chunk, MemOperand::offset_minus_one));
354 __ lwl(a5,
355 MemOperand(a1, 2, loadstore_chunk, MemOperand::offset_minus_one));
356 __ lwl(a6,
357 MemOperand(a1, 3, loadstore_chunk, MemOperand::offset_minus_one));
358 __ lwl(a7,
359 MemOperand(a1, 4, loadstore_chunk, MemOperand::offset_minus_one));
360 __ lwl(t0,
361 MemOperand(a1, 5, loadstore_chunk, MemOperand::offset_minus_one));
362 __ lwl(t1,
363 MemOperand(a1, 6, loadstore_chunk, MemOperand::offset_minus_one));
364 __ lwl(t2,
365 MemOperand(a1, 7, loadstore_chunk, MemOperand::offset_minus_one));
366 __ lwl(t3,
367 MemOperand(a1, 8, loadstore_chunk, MemOperand::offset_minus_one));
368 __ Pref(pref_hint_load, MemOperand(a1, 4 * pref_chunk)); 414 __ Pref(pref_hint_load, MemOperand(a1, 4 * pref_chunk));
369 __ sw(a4, MemOperand(a0)); 415 __ sw(a4, MemOperand(a0));
370 __ sw(a5, MemOperand(a0, 1, loadstore_chunk)); 416 __ sw(a5, MemOperand(a0, 1, loadstore_chunk));
371 __ sw(a6, MemOperand(a0, 2, loadstore_chunk)); 417 __ sw(a6, MemOperand(a0, 2, loadstore_chunk));
372 __ sw(a7, MemOperand(a0, 3, loadstore_chunk)); 418 __ sw(a7, MemOperand(a0, 3, loadstore_chunk));
373 __ sw(t0, MemOperand(a0, 4, loadstore_chunk)); 419 __ sw(t0, MemOperand(a0, 4, loadstore_chunk));
374 __ sw(t1, MemOperand(a0, 5, loadstore_chunk)); 420 __ sw(t1, MemOperand(a0, 5, loadstore_chunk));
375 __ sw(t2, MemOperand(a0, 6, loadstore_chunk)); 421 __ sw(t2, MemOperand(a0, 6, loadstore_chunk));
376 __ sw(t3, MemOperand(a0, 7, loadstore_chunk)); 422 __ sw(t3, MemOperand(a0, 7, loadstore_chunk));
377 __ lwr(a4, MemOperand(a1, 8, loadstore_chunk)); 423 if (kArchEndian == kLittle) {
378 __ lwr(a5, MemOperand(a1, 9, loadstore_chunk)); 424 __ lwr(a4, MemOperand(a1, 8, loadstore_chunk));
379 __ lwr(a6, MemOperand(a1, 10, loadstore_chunk)); 425 __ lwr(a5, MemOperand(a1, 9, loadstore_chunk));
380 __ lwr(a7, MemOperand(a1, 11, loadstore_chunk)); 426 __ lwr(a6, MemOperand(a1, 10, loadstore_chunk));
381 __ lwr(t0, MemOperand(a1, 12, loadstore_chunk)); 427 __ lwr(a7, MemOperand(a1, 11, loadstore_chunk));
382 __ lwr(t1, MemOperand(a1, 13, loadstore_chunk)); 428 __ lwr(t0, MemOperand(a1, 12, loadstore_chunk));
383 __ lwr(t2, MemOperand(a1, 14, loadstore_chunk)); 429 __ lwr(t1, MemOperand(a1, 13, loadstore_chunk));
384 __ lwr(t3, MemOperand(a1, 15, loadstore_chunk)); 430 __ lwr(t2, MemOperand(a1, 14, loadstore_chunk));
385 __ lwl(a4, 431 __ lwr(t3, MemOperand(a1, 15, loadstore_chunk));
386 MemOperand(a1, 9, loadstore_chunk, MemOperand::offset_minus_one)); 432 __ lwl(a4,
387 __ lwl(a5, 433 MemOperand(a1, 9, loadstore_chunk, MemOperand::offset_minus_one));
388 MemOperand(a1, 10, loadstore_chunk, MemOperand::offset_minus_one)); 434 __ lwl(a5,
389 __ lwl(a6, 435 MemOperand(a1, 10, loadstore_chunk, MemOperand::offset_minus_one));
390 MemOperand(a1, 11, loadstore_chunk, MemOperand::offset_minus_one)); 436 __ lwl(a6,
391 __ lwl(a7, 437 MemOperand(a1, 11, loadstore_chunk, MemOperand::offset_minus_one));
392 MemOperand(a1, 12, loadstore_chunk, MemOperand::offset_minus_one)); 438 __ lwl(a7,
393 __ lwl(t0, 439 MemOperand(a1, 12, loadstore_chunk, MemOperand::offset_minus_one));
394 MemOperand(a1, 13, loadstore_chunk, MemOperand::offset_minus_one)); 440 __ lwl(t0,
395 __ lwl(t1, 441 MemOperand(a1, 13, loadstore_chunk, MemOperand::offset_minus_one));
396 MemOperand(a1, 14, loadstore_chunk, MemOperand::offset_minus_one)); 442 __ lwl(t1,
397 __ lwl(t2, 443 MemOperand(a1, 14, loadstore_chunk, MemOperand::offset_minus_one));
398 MemOperand(a1, 15, loadstore_chunk, MemOperand::offset_minus_one)); 444 __ lwl(t2,
399 __ lwl(t3, 445 MemOperand(a1, 15, loadstore_chunk, MemOperand::offset_minus_one));
400 MemOperand(a1, 16, loadstore_chunk, MemOperand::offset_minus_one)); 446 __ lwl(t3,
447 MemOperand(a1, 16, loadstore_chunk, MemOperand::offset_minus_one));
448 } else {
449 __ lwl(a4, MemOperand(a1, 8, loadstore_chunk));
450 __ lwl(a5, MemOperand(a1, 9, loadstore_chunk));
451 __ lwl(a6, MemOperand(a1, 10, loadstore_chunk));
452 __ lwl(a7, MemOperand(a1, 11, loadstore_chunk));
453 __ lwl(t0, MemOperand(a1, 12, loadstore_chunk));
454 __ lwl(t1, MemOperand(a1, 13, loadstore_chunk));
455 __ lwl(t2, MemOperand(a1, 14, loadstore_chunk));
456 __ lwl(t3, MemOperand(a1, 15, loadstore_chunk));
457 __ lwr(a4,
458 MemOperand(a1, 9, loadstore_chunk, MemOperand::offset_minus_one));
459 __ lwr(a5,
460 MemOperand(a1, 10, loadstore_chunk, MemOperand::offset_minus_one));
461 __ lwr(a6,
462 MemOperand(a1, 11, loadstore_chunk, MemOperand::offset_minus_one));
463 __ lwr(a7,
464 MemOperand(a1, 12, loadstore_chunk, MemOperand::offset_minus_one));
465 __ lwr(t0,
466 MemOperand(a1, 13, loadstore_chunk, MemOperand::offset_minus_one));
467 __ lwr(t1,
468 MemOperand(a1, 14, loadstore_chunk, MemOperand::offset_minus_one));
469 __ lwr(t2,
470 MemOperand(a1, 15, loadstore_chunk, MemOperand::offset_minus_one));
471 __ lwr(t3,
472 MemOperand(a1, 16, loadstore_chunk, MemOperand::offset_minus_one));
473 }
401 __ Pref(pref_hint_load, MemOperand(a1, 5 * pref_chunk)); 474 __ Pref(pref_hint_load, MemOperand(a1, 5 * pref_chunk));
402 __ sw(a4, MemOperand(a0, 8, loadstore_chunk)); 475 __ sw(a4, MemOperand(a0, 8, loadstore_chunk));
403 __ sw(a5, MemOperand(a0, 9, loadstore_chunk)); 476 __ sw(a5, MemOperand(a0, 9, loadstore_chunk));
404 __ sw(a6, MemOperand(a0, 10, loadstore_chunk)); 477 __ sw(a6, MemOperand(a0, 10, loadstore_chunk));
405 __ sw(a7, MemOperand(a0, 11, loadstore_chunk)); 478 __ sw(a7, MemOperand(a0, 11, loadstore_chunk));
406 __ sw(t0, MemOperand(a0, 12, loadstore_chunk)); 479 __ sw(t0, MemOperand(a0, 12, loadstore_chunk));
407 __ sw(t1, MemOperand(a0, 13, loadstore_chunk)); 480 __ sw(t1, MemOperand(a0, 13, loadstore_chunk));
408 __ sw(t2, MemOperand(a0, 14, loadstore_chunk)); 481 __ sw(t2, MemOperand(a0, 14, loadstore_chunk));
409 __ sw(t3, MemOperand(a0, 15, loadstore_chunk)); 482 __ sw(t3, MemOperand(a0, 15, loadstore_chunk));
410 __ addiu(a0, a0, 16 * loadstore_chunk); 483 __ addiu(a0, a0, 16 * loadstore_chunk);
411 __ bne(a0, a3, &ua_loop16w); 484 __ bne(a0, a3, &ua_loop16w);
412 __ addiu(a1, a1, 16 * loadstore_chunk); // In delay slot. 485 __ addiu(a1, a1, 16 * loadstore_chunk); // In delay slot.
413 __ mov(a2, t8); 486 __ mov(a2, t8);
414 487
415 // Here less than 64-bytes. Check for 488 // Here less than 64-bytes. Check for
416 // a 32 byte chunk and copy if there is one. Otherwise jump down to 489 // a 32 byte chunk and copy if there is one. Otherwise jump down to
417 // ua_chk1w to handle the tail end of the copy. 490 // ua_chk1w to handle the tail end of the copy.
418 __ bind(&ua_chkw); 491 __ bind(&ua_chkw);
419 __ Pref(pref_hint_load, MemOperand(a1)); 492 __ Pref(pref_hint_load, MemOperand(a1));
420 __ andi(t8, a2, 0x1f); 493 __ andi(t8, a2, 0x1f);
421 494
422 __ beq(a2, t8, &ua_chk1w); 495 __ beq(a2, t8, &ua_chk1w);
423 __ nop(); // In delay slot. 496 __ nop(); // In delay slot.
424 __ lwr(a4, MemOperand(a1)); 497 if (kArchEndian == kLittle) {
425 __ lwr(a5, MemOperand(a1, 1, loadstore_chunk)); 498 __ lwr(a4, MemOperand(a1));
426 __ lwr(a6, MemOperand(a1, 2, loadstore_chunk)); 499 __ lwr(a5, MemOperand(a1, 1, loadstore_chunk));
427 __ lwr(a7, MemOperand(a1, 3, loadstore_chunk)); 500 __ lwr(a6, MemOperand(a1, 2, loadstore_chunk));
428 __ lwr(t0, MemOperand(a1, 4, loadstore_chunk)); 501 __ lwr(a7, MemOperand(a1, 3, loadstore_chunk));
429 __ lwr(t1, MemOperand(a1, 5, loadstore_chunk)); 502 __ lwr(t0, MemOperand(a1, 4, loadstore_chunk));
430 __ lwr(t2, MemOperand(a1, 6, loadstore_chunk)); 503 __ lwr(t1, MemOperand(a1, 5, loadstore_chunk));
431 __ lwr(t3, MemOperand(a1, 7, loadstore_chunk)); 504 __ lwr(t2, MemOperand(a1, 6, loadstore_chunk));
432 __ lwl(a4, 505 __ lwr(t3, MemOperand(a1, 7, loadstore_chunk));
433 MemOperand(a1, 1, loadstore_chunk, MemOperand::offset_minus_one)); 506 __ lwl(a4,
434 __ lwl(a5, 507 MemOperand(a1, 1, loadstore_chunk, MemOperand::offset_minus_one));
435 MemOperand(a1, 2, loadstore_chunk, MemOperand::offset_minus_one)); 508 __ lwl(a5,
436 __ lwl(a6, 509 MemOperand(a1, 2, loadstore_chunk, MemOperand::offset_minus_one));
437 MemOperand(a1, 3, loadstore_chunk, MemOperand::offset_minus_one)); 510 __ lwl(a6,
438 __ lwl(a7, 511 MemOperand(a1, 3, loadstore_chunk, MemOperand::offset_minus_one));
439 MemOperand(a1, 4, loadstore_chunk, MemOperand::offset_minus_one)); 512 __ lwl(a7,
440 __ lwl(t0, 513 MemOperand(a1, 4, loadstore_chunk, MemOperand::offset_minus_one));
441 MemOperand(a1, 5, loadstore_chunk, MemOperand::offset_minus_one)); 514 __ lwl(t0,
442 __ lwl(t1, 515 MemOperand(a1, 5, loadstore_chunk, MemOperand::offset_minus_one));
443 MemOperand(a1, 6, loadstore_chunk, MemOperand::offset_minus_one)); 516 __ lwl(t1,
444 __ lwl(t2, 517 MemOperand(a1, 6, loadstore_chunk, MemOperand::offset_minus_one));
445 MemOperand(a1, 7, loadstore_chunk, MemOperand::offset_minus_one)); 518 __ lwl(t2,
446 __ lwl(t3, 519 MemOperand(a1, 7, loadstore_chunk, MemOperand::offset_minus_one));
447 MemOperand(a1, 8, loadstore_chunk, MemOperand::offset_minus_one)); 520 __ lwl(t3,
521 MemOperand(a1, 8, loadstore_chunk, MemOperand::offset_minus_one));
522 } else {
523 __ lwl(a4, MemOperand(a1));
524 __ lwl(a5, MemOperand(a1, 1, loadstore_chunk));
525 __ lwl(a6, MemOperand(a1, 2, loadstore_chunk));
526 __ lwl(a7, MemOperand(a1, 3, loadstore_chunk));
527 __ lwl(t0, MemOperand(a1, 4, loadstore_chunk));
528 __ lwl(t1, MemOperand(a1, 5, loadstore_chunk));
529 __ lwl(t2, MemOperand(a1, 6, loadstore_chunk));
530 __ lwl(t3, MemOperand(a1, 7, loadstore_chunk));
531 __ lwr(a4,
532 MemOperand(a1, 1, loadstore_chunk, MemOperand::offset_minus_one));
533 __ lwr(a5,
534 MemOperand(a1, 2, loadstore_chunk, MemOperand::offset_minus_one));
535 __ lwr(a6,
536 MemOperand(a1, 3, loadstore_chunk, MemOperand::offset_minus_one));
537 __ lwr(a7,
538 MemOperand(a1, 4, loadstore_chunk, MemOperand::offset_minus_one));
539 __ lwr(t0,
540 MemOperand(a1, 5, loadstore_chunk, MemOperand::offset_minus_one));
541 __ lwr(t1,
542 MemOperand(a1, 6, loadstore_chunk, MemOperand::offset_minus_one));
543 __ lwr(t2,
544 MemOperand(a1, 7, loadstore_chunk, MemOperand::offset_minus_one));
545 __ lwr(t3,
546 MemOperand(a1, 8, loadstore_chunk, MemOperand::offset_minus_one));
547 }
448 __ addiu(a1, a1, 8 * loadstore_chunk); 548 __ addiu(a1, a1, 8 * loadstore_chunk);
449 __ sw(a4, MemOperand(a0)); 549 __ sw(a4, MemOperand(a0));
450 __ sw(a5, MemOperand(a0, 1, loadstore_chunk)); 550 __ sw(a5, MemOperand(a0, 1, loadstore_chunk));
451 __ sw(a6, MemOperand(a0, 2, loadstore_chunk)); 551 __ sw(a6, MemOperand(a0, 2, loadstore_chunk));
452 __ sw(a7, MemOperand(a0, 3, loadstore_chunk)); 552 __ sw(a7, MemOperand(a0, 3, loadstore_chunk));
453 __ sw(t0, MemOperand(a0, 4, loadstore_chunk)); 553 __ sw(t0, MemOperand(a0, 4, loadstore_chunk));
454 __ sw(t1, MemOperand(a0, 5, loadstore_chunk)); 554 __ sw(t1, MemOperand(a0, 5, loadstore_chunk));
455 __ sw(t2, MemOperand(a0, 6, loadstore_chunk)); 555 __ sw(t2, MemOperand(a0, 6, loadstore_chunk));
456 __ sw(t3, MemOperand(a0, 7, loadstore_chunk)); 556 __ sw(t3, MemOperand(a0, 7, loadstore_chunk));
457 __ addiu(a0, a0, 8 * loadstore_chunk); 557 __ addiu(a0, a0, 8 * loadstore_chunk);
458 558
459 // Less than 32 bytes to copy. Set up for a loop to 559 // Less than 32 bytes to copy. Set up for a loop to
460 // copy one word at a time. 560 // copy one word at a time.
461 __ bind(&ua_chk1w); 561 __ bind(&ua_chk1w);
462 __ andi(a2, t8, loadstore_chunk - 1); 562 __ andi(a2, t8, loadstore_chunk - 1);
463 __ beq(a2, t8, &ua_smallCopy); 563 __ beq(a2, t8, &ua_smallCopy);
464 __ subu(a3, t8, a2); // In delay slot. 564 __ subu(a3, t8, a2); // In delay slot.
465 __ addu(a3, a0, a3); 565 __ addu(a3, a0, a3);
466 566
467 __ bind(&ua_wordCopy_loop); 567 __ bind(&ua_wordCopy_loop);
468 __ lwr(v1, MemOperand(a1)); 568 if (kArchEndian == kLittle) {
469 __ lwl(v1, 569 __ lwr(v1, MemOperand(a1));
470 MemOperand(a1, 1, loadstore_chunk, MemOperand::offset_minus_one)); 570 __ lwl(v1,
571 MemOperand(a1, 1, loadstore_chunk, MemOperand::offset_minus_one));
572 } else {
573 __ lwl(v1, MemOperand(a1));
574 __ lwr(v1,
575 MemOperand(a1, 1, loadstore_chunk, MemOperand::offset_minus_one));
576 }
471 __ addiu(a0, a0, loadstore_chunk); 577 __ addiu(a0, a0, loadstore_chunk);
472 __ addiu(a1, a1, loadstore_chunk); 578 __ addiu(a1, a1, loadstore_chunk);
473 __ bne(a0, a3, &ua_wordCopy_loop); 579 __ bne(a0, a3, &ua_wordCopy_loop);
474 __ sw(v1, MemOperand(a0, -1, loadstore_chunk)); // In delay slot. 580 __ sw(v1, MemOperand(a0, -1, loadstore_chunk)); // In delay slot.
475 581
476 // Copy the last 8 bytes. 582 // Copy the last 8 bytes.
477 __ bind(&ua_smallCopy); 583 __ bind(&ua_smallCopy);
478 __ beq(a2, zero_reg, &leave); 584 __ beq(a2, zero_reg, &leave);
479 __ addu(a3, a0, a2); // In delay slot. 585 __ addu(a3, a0, a2); // In delay slot.
480 586
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 795
690 // Call into runtime if GC is required. 796 // Call into runtime if GC is required.
691 __ bind(&gc_required); 797 __ bind(&gc_required);
692 __ ld(ra, MemOperand(sp, 0)); 798 __ ld(ra, MemOperand(sp, 0));
693 __ Branch(USE_DELAY_SLOT, fail); 799 __ Branch(USE_DELAY_SLOT, fail);
694 __ daddiu(sp, sp, kPointerSize); // In delay slot. 800 __ daddiu(sp, sp, kPointerSize); // In delay slot.
695 801
696 // Convert and copy elements. 802 // Convert and copy elements.
697 __ bind(&loop); 803 __ bind(&loop);
698 __ ld(scratch2, MemOperand(scratch1)); 804 __ ld(scratch2, MemOperand(scratch1));
699 __ Daddu(scratch1, scratch1, kIntSize); 805 __ Daddu(scratch1, scratch1, kPointerSize);
700 // scratch2: current element 806 // scratch2: current element
701 __ JumpIfNotSmi(scratch2, &convert_hole); 807 __ JumpIfNotSmi(scratch2, &convert_hole);
702 __ SmiUntag(scratch2); 808 __ SmiUntag(scratch2);
703 809
704 // Normal smi, convert to double and store. 810 // Normal smi, convert to double and store.
705 __ mtc1(scratch2, f0); 811 __ mtc1(scratch2, f0);
706 __ cvt_d_w(f0, f0); 812 __ cvt_d_w(f0, f0);
707 __ sdc1(f0, MemOperand(scratch3)); 813 __ sdc1(f0, MemOperand(scratch3));
708 __ Branch(USE_DELAY_SLOT, &entry); 814 __ Branch(USE_DELAY_SLOT, &entry);
709 __ daddiu(scratch3, scratch3, kDoubleSize); // In delay slot. 815 __ daddiu(scratch3, scratch3, kDoubleSize); // In delay slot.
710 816
711 // Hole found, store the-hole NaN. 817 // Hole found, store the-hole NaN.
712 __ bind(&convert_hole); 818 __ bind(&convert_hole);
713 if (FLAG_debug_code) { 819 if (FLAG_debug_code) {
714 // Restore a "smi-untagged" heap object. 820 // Restore a "smi-untagged" heap object.
715 __ Or(scratch2, scratch2, Operand(1)); 821 __ Or(scratch2, scratch2, Operand(1));
716 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 822 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
717 __ Assert(eq, kObjectFoundInSmiOnlyArray, at, Operand(scratch2)); 823 __ Assert(eq, kObjectFoundInSmiOnlyArray, at, Operand(scratch2));
718 } 824 }
719 // mantissa 825 // mantissa
720 __ sw(hole_lower, MemOperand(scratch3)); 826 __ sw(hole_lower, MemOperand(scratch3, Register::kMantissaOffset));
721 // exponent 827 // exponent
722 __ sw(hole_upper, MemOperand(scratch3, kIntSize)); 828 __ sw(hole_upper, MemOperand(scratch3, Register::kExponentOffset));
723 __ Daddu(scratch3, scratch3, kDoubleSize); 829 __ Daddu(scratch3, scratch3, kDoubleSize);
724 830
725 __ bind(&entry); 831 __ bind(&entry);
726 __ Branch(&loop, lt, scratch3, Operand(array_end)); 832 __ Branch(&loop, lt, scratch3, Operand(array_end));
727 833
728 __ bind(&done); 834 __ bind(&done);
729 __ pop(ra); 835 __ pop(ra);
730 } 836 }
731 837
732 838
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex); 885 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex);
780 __ sd(length, MemOperand(array, FixedDoubleArray::kLengthOffset)); 886 __ sd(length, MemOperand(array, FixedDoubleArray::kLengthOffset));
781 __ sd(scratch, MemOperand(array, HeapObject::kMapOffset)); 887 __ sd(scratch, MemOperand(array, HeapObject::kMapOffset));
782 888
783 // Prepare for conversion loop. 889 // Prepare for conversion loop.
784 Register src_elements = elements; 890 Register src_elements = elements;
785 Register dst_elements = target_map; 891 Register dst_elements = target_map;
786 Register dst_end = length; 892 Register dst_end = length;
787 Register heap_number_map = scratch; 893 Register heap_number_map = scratch;
788 __ Daddu(src_elements, src_elements, 894 __ Daddu(src_elements, src_elements,
789 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag + 4)); 895 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag));
790 __ Daddu(dst_elements, array, Operand(FixedArray::kHeaderSize)); 896 __ Daddu(dst_elements, array, Operand(FixedArray::kHeaderSize));
791 __ SmiScale(dst_end, dst_end, kPointerSizeLog2); 897 __ SmiScale(dst_end, dst_end, kPointerSizeLog2);
792 __ Daddu(dst_end, dst_elements, dst_end); 898 __ Daddu(dst_end, dst_elements, dst_end);
793 899
794 // Allocating heap numbers in the loop below can fail and cause a jump to 900 // Allocating heap numbers in the loop below can fail and cause a jump to
795 // gc_required. We can't leave a partly initialized FixedArray behind, 901 // gc_required. We can't leave a partly initialized FixedArray behind,
796 // so pessimistically fill it with holes now. 902 // so pessimistically fill it with holes now.
797 Label initialization_loop, initialization_loop_entry; 903 Label initialization_loop, initialization_loop_entry;
798 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex); 904 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
799 __ Branch(&initialization_loop_entry); 905 __ Branch(&initialization_loop_entry);
(...skipping 17 matching lines...) Expand all
817 923
818 // Call into runtime if GC is required. 924 // Call into runtime if GC is required.
819 __ bind(&gc_required); 925 __ bind(&gc_required);
820 __ MultiPop( 926 __ MultiPop(
821 value.bit() | key.bit() | receiver.bit() | target_map.bit() | ra.bit()); 927 value.bit() | key.bit() | receiver.bit() | target_map.bit() | ra.bit());
822 928
823 __ Branch(fail); 929 __ Branch(fail);
824 930
825 __ bind(&loop); 931 __ bind(&loop);
826 Register upper_bits = key; 932 Register upper_bits = key;
827 __ lw(upper_bits, MemOperand(src_elements)); 933 __ lw(upper_bits, MemOperand(src_elements, Register::kExponentOffset));
828 __ Daddu(src_elements, src_elements, kDoubleSize); 934 __ Daddu(src_elements, src_elements, kDoubleSize);
829 // upper_bits: current element's upper 32 bit 935 // upper_bits: current element's upper 32 bit
830 // src_elements: address of next element's upper 32 bit 936 // src_elements: address of next element
831 __ Branch(&convert_hole, eq, a1, Operand(kHoleNanUpper32)); 937 __ Branch(&convert_hole, eq, a1, Operand(kHoleNanUpper32));
832 938
833 // Non-hole double, copy value into a heap number. 939 // Non-hole double, copy value into a heap number.
834 Register heap_number = receiver; 940 Register heap_number = receiver;
835 Register scratch2 = value; 941 Register scratch2 = value;
836 Register scratch3 = t2; 942 Register scratch3 = t2;
837 __ AllocateHeapNumber(heap_number, scratch2, scratch3, heap_number_map, 943 __ AllocateHeapNumber(heap_number, scratch2, scratch3, heap_number_map,
838 &gc_required); 944 &gc_required);
839 // heap_number: new heap number 945 // heap_number: new heap number
840 // Load mantissa of current element, src_elements 946 // Load current element, src_elements point to next element.
841 // point to exponent of next element. 947
842 __ lw(scratch2, MemOperand(heap_number, -12)); 948 __ ld(scratch2, MemOperand(src_elements, -kDoubleSize));
843 __ sw(scratch2, FieldMemOperand(heap_number, HeapNumber::kMantissaOffset)); 949 __ sd(scratch2, FieldMemOperand(heap_number, HeapNumber::kValueOffset));
844 __ sw(upper_bits, FieldMemOperand(heap_number, HeapNumber::kExponentOffset)); 950
845 __ mov(scratch2, dst_elements); 951 __ mov(scratch2, dst_elements);
846 __ sd(heap_number, MemOperand(dst_elements)); 952 __ sd(heap_number, MemOperand(dst_elements));
847 __ Daddu(dst_elements, dst_elements, kPointerSize); 953 __ Daddu(dst_elements, dst_elements, kPointerSize);
848 __ RecordWrite(array, 954 __ RecordWrite(array,
849 scratch2, 955 scratch2,
850 heap_number, 956 heap_number,
851 kRAHasBeenSaved, 957 kRAHasBeenSaved,
852 kDontSaveFPRegs, 958 kDontSaveFPRegs,
853 EMIT_REMEMBERED_SET, 959 EMIT_REMEMBERED_SET,
854 OMIT_SMI_CHECK); 960 OMIT_SMI_CHECK);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 __ Move(double_scratch2, 1.); 1144 __ Move(double_scratch2, 1.);
1039 __ add_d(result, result, double_scratch2); 1145 __ add_d(result, result, double_scratch2);
1040 __ dsrl(temp1, temp2, 11); 1146 __ dsrl(temp1, temp2, 11);
1041 __ Ext(temp2, temp2, 0, 11); 1147 __ Ext(temp2, temp2, 0, 11);
1042 __ Daddu(temp1, temp1, Operand(0x3ff)); 1148 __ Daddu(temp1, temp1, Operand(0x3ff));
1043 1149
1044 // Must not call ExpConstant() after overwriting temp3! 1150 // Must not call ExpConstant() after overwriting temp3!
1045 __ li(temp3, Operand(ExternalReference::math_exp_log_table())); 1151 __ li(temp3, Operand(ExternalReference::math_exp_log_table()));
1046 __ dsll(at, temp2, 3); 1152 __ dsll(at, temp2, 3);
1047 __ Daddu(temp3, temp3, Operand(at)); 1153 __ Daddu(temp3, temp3, Operand(at));
1048 __ lwu(temp2, MemOperand(temp3, 0)); 1154 __ lwu(temp2, MemOperand(temp3, Register::kMantissaOffset));
1049 __ lwu(temp3, MemOperand(temp3, kIntSize)); 1155 __ lwu(temp3, MemOperand(temp3, Register::kExponentOffset));
1050 // The first word is loaded is the lower number register. 1156 // The first word is loaded is the lower number register.
1051 if (temp2.code() < temp3.code()) { 1157 if (temp2.code() < temp3.code()) {
1052 __ dsll(at, temp1, 20); 1158 __ dsll(at, temp1, 20);
1053 __ Or(temp1, temp3, at); 1159 __ Or(temp1, temp3, at);
1054 __ Move(double_scratch1, temp2, temp1); 1160 __ Move(double_scratch1, temp2, temp1);
1055 } else { 1161 } else {
1056 __ dsll(at, temp1, 20); 1162 __ dsll(at, temp1, 20);
1057 __ Or(temp1, temp2, at); 1163 __ Or(temp1, temp2, at);
1058 __ Move(double_scratch1, temp3, temp1); 1164 __ Move(double_scratch1, temp3, temp1);
1059 } 1165 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 } 1255 }
1150 } 1256 }
1151 1257
1152 1258
1153 #undef __ 1259 #undef __
1154 1260
1155 } // namespace internal 1261 } // namespace internal
1156 } // namespace v8 1262 } // namespace v8
1157 1263
1158 #endif // V8_TARGET_ARCH_MIPS64 1264 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/mips64/constants-mips64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698