Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 94ce8eb4046b9e056187c0a0b0aebc528f6d8633..9cf2e56a8a2a9e3f24a4f059c063e4c4f6e02dff 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -1408,206 +1408,6 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
__ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
} |
-static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector, |
- Register slot) { |
- __ add(FieldOperand(feedback_vector, slot, times_half_pointer_size, |
- FixedArray::kHeaderSize + kPointerSize), |
- Immediate(Smi::FromInt(1))); |
-} |
- |
-void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
- // eax - number of arguments |
- // edi - function |
- // edx - slot id |
- // ebx - vector |
- __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
- __ cmp(edi, ecx); |
- __ j(not_equal, miss); |
- |
- // Reload ecx. |
- __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
- FixedArray::kHeaderSize)); |
- |
- // Increment the call count for monomorphic function calls. |
- IncrementCallCount(masm, ebx, edx); |
- |
- __ mov(ebx, ecx); |
- __ mov(edx, edi); |
- ArrayConstructorStub stub(masm->isolate()); |
- __ TailCallStub(&stub); |
- |
- // Unreachable. |
-} |
- |
- |
-void CallICStub::Generate(MacroAssembler* masm) { |
- // edi - number of arguments |
- // edi - function |
- // edx - slot id |
- // ebx - vector |
- Isolate* isolate = masm->isolate(); |
- Label extra_checks_or_miss, call, call_function, call_count_incremented; |
- |
- // The checks. First, does edi match the recorded monomorphic target? |
- __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
- 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); |
- |
- __ cmp(edi, FieldOperand(ecx, WeakCell::kValueOffset)); |
- __ j(not_equal, &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(edi, &extra_checks_or_miss); |
- |
- __ bind(&call_function); |
- |
- // Increment the call count for monomorphic function calls. |
- IncrementCallCount(masm, ebx, edx); |
- |
- __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), |
- tail_call_mode()), |
- RelocInfo::CODE_TARGET); |
- |
- __ bind(&extra_checks_or_miss); |
- Label uninitialized, miss, not_allocation_site; |
- |
- __ cmp(ecx, Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); |
- __ j(equal, &call); |
- |
- // Check if we have an allocation site. |
- __ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset), |
- Heap::kAllocationSiteMapRootIndex); |
- __ j(not_equal, ¬_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); |
- } |
- |
- __ cmp(ecx, Immediate(TypeFeedbackVector::UninitializedSentinel(isolate))); |
- __ j(equal, &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(ecx); |
- __ CmpObjectType(ecx, JS_FUNCTION_TYPE, ecx); |
- __ j(not_equal, &miss); |
- __ mov( |
- FieldOperand(ebx, edx, times_half_pointer_size, FixedArray::kHeaderSize), |
- Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); |
- |
- __ bind(&call); |
- |
- // Increment the call count for megamorphic function calls. |
- IncrementCallCount(masm, ebx, edx); |
- |
- __ 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(edi, &miss); |
- |
- // Goto miss case if we do not have a function. |
- __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
- __ j(not_equal, &miss); |
- |
- // Make sure the function is not the Array() function, which requires special |
- // behavior on MISS. |
- __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
- __ cmp(edi, ecx); |
- __ j(equal, &miss); |
- |
- // Make sure the function belongs to the same native context. |
- __ mov(ecx, FieldOperand(edi, JSFunction::kContextOffset)); |
- __ mov(ecx, ContextOperand(ecx, Context::NATIVE_CONTEXT_INDEX)); |
- __ cmp(ecx, NativeContextOperand()); |
- __ j(not_equal, &miss); |
- |
- // Store the function. Use a stub since we need a frame for allocation. |
- // eax - number of arguments |
- // ebx - vector |
- // edx - slot |
- // edi - function |
- { |
- FrameScope scope(masm, StackFrame::INTERNAL); |
- CreateWeakCellStub create_stub(isolate); |
- __ SmiTag(eax); |
- __ push(eax); |
- __ push(ebx); |
- __ push(edx); |
- __ push(edi); |
- __ push(esi); |
- __ CallStub(&create_stub); |
- __ pop(esi); |
- __ pop(edi); |
- __ pop(edx); |
- __ pop(ebx); |
- __ pop(eax); |
- __ SmiUntag(eax); |
- } |
- |
- __ 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); |
- |
- // Unreachable |
- __ int3(); |
-} |
- |
- |
-void CallICStub::GenerateMiss(MacroAssembler* masm) { |
- FrameScope scope(masm, StackFrame::INTERNAL); |
- |
- // Preserve the number of arguments. |
- __ SmiTag(eax); |
- __ push(eax); |
- |
- // Push the function and feedback info. |
- __ push(edi); |
- __ push(ebx); |
- __ push(edx); |
- |
- // Call the entry. |
- __ CallRuntime(Runtime::kCallIC_Miss); |
- |
- // Move result to edi and exit the internal frame. |
- __ mov(edi, eax); |
- |
- // Restore number of arguments. |
- __ pop(eax); |
- __ SmiUntag(eax); |
-} |
- |
- |
bool CEntryStub::NeedsImmovableCode() { |
return false; |
} |