Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index 93d2d05a0e68b65c49a3dcf62c8e650aa0553e2f..2b3891e5f613abdfe28dea8432853573988a5edb 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -1758,192 +1758,6 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
__ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
} |
-// Note: feedback_vector and slot are clobbered after the call. |
-static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector, |
- Register slot) { |
- __ add(feedback_vector, feedback_vector, |
- Operand::PointerOffsetFromSmiKey(slot)); |
- __ add(feedback_vector, feedback_vector, |
- Operand(FixedArray::kHeaderSize + kPointerSize)); |
- __ ldr(slot, FieldMemOperand(feedback_vector, 0)); |
- __ add(slot, slot, Operand(Smi::FromInt(1))); |
- __ str(slot, FieldMemOperand(feedback_vector, 0)); |
-} |
- |
-void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
- // r0 - number of arguments |
- // r1 - function |
- // r3 - slot id |
- // r2 - vector |
- // r4 - allocation site (loaded from vector[slot]) |
- __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r5); |
- __ cmp(r1, r5); |
- __ b(ne, miss); |
- |
- // Increment the call count for monomorphic function calls. |
- IncrementCallCount(masm, r2, r3); |
- |
- __ mov(r2, r4); |
- __ mov(r3, r1); |
- ArrayConstructorStub stub(masm->isolate()); |
- __ TailCallStub(&stub); |
-} |
- |
- |
-void CallICStub::Generate(MacroAssembler* masm) { |
- // r0 - number of arguments |
- // r1 - function |
- // r3 - slot id (Smi) |
- // r2 - vector |
- Label extra_checks_or_miss, call, call_function, call_count_incremented; |
- |
- // The checks. First, does r1 match the recorded monomorphic target? |
- __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
- __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
- |
- // We don't know that we have a weak cell. We might have a private symbol |
- // or an AllocationSite, but the memory is safe to examine. |
- // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to |
- // FixedArray. |
- // WeakCell::kValueOffset - contains a JSFunction or Smi(0) |
- // Symbol::kHashFieldSlot - if the low bit is 1, then the hash is not |
- // computed, meaning that it can't appear to be a pointer. If the low bit is |
- // 0, then hash is computed, but the 0 bit prevents the field from appearing |
- // to be a pointer. |
- STATIC_ASSERT(WeakCell::kSize >= kPointerSize); |
- STATIC_ASSERT(AllocationSite::kTransitionInfoOffset == |
- WeakCell::kValueOffset && |
- WeakCell::kValueOffset == Symbol::kHashFieldSlot); |
- |
- __ ldr(r5, FieldMemOperand(r4, WeakCell::kValueOffset)); |
- __ cmp(r1, r5); |
- __ b(ne, &extra_checks_or_miss); |
- |
- // The compare above could have been a SMI/SMI comparison. Guard against this |
- // convincing us that we have a monomorphic JSFunction. |
- __ JumpIfSmi(r1, &extra_checks_or_miss); |
- |
- __ bind(&call_function); |
- |
- // Increment the call count for monomorphic function calls. |
- IncrementCallCount(masm, r2, r3); |
- |
- __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), |
- tail_call_mode()), |
- RelocInfo::CODE_TARGET); |
- |
- __ bind(&extra_checks_or_miss); |
- Label uninitialized, miss, not_allocation_site; |
- |
- __ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex); |
- __ b(eq, &call); |
- |
- // Verify that r4 contains an AllocationSite |
- __ ldr(r5, FieldMemOperand(r4, HeapObject::kMapOffset)); |
- __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
- __ b(ne, ¬_allocation_site); |
- |
- // We have an allocation site. |
- HandleArrayCase(masm, &miss); |
- |
- __ bind(¬_allocation_site); |
- |
- // The following cases attempt to handle MISS cases without going to the |
- // runtime. |
- if (FLAG_trace_ic) { |
- __ jmp(&miss); |
- } |
- |
- __ CompareRoot(r4, Heap::kuninitialized_symbolRootIndex); |
- __ b(eq, &uninitialized); |
- |
- // We are going megamorphic. If the feedback is a JSFunction, it is fine |
- // to handle it here. More complex cases are dealt with in the runtime. |
- __ AssertNotSmi(r4); |
- __ CompareObjectType(r4, r5, r5, JS_FUNCTION_TYPE); |
- __ b(ne, &miss); |
- __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
- __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); |
- __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
- |
- __ bind(&call); |
- |
- // Increment the call count for megamorphic function calls. |
- IncrementCallCount(masm, r2, r3); |
- |
- __ bind(&call_count_incremented); |
- __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), |
- RelocInfo::CODE_TARGET); |
- |
- __ bind(&uninitialized); |
- |
- // We are going monomorphic, provided we actually have a JSFunction. |
- __ JumpIfSmi(r1, &miss); |
- |
- // Goto miss case if we do not have a function. |
- __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); |
- __ b(ne, &miss); |
- |
- // Make sure the function is not the Array() function, which requires special |
- // behavior on MISS. |
- __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r4); |
- __ cmp(r1, r4); |
- __ b(eq, &miss); |
- |
- // Make sure the function belongs to the same native context. |
- __ ldr(r4, FieldMemOperand(r1, JSFunction::kContextOffset)); |
- __ ldr(r4, ContextMemOperand(r4, Context::NATIVE_CONTEXT_INDEX)); |
- __ ldr(ip, NativeContextMemOperand()); |
- __ cmp(r4, ip); |
- __ b(ne, &miss); |
- |
- // Store the function. Use a stub since we need a frame for allocation. |
- // r2 - vector |
- // r3 - slot |
- // r1 - function |
- { |
- FrameScope scope(masm, StackFrame::INTERNAL); |
- CreateWeakCellStub create_stub(masm->isolate()); |
- __ SmiTag(r0); |
- __ Push(r0, r2, r3, cp, r1); |
- __ CallStub(&create_stub); |
- __ Pop(r2, r3, cp, r1); |
- __ Pop(r0); |
- __ SmiUntag(r0); |
- } |
- |
- __ jmp(&call_function); |
- |
- // We are here because tracing is on or we encountered a MISS case we can't |
- // handle here. |
- __ bind(&miss); |
- GenerateMiss(masm); |
- |
- __ jmp(&call_count_incremented); |
-} |
- |
- |
-void CallICStub::GenerateMiss(MacroAssembler* masm) { |
- FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
- |
- // Preserve the number of arguments as Smi. |
- __ SmiTag(r0); |
- |
- // Push the receiver and the function and feedback info. |
- __ Push(r0, r1, r2, r3); |
- |
- // Call the entry. |
- __ CallRuntime(Runtime::kCallIC_Miss); |
- |
- // Move result to edi and exit the internal frame. |
- __ mov(r1, r0); |
- |
- // Restore number of arguments. |
- __ Pop(r0); |
- __ SmiUntag(r0); |
-} |
- |
- |
// StringCharCodeAtGenerator |
void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
// If the receiver is a smi trigger the non-string case. |