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

Side by Side Diff: src/arm64/codegen-arm64.cc

Issue 2626893005: Revert of Internalize strings in-place (Closed)
Patch Set: rebased Created 3 years, 11 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
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/ast/ast-types.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/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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 } 93 }
94 94
95 95
96 void StringCharLoadGenerator::Generate(MacroAssembler* masm, 96 void StringCharLoadGenerator::Generate(MacroAssembler* masm,
97 Register string, 97 Register string,
98 Register index, 98 Register index,
99 Register result, 99 Register result,
100 Label* call_runtime) { 100 Label* call_runtime) {
101 DCHECK(string.Is64Bits() && index.Is32Bits() && result.Is64Bits()); 101 DCHECK(string.Is64Bits() && index.Is32Bits() && result.Is64Bits());
102 Label indirect_string_loaded;
103 __ Bind(&indirect_string_loaded);
104
105 // Fetch the instance type of the receiver into result register. 102 // Fetch the instance type of the receiver into result register.
106 __ Ldr(result, FieldMemOperand(string, HeapObject::kMapOffset)); 103 __ Ldr(result, FieldMemOperand(string, HeapObject::kMapOffset));
107 __ Ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); 104 __ Ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
108 105
109 // We need special handling for indirect strings. 106 // We need special handling for indirect strings.
110 Label check_sequential; 107 Label check_sequential;
111 __ TestAndBranchIfAllClear(result, kIsIndirectStringMask, &check_sequential); 108 __ TestAndBranchIfAllClear(result, kIsIndirectStringMask, &check_sequential);
112 109
113 // Dispatch on the indirect string shape: slice or cons. 110 // Dispatch on the indirect string shape: slice or cons.
114 Label cons_string, thin_string; 111 Label cons_string;
115 __ And(result, result, kStringRepresentationMask); 112 __ TestAndBranchIfAllClear(result, kSlicedNotConsMask, &cons_string);
116 __ Cmp(result, kConsStringTag);
117 __ B(eq, &cons_string);
118 __ Cmp(result, kThinStringTag);
119 __ B(eq, &thin_string);
120 113
121 // Handle slices. 114 // Handle slices.
115 Label indirect_string_loaded;
122 __ Ldr(result.W(), 116 __ Ldr(result.W(),
123 UntagSmiFieldMemOperand(string, SlicedString::kOffsetOffset)); 117 UntagSmiFieldMemOperand(string, SlicedString::kOffsetOffset));
124 __ Ldr(string, FieldMemOperand(string, SlicedString::kParentOffset)); 118 __ Ldr(string, FieldMemOperand(string, SlicedString::kParentOffset));
125 __ Add(index, index, result.W()); 119 __ Add(index, index, result.W());
126 __ B(&indirect_string_loaded); 120 __ B(&indirect_string_loaded);
127 121
128 // Handle thin strings.
129 __ Bind(&thin_string);
130 __ Ldr(string, FieldMemOperand(string, ThinString::kActualOffset));
131 __ B(&indirect_string_loaded);
132
133 // Handle cons strings. 122 // Handle cons strings.
134 // 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
135 // 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
136 // 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
137 // the string. 126 // the string.
138 __ Bind(&cons_string); 127 __ Bind(&cons_string);
139 __ Ldr(result, FieldMemOperand(string, ConsString::kSecondOffset)); 128 __ Ldr(result, FieldMemOperand(string, ConsString::kSecondOffset));
140 __ JumpIfNotRoot(result, Heap::kempty_stringRootIndex, call_runtime); 129 __ JumpIfNotRoot(result, Heap::kempty_stringRootIndex, call_runtime);
141 // 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.
142 __ Ldr(string, FieldMemOperand(string, ConsString::kFirstOffset)); 131 __ Ldr(string, FieldMemOperand(string, ConsString::kFirstOffset));
143 __ B(&indirect_string_loaded); 132
133 __ Bind(&indirect_string_loaded);
134 __ Ldr(result, FieldMemOperand(string, HeapObject::kMapOffset));
135 __ Ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
144 136
145 // Distinguish sequential and external strings. Only these two string 137 // Distinguish sequential and external strings. Only these two string
146 // representations can reach here (slices and flat cons strings have been 138 // representations can reach here (slices and flat cons strings have been
147 // reduced to the underlying sequential or external string). 139 // reduced to the underlying sequential or external string).
148 Label external_string, check_encoding; 140 Label external_string, check_encoding;
149 __ Bind(&check_sequential); 141 __ Bind(&check_sequential);
150 STATIC_ASSERT(kSeqStringTag == 0); 142 STATIC_ASSERT(kSeqStringTag == 0);
151 __ TestAndBranchIfAnySet(result, kStringRepresentationMask, &external_string); 143 __ TestAndBranchIfAnySet(result, kStringRepresentationMask, &external_string);
152 144
153 // Prepare sequential strings 145 // Prepare sequential strings
(...skipping 29 matching lines...) Expand all
183 __ Ldrb(result, MemOperand(string, index, SXTW)); 175 __ Ldrb(result, MemOperand(string, index, SXTW));
184 __ Bind(&done); 176 __ Bind(&done);
185 } 177 }
186 178
187 #undef __ 179 #undef __
188 180
189 } // namespace internal 181 } // namespace internal
190 } // namespace v8 182 } // namespace v8
191 183
192 #endif // V8_TARGET_ARCH_ARM64 184 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/ast/ast-types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698