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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/arm64/macro-assembler-arm64-inl.h" | 8 #include "src/arm64/macro-assembler-arm64-inl.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/counters.h" | 10 #include "src/counters.h" |
(...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1987 __ Peek(receiver, 0); | 1987 __ Peek(receiver, 0); |
1988 __ Poke(this_arg, 0); | 1988 __ Poke(this_arg, 0); |
1989 } | 1989 } |
1990 | 1990 |
1991 // ----------- S t a t e ------------- | 1991 // ----------- S t a t e ------------- |
1992 // -- x2 : argArray | 1992 // -- x2 : argArray |
1993 // -- x1 : receiver | 1993 // -- x1 : receiver |
1994 // -- jssp[0] : thisArg | 1994 // -- jssp[0] : thisArg |
1995 // ----------------------------------- | 1995 // ----------------------------------- |
1996 | 1996 |
1997 // 2. Make sure the receiver is actually callable. | 1997 // 2. We don't need to check explicitly for callable receiver here, |
1998 Label receiver_not_callable; | 1998 // since that's the first thing the Call/CallWithArrayLike builtins |
1999 __ JumpIfSmi(receiver, &receiver_not_callable); | 1999 // will do. |
2000 __ Ldr(x10, FieldMemOperand(receiver, HeapObject::kMapOffset)); | |
2001 __ Ldrb(w10, FieldMemOperand(x10, Map::kBitFieldOffset)); | |
2002 __ TestAndBranchIfAllClear(x10, 1 << Map::kIsCallable, | |
2003 &receiver_not_callable); | |
2004 | 2000 |
2005 // 3. Tail call with no arguments if argArray is null or undefined. | 2001 // 3. Tail call with no arguments if argArray is null or undefined. |
2006 Label no_arguments; | 2002 Label no_arguments; |
2007 __ Cmp(arg_array, null_value); | 2003 __ Cmp(arg_array, null_value); |
2008 __ Ccmp(arg_array, undefined_value, ZFlag, ne); | 2004 __ Ccmp(arg_array, undefined_value, ZFlag, ne); |
2009 __ B(eq, &no_arguments); | 2005 __ B(eq, &no_arguments); |
2010 | 2006 |
2011 // 4a. Apply the receiver to the given argArray. | 2007 // 4a. Apply the receiver to the given argArray. |
2012 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), | 2008 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
2013 RelocInfo::CODE_TARGET); | 2009 RelocInfo::CODE_TARGET); |
2014 | 2010 |
2015 // 4b. The argArray is either null or undefined, so we tail call without any | 2011 // 4b. The argArray is either null or undefined, so we tail call without any |
2016 // arguments to the receiver. | 2012 // arguments to the receiver. |
2017 __ Bind(&no_arguments); | 2013 __ Bind(&no_arguments); |
2018 { | 2014 { |
2019 __ Mov(x0, 0); | 2015 __ Mov(x0, 0); |
2020 DCHECK(receiver.Is(x1)); | 2016 DCHECK(receiver.Is(x1)); |
2021 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2017 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
2022 } | 2018 } |
2023 | |
2024 // 4c. The receiver is not callable, throw an appropriate TypeError. | |
2025 __ Bind(&receiver_not_callable); | |
2026 { | |
2027 __ Poke(receiver, 0); | |
2028 __ TailCallRuntime(Runtime::kThrowApplyNonFunction); | |
2029 } | |
2030 } | 2019 } |
2031 | 2020 |
2032 // static | 2021 // static |
2033 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { | 2022 void Builtins::Generate_FunctionPrototypeCall(MacroAssembler* masm) { |
2034 Register argc = x0; | 2023 Register argc = x0; |
2035 Register function = x1; | 2024 Register function = x1; |
2036 Register scratch1 = x10; | 2025 Register scratch1 = x10; |
2037 Register scratch2 = x11; | 2026 Register scratch2 = x11; |
2038 | 2027 |
2039 ASM_LOCATION("Builtins::Generate_FunctionPrototypeCall"); | 2028 ASM_LOCATION("Builtins::Generate_FunctionPrototypeCall"); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 | 2107 |
2119 __ Poke(this_argument, 0); // Overwrite receiver. | 2108 __ Poke(this_argument, 0); // Overwrite receiver. |
2120 } | 2109 } |
2121 | 2110 |
2122 // ----------- S t a t e ------------- | 2111 // ----------- S t a t e ------------- |
2123 // -- x2 : argumentsList | 2112 // -- x2 : argumentsList |
2124 // -- x1 : target | 2113 // -- x1 : target |
2125 // -- jssp[0] : thisArgument | 2114 // -- jssp[0] : thisArgument |
2126 // ----------------------------------- | 2115 // ----------------------------------- |
2127 | 2116 |
2128 // 2. Make sure the target is actually callable. | 2117 // 2. We don't need to check explicitly for callable target here, |
2129 Label target_not_callable; | 2118 // since that's the first thing the Call/CallWithArrayLike builtins |
2130 __ JumpIfSmi(target, &target_not_callable); | 2119 // will do. |
2131 __ Ldr(x10, FieldMemOperand(target, HeapObject::kMapOffset)); | |
2132 __ Ldr(x10, FieldMemOperand(x10, Map::kBitFieldOffset)); | |
2133 __ TestAndBranchIfAllClear(x10, 1 << Map::kIsCallable, &target_not_callable); | |
2134 | 2120 |
2135 // 3a. Apply the target to the given argumentsList. | 2121 // 3. Apply the target to the given argumentsList. |
2136 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), | 2122 __ Jump(masm->isolate()->builtins()->CallWithArrayLike(), |
2137 RelocInfo::CODE_TARGET); | 2123 RelocInfo::CODE_TARGET); |
2138 | |
2139 // 3b. The target is not callable, throw an appropriate TypeError. | |
2140 __ Bind(&target_not_callable); | |
2141 { | |
2142 __ Poke(target, 0); | |
2143 __ TailCallRuntime(Runtime::kThrowApplyNonFunction); | |
2144 } | |
2145 } | 2124 } |
2146 | 2125 |
2147 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { | 2126 void Builtins::Generate_ReflectConstruct(MacroAssembler* masm) { |
2148 // ----------- S t a t e ------------- | 2127 // ----------- S t a t e ------------- |
2149 // -- x0 : argc | 2128 // -- x0 : argc |
2150 // -- jssp[0] : new.target (optional) | 2129 // -- jssp[0] : new.target (optional) |
2151 // -- jssp[8] : argumentsList | 2130 // -- jssp[8] : argumentsList |
2152 // -- jssp[16] : target | 2131 // -- jssp[16] : target |
2153 // -- jssp[24] : receiver | 2132 // -- jssp[24] : receiver |
2154 // ----------------------------------- | 2133 // ----------------------------------- |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3126 // Now jump to the instructions of the returned code object. | 3105 // Now jump to the instructions of the returned code object. |
3127 __ Jump(x8); | 3106 __ Jump(x8); |
3128 } | 3107 } |
3129 | 3108 |
3130 #undef __ | 3109 #undef __ |
3131 | 3110 |
3132 } // namespace internal | 3111 } // namespace internal |
3133 } // namespace v8 | 3112 } // namespace v8 |
3134 | 3113 |
3135 #endif // V8_TARGET_ARCH_ARM | 3114 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |