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

Unified Diff: src/ic/ppc/ic-ppc.cc

Issue 1546323002: [ic] Fixed receiver_map register trashing in KeyedStoreIC megamorphic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ic/mips64/ic-mips64.cc ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/ppc/ic-ppc.cc
diff --git a/src/ic/ppc/ic-ppc.cc b/src/ic/ppc/ic-ppc.cc
index 2715cc9c195cfa7001061ab8cdbf1ba0d8fc12cc..c5f4a3c0a1bb0eba9078c46c93a64ce8f34fe8f3 100644
--- a/src/ic/ppc/ic-ppc.cc
+++ b/src/ic/ppc/ic-ppc.cc
@@ -497,13 +497,16 @@ static void KeyedStoreGenerateMegamorphicHelper(
// Fast case: Do the store, could be either Object or double.
__ bind(fast_object);
- Register scratch_value = r7;
+ Register scratch = r7;
+ Register scratch2 = r0;
Register address = r8;
+ DCHECK(!AreAliased(value, key, receiver, receiver_map, elements_map, elements,
+ scratch, scratch2, address));
+
if (check_map == kCheckMap) {
__ LoadP(elements_map, FieldMemOperand(elements, HeapObject::kMapOffset));
- __ mov(scratch_value,
- Operand(masm->isolate()->factory()->fixed_array_map()));
- __ cmp(elements_map, scratch_value);
+ __ mov(scratch, Operand(masm->isolate()->factory()->fixed_array_map()));
+ __ cmp(elements_map, scratch);
__ bne(fast_double);
}
@@ -512,13 +515,12 @@ static void KeyedStoreGenerateMegamorphicHelper(
// there may be a callback on the element
Label holecheck_passed1;
__ addi(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
- __ SmiToPtrArrayOffset(scratch_value, key);
- __ LoadPX(scratch_value, MemOperand(address, scratch_value));
- __ Cmpi(scratch_value, Operand(masm->isolate()->factory()->the_hole_value()),
- r0);
+ __ SmiToPtrArrayOffset(scratch, key);
+ __ LoadPX(scratch, MemOperand(address, scratch));
+ __ Cmpi(scratch, Operand(masm->isolate()->factory()->the_hole_value()),
+ scratch2);
__ bne(&holecheck_passed1);
- __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch_value,
- slow);
+ __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch, slow);
__ bind(&holecheck_passed1);
@@ -528,35 +530,34 @@ static void KeyedStoreGenerateMegamorphicHelper(
if (increment_length == kIncrementLength) {
// Add 1 to receiver->length.
- __ AddSmiLiteral(scratch_value, key, Smi::FromInt(1), r0);
- __ StoreP(scratch_value, FieldMemOperand(receiver, JSArray::kLengthOffset),
- r0);
+ __ AddSmiLiteral(scratch, key, Smi::FromInt(1), scratch2);
+ __ StoreP(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset),
+ scratch2);
}
// It's irrelevant whether array is smi-only or not when writing a smi.
__ addi(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
- __ SmiToPtrArrayOffset(scratch_value, key);
- __ StorePX(value, MemOperand(address, scratch_value));
+ __ SmiToPtrArrayOffset(scratch, key);
+ __ StorePX(value, MemOperand(address, scratch));
__ Ret();
__ bind(&non_smi_value);
// Escape to elements kind transition case.
- __ CheckFastObjectElements(receiver_map, scratch_value,
- &transition_smi_elements);
+ __ CheckFastObjectElements(receiver_map, scratch, &transition_smi_elements);
// Fast elements array, store the value to the elements backing store.
__ bind(&finish_object_store);
if (increment_length == kIncrementLength) {
// Add 1 to receiver->length.
- __ AddSmiLiteral(scratch_value, key, Smi::FromInt(1), r0);
- __ StoreP(scratch_value, FieldMemOperand(receiver, JSArray::kLengthOffset),
- r0);
+ __ AddSmiLiteral(scratch, key, Smi::FromInt(1), scratch2);
+ __ StoreP(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset),
+ scratch2);
}
__ addi(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
- __ SmiToPtrArrayOffset(scratch_value, key);
- __ StorePUX(value, MemOperand(address, scratch_value));
+ __ SmiToPtrArrayOffset(scratch, key);
+ __ StorePUX(value, MemOperand(address, scratch));
// Update write barrier for the elements array address.
- __ mr(scratch_value, value); // Preserve the value which is returned.
- __ RecordWrite(elements, address, scratch_value, kLRHasNotBeenSaved,
+ __ mr(scratch, value); // Preserve the value which is returned.
+ __ RecordWrite(elements, address, scratch, kLRHasNotBeenSaved,
kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
__ Ret();
@@ -574,21 +575,20 @@ static void KeyedStoreGenerateMegamorphicHelper(
__ addi(address, elements,
Operand((FixedDoubleArray::kHeaderSize + Register::kExponentOffset -
kHeapObjectTag)));
- __ SmiToDoubleArrayOffset(scratch_value, key);
- __ lwzx(scratch_value, MemOperand(address, scratch_value));
- __ Cmpi(scratch_value, Operand(kHoleNanUpper32), r0);
+ __ SmiToDoubleArrayOffset(scratch, key);
+ __ lwzx(scratch, MemOperand(address, scratch));
+ __ Cmpi(scratch, Operand(kHoleNanUpper32), scratch2);
__ bne(&fast_double_without_map_check);
- __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch_value,
- slow);
+ __ JumpIfDictionaryInPrototypeChain(receiver, elements_map, scratch, slow);
__ bind(&fast_double_without_map_check);
- __ StoreNumberToDoubleElements(value, key, elements, r6, d0,
+ __ StoreNumberToDoubleElements(value, key, elements, scratch, d0,
&transition_double_elements);
if (increment_length == kIncrementLength) {
// Add 1 to receiver->length.
- __ AddSmiLiteral(scratch_value, key, Smi::FromInt(1), r0);
- __ StoreP(scratch_value, FieldMemOperand(receiver, JSArray::kLengthOffset),
- r0);
+ __ AddSmiLiteral(scratch, key, Smi::FromInt(1), scratch2);
+ __ StoreP(scratch, FieldMemOperand(receiver, JSArray::kLengthOffset),
+ scratch2);
}
__ Ret();
@@ -601,7 +601,7 @@ static void KeyedStoreGenerateMegamorphicHelper(
// Value is a double. Transition FAST_SMI_ELEMENTS ->
// FAST_DOUBLE_ELEMENTS and complete the store.
__ LoadTransitionedArrayMapConditional(
- FAST_SMI_ELEMENTS, FAST_DOUBLE_ELEMENTS, receiver_map, r7, slow);
+ FAST_SMI_ELEMENTS, FAST_DOUBLE_ELEMENTS, receiver_map, scratch, slow);
AllocationSiteMode mode =
AllocationSite::GetMode(FAST_SMI_ELEMENTS, FAST_DOUBLE_ELEMENTS);
ElementsTransitionGenerator::GenerateSmiToDouble(masm, receiver, key, value,
@@ -612,7 +612,7 @@ static void KeyedStoreGenerateMegamorphicHelper(
__ bind(&non_double_value);
// Value is not a double, FAST_SMI_ELEMENTS -> FAST_ELEMENTS
__ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, FAST_ELEMENTS,
- receiver_map, r7, slow);
+ receiver_map, scratch, slow);
mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, FAST_ELEMENTS);
ElementsTransitionGenerator::GenerateMapChangeElementsTransition(
masm, receiver, key, value, receiver_map, mode, slow);
@@ -624,7 +624,7 @@ static void KeyedStoreGenerateMegamorphicHelper(
// HeapNumber. Make sure that the receiver is a Array with FAST_ELEMENTS and
// transition array from FAST_DOUBLE_ELEMENTS to FAST_ELEMENTS
__ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS,
- receiver_map, r7, slow);
+ receiver_map, scratch, slow);
mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS);
ElementsTransitionGenerator::GenerateDoubleToObject(
masm, receiver, key, value, receiver_map, mode, slow);
« no previous file with comments | « src/ic/mips64/ic-mips64.cc ('k') | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698