| 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 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 __ Poke(undefined_value, 0); // Overwrite receiver. | 2168 __ Poke(undefined_value, 0); // Overwrite receiver. |
| 2169 } | 2169 } |
| 2170 | 2170 |
| 2171 // ----------- S t a t e ------------- | 2171 // ----------- S t a t e ------------- |
| 2172 // -- x2 : argumentsList | 2172 // -- x2 : argumentsList |
| 2173 // -- x1 : target | 2173 // -- x1 : target |
| 2174 // -- x3 : new.target | 2174 // -- x3 : new.target |
| 2175 // -- jssp[0] : receiver (undefined) | 2175 // -- jssp[0] : receiver (undefined) |
| 2176 // ----------------------------------- | 2176 // ----------------------------------- |
| 2177 | 2177 |
| 2178 // 2. Make sure the target is actually a constructor. | 2178 // 2. We don't need to check explicitly for constructor target here, |
| 2179 Label target_not_constructor; | 2179 // since that's the first thing the Construct/ConstructWithArrayLike |
| 2180 __ JumpIfSmi(target, &target_not_constructor); | 2180 // builtins will do. |
| 2181 __ Ldr(x10, FieldMemOperand(target, HeapObject::kMapOffset)); | |
| 2182 __ Ldrb(x10, FieldMemOperand(x10, Map::kBitFieldOffset)); | |
| 2183 __ TestAndBranchIfAllClear(x10, 1 << Map::kIsConstructor, | |
| 2184 &target_not_constructor); | |
| 2185 | 2181 |
| 2186 // 3. Make sure the new.target is actually a constructor. | 2182 // 3. We don't need to check explicitly for constructor new.target here, |
| 2187 Label new_target_not_constructor; | 2183 // since that's the second thing the Construct/ConstructWithArrayLike |
| 2188 __ JumpIfSmi(new_target, &new_target_not_constructor); | 2184 // builtins will do. |
| 2189 __ Ldr(x10, FieldMemOperand(new_target, HeapObject::kMapOffset)); | |
| 2190 __ Ldrb(x10, FieldMemOperand(x10, Map::kBitFieldOffset)); | |
| 2191 __ TestAndBranchIfAllClear(x10, 1 << Map::kIsConstructor, | |
| 2192 &new_target_not_constructor); | |
| 2193 | 2185 |
| 2194 // 4a. Construct the target with the given new.target and argumentsList. | 2186 // 4. Construct the target with the given new.target and argumentsList. |
| 2195 __ Jump(masm->isolate()->builtins()->ConstructWithArrayLike(), | 2187 __ Jump(masm->isolate()->builtins()->ConstructWithArrayLike(), |
| 2196 RelocInfo::CODE_TARGET); | 2188 RelocInfo::CODE_TARGET); |
| 2197 | |
| 2198 // 4b. The target is not a constructor, throw an appropriate TypeError. | |
| 2199 __ Bind(&target_not_constructor); | |
| 2200 { | |
| 2201 __ Poke(target, 0); | |
| 2202 __ TailCallRuntime(Runtime::kThrowNotConstructor); | |
| 2203 } | |
| 2204 | |
| 2205 // 4c. The new.target is not a constructor, throw an appropriate TypeError. | |
| 2206 __ Bind(&new_target_not_constructor); | |
| 2207 { | |
| 2208 __ Poke(new_target, 0); | |
| 2209 __ TailCallRuntime(Runtime::kThrowNotConstructor); | |
| 2210 } | |
| 2211 } | 2189 } |
| 2212 | 2190 |
| 2213 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { | 2191 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { |
| 2214 __ Push(lr, fp); | 2192 __ Push(lr, fp); |
| 2215 __ Mov(x11, StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR)); | 2193 __ Mov(x11, StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR)); |
| 2216 __ Push(x11, x1); // x1: function | 2194 __ Push(x11, x1); // x1: function |
| 2217 // We do not yet push the number of arguments, to maintain a 16-byte aligned | 2195 // We do not yet push the number of arguments, to maintain a 16-byte aligned |
| 2218 // stack pointer. This is done in step (3) in | 2196 // stack pointer. This is done in step (3) in |
| 2219 // Generate_ArgumentsAdaptorTrampoline. | 2197 // Generate_ArgumentsAdaptorTrampoline. |
| 2220 __ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); | 2198 __ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3105 // Now jump to the instructions of the returned code object. | 3083 // Now jump to the instructions of the returned code object. |
| 3106 __ Jump(x8); | 3084 __ Jump(x8); |
| 3107 } | 3085 } |
| 3108 | 3086 |
| 3109 #undef __ | 3087 #undef __ |
| 3110 | 3088 |
| 3111 } // namespace internal | 3089 } // namespace internal |
| 3112 } // namespace v8 | 3090 } // namespace v8 |
| 3113 | 3091 |
| 3114 #endif // V8_TARGET_ARCH_ARM | 3092 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |