| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2114 | 2114 |
| 2115 void CallICStub::Generate(MacroAssembler* masm) { | 2115 void CallICStub::Generate(MacroAssembler* masm) { |
| 2116 // edi - function | 2116 // edi - function |
| 2117 // edx - slot id | 2117 // edx - slot id |
| 2118 // ebx - vector | 2118 // ebx - vector |
| 2119 Isolate* isolate = masm->isolate(); | 2119 Isolate* isolate = masm->isolate(); |
| 2120 const int with_types_offset = | 2120 const int with_types_offset = |
| 2121 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); | 2121 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); |
| 2122 const int generic_offset = | 2122 const int generic_offset = |
| 2123 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); | 2123 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); |
| 2124 Label extra_checks_or_miss, call; | 2124 Label extra_checks_or_miss, call, call_function; |
| 2125 int argc = arg_count(); | 2125 int argc = arg_count(); |
| 2126 ParameterCount actual(argc); | 2126 ParameterCount actual(argc); |
| 2127 | 2127 |
| 2128 // The checks. First, does edi match the recorded monomorphic target? | 2128 // The checks. First, does edi match the recorded monomorphic target? |
| 2129 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 2129 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
| 2130 FixedArray::kHeaderSize)); | 2130 FixedArray::kHeaderSize)); |
| 2131 | 2131 |
| 2132 // We don't know that we have a weak cell. We might have a private symbol | 2132 // We don't know that we have a weak cell. We might have a private symbol |
| 2133 // or an AllocationSite, but the memory is safe to examine. | 2133 // or an AllocationSite, but the memory is safe to examine. |
| 2134 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to | 2134 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2148 | 2148 |
| 2149 // The compare above could have been a SMI/SMI comparison. Guard against this | 2149 // The compare above could have been a SMI/SMI comparison. Guard against this |
| 2150 // convincing us that we have a monomorphic JSFunction. | 2150 // convincing us that we have a monomorphic JSFunction. |
| 2151 __ JumpIfSmi(edi, &extra_checks_or_miss); | 2151 __ JumpIfSmi(edi, &extra_checks_or_miss); |
| 2152 | 2152 |
| 2153 // Increment the call count for monomorphic function calls. | 2153 // Increment the call count for monomorphic function calls. |
| 2154 __ add(FieldOperand(ebx, edx, times_half_pointer_size, | 2154 __ add(FieldOperand(ebx, edx, times_half_pointer_size, |
| 2155 FixedArray::kHeaderSize + kPointerSize), | 2155 FixedArray::kHeaderSize + kPointerSize), |
| 2156 Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 2156 Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
| 2157 | 2157 |
| 2158 __ bind(&call); | 2158 __ bind(&call_function); |
| 2159 __ Set(eax, argc); | 2159 __ Set(eax, argc); |
| 2160 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2160 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode()), |
| 2161 RelocInfo::CODE_TARGET); |
| 2161 | 2162 |
| 2162 __ bind(&extra_checks_or_miss); | 2163 __ bind(&extra_checks_or_miss); |
| 2163 Label uninitialized, miss, not_allocation_site; | 2164 Label uninitialized, miss, not_allocation_site; |
| 2164 | 2165 |
| 2165 __ cmp(ecx, Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); | 2166 __ cmp(ecx, Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); |
| 2166 __ j(equal, &call); | 2167 __ j(equal, &call); |
| 2167 | 2168 |
| 2168 // Check if we have an allocation site. | 2169 // Check if we have an allocation site. |
| 2169 __ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset), | 2170 __ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset), |
| 2170 Heap::kAllocationSiteMapRootIndex); | 2171 Heap::kAllocationSiteMapRootIndex); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2188 // to handle it here. More complex cases are dealt with in the runtime. | 2189 // to handle it here. More complex cases are dealt with in the runtime. |
| 2189 __ AssertNotSmi(ecx); | 2190 __ AssertNotSmi(ecx); |
| 2190 __ CmpObjectType(ecx, JS_FUNCTION_TYPE, ecx); | 2191 __ CmpObjectType(ecx, JS_FUNCTION_TYPE, ecx); |
| 2191 __ j(not_equal, &miss); | 2192 __ j(not_equal, &miss); |
| 2192 __ mov( | 2193 __ mov( |
| 2193 FieldOperand(ebx, edx, times_half_pointer_size, FixedArray::kHeaderSize), | 2194 FieldOperand(ebx, edx, times_half_pointer_size, FixedArray::kHeaderSize), |
| 2194 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); | 2195 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); |
| 2195 // We have to update statistics for runtime profiling. | 2196 // We have to update statistics for runtime profiling. |
| 2196 __ sub(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1))); | 2197 __ sub(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1))); |
| 2197 __ add(FieldOperand(ebx, generic_offset), Immediate(Smi::FromInt(1))); | 2198 __ add(FieldOperand(ebx, generic_offset), Immediate(Smi::FromInt(1))); |
| 2198 __ jmp(&call); | 2199 |
| 2200 __ bind(&call); |
| 2201 __ Set(eax, argc); |
| 2202 __ Jump(masm->isolate()->builtins()->Call(convert_mode()), |
| 2203 RelocInfo::CODE_TARGET); |
| 2199 | 2204 |
| 2200 __ bind(&uninitialized); | 2205 __ bind(&uninitialized); |
| 2201 | 2206 |
| 2202 // We are going monomorphic, provided we actually have a JSFunction. | 2207 // We are going monomorphic, provided we actually have a JSFunction. |
| 2203 __ JumpIfSmi(edi, &miss); | 2208 __ JumpIfSmi(edi, &miss); |
| 2204 | 2209 |
| 2205 // Goto miss case if we do not have a function. | 2210 // Goto miss case if we do not have a function. |
| 2206 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 2211 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
| 2207 __ j(not_equal, &miss); | 2212 __ j(not_equal, &miss); |
| 2208 | 2213 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2232 // edx - slot | 2237 // edx - slot |
| 2233 // edi - function | 2238 // edi - function |
| 2234 { | 2239 { |
| 2235 FrameScope scope(masm, StackFrame::INTERNAL); | 2240 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2236 CreateWeakCellStub create_stub(isolate); | 2241 CreateWeakCellStub create_stub(isolate); |
| 2237 __ push(edi); | 2242 __ push(edi); |
| 2238 __ CallStub(&create_stub); | 2243 __ CallStub(&create_stub); |
| 2239 __ pop(edi); | 2244 __ pop(edi); |
| 2240 } | 2245 } |
| 2241 | 2246 |
| 2242 __ jmp(&call); | 2247 __ jmp(&call_function); |
| 2243 | 2248 |
| 2244 // We are here because tracing is on or we encountered a MISS case we can't | 2249 // We are here because tracing is on or we encountered a MISS case we can't |
| 2245 // handle here. | 2250 // handle here. |
| 2246 __ bind(&miss); | 2251 __ bind(&miss); |
| 2247 GenerateMiss(masm); | 2252 GenerateMiss(masm); |
| 2248 | 2253 |
| 2249 __ jmp(&call); | 2254 __ jmp(&call); |
| 2250 | 2255 |
| 2251 // Unreachable | 2256 // Unreachable |
| 2252 __ int3(); | 2257 __ int3(); |
| (...skipping 3413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5666 Operand(ebp, 7 * kPointerSize), NULL); | 5671 Operand(ebp, 7 * kPointerSize), NULL); |
| 5667 } | 5672 } |
| 5668 | 5673 |
| 5669 | 5674 |
| 5670 #undef __ | 5675 #undef __ |
| 5671 | 5676 |
| 5672 } // namespace internal | 5677 } // namespace internal |
| 5673 } // namespace v8 | 5678 } // namespace v8 |
| 5674 | 5679 |
| 5675 #endif // V8_TARGET_ARCH_IA32 | 5680 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |