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_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1738 | 1738 |
1739 Label non_callable, non_function, non_smi; | 1739 Label non_callable, non_function, non_smi; |
1740 __ JumpIfSmi(rdi, &non_callable); | 1740 __ JumpIfSmi(rdi, &non_callable); |
1741 __ bind(&non_smi); | 1741 __ bind(&non_smi); |
1742 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); | 1742 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); |
1743 __ j(equal, masm->isolate()->builtins()->CallFunction(mode), | 1743 __ j(equal, masm->isolate()->builtins()->CallFunction(mode), |
1744 RelocInfo::CODE_TARGET); | 1744 RelocInfo::CODE_TARGET); |
1745 __ CmpInstanceType(rcx, JS_PROXY_TYPE); | 1745 __ CmpInstanceType(rcx, JS_PROXY_TYPE); |
1746 __ j(not_equal, &non_function); | 1746 __ j(not_equal, &non_function); |
1747 | 1747 |
1748 // 1. Call to function proxy. | 1748 // 1. Runtime fallback for Proxy [[Call]]. |
1749 // TODO(neis): Implement [[Call]] on proxies. | 1749 __ PopReturnAddressTo(kScratchRegister); |
| 1750 __ Push(rdi); |
| 1751 __ PushReturnAddressFrom(kScratchRegister); |
| 1752 // Increase the arguments size to include the pushed function and the |
| 1753 // existing receiver on the stack. |
| 1754 __ addp(rax, Immediate(2)); |
| 1755 // Tail-call to the runtime. |
| 1756 __ JumpToExternalReference( |
| 1757 ExternalReference(Runtime::kJSProxyCall, masm->isolate()), 1); |
1750 | 1758 |
1751 // 2. Call to something else, which might have a [[Call]] internal method (if | 1759 // 2. Call to something else, which might have a [[Call]] internal method (if |
1752 // not we raise an exception). | 1760 // not we raise an exception). |
1753 __ bind(&non_function); | 1761 __ bind(&non_function); |
1754 // Check if target has a [[Call]] internal method. | 1762 // Check if target has a [[Call]] internal method. |
1755 __ testb(FieldOperand(rcx, Map::kBitFieldOffset), | 1763 __ testb(FieldOperand(rcx, Map::kBitFieldOffset), |
1756 Immediate(1 << Map::kIsCallable)); | 1764 Immediate(1 << Map::kIsCallable)); |
1757 __ j(zero, &non_callable, Label::kNear); | 1765 __ j(zero, &non_callable, Label::kNear); |
1758 // Overwrite the original receiver with the (original) target. | 1766 // Overwrite the original receiver with the (original) target. |
1759 __ movp(args.GetReceiverOperand(), rdi); | 1767 __ movp(args.GetReceiverOperand(), rdi); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 __ ret(0); | 2042 __ ret(0); |
2035 } | 2043 } |
2036 | 2044 |
2037 | 2045 |
2038 #undef __ | 2046 #undef __ |
2039 | 2047 |
2040 } // namespace internal | 2048 } // namespace internal |
2041 } // namespace v8 | 2049 } // namespace v8 |
2042 | 2050 |
2043 #endif // V8_TARGET_ARCH_X64 | 2051 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |