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

Side by Side Diff: src/ic/mips/ic-mips.cc

Issue 1608933003: MIPS: Use the Lsa() macro/r6 instruction in existing code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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/full-codegen/mips/full-codegen-mips.cc ('k') | src/ic/mips/stub-cache-mips.cc » ('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 #if V8_TARGET_ARCH_MIPS 5 #if V8_TARGET_ARCH_MIPS
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/ic/ic.h" 8 #include "src/ic/ic.h"
9 #include "src/ic/ic-compiler.h" 9 #include "src/ic/ic-compiler.h"
10 #include "src/ic/stub-cache.h" 10 #include "src/ic/stub-cache.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); 223 __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
224 __ Branch(&done); 224 __ Branch(&done);
225 } 225 }
226 226
227 __ bind(&in_bounds); 227 __ bind(&in_bounds);
228 // Fast case: Do the load. 228 // Fast case: Do the load.
229 __ Addu(scratch1, elements, 229 __ Addu(scratch1, elements,
230 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 230 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
231 // The key is a smi. 231 // The key is a smi.
232 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2); 232 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize < kPointerSizeLog2);
233 __ sll(at, key, kPointerSizeLog2 - kSmiTagSize); 233 __ Lsa(at, scratch1, key, kPointerSizeLog2 - kSmiTagSize);
234 __ addu(at, at, scratch1);
235 __ lw(scratch2, MemOperand(at)); 234 __ lw(scratch2, MemOperand(at));
236 235
237 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 236 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
238 // In case the loaded value is the_hole we have to check the prototype chain. 237 // In case the loaded value is the_hole we have to check the prototype chain.
239 __ Branch(&check_prototypes, eq, scratch2, Operand(at)); 238 __ Branch(&check_prototypes, eq, scratch2, Operand(at));
240 __ Move(result, scratch2); 239 __ Move(result, scratch2);
241 __ bind(&done); 240 __ bind(&done);
242 } 241 }
243 242
244 243
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 __ lw(elements_map, FieldMemOperand(elements, HeapObject::kMapOffset)); 483 __ lw(elements_map, FieldMemOperand(elements, HeapObject::kMapOffset));
485 __ Branch(fast_double, ne, elements_map, 484 __ Branch(fast_double, ne, elements_map,
486 Operand(masm->isolate()->factory()->fixed_array_map())); 485 Operand(masm->isolate()->factory()->fixed_array_map()));
487 } 486 }
488 487
489 // HOLECHECK: guards "A[i] = V" 488 // HOLECHECK: guards "A[i] = V"
490 // We have to go to the runtime if the current value is the hole because 489 // We have to go to the runtime if the current value is the hole because
491 // there may be a callback on the element. 490 // there may be a callback on the element.
492 Label holecheck_passed1; 491 Label holecheck_passed1;
493 __ Addu(address, elements, FixedArray::kHeaderSize - kHeapObjectTag); 492 __ Addu(address, elements, FixedArray::kHeaderSize - kHeapObjectTag);
494 __ sll(at, key, kPointerSizeLog2 - kSmiTagSize); 493 __ Lsa(address, address, key, kPointerSizeLog2 - kSmiTagSize);
495 __ addu(address, address, at);
496 __ lw(scratch, MemOperand(address)); 494 __ lw(scratch, MemOperand(address));
497 __ Branch(&holecheck_passed1, ne, scratch, 495 __ Branch(&holecheck_passed1, ne, scratch,
498 Operand(masm->isolate()->factory()->the_hole_value())); 496 Operand(masm->isolate()->factory()->the_hole_value()));
499 __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch, slow); 497 __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch, slow);
500 498
501 __ bind(&holecheck_passed1); 499 __ bind(&holecheck_passed1);
502 500
503 // Smi stores don't require further checks. 501 // Smi stores don't require further checks.
504 Label non_smi_value; 502 Label non_smi_value;
505 __ JumpIfNotSmi(value, &non_smi_value); 503 __ JumpIfNotSmi(value, &non_smi_value);
506 504
507 if (increment_length == kIncrementLength) { 505 if (increment_length == kIncrementLength) {
508 // Add 1 to receiver->length. 506 // Add 1 to receiver->length.
509 __ Addu(scratch, key, Operand(Smi::FromInt(1))); 507 __ Addu(scratch, key, Operand(Smi::FromInt(1)));
510 __ sw(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset)); 508 __ sw(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset));
511 } 509 }
512 // It's irrelevant whether array is smi-only or not when writing a smi. 510 // It's irrelevant whether array is smi-only or not when writing a smi.
513 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 511 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
514 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize); 512 __ Lsa(address, address, key, kPointerSizeLog2 - kSmiTagSize);
515 __ Addu(address, address, scratch);
516 __ sw(value, MemOperand(address)); 513 __ sw(value, MemOperand(address));
517 __ Ret(); 514 __ Ret();
518 515
519 __ bind(&non_smi_value); 516 __ bind(&non_smi_value);
520 // Escape to elements kind transition case. 517 // Escape to elements kind transition case.
521 __ CheckFastObjectElements(receiver_map, scratch, &transition_smi_elements); 518 __ CheckFastObjectElements(receiver_map, scratch, &transition_smi_elements);
522 519
523 // Fast elements array, store the value to the elements backing store. 520 // Fast elements array, store the value to the elements backing store.
524 __ bind(&finish_object_store); 521 __ bind(&finish_object_store);
525 if (increment_length == kIncrementLength) { 522 if (increment_length == kIncrementLength) {
526 // Add 1 to receiver->length. 523 // Add 1 to receiver->length.
527 __ Addu(scratch, key, Operand(Smi::FromInt(1))); 524 __ Addu(scratch, key, Operand(Smi::FromInt(1)));
528 __ sw(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset)); 525 __ sw(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset));
529 } 526 }
530 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 527 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
531 __ sll(scratch, key, kPointerSizeLog2 - kSmiTagSize); 528 __ Lsa(address, address, key, kPointerSizeLog2 - kSmiTagSize);
532 __ Addu(address, address, scratch);
533 __ sw(value, MemOperand(address)); 529 __ sw(value, MemOperand(address));
534 // Update write barrier for the elements array address. 530 // Update write barrier for the elements array address.
535 __ mov(scratch, value); // Preserve the value which is returned. 531 __ mov(scratch, value); // Preserve the value which is returned.
536 __ RecordWrite(elements, address, scratch, kRAHasNotBeenSaved, 532 __ RecordWrite(elements, address, scratch, kRAHasNotBeenSaved,
537 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 533 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
538 __ Ret(); 534 __ Ret();
539 535
540 __ bind(fast_double); 536 __ bind(fast_double);
541 if (check_map == kCheckMap) { 537 if (check_map == kCheckMap) {
542 // Check for fast double array case. If this fails, call through to the 538 // Check for fast double array case. If this fails, call through to the
543 // runtime. 539 // runtime.
544 __ LoadRoot(at, Heap::kFixedDoubleArrayMapRootIndex); 540 __ LoadRoot(at, Heap::kFixedDoubleArrayMapRootIndex);
545 __ Branch(slow, ne, elements_map, Operand(at)); 541 __ Branch(slow, ne, elements_map, Operand(at));
546 } 542 }
547 543
548 // HOLECHECK: guards "A[i] double hole?" 544 // HOLECHECK: guards "A[i] double hole?"
549 // We have to see if the double version of the hole is present. If so 545 // We have to see if the double version of the hole is present. If so
550 // go to the runtime. 546 // go to the runtime.
551 __ Addu(address, elements, Operand(FixedDoubleArray::kHeaderSize + 547 __ Addu(address, elements, Operand(FixedDoubleArray::kHeaderSize +
552 kHoleNanUpper32Offset - kHeapObjectTag)); 548 kHoleNanUpper32Offset - kHeapObjectTag));
553 __ sll(at, key, kPointerSizeLog2); 549 __ Lsa(address, address, key, kPointerSizeLog2);
554 __ addu(address, address, at);
555 __ lw(scratch, MemOperand(address)); 550 __ lw(scratch, MemOperand(address));
556 __ Branch(&fast_double_without_map_check, ne, scratch, 551 __ Branch(&fast_double_without_map_check, ne, scratch,
557 Operand(kHoleNanUpper32)); 552 Operand(kHoleNanUpper32));
558 __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch, slow); 553 __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch, slow);
559 554
560 __ bind(&fast_double_without_map_check); 555 __ bind(&fast_double_without_map_check);
561 __ StoreNumberToDoubleElements(value, key, elements, scratch, scratch2, 556 __ StoreNumberToDoubleElements(value, key, elements, scratch, scratch2,
562 scratch3, &transition_double_elements); 557 scratch3, &transition_double_elements);
563 if (increment_length == kIncrementLength) { 558 if (increment_length == kIncrementLength) {
564 // Add 1 to receiver->length. 559 // Add 1 to receiver->length.
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 break; 917 break;
923 default: 918 default:
924 UNIMPLEMENTED(); 919 UNIMPLEMENTED();
925 } 920 }
926 patcher.ChangeBranchCondition(branch_instr, opcode); 921 patcher.ChangeBranchCondition(branch_instr, opcode);
927 } 922 }
928 } // namespace internal 923 } // namespace internal
929 } // namespace v8 924 } // namespace v8
930 925
931 #endif // V8_TARGET_ARCH_MIPS 926 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/ic/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698