Revision: 9418
Author: [email protected]
Date: Mon Sep 26 00:36:44 2011
Log: Small refactor to KeyedStoreIC::GenerateGeneric to make it
slightly faster.
Review URL: http://codereview.chromium.org/8008016
http://code.google.com/p/v8/source/detail?r=9418
Modified:
/branches/bleeding_edge/src/arm/ic-arm.cc
/branches/bleeding_edge/src/ia32/ic-ia32.cc
=======================================
--- /branches/bleeding_edge/src/arm/ic-arm.cc Fri Sep 23 02:31:20 2011
+++ /branches/bleeding_edge/src/arm/ic-arm.cc Mon Sep 26 00:36:44 2011
@@ -1360,28 +1360,25 @@
__ bind(&fast);
Register scratch_value = r4;
Register address = r5;
+
+ Label non_smi_value;
+ __ JumpIfNotSmi(value, &non_smi_value);
+ // It's irrelevant whether array is smi-only or not when writing a smi.
+ __ add(address, elements, Operand(FixedArray::kHeaderSize -
kHeapObjectTag));
+ __ add(address, address, Operand(key, LSL, kPointerSizeLog2 -
kSmiTagSize));
+ __ str(value, MemOperand(address));
+ __ Ret();
+
+ __ bind(&non_smi_value);
if (FLAG_smi_only_arrays) {
- Label not_smi_only;
- // Make sure the elements are smi-only.
+ // Escape to slow case when writing non-smi into smi-only array.
__ ldr(scratch_value, FieldMemOperand(receiver,
HeapObject::kMapOffset));
- __ CheckFastSmiOnlyElements(scratch_value, scratch_value,
¬_smi_only);
- // Non-smis need to call into the runtime if the array is smi only.
- __ JumpIfNotSmi(value, &slow);
- __ add(address, elements,
- Operand(FixedArray::kHeaderSize - kHeapObjectTag));
- __ add(address, address, Operand(key, LSL, kPointerSizeLog2 -
kSmiTagSize));
- __ str(value, MemOperand(address));
- __ Ret();
- __ bind(¬_smi_only);
- }
- // Fast case, store the value to the elements backing store.
+ __ CheckFastObjectElements(scratch_value, scratch_value, &slow);
+ }
+ // Fast elements array, store the value to the elements backing store.
__ add(address, elements, Operand(FixedArray::kHeaderSize -
kHeapObjectTag));
__ add(address, address, Operand(key, LSL, kPointerSizeLog2 -
kSmiTagSize));
__ str(value, MemOperand(address));
- // Skip write barrier if the written value is a smi.
- __ tst(value, Operand(kSmiTagMask));
- __ Ret(eq);
-
// Update write barrier for the elements array address.
__ mov(scratch_value, value); // Preserve the value which is returned.
__ RecordWrite(elements,
@@ -1391,7 +1388,6 @@
kDontSaveFPRegs,
EMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
-
__ Ret();
}
=======================================
--- /branches/bleeding_edge/src/ia32/ic-ia32.cc Thu Sep 22 04:30:04 2011
+++ /branches/bleeding_edge/src/ia32/ic-ia32.cc Mon Sep 26 00:36:44 2011
@@ -811,23 +811,24 @@
// edx: receiver
// edi: FixedArray receiver->elements
+ Label non_smi_value;
+ __ JumpIfNotSmi(eax, &non_smi_value);
+ // It's irrelevant whether array is smi-only or not when writing a smi.
+ __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax);
+ __ ret(0);
+
+ __ bind(&non_smi_value);
if (FLAG_smi_only_arrays) {
- Label not_smi_only;
- // Make sure the elements are smi-only.
+ // Escape to slow case when writing non-smi into smi-only array.
__ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset));
- __ CheckFastSmiOnlyElements(ebx, ¬_smi_only, Label::kNear);
- // Non-smis need to call into the runtime if the array is smi only.
- __ JumpIfNotSmi(eax, &slow);
- __ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax);
- __ ret(0);
- __ bind(¬_smi_only);
- }
-
+ __ CheckFastObjectElements(ebx, &slow, Label::kNear);
+ }
+ // Fast elements array, store the value to the elements backing store.
__ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax);
-
// Update write barrier for the elements array address.
__ mov(edx, Operand(eax)); // Preserve the value which is returned.
- __ RecordWriteArray(edi, edx, ecx, kDontSaveFPRegs);
+ __ RecordWriteArray(
+ edi, edx, ecx, kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
__ ret(0);
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev