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 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2171 __ mov(jmp_reg, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 2171 __ mov(jmp_reg, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
2172 __ mov(jmp_reg, FieldOperand(jmp_reg, | 2172 __ mov(jmp_reg, FieldOperand(jmp_reg, |
2173 SharedFunctionInfo::kConstructStubOffset)); | 2173 SharedFunctionInfo::kConstructStubOffset)); |
2174 __ lea(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize)); | 2174 __ lea(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize)); |
2175 __ jmp(jmp_reg); | 2175 __ jmp(jmp_reg); |
2176 | 2176 |
2177 // edi: called object | 2177 // edi: called object |
2178 // eax: number of arguments | 2178 // eax: number of arguments |
2179 // ecx: object map | 2179 // ecx: object map |
2180 // esp[0]: original receiver (for IsSuperConstructorCall) | 2180 // esp[0]: original receiver (for IsSuperConstructorCall) |
2181 Label do_call; | |
2182 __ bind(&slow); | 2181 __ bind(&slow); |
2183 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); | 2182 { |
2184 __ j(not_equal, &non_function_call); | 2183 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); |
2185 __ GetBuiltinEntry(edx, | 2184 __ j(not_equal, &non_function_call, Label::kNear); |
2186 Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX); | 2185 if (IsSuperConstructorCall()) __ Drop(1); |
2187 __ jmp(&do_call); | 2186 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
| 2187 __ mov(edi, FieldOperand(edi, JSFunctionProxy::kConstructTrapOffset)); |
| 2188 __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
2188 | 2189 |
2189 __ bind(&non_function_call); | 2190 __ bind(&non_function_call); |
2190 __ GetBuiltinEntry(edx, | 2191 if (IsSuperConstructorCall()) __ Drop(1); |
2191 Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX); | 2192 { |
2192 __ bind(&do_call); | 2193 // Determine the delegate for the target (if any). |
2193 if (IsSuperConstructorCall()) { | 2194 FrameScope scope(masm, StackFrame::INTERNAL); |
2194 __ Drop(1); | 2195 __ SmiTag(eax); |
| 2196 __ Push(eax); |
| 2197 __ Push(edi); |
| 2198 __ CallRuntime(Runtime::kGetConstructorDelegate, 1); |
| 2199 __ mov(edi, eax); |
| 2200 __ Pop(eax); |
| 2201 __ SmiUntag(eax); |
| 2202 } |
| 2203 // The delegate is always a regular function. |
| 2204 __ AssertFunction(edi); |
| 2205 __ Jump(isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET); |
2195 } | 2206 } |
2196 // Set expected number of arguments to zero (not changing eax). | |
2197 __ Move(ebx, Immediate(0)); | |
2198 Handle<Code> arguments_adaptor = | |
2199 isolate()->builtins()->ArgumentsAdaptorTrampoline(); | |
2200 __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET); | |
2201 } | 2207 } |
2202 | 2208 |
2203 | 2209 |
2204 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { | 2210 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { |
2205 __ mov(vector, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | 2211 __ mov(vector, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
2206 __ mov(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); | 2212 __ mov(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); |
2207 __ mov(vector, FieldOperand(vector, | 2213 __ mov(vector, FieldOperand(vector, |
2208 SharedFunctionInfo::kFeedbackVectorOffset)); | 2214 SharedFunctionInfo::kFeedbackVectorOffset)); |
2209 } | 2215 } |
2210 | 2216 |
(...skipping 3589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5800 Operand(ebp, 7 * kPointerSize), NULL); | 5806 Operand(ebp, 7 * kPointerSize), NULL); |
5801 } | 5807 } |
5802 | 5808 |
5803 | 5809 |
5804 #undef __ | 5810 #undef __ |
5805 | 5811 |
5806 } // namespace internal | 5812 } // namespace internal |
5807 } // namespace v8 | 5813 } // namespace v8 |
5808 | 5814 |
5809 #endif // V8_TARGET_ARCH_IA32 | 5815 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |