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

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

Issue 2374003002: [ic][mips][mips64] Ensure store handlers return value in proper register. (Closed)
Patch Set: Created 4 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/ic/mips/handler-compiler-mips.cc ('k') | src/ic/mips64/handler-compiler-mips64.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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 487
488 if (increment_length == kIncrementLength) { 488 if (increment_length == kIncrementLength) {
489 // Add 1 to receiver->length. 489 // Add 1 to receiver->length.
490 __ Addu(scratch, key, Operand(Smi::FromInt(1))); 490 __ Addu(scratch, key, Operand(Smi::FromInt(1)));
491 __ sw(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset)); 491 __ sw(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset));
492 } 492 }
493 // It's irrelevant whether array is smi-only or not when writing a smi. 493 // It's irrelevant whether array is smi-only or not when writing a smi.
494 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 494 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
495 __ Lsa(address, address, key, kPointerSizeLog2 - kSmiTagSize); 495 __ Lsa(address, address, key, kPointerSizeLog2 - kSmiTagSize);
496 __ sw(value, MemOperand(address)); 496 __ sw(value, MemOperand(address));
497 __ Ret(); 497 __ Ret(USE_DELAY_SLOT);
498 __ Move(v0, value); // Ensure the stub returns correct value.
498 499
499 __ bind(&non_smi_value); 500 __ bind(&non_smi_value);
500 // Escape to elements kind transition case. 501 // Escape to elements kind transition case.
501 __ CheckFastObjectElements(receiver_map, scratch, &transition_smi_elements); 502 __ CheckFastObjectElements(receiver_map, scratch, &transition_smi_elements);
502 503
503 // Fast elements array, store the value to the elements backing store. 504 // Fast elements array, store the value to the elements backing store.
504 __ bind(&finish_object_store); 505 __ bind(&finish_object_store);
505 if (increment_length == kIncrementLength) { 506 if (increment_length == kIncrementLength) {
506 // Add 1 to receiver->length. 507 // Add 1 to receiver->length.
507 __ Addu(scratch, key, Operand(Smi::FromInt(1))); 508 __ Addu(scratch, key, Operand(Smi::FromInt(1)));
508 __ sw(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset)); 509 __ sw(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset));
509 } 510 }
510 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 511 __ Addu(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
511 __ Lsa(address, address, key, kPointerSizeLog2 - kSmiTagSize); 512 __ Lsa(address, address, key, kPointerSizeLog2 - kSmiTagSize);
512 __ sw(value, MemOperand(address)); 513 __ sw(value, MemOperand(address));
513 // Update write barrier for the elements array address. 514 // Update write barrier for the elements array address.
514 __ mov(scratch, value); // Preserve the value which is returned. 515 __ mov(scratch, value); // Preserve the value which is returned.
515 __ RecordWrite(elements, address, scratch, kRAHasNotBeenSaved, 516 __ RecordWrite(elements, address, scratch, kRAHasNotBeenSaved,
516 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 517 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
517 __ Ret(); 518 __ Ret(USE_DELAY_SLOT);
519 __ Move(v0, value); // Ensure the stub returns correct value.
518 520
519 __ bind(fast_double); 521 __ bind(fast_double);
520 if (check_map == kCheckMap) { 522 if (check_map == kCheckMap) {
521 // Check for fast double array case. If this fails, call through to the 523 // Check for fast double array case. If this fails, call through to the
522 // runtime. 524 // runtime.
523 __ LoadRoot(at, Heap::kFixedDoubleArrayMapRootIndex); 525 __ LoadRoot(at, Heap::kFixedDoubleArrayMapRootIndex);
524 __ Branch(slow, ne, elements_map, Operand(at)); 526 __ Branch(slow, ne, elements_map, Operand(at));
525 } 527 }
526 528
527 // HOLECHECK: guards "A[i] double hole?" 529 // HOLECHECK: guards "A[i] double hole?"
528 // We have to see if the double version of the hole is present. If so 530 // We have to see if the double version of the hole is present. If so
529 // go to the runtime. 531 // go to the runtime.
530 __ Addu(address, elements, Operand(FixedDoubleArray::kHeaderSize + 532 __ Addu(address, elements, Operand(FixedDoubleArray::kHeaderSize +
531 kHoleNanUpper32Offset - kHeapObjectTag)); 533 kHoleNanUpper32Offset - kHeapObjectTag));
532 __ Lsa(address, address, key, kPointerSizeLog2); 534 __ Lsa(address, address, key, kPointerSizeLog2);
533 __ lw(scratch, MemOperand(address)); 535 __ lw(scratch, MemOperand(address));
534 __ Branch(&fast_double_without_map_check, ne, scratch, 536 __ Branch(&fast_double_without_map_check, ne, scratch,
535 Operand(kHoleNanUpper32)); 537 Operand(kHoleNanUpper32));
536 __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch, slow); 538 __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch, slow);
537 539
538 __ bind(&fast_double_without_map_check); 540 __ bind(&fast_double_without_map_check);
539 __ StoreNumberToDoubleElements(value, key, elements, scratch, scratch2, 541 __ StoreNumberToDoubleElements(value, key, elements, scratch, scratch2,
540 scratch3, &transition_double_elements); 542 scratch3, &transition_double_elements);
541 if (increment_length == kIncrementLength) { 543 if (increment_length == kIncrementLength) {
542 // Add 1 to receiver->length. 544 // Add 1 to receiver->length.
543 __ Addu(scratch, key, Operand(Smi::FromInt(1))); 545 __ Addu(scratch, key, Operand(Smi::FromInt(1)));
544 __ sw(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset)); 546 __ sw(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset));
545 } 547 }
546 __ Ret(); 548 __ Ret(USE_DELAY_SLOT);
549 __ Move(v0, value); // Ensure the stub returns correct value.
547 550
548 __ bind(&transition_smi_elements); 551 __ bind(&transition_smi_elements);
549 // Transition the array appropriately depending on the value type. 552 // Transition the array appropriately depending on the value type.
550 __ lw(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); 553 __ lw(scratch, FieldMemOperand(value, HeapObject::kMapOffset));
551 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex); 554 __ LoadRoot(at, Heap::kHeapNumberMapRootIndex);
552 __ Branch(&non_double_value, ne, scratch, Operand(at)); 555 __ Branch(&non_double_value, ne, scratch, Operand(at));
553 556
554 // Value is a double. Transition FAST_SMI_ELEMENTS -> 557 // Value is a double. Transition FAST_SMI_ELEMENTS ->
555 // FAST_DOUBLE_ELEMENTS and complete the store. 558 // FAST_DOUBLE_ELEMENTS and complete the store.
556 __ LoadTransitionedArrayMapConditional( 559 __ LoadTransitionedArrayMapConditional(
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 DCHECK(name.is(a2)); 753 DCHECK(name.is(a2));
751 DCHECK(value.is(a0)); 754 DCHECK(value.is(a0));
752 DCHECK(StoreWithVectorDescriptor::VectorRegister().is(a3)); 755 DCHECK(StoreWithVectorDescriptor::VectorRegister().is(a3));
753 DCHECK(StoreWithVectorDescriptor::SlotRegister().is(t0)); 756 DCHECK(StoreWithVectorDescriptor::SlotRegister().is(t0));
754 757
755 __ lw(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); 758 __ lw(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
756 759
757 GenerateDictionaryStore(masm, &miss, dictionary, name, value, t2, t5); 760 GenerateDictionaryStore(masm, &miss, dictionary, name, value, t2, t5);
758 Counters* counters = masm->isolate()->counters(); 761 Counters* counters = masm->isolate()->counters();
759 __ IncrementCounter(counters->ic_store_normal_hit(), 1, t2, t5); 762 __ IncrementCounter(counters->ic_store_normal_hit(), 1, t2, t5);
760 __ Ret(); 763 __ Ret(USE_DELAY_SLOT);
764 __ Move(v0, value); // Ensure the stub returns correct value.
761 765
762 __ bind(&miss); 766 __ bind(&miss);
763 __ IncrementCounter(counters->ic_store_normal_miss(), 1, t2, t5); 767 __ IncrementCounter(counters->ic_store_normal_miss(), 1, t2, t5);
764 GenerateMiss(masm); 768 GenerateMiss(masm);
765 } 769 }
766 770
767 771
768 #undef __ 772 #undef __
769 773
770 774
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 break; 892 break;
889 default: 893 default:
890 UNIMPLEMENTED(); 894 UNIMPLEMENTED();
891 } 895 }
892 patcher.ChangeBranchCondition(branch_instr, opcode); 896 patcher.ChangeBranchCondition(branch_instr, opcode);
893 } 897 }
894 } // namespace internal 898 } // namespace internal
895 } // namespace v8 899 } // namespace v8
896 900
897 #endif // V8_TARGET_ARCH_MIPS 901 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ic/mips/handler-compiler-mips.cc ('k') | src/ic/mips64/handler-compiler-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698