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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2041 __ mov(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); | 2041 __ mov(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); |
2042 __ mov(vector, FieldOperand(vector, | 2042 __ mov(vector, FieldOperand(vector, |
2043 SharedFunctionInfo::kFeedbackVectorOffset)); | 2043 SharedFunctionInfo::kFeedbackVectorOffset)); |
2044 } | 2044 } |
2045 | 2045 |
2046 | 2046 |
2047 void CallIC_ArrayStub::Generate(MacroAssembler* masm) { | 2047 void CallIC_ArrayStub::Generate(MacroAssembler* masm) { |
2048 // edi - function | 2048 // edi - function |
2049 // edx - slot id | 2049 // edx - slot id |
2050 Label miss; | 2050 Label miss; |
2051 int argc = state_.arg_count(); | 2051 int argc = arg_count(); |
2052 ParameterCount actual(argc); | 2052 ParameterCount actual(argc); |
2053 | 2053 |
2054 EmitLoadTypeFeedbackVector(masm, ebx); | 2054 EmitLoadTypeFeedbackVector(masm, ebx); |
2055 | 2055 |
2056 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); | 2056 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
2057 __ cmp(edi, ecx); | 2057 __ cmp(edi, ecx); |
2058 __ j(not_equal, &miss); | 2058 __ j(not_equal, &miss); |
2059 | 2059 |
2060 __ mov(eax, arg_count()); | 2060 __ mov(eax, arg_count()); |
2061 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 2061 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
(...skipping 23 matching lines...) Expand all Loading... |
2085 } | 2085 } |
2086 | 2086 |
2087 | 2087 |
2088 void CallICStub::Generate(MacroAssembler* masm) { | 2088 void CallICStub::Generate(MacroAssembler* masm) { |
2089 // edi - function | 2089 // edi - function |
2090 // edx - slot id | 2090 // edx - slot id |
2091 Isolate* isolate = masm->isolate(); | 2091 Isolate* isolate = masm->isolate(); |
2092 Label extra_checks_or_miss, slow_start; | 2092 Label extra_checks_or_miss, slow_start; |
2093 Label slow, non_function, wrap, cont; | 2093 Label slow, non_function, wrap, cont; |
2094 Label have_js_function; | 2094 Label have_js_function; |
2095 int argc = state_.arg_count(); | 2095 int argc = arg_count(); |
2096 ParameterCount actual(argc); | 2096 ParameterCount actual(argc); |
2097 | 2097 |
2098 EmitLoadTypeFeedbackVector(masm, ebx); | 2098 EmitLoadTypeFeedbackVector(masm, ebx); |
2099 | 2099 |
2100 // The checks. First, does edi match the recorded monomorphic target? | 2100 // The checks. First, does edi match the recorded monomorphic target? |
2101 __ cmp(edi, FieldOperand(ebx, edx, times_half_pointer_size, | 2101 __ cmp(edi, FieldOperand(ebx, edx, times_half_pointer_size, |
2102 FixedArray::kHeaderSize)); | 2102 FixedArray::kHeaderSize)); |
2103 __ j(not_equal, &extra_checks_or_miss); | 2103 __ j(not_equal, &extra_checks_or_miss); |
2104 | 2104 |
2105 __ bind(&have_js_function); | 2105 __ bind(&have_js_function); |
2106 if (state_.CallAsMethod()) { | 2106 if (CallAsMethod()) { |
2107 EmitContinueIfStrictOrNative(masm, &cont); | 2107 EmitContinueIfStrictOrNative(masm, &cont); |
2108 | 2108 |
2109 // Load the receiver from the stack. | 2109 // Load the receiver from the stack. |
2110 __ mov(eax, Operand(esp, (argc + 1) * kPointerSize)); | 2110 __ mov(eax, Operand(esp, (argc + 1) * kPointerSize)); |
2111 | 2111 |
2112 __ JumpIfSmi(eax, &wrap); | 2112 __ JumpIfSmi(eax, &wrap); |
2113 | 2113 |
2114 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); | 2114 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); |
2115 __ j(below, &wrap); | 2115 __ j(below, &wrap); |
2116 | 2116 |
2117 __ bind(&cont); | 2117 __ bind(&cont); |
2118 } | 2118 } |
2119 | 2119 |
2120 __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper()); | 2120 __ InvokeFunction(edi, actual, JUMP_FUNCTION, NullCallWrapper()); |
2121 | 2121 |
2122 __ bind(&slow); | 2122 __ bind(&slow); |
2123 EmitSlowCase(isolate, masm, argc, &non_function); | 2123 EmitSlowCase(isolate, masm, argc, &non_function); |
2124 | 2124 |
2125 if (state_.CallAsMethod()) { | 2125 if (CallAsMethod()) { |
2126 __ bind(&wrap); | 2126 __ bind(&wrap); |
2127 EmitWrapCase(masm, argc, &cont); | 2127 EmitWrapCase(masm, argc, &cont); |
2128 } | 2128 } |
2129 | 2129 |
2130 __ bind(&extra_checks_or_miss); | 2130 __ bind(&extra_checks_or_miss); |
2131 Label miss; | 2131 Label miss; |
2132 | 2132 |
2133 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 2133 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
2134 FixedArray::kHeaderSize)); | 2134 FixedArray::kHeaderSize)); |
2135 __ cmp(ecx, Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); | 2135 __ cmp(ecx, Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); |
(...skipping 28 matching lines...) Expand all Loading... |
2164 __ j(not_equal, &slow); | 2164 __ j(not_equal, &slow); |
2165 __ jmp(&have_js_function); | 2165 __ jmp(&have_js_function); |
2166 | 2166 |
2167 // Unreachable | 2167 // Unreachable |
2168 __ int3(); | 2168 __ int3(); |
2169 } | 2169 } |
2170 | 2170 |
2171 | 2171 |
2172 void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) { | 2172 void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) { |
2173 // Get the receiver of the function from the stack; 1 ~ return address. | 2173 // Get the receiver of the function from the stack; 1 ~ return address. |
2174 __ mov(ecx, Operand(esp, (state_.arg_count() + 1) * kPointerSize)); | 2174 __ mov(ecx, Operand(esp, (arg_count() + 1) * kPointerSize)); |
2175 | 2175 |
2176 { | 2176 { |
2177 FrameScope scope(masm, StackFrame::INTERNAL); | 2177 FrameScope scope(masm, StackFrame::INTERNAL); |
2178 | 2178 |
2179 // Push the receiver and the function and feedback info. | 2179 // Push the receiver and the function and feedback info. |
2180 __ push(ecx); | 2180 __ push(ecx); |
2181 __ push(edi); | 2181 __ push(edi); |
2182 __ push(ebx); | 2182 __ push(ebx); |
2183 __ push(edx); | 2183 __ push(edx); |
2184 | 2184 |
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4644 Operand(ebp, 7 * kPointerSize), | 4644 Operand(ebp, 7 * kPointerSize), |
4645 NULL); | 4645 NULL); |
4646 } | 4646 } |
4647 | 4647 |
4648 | 4648 |
4649 #undef __ | 4649 #undef __ |
4650 | 4650 |
4651 } } // namespace v8::internal | 4651 } } // namespace v8::internal |
4652 | 4652 |
4653 #endif // V8_TARGET_ARCH_X87 | 4653 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |