| 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; | 111 Label cons_string, thin_string; |
| 112 __ TestAndBranchIfAllClear(result, kSlicedNotConsMask, &cons_string); | 112 __ And(result, result, kStringRepresentationMask); |
| 113 __ Cmp(result, kConsStringTag); |
| 114 __ B(eq, &cons_string); |
| 115 __ Cmp(result, kThinStringTag); |
| 116 __ B(eq, &thin_string); |
| 113 | 117 |
| 114 // Handle slices. | 118 // Handle slices. |
| 115 Label indirect_string_loaded; | 119 Label indirect_string_loaded; |
| 116 __ Ldr(result.W(), | 120 __ Ldr(result.W(), |
| 117 UntagSmiFieldMemOperand(string, SlicedString::kOffsetOffset)); | 121 UntagSmiFieldMemOperand(string, SlicedString::kOffsetOffset)); |
| 118 __ Ldr(string, FieldMemOperand(string, SlicedString::kParentOffset)); | 122 __ Ldr(string, FieldMemOperand(string, SlicedString::kParentOffset)); |
| 119 __ Add(index, index, result.W()); | 123 __ Add(index, index, result.W()); |
| 120 __ B(&indirect_string_loaded); | 124 __ B(&indirect_string_loaded); |
| 121 | 125 |
| 126 // Handle thin strings. |
| 127 __ Bind(&thin_string); |
| 128 __ Ldr(string, FieldMemOperand(string, ThinString::kActualOffset)); |
| 129 __ B(&indirect_string_loaded); |
| 130 |
| 122 // Handle cons strings. | 131 // Handle cons strings. |
| 123 // Check whether the right hand side is the empty string (i.e. if | 132 // Check whether the right hand side is the empty string (i.e. if |
| 124 // this is really a flat string in a cons string). If that is not | 133 // this is really a flat string in a cons string). If that is not |
| 125 // the case we would rather go to the runtime system now to flatten | 134 // the case we would rather go to the runtime system now to flatten |
| 126 // the string. | 135 // the string. |
| 127 __ Bind(&cons_string); | 136 __ Bind(&cons_string); |
| 128 __ Ldr(result, FieldMemOperand(string, ConsString::kSecondOffset)); | 137 __ Ldr(result, FieldMemOperand(string, ConsString::kSecondOffset)); |
| 129 __ JumpIfNotRoot(result, Heap::kempty_stringRootIndex, call_runtime); | 138 __ JumpIfNotRoot(result, Heap::kempty_stringRootIndex, call_runtime); |
| 130 // Get the first of the two strings and load its instance type. | 139 // Get the first of the two strings and load its instance type. |
| 131 __ Ldr(string, FieldMemOperand(string, ConsString::kFirstOffset)); | 140 __ Ldr(string, FieldMemOperand(string, ConsString::kFirstOffset)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 __ Ldrb(result, MemOperand(string, index, SXTW)); | 184 __ Ldrb(result, MemOperand(string, index, SXTW)); |
| 176 __ Bind(&done); | 185 __ Bind(&done); |
| 177 } | 186 } |
| 178 | 187 |
| 179 #undef __ | 188 #undef __ |
| 180 | 189 |
| 181 } // namespace internal | 190 } // namespace internal |
| 182 } // namespace v8 | 191 } // namespace v8 |
| 183 | 192 |
| 184 #endif // V8_TARGET_ARCH_ARM64 | 193 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |