Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: src/arm64/code-stubs-arm64.cc

Issue 378503003: ARM64: Use UntagSmi helpers and clean up assertions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Replace one '32' with 'kWRegSizeInBits'. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/arm64/debug-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 STATIC_ASSERT((kSmiShift / kBitsPerByte) == 4); 1991 __ Ldr(w11, UntagSmiMemOperand(caller_fp,
1992 __ Ldr(w11, MemOperand(caller_fp, StandardFrameConstants::kContextOffset + 1992 StandardFrameConstants::kContextOffset));
1993 (kSmiShift / kBitsPerByte)));
1994 __ Cmp(w11, StackFrame::ARGUMENTS_ADAPTOR); 1993 __ Cmp(w11, StackFrame::ARGUMENTS_ADAPTOR);
1995 __ B(ne, &runtime); 1994 __ B(ne, &runtime);
1996 1995
1997 // Patch the arguments.length and parameters pointer in the current frame. 1996 // Patch the arguments.length and parameters pointer in the current frame.
1998 __ Ldr(x11, MemOperand(caller_fp, 1997 __ Ldr(x11, MemOperand(caller_fp,
1999 ArgumentsAdaptorFrameConstants::kLengthOffset)); 1998 ArgumentsAdaptorFrameConstants::kLengthOffset));
2000 __ Poke(x11, 0 * kXRegSize); 1999 __ Poke(x11, 0 * kXRegSize);
2001 __ Add(x10, caller_fp, Operand::UntagSmiAndScale(x11, kPointerSizeLog2)); 2000 __ Add(x10, caller_fp, Operand::UntagSmiAndScale(x11, kPointerSizeLog2));
2002 __ Add(x10, x10, StandardFrameConstants::kCallerSPOffset); 2001 __ Add(x10, x10, StandardFrameConstants::kCallerSPOffset);
2003 __ Poke(x10, 1 * kXRegSize); 2002 __ Poke(x10, 1 * kXRegSize);
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
2831 __ Bind(&next_capture); 2830 __ Bind(&next_capture);
2832 __ Subs(number_of_capture_registers, number_of_capture_registers, 2); 2831 __ Subs(number_of_capture_registers, number_of_capture_registers, 2);
2833 __ B(mi, &done); 2832 __ B(mi, &done);
2834 // Read two 32 bit values from the static offsets vector buffer into 2833 // Read two 32 bit values from the static offsets vector buffer into
2835 // an X register 2834 // an X register
2836 __ Ldr(current_offset, 2835 __ Ldr(current_offset,
2837 MemOperand(offsets_vector_index, kWRegSize * 2, PostIndex)); 2836 MemOperand(offsets_vector_index, kWRegSize * 2, PostIndex));
2838 // Store the smi values in the last match info. 2837 // Store the smi values in the last match info.
2839 __ SmiTag(x10, current_offset); 2838 __ SmiTag(x10, current_offset);
2840 // Clearing the 32 bottom bits gives us a Smi. 2839 // Clearing the 32 bottom bits gives us a Smi.
2841 STATIC_ASSERT(kSmiShift == 32); 2840 STATIC_ASSERT(kSmiTag == 0);
2842 __ And(x11, current_offset, ~kWRegMask); 2841 __ Bic(x11, current_offset, kSmiShiftMask);
2843 __ Stp(x10, 2842 __ Stp(x10,
2844 x11, 2843 x11,
2845 MemOperand(last_match_offsets, kXRegSize * 2, PostIndex)); 2844 MemOperand(last_match_offsets, kXRegSize * 2, PostIndex));
2846 __ B(&next_capture); 2845 __ B(&next_capture);
2847 __ Bind(&done); 2846 __ Bind(&done);
2848 2847
2849 // Return last match info. 2848 // Return last match info.
2850 __ Peek(x0, kLastMatchInfoOffset); 2849 __ Peek(x0, kLastMatchInfoOffset);
2851 __ PopCPURegList(used_callee_saved_registers); 2850 __ PopCPURegList(used_callee_saved_registers);
2852 // Drop the 4 arguments of the stub from the stack. 2851 // Drop the 4 arguments of the stub from the stack.
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
3471 } 3470 }
3472 3471
3473 3472
3474 void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) { 3473 void StringCharFromCodeGenerator::GenerateFast(MacroAssembler* masm) {
3475 __ JumpIfNotSmi(code_, &slow_case_); 3474 __ JumpIfNotSmi(code_, &slow_case_);
3476 __ Cmp(code_, Smi::FromInt(String::kMaxOneByteCharCode)); 3475 __ Cmp(code_, Smi::FromInt(String::kMaxOneByteCharCode));
3477 __ B(hi, &slow_case_); 3476 __ B(hi, &slow_case_);
3478 3477
3479 __ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex); 3478 __ LoadRoot(result_, Heap::kSingleCharacterStringCacheRootIndex);
3480 // At this point code register contains smi tagged ASCII char code. 3479 // At this point code register contains smi tagged ASCII char code.
3481 STATIC_ASSERT(kSmiShift > kPointerSizeLog2); 3480 __ Add(result_, result_, Operand::UntagSmiAndScale(code_, kPointerSizeLog2));
3482 __ Add(result_, result_, Operand(code_, LSR, kSmiShift - kPointerSizeLog2));
3483 __ Ldr(result_, FieldMemOperand(result_, FixedArray::kHeaderSize)); 3481 __ Ldr(result_, FieldMemOperand(result_, FixedArray::kHeaderSize));
3484 __ JumpIfRoot(result_, Heap::kUndefinedValueRootIndex, &slow_case_); 3482 __ JumpIfRoot(result_, Heap::kUndefinedValueRootIndex, &slow_case_);
3485 __ Bind(&exit_); 3483 __ Bind(&exit_);
3486 } 3484 }
3487 3485
3488 3486
3489 void StringCharFromCodeGenerator::GenerateSlow( 3487 void StringCharFromCodeGenerator::GenerateSlow(
3490 MacroAssembler* masm, 3488 MacroAssembler* masm,
3491 const RuntimeCallHelper& call_helper) { 3489 const RuntimeCallHelper& call_helper) {
3492 __ Abort(kUnexpectedFallthroughToCharFromCodeSlowCase); 3490 __ Abort(kUnexpectedFallthroughToCharFromCodeSlowCase);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
3841 3839
3842 3840
3843 void StringHelper::GenerateHashInit(MacroAssembler* masm, 3841 void StringHelper::GenerateHashInit(MacroAssembler* masm,
3844 Register hash, 3842 Register hash,
3845 Register character) { 3843 Register character) {
3846 ASSERT(!AreAliased(hash, character)); 3844 ASSERT(!AreAliased(hash, character));
3847 3845
3848 // hash = character + (character << 10); 3846 // hash = character + (character << 10);
3849 __ LoadRoot(hash, Heap::kHashSeedRootIndex); 3847 __ LoadRoot(hash, Heap::kHashSeedRootIndex);
3850 // Untag smi seed and add the character. 3848 // Untag smi seed and add the character.
3851 __ Add(hash, character, Operand(hash, LSR, kSmiShift)); 3849 __ Add(hash, character, Operand::UntagSmi(hash));
3852 3850
3853 // Compute hashes modulo 2^32 using a 32-bit W register. 3851 // Compute hashes modulo 2^32 using a 32-bit W register.
3854 Register hash_w = hash.W(); 3852 Register hash_w = hash.W();
3855 3853
3856 // hash += hash << 10; 3854 // hash += hash << 10;
3857 __ Add(hash_w, hash_w, Operand(hash_w, LSL, 10)); 3855 __ Add(hash_w, hash_w, Operand(hash_w, LSL, 10));
3858 // hash ^= hash >> 6; 3856 // hash ^= hash >> 6;
3859 __ Eor(hash_w, hash_w, Operand(hash_w, LSR, 6)); 3857 __ Eor(hash_w, hash_w, Operand(hash_w, LSR, 6));
3860 } 3858 }
3861 3859
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
5428 MemOperand(fp, 6 * kPointerSize), 5426 MemOperand(fp, 6 * kPointerSize),
5429 NULL); 5427 NULL);
5430 } 5428 }
5431 5429
5432 5430
5433 #undef __ 5431 #undef __
5434 5432
5435 } } // namespace v8::internal 5433 } } // namespace v8::internal
5436 5434
5437 #endif // V8_TARGET_ARCH_ARM64 5435 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/arm64/debug-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698