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

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

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: forgot one Created 4 years 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/x87/codegen-x87.h" 5 #include "src/x87/codegen-x87.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/heap/heap.h" 10 #include "src/heap/heap.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // Fetch the instance type of the receiver into result register. 221 // Fetch the instance type of the receiver into result register.
222 __ mov(result, FieldOperand(string, HeapObject::kMapOffset)); 222 __ mov(result, FieldOperand(string, HeapObject::kMapOffset));
223 __ movzx_b(result, FieldOperand(result, Map::kInstanceTypeOffset)); 223 __ movzx_b(result, FieldOperand(result, Map::kInstanceTypeOffset));
224 224
225 // We need special handling for indirect strings. 225 // We need special handling for indirect strings.
226 Label check_sequential; 226 Label check_sequential;
227 __ test(result, Immediate(kIsIndirectStringMask)); 227 __ test(result, Immediate(kIsIndirectStringMask));
228 __ j(zero, &check_sequential, Label::kNear); 228 __ j(zero, &check_sequential, Label::kNear);
229 229
230 // Dispatch on the indirect string shape: slice or cons. 230 // Dispatch on the indirect string shape: slice or cons.
231 Label cons_string; 231 Label cons_string, thin_string;
232 __ test(result, Immediate(kSlicedNotConsMask)); 232 __ and_(result, Immediate(kStringRepresentationMask));
233 __ j(zero, &cons_string, Label::kNear); 233 __ cmp(result, Immediate(kConsStringTag));
234 __ j(equal, &cons_string, Label::kNear);
235 __ cmp(result, Immediate(kThinStringTag));
236 __ j(equal, &thin_string, Label::kNear);
234 237
235 // Handle slices. 238 // Handle slices.
236 Label indirect_string_loaded; 239 Label indirect_string_loaded;
237 __ mov(result, FieldOperand(string, SlicedString::kOffsetOffset)); 240 __ mov(result, FieldOperand(string, SlicedString::kOffsetOffset));
238 __ SmiUntag(result); 241 __ SmiUntag(result);
239 __ add(index, result); 242 __ add(index, result);
240 __ mov(string, FieldOperand(string, SlicedString::kParentOffset)); 243 __ mov(string, FieldOperand(string, SlicedString::kParentOffset));
241 __ jmp(&indirect_string_loaded, Label::kNear); 244 __ jmp(&indirect_string_loaded, Label::kNear);
242 245
246 // Handle thin strings.
247 __ bind(&thin_string);
248 __ mov(string, FieldOperand(string, ThinString::kActualOffset));
249 __ jmp(&indirect_string_loaded, Label::kNear);
250
243 // Handle cons strings. 251 // Handle cons strings.
244 // Check whether the right hand side is the empty string (i.e. if 252 // Check whether the right hand side is the empty string (i.e. if
245 // this is really a flat string in a cons string). If that is not 253 // this is really a flat string in a cons string). If that is not
246 // the case we would rather go to the runtime system now to flatten 254 // the case we would rather go to the runtime system now to flatten
247 // the string. 255 // the string.
248 __ bind(&cons_string); 256 __ bind(&cons_string);
249 __ cmp(FieldOperand(string, ConsString::kSecondOffset), 257 __ cmp(FieldOperand(string, ConsString::kSecondOffset),
250 Immediate(factory->empty_string())); 258 Immediate(factory->empty_string()));
251 __ j(not_equal, call_runtime); 259 __ j(not_equal, call_runtime);
252 __ mov(string, FieldOperand(string, ConsString::kFirstOffset)); 260 __ mov(string, FieldOperand(string, ConsString::kFirstOffset));
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 CodePatcher patcher(isolate, sequence, young_length); 373 CodePatcher patcher(isolate, sequence, young_length);
366 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); 374 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32);
367 } 375 }
368 } 376 }
369 377
370 378
371 } // namespace internal 379 } // namespace internal
372 } // namespace v8 380 } // namespace v8
373 381
374 #endif // V8_TARGET_ARCH_X87 382 #endif // V8_TARGET_ARCH_X87
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698