| 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/arm64/codegen-arm64.h" | 5 #include "src/arm64/codegen-arm64.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
| 8 | 8 |
| 9 #include "src/arm64/simulator-arm64.h" | 9 #include "src/arm64/simulator-arm64.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 DCHECK(string.Is64Bits() && index.Is32Bits() && result.Is64Bits()); | 101 DCHECK(string.Is64Bits() && index.Is32Bits() && result.Is64Bits()); |
| 102 // Fetch the instance type of the receiver into result register. | 102 // Fetch the instance type of the receiver into result register. |
| 103 __ Ldr(result, FieldMemOperand(string, HeapObject::kMapOffset)); | 103 __ Ldr(result, FieldMemOperand(string, HeapObject::kMapOffset)); |
| 104 __ Ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); | 104 __ Ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); |
| 105 | 105 |
| 106 // We need special handling for indirect strings. | 106 // We need special handling for indirect strings. |
| 107 Label check_sequential; | 107 Label check_sequential; |
| 108 __ TestAndBranchIfAllClear(result, kIsIndirectStringMask, &check_sequential); | 108 __ TestAndBranchIfAllClear(result, kIsIndirectStringMask, &check_sequential); |
| 109 | 109 |
| 110 // Dispatch on the indirect string shape: slice or cons. | 110 // Dispatch on the indirect string shape: slice or cons. |
| 111 Label cons_string, thin_string; | 111 Label cons_string; |
| 112 __ And(result, result, kStringRepresentationMask); | 112 __ TestAndBranchIfAllClear(result, kSlicedNotConsMask, &cons_string); |
| 113 __ Cmp(result, kConsStringTag); | |
| 114 __ B(eq, &cons_string); | |
| 115 __ Cmp(result, kThinStringTag); | |
| 116 __ B(eq, &thin_string); | |
| 117 | 113 |
| 118 // Handle slices. | 114 // Handle slices. |
| 119 Label indirect_string_loaded; | 115 Label indirect_string_loaded; |
| 120 __ Ldr(result.W(), | 116 __ Ldr(result.W(), |
| 121 UntagSmiFieldMemOperand(string, SlicedString::kOffsetOffset)); | 117 UntagSmiFieldMemOperand(string, SlicedString::kOffsetOffset)); |
| 122 __ Ldr(string, FieldMemOperand(string, SlicedString::kParentOffset)); | 118 __ Ldr(string, FieldMemOperand(string, SlicedString::kParentOffset)); |
| 123 __ Add(index, index, result.W()); | 119 __ Add(index, index, result.W()); |
| 124 __ B(&indirect_string_loaded); | 120 __ B(&indirect_string_loaded); |
| 125 | 121 |
| 126 // Handle thin strings. | |
| 127 __ Bind(&thin_string); | |
| 128 __ Ldr(string, FieldMemOperand(string, ThinString::kActualOffset)); | |
| 129 __ B(&indirect_string_loaded); | |
| 130 | |
| 131 // Handle cons strings. | 122 // Handle cons strings. |
| 132 // Check whether the right hand side is the empty string (i.e. if | 123 // Check whether the right hand side is the empty string (i.e. if |
| 133 // this is really a flat string in a cons string). If that is not | 124 // this is really a flat string in a cons string). If that is not |
| 134 // the case we would rather go to the runtime system now to flatten | 125 // the case we would rather go to the runtime system now to flatten |
| 135 // the string. | 126 // the string. |
| 136 __ Bind(&cons_string); | 127 __ Bind(&cons_string); |
| 137 __ Ldr(result, FieldMemOperand(string, ConsString::kSecondOffset)); | 128 __ Ldr(result, FieldMemOperand(string, ConsString::kSecondOffset)); |
| 138 __ JumpIfNotRoot(result, Heap::kempty_stringRootIndex, call_runtime); | 129 __ JumpIfNotRoot(result, Heap::kempty_stringRootIndex, call_runtime); |
| 139 // Get the first of the two strings and load its instance type. | 130 // Get the first of the two strings and load its instance type. |
| 140 __ Ldr(string, FieldMemOperand(string, ConsString::kFirstOffset)); | 131 __ Ldr(string, FieldMemOperand(string, ConsString::kFirstOffset)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 __ Ldrb(result, MemOperand(string, index, SXTW)); | 175 __ Ldrb(result, MemOperand(string, index, SXTW)); |
| 185 __ Bind(&done); | 176 __ Bind(&done); |
| 186 } | 177 } |
| 187 | 178 |
| 188 #undef __ | 179 #undef __ |
| 189 | 180 |
| 190 } // namespace internal | 181 } // namespace internal |
| 191 } // namespace v8 | 182 } // namespace v8 |
| 192 | 183 |
| 193 #endif // V8_TARGET_ARCH_ARM64 | 184 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |