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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1981 // Stack layout on entry. | 1981 // Stack layout on entry. |
1982 // jssp[0]: number of parameters (tagged) | 1982 // jssp[0]: number of parameters (tagged) |
1983 // jssp[8]: address of receiver argument | 1983 // jssp[8]: address of receiver argument |
1984 // jssp[16]: function | 1984 // jssp[16]: function |
1985 | 1985 |
1986 // Check if the calling frame is an arguments adaptor frame. | 1986 // Check if the calling frame is an arguments adaptor frame. |
1987 Label runtime; | 1987 Label runtime; |
1988 Register caller_fp = x10; | 1988 Register caller_fp = x10; |
1989 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1989 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1990 // Load and untag the context. | 1990 // Load and untag the context. |
1991 __ Ldr(w11, UntagSmiMemOperand(caller_fp, | 1991 STATIC_ASSERT((kSmiShift / kBitsPerByte) == 4); |
1992 StandardFrameConstants::kContextOffset)); | 1992 __ Ldr(w11, MemOperand(caller_fp, StandardFrameConstants::kContextOffset + |
| 1993 (kSmiShift / kBitsPerByte))); |
1993 __ Cmp(w11, StackFrame::ARGUMENTS_ADAPTOR); | 1994 __ Cmp(w11, StackFrame::ARGUMENTS_ADAPTOR); |
1994 __ B(ne, &runtime); | 1995 __ B(ne, &runtime); |
1995 | 1996 |
1996 // Patch the arguments.length and parameters pointer in the current frame. | 1997 // Patch the arguments.length and parameters pointer in the current frame. |
1997 __ Ldr(x11, MemOperand(caller_fp, | 1998 __ Ldr(x11, MemOperand(caller_fp, |
1998 ArgumentsAdaptorFrameConstants::kLengthOffset)); | 1999 ArgumentsAdaptorFrameConstants::kLengthOffset)); |
1999 __ Poke(x11, 0 * kXRegSize); | 2000 __ Poke(x11, 0 * kXRegSize); |
2000 __ Add(x10, caller_fp, Operand::UntagSmiAndScale(x11, kPointerSizeLog2)); | 2001 __ Add(x10, caller_fp, Operand::UntagSmiAndScale(x11, kPointerSizeLog2)); |
2001 __ Add(x10, x10, StandardFrameConstants::kCallerSPOffset); | 2002 __ Add(x10, x10, StandardFrameConstants::kCallerSPOffset); |
2002 __ Poke(x10, 1 * kXRegSize); | 2003 __ Poke(x10, 1 * kXRegSize); |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2830 __ Bind(&next_capture); | 2831 __ Bind(&next_capture); |
2831 __ Subs(number_of_capture_registers, number_of_capture_registers, 2); | 2832 __ Subs(number_of_capture_registers, number_of_capture_registers, 2); |
2832 __ B(mi, &done); | 2833 __ B(mi, &done); |
2833 // Read two 32 bit values from the static offsets vector buffer into | 2834 // Read two 32 bit values from the static offsets vector buffer into |
2834 // an X register | 2835 // an X register |
2835 __ Ldr(current_offset, | 2836 __ Ldr(current_offset, |
2836 MemOperand(offsets_vector_index, kWRegSize * 2, PostIndex)); | 2837 MemOperand(offsets_vector_index, kWRegSize * 2, PostIndex)); |
2837 // Store the smi values in the last match info. | 2838 // Store the smi values in the last match info. |
2838 __ SmiTag(x10, current_offset); | 2839 __ SmiTag(x10, current_offset); |
2839 // Clearing the 32 bottom bits gives us a Smi. | 2840 // Clearing the 32 bottom bits gives us a Smi. |
2840 STATIC_ASSERT(kSmiTag == 0); | 2841 STATIC_ASSERT(kSmiShift == 32); |
2841 __ Bic(x11, current_offset, kSmiShiftMask); | 2842 __ And(x11, current_offset, ~kWRegMask); |
2842 __ Stp(x10, | 2843 __ Stp(x10, |
2843 x11, | 2844 x11, |
2844 MemOperand(last_match_offsets, kXRegSize * 2, PostIndex)); | 2845 MemOperand(last_match_offsets, kXRegSize * 2, PostIndex)); |
2845 __ B(&next_capture); | 2846 __ B(&next_capture); |
2846 __ Bind(&done); | 2847 __ Bind(&done); |
2847 | 2848 |
2848 // Return last match info. | 2849 // Return last match info. |
2849 __ Peek(x0, kLastMatchInfoOffset); | 2850 __ Peek(x0, kLastMatchInfoOffset); |
2850 __ PopCPURegList(used_callee_saved_registers); | 2851 __ PopCPURegList(used_callee_saved_registers); |
2851 // Drop the 4 arguments of the stub from the stack. | 2852 // Drop the 4 arguments of the stub from the stack. |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3470 } | 3471 } |
3471 | 3472 |
3472 | 3473 |
3473 void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) { | 3474 void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) { |
3474 __ JumpIfNotSmi(code_, &slow_case_); | 3475 __ JumpIfNotSmi(code_, &slow_case_); |
3475 __ Cmp(code_, Smi::FromInt(String::kMaxOneByteCharCode)); | 3476 __ Cmp(code_, Smi::FromInt(String::kMaxOneByteCharCode)); |
3476 __ B(hi, &slow_case_); | 3477 __ B(hi, &slow_case_); |
3477 | 3478 |
3478 __ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex); | 3479 __ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex); |
3479 // At this point code register contains smi tagged ASCII char code. | 3480 // At this point code register contains smi tagged ASCII char code. |
3480 __ Add(result_, result_, Operand::UntagSmiAndScale(code_, kPointerSizeLog2)); | 3481 STATIC_ASSERT(kSmiShift > kPointerSizeLog2); |
| 3482 __ Add(result_, result_, Operand(code_, LSR, kSmiShift - kPointerSizeLog2)); |
3481 __ Ldr(result_, FieldMemOperand(result_, FixedArray::kHeaderSize)); | 3483 __ Ldr(result_, FieldMemOperand(result_, FixedArray::kHeaderSize)); |
3482 __ JumpIfRoot(result_, Heap::kUndefinedValueRootIndex, &slow_case_); | 3484 __ JumpIfRoot(result_, Heap::kUndefinedValueRootIndex, &slow_case_); |
3483 __ Bind(&exit_); | 3485 __ Bind(&exit_); |
3484 } | 3486 } |
3485 | 3487 |
3486 | 3488 |
3487 void StringCharFromCodeGenerator::GenerateSlow( | 3489 void StringCharFromCodeGenerator::GenerateSlow( |
3488 MacroAssembler* masm, | 3490 MacroAssembler* masm, |
3489 const RuntimeCallHelper& call_helper) { | 3491 const RuntimeCallHelper& call_helper) { |
3490 __ Abort(kUnexpectedFallthroughToCharFromCodeSlowCase); | 3492 __ Abort(kUnexpectedFallthroughToCharFromCodeSlowCase); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3839 | 3841 |
3840 | 3842 |
3841 void StringHelper::GenerateHashInit(MacroAssembler* masm, | 3843 void StringHelper::GenerateHashInit(MacroAssembler* masm, |
3842 Register hash, | 3844 Register hash, |
3843 Register character) { | 3845 Register character) { |
3844 ASSERT(!AreAliased(hash, character)); | 3846 ASSERT(!AreAliased(hash, character)); |
3845 | 3847 |
3846 // hash = character + (character << 10); | 3848 // hash = character + (character << 10); |
3847 __ LoadRoot(hash, Heap::kHashSeedRootIndex); | 3849 __ LoadRoot(hash, Heap::kHashSeedRootIndex); |
3848 // Untag smi seed and add the character. | 3850 // Untag smi seed and add the character. |
3849 __ Add(hash, character, Operand::UntagSmi(hash)); | 3851 __ Add(hash, character, Operand(hash, LSR, kSmiShift)); |
3850 | 3852 |
3851 // Compute hashes modulo 2^32 using a 32-bit W register. | 3853 // Compute hashes modulo 2^32 using a 32-bit W register. |
3852 Register hash_w = hash.W(); | 3854 Register hash_w = hash.W(); |
3853 | 3855 |
3854 // hash += hash << 10; | 3856 // hash += hash << 10; |
3855 __ Add(hash_w, hash_w, Operand(hash_w, LSL, 10)); | 3857 __ Add(hash_w, hash_w, Operand(hash_w, LSL, 10)); |
3856 // hash ^= hash >> 6; | 3858 // hash ^= hash >> 6; |
3857 __ Eor(hash_w, hash_w, Operand(hash_w, LSR, 6)); | 3859 __ Eor(hash_w, hash_w, Operand(hash_w, LSR, 6)); |
3858 } | 3860 } |
3859 | 3861 |
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5426 MemOperand(fp, 6 * kPointerSize), | 5428 MemOperand(fp, 6 * kPointerSize), |
5427 NULL); | 5429 NULL); |
5428 } | 5430 } |
5429 | 5431 |
5430 | 5432 |
5431 #undef __ | 5433 #undef __ |
5432 | 5434 |
5433 } } // namespace v8::internal | 5435 } } // namespace v8::internal |
5434 | 5436 |
5435 #endif // V8_TARGET_ARCH_ARM64 | 5437 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |