OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 Register jmp_reg = rcx; | 2034 Register jmp_reg = rcx; |
2035 __ movp(jmp_reg, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 2035 __ movp(jmp_reg, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
2036 __ movp(jmp_reg, FieldOperand(jmp_reg, | 2036 __ movp(jmp_reg, FieldOperand(jmp_reg, |
2037 SharedFunctionInfo::kConstructStubOffset)); | 2037 SharedFunctionInfo::kConstructStubOffset)); |
2038 __ leap(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize)); | 2038 __ leap(jmp_reg, FieldOperand(jmp_reg, Code::kHeaderSize)); |
2039 __ jmp(jmp_reg); | 2039 __ jmp(jmp_reg); |
2040 | 2040 |
2041 // rdi: called object | 2041 // rdi: called object |
2042 // rax: number of arguments | 2042 // rax: number of arguments |
2043 // r11: object map | 2043 // r11: object map |
2044 Label do_call; | |
2045 __ bind(&slow); | 2044 __ bind(&slow); |
2046 __ CmpInstanceType(r11, JS_FUNCTION_PROXY_TYPE); | 2045 { |
2047 __ j(not_equal, &non_function_call); | 2046 StackArgumentsAccessor args(rsp, rax); |
2048 __ GetBuiltinEntry(rdx, | 2047 // Overwrite the original receiver with the (original) target (not necessary |
2049 Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX); | 2048 // in case of rdi being smi, when we jump directly to non_function_call |
2050 __ jmp(&do_call); | 2049 // below). |
| 2050 __ movp(args.GetReceiverOperand(), rdi); |
2051 | 2051 |
2052 __ bind(&non_function_call); | 2052 __ CmpInstanceType(r11, JS_FUNCTION_PROXY_TYPE); |
2053 __ GetBuiltinEntry(rdx, | 2053 __ j(not_equal, &non_function_call, Label::kNear); |
2054 Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX); | 2054 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
2055 __ bind(&do_call); | 2055 __ movp(rdi, FieldOperand(rdi, JSFunctionProxy::kConstructTrapOffset)); |
2056 // Set expected number of arguments to zero (not changing rax). | 2056 __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
2057 __ Set(rbx, 0); | 2057 |
2058 __ Jump(isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2058 __ bind(&non_function_call); |
2059 RelocInfo::CODE_TARGET); | 2059 { |
| 2060 // Determine the delegate for the target (if any). |
| 2061 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2062 __ Integer32ToSmi(rax, rax); |
| 2063 __ Push(rax); |
| 2064 __ Push(rdi); |
| 2065 __ CallRuntime(Runtime::kGetConstructorDelegate, 1); |
| 2066 __ movp(rdi, rax); |
| 2067 __ Pop(rax); |
| 2068 __ SmiToInteger32(rax, rax); |
| 2069 } |
| 2070 // The delegate is always a regular function. |
| 2071 __ AssertFunction(rdi); |
| 2072 __ Jump(isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET); |
| 2073 } |
2060 } | 2074 } |
2061 | 2075 |
2062 | 2076 |
2063 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { | 2077 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { |
2064 __ movp(vector, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 2078 __ movp(vector, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
2065 __ movp(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); | 2079 __ movp(vector, FieldOperand(vector, JSFunction::kSharedFunctionInfoOffset)); |
2066 __ movp(vector, FieldOperand(vector, | 2080 __ movp(vector, FieldOperand(vector, |
2067 SharedFunctionInfo::kFeedbackVectorOffset)); | 2081 SharedFunctionInfo::kFeedbackVectorOffset)); |
2068 } | 2082 } |
2069 | 2083 |
(...skipping 3504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5574 kStackSpace, nullptr, return_value_operand, NULL); | 5588 kStackSpace, nullptr, return_value_operand, NULL); |
5575 } | 5589 } |
5576 | 5590 |
5577 | 5591 |
5578 #undef __ | 5592 #undef __ |
5579 | 5593 |
5580 } // namespace internal | 5594 } // namespace internal |
5581 } // namespace v8 | 5595 } // namespace v8 |
5582 | 5596 |
5583 #endif // V8_TARGET_ARCH_X64 | 5597 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |