Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index 59f304d51dd7229daef43d92a864063b80657ab6..6d6a2d99dac2de97e1bd3b28e02fb9b0bf95450c 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -3057,238 +3057,6 @@ void CallICTrampolineStub::Generate(MacroAssembler* masm) { |
__ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
} |
- |
-static void HandleArrayCases(MacroAssembler* masm, Register feedback, |
- Register receiver_map, Register scratch1, |
- Register scratch2, bool is_polymorphic, |
- Label* miss) { |
- // feedback initially contains the feedback array |
- Label next_loop, prepare_next; |
- Label start_polymorphic; |
- |
- Register cached_map = scratch1; |
- |
- __ ldr(cached_map, |
- FieldMemOperand(feedback, FixedArray::OffsetOfElementAt(0))); |
- __ ldr(cached_map, FieldMemOperand(cached_map, WeakCell::kValueOffset)); |
- __ cmp(receiver_map, cached_map); |
- __ b(ne, &start_polymorphic); |
- // found, now call handler. |
- Register handler = feedback; |
- __ ldr(handler, FieldMemOperand(feedback, FixedArray::OffsetOfElementAt(1))); |
- __ add(pc, handler, Operand(Code::kHeaderSize - kHeapObjectTag)); |
- |
- |
- Register length = scratch2; |
- __ bind(&start_polymorphic); |
- __ ldr(length, FieldMemOperand(feedback, FixedArray::kLengthOffset)); |
- if (!is_polymorphic) { |
- // If the IC could be monomorphic we have to make sure we don't go past the |
- // end of the feedback array. |
- __ cmp(length, Operand(Smi::FromInt(2))); |
- __ b(eq, miss); |
- } |
- |
- Register too_far = length; |
- Register pointer_reg = feedback; |
- |
- // +-----+------+------+-----+-----+ ... ----+ |
- // | map | len | wm0 | h0 | wm1 | hN | |
- // +-----+------+------+-----+-----+ ... ----+ |
- // 0 1 2 len-1 |
- // ^ ^ |
- // | | |
- // pointer_reg too_far |
- // aka feedback scratch2 |
- // also need receiver_map |
- // use cached_map (scratch1) to look in the weak map values. |
- __ add(too_far, feedback, Operand::PointerOffsetFromSmiKey(length)); |
- __ add(too_far, too_far, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
- __ add(pointer_reg, feedback, |
- Operand(FixedArray::OffsetOfElementAt(2) - kHeapObjectTag)); |
- |
- __ bind(&next_loop); |
- __ ldr(cached_map, MemOperand(pointer_reg)); |
- __ ldr(cached_map, FieldMemOperand(cached_map, WeakCell::kValueOffset)); |
- __ cmp(receiver_map, cached_map); |
- __ b(ne, &prepare_next); |
- __ ldr(handler, MemOperand(pointer_reg, kPointerSize)); |
- __ add(pc, handler, Operand(Code::kHeaderSize - kHeapObjectTag)); |
- |
- __ bind(&prepare_next); |
- __ add(pointer_reg, pointer_reg, Operand(kPointerSize * 2)); |
- __ cmp(pointer_reg, too_far); |
- __ b(lt, &next_loop); |
- |
- // We exhausted our array of map handler pairs. |
- __ jmp(miss); |
-} |
- |
- |
-static void HandleMonomorphicCase(MacroAssembler* masm, Register receiver, |
- Register receiver_map, Register feedback, |
- Register vector, Register slot, |
- Register scratch, Label* compare_map, |
- Label* load_smi_map, Label* try_array) { |
- __ JumpIfSmi(receiver, load_smi_map); |
- __ ldr(receiver_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); |
- __ bind(compare_map); |
- Register cached_map = scratch; |
- // Move the weak map into the weak_cell register. |
- __ ldr(cached_map, FieldMemOperand(feedback, WeakCell::kValueOffset)); |
- __ cmp(cached_map, receiver_map); |
- __ b(ne, try_array); |
- Register handler = feedback; |
- __ add(handler, vector, Operand::PointerOffsetFromSmiKey(slot)); |
- __ ldr(handler, |
- FieldMemOperand(handler, FixedArray::kHeaderSize + kPointerSize)); |
- __ add(pc, handler, Operand(Code::kHeaderSize - kHeapObjectTag)); |
-} |
- |
-void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { |
- __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); |
- KeyedStoreICStub stub(isolate(), state()); |
- stub.GenerateForTrampoline(masm); |
-} |
- |
-void KeyedStoreICStub::Generate(MacroAssembler* masm) { |
- GenerateImpl(masm, false); |
-} |
- |
-void KeyedStoreICStub::GenerateForTrampoline(MacroAssembler* masm) { |
- GenerateImpl(masm, true); |
-} |
- |
- |
-static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register feedback, |
- Register receiver_map, Register scratch1, |
- Register scratch2, Label* miss) { |
- // feedback initially contains the feedback array |
- Label next_loop, prepare_next; |
- Label start_polymorphic; |
- Label transition_call; |
- |
- Register cached_map = scratch1; |
- Register too_far = scratch2; |
- Register pointer_reg = feedback; |
- __ ldr(too_far, FieldMemOperand(feedback, FixedArray::kLengthOffset)); |
- |
- // +-----+------+------+-----+-----+-----+ ... ----+ |
- // | map | len | wm0 | wt0 | h0 | wm1 | hN | |
- // +-----+------+------+-----+-----+ ----+ ... ----+ |
- // 0 1 2 len-1 |
- // ^ ^ |
- // | | |
- // pointer_reg too_far |
- // aka feedback scratch2 |
- // also need receiver_map |
- // use cached_map (scratch1) to look in the weak map values. |
- __ add(too_far, feedback, Operand::PointerOffsetFromSmiKey(too_far)); |
- __ add(too_far, too_far, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
- __ add(pointer_reg, feedback, |
- Operand(FixedArray::OffsetOfElementAt(0) - kHeapObjectTag)); |
- |
- __ bind(&next_loop); |
- __ ldr(cached_map, MemOperand(pointer_reg)); |
- __ ldr(cached_map, FieldMemOperand(cached_map, WeakCell::kValueOffset)); |
- __ cmp(receiver_map, cached_map); |
- __ b(ne, &prepare_next); |
- // Is it a transitioning store? |
- __ ldr(too_far, MemOperand(pointer_reg, kPointerSize)); |
- __ CompareRoot(too_far, Heap::kUndefinedValueRootIndex); |
- __ b(ne, &transition_call); |
- __ ldr(pointer_reg, MemOperand(pointer_reg, kPointerSize * 2)); |
- __ add(pc, pointer_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); |
- |
- __ bind(&transition_call); |
- __ ldr(too_far, FieldMemOperand(too_far, WeakCell::kValueOffset)); |
- __ JumpIfSmi(too_far, miss); |
- |
- __ ldr(receiver_map, MemOperand(pointer_reg, kPointerSize * 2)); |
- |
- // Load the map into the correct register. |
- DCHECK(feedback.is(StoreTransitionDescriptor::MapRegister())); |
- __ mov(feedback, too_far); |
- |
- __ add(pc, receiver_map, Operand(Code::kHeaderSize - kHeapObjectTag)); |
- |
- __ bind(&prepare_next); |
- __ add(pointer_reg, pointer_reg, Operand(kPointerSize * 3)); |
- __ cmp(pointer_reg, too_far); |
- __ b(lt, &next_loop); |
- |
- // We exhausted our array of map handler pairs. |
- __ jmp(miss); |
-} |
- |
-void KeyedStoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { |
- Register receiver = StoreWithVectorDescriptor::ReceiverRegister(); // r1 |
- Register key = StoreWithVectorDescriptor::NameRegister(); // r2 |
- Register vector = StoreWithVectorDescriptor::VectorRegister(); // r3 |
- Register slot = StoreWithVectorDescriptor::SlotRegister(); // r4 |
- DCHECK(StoreWithVectorDescriptor::ValueRegister().is(r0)); // r0 |
- Register feedback = r5; |
- Register receiver_map = r6; |
- Register scratch1 = r9; |
- |
- __ add(feedback, vector, Operand::PointerOffsetFromSmiKey(slot)); |
- __ ldr(feedback, FieldMemOperand(feedback, FixedArray::kHeaderSize)); |
- |
- // Try to quickly handle the monomorphic case without knowing for sure |
- // if we have a weak cell in feedback. We do know it's safe to look |
- // at WeakCell::kValueOffset. |
- Label try_array, load_smi_map, compare_map; |
- Label not_array, miss; |
- HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, slot, |
- scratch1, &compare_map, &load_smi_map, &try_array); |
- |
- __ bind(&try_array); |
- // Is it a fixed array? |
- __ ldr(scratch1, FieldMemOperand(feedback, HeapObject::kMapOffset)); |
- __ CompareRoot(scratch1, Heap::kFixedArrayMapRootIndex); |
- __ b(ne, ¬_array); |
- |
- // We have a polymorphic element handler. |
- Label polymorphic, try_poly_name; |
- __ bind(&polymorphic); |
- |
- // We are using register r8, which is used for the embedded constant pool |
- // when FLAG_enable_embedded_constant_pool is true. |
- DCHECK(!FLAG_enable_embedded_constant_pool); |
- Register scratch2 = r8; |
- |
- HandlePolymorphicStoreCase(masm, feedback, receiver_map, scratch1, scratch2, |
- &miss); |
- |
- __ bind(¬_array); |
- // Is it generic? |
- __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); |
- __ b(ne, &try_poly_name); |
- Handle<Code> megamorphic_stub = |
- KeyedStoreIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState()); |
- __ Jump(megamorphic_stub, RelocInfo::CODE_TARGET); |
- |
- __ bind(&try_poly_name); |
- // We might have a name in feedback, and a fixed array in the next slot. |
- __ cmp(key, feedback); |
- __ b(ne, &miss); |
- // If the name comparison succeeded, we know we have a fixed array with |
- // at least one map/handler pair. |
- __ add(feedback, vector, Operand::PointerOffsetFromSmiKey(slot)); |
- __ ldr(feedback, |
- FieldMemOperand(feedback, FixedArray::kHeaderSize + kPointerSize)); |
- HandleArrayCases(masm, feedback, receiver_map, scratch1, scratch2, false, |
- &miss); |
- |
- __ bind(&miss); |
- KeyedStoreIC::GenerateMiss(masm); |
- |
- __ bind(&load_smi_map); |
- __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); |
- __ jmp(&compare_map); |
-} |
- |
- |
void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
if (masm->isolate()->function_entry_hook() != NULL) { |
ProfileEntryHookStub stub(masm->isolate()); |