Index: src/arm64/codegen-arm64.cc |
diff --git a/src/arm64/codegen-arm64.cc b/src/arm64/codegen-arm64.cc |
index e6ddcfadb8dadfb221c93b293f9c7430fb4edfe2..4fb9a2d93901e783fde2b38db8b87366ab374e52 100644 |
--- a/src/arm64/codegen-arm64.cc |
+++ b/src/arm64/codegen-arm64.cc |
@@ -99,6 +99,9 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm, |
Register result, |
Label* call_runtime) { |
DCHECK(string.Is64Bits() && index.Is32Bits() && result.Is64Bits()); |
+ Label indirect_string_loaded; |
+ __ Bind(&indirect_string_loaded); |
+ |
// Fetch the instance type of the receiver into result register. |
__ Ldr(result, FieldMemOperand(string, HeapObject::kMapOffset)); |
__ Ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); |
@@ -108,17 +111,25 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm, |
__ TestAndBranchIfAllClear(result, kIsIndirectStringMask, &check_sequential); |
// Dispatch on the indirect string shape: slice or cons. |
- Label cons_string; |
- __ TestAndBranchIfAllClear(result, kSlicedNotConsMask, &cons_string); |
+ Label cons_string, thin_string; |
+ __ And(result, result, kStringRepresentationMask); |
+ __ Cmp(result, kConsStringTag); |
+ __ B(eq, &cons_string); |
+ __ Cmp(result, kThinStringTag); |
+ __ B(eq, &thin_string); |
// Handle slices. |
- Label indirect_string_loaded; |
__ Ldr(result.W(), |
UntagSmiFieldMemOperand(string, SlicedString::kOffsetOffset)); |
__ Ldr(string, FieldMemOperand(string, SlicedString::kParentOffset)); |
__ Add(index, index, result.W()); |
__ B(&indirect_string_loaded); |
+ // Handle thin strings. |
+ __ Bind(&thin_string); |
+ __ Ldr(string, FieldMemOperand(string, ThinString::kActualOffset)); |
+ __ B(&indirect_string_loaded); |
+ |
// Handle cons strings. |
// Check whether the right hand side is the empty string (i.e. if |
// this is really a flat string in a cons string). If that is not |
@@ -129,10 +140,7 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm, |
__ JumpIfNotRoot(result, Heap::kempty_stringRootIndex, call_runtime); |
// Get the first of the two strings and load its instance type. |
__ Ldr(string, FieldMemOperand(string, ConsString::kFirstOffset)); |
- |
- __ Bind(&indirect_string_loaded); |
- __ Ldr(result, FieldMemOperand(string, HeapObject::kMapOffset)); |
- __ Ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); |
+ __ B(&indirect_string_loaded); |
// Distinguish sequential and external strings. Only these two string |
// representations can reach here (slices and flat cons strings have been |