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

Side by Side Diff: src/arm/codegen-arm.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/arm/codegen-arm.h" 5 #include "src/arm/codegen-arm.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 // Fetch the instance type of the receiver into result register. 325 // Fetch the instance type of the receiver into result register.
326 __ ldr(result, FieldMemOperand(string, HeapObject::kMapOffset)); 326 __ ldr(result, FieldMemOperand(string, HeapObject::kMapOffset));
327 __ ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset)); 327 __ ldrb(result, FieldMemOperand(result, Map::kInstanceTypeOffset));
328 328
329 // We need special handling for indirect strings. 329 // We need special handling for indirect strings.
330 Label check_sequential; 330 Label check_sequential;
331 __ tst(result, Operand(kIsIndirectStringMask)); 331 __ tst(result, Operand(kIsIndirectStringMask));
332 __ b(eq, &check_sequential); 332 __ b(eq, &check_sequential);
333 333
334 // Dispatch on the indirect string shape: slice or cons. 334 // Dispatch on the indirect string shape: slice or cons.
335 Label cons_string; 335 Label cons_string, thin_string;
336 __ tst(result, Operand(kSlicedNotConsMask)); 336 __ and_(result, result, Operand(kStringRepresentationMask));
337 __ cmp(result, Operand(kConsStringTag));
337 __ b(eq, &cons_string); 338 __ b(eq, &cons_string);
339 __ cmp(result, Operand(kThinStringTag));
340 __ b(eq, &thin_string);
338 341
339 // Handle slices. 342 // Handle slices.
340 Label indirect_string_loaded; 343 Label indirect_string_loaded;
341 __ ldr(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); 344 __ ldr(result, FieldMemOperand(string, SlicedString::kOffsetOffset));
342 __ ldr(string, FieldMemOperand(string, SlicedString::kParentOffset)); 345 __ ldr(string, FieldMemOperand(string, SlicedString::kParentOffset));
343 __ add(index, index, Operand::SmiUntag(result)); 346 __ add(index, index, Operand::SmiUntag(result));
344 __ jmp(&indirect_string_loaded); 347 __ jmp(&indirect_string_loaded);
345 348
349 // Handle thin strings.
350 __ bind(&thin_string);
351 __ ldr(string, FieldMemOperand(string, ThinString::kActualOffset));
352 __ jmp(&indirect_string_loaded);
353
346 // Handle cons strings. 354 // Handle cons strings.
347 // Check whether the right hand side is the empty string (i.e. if 355 // Check whether the right hand side is the empty string (i.e. if
348 // this is really a flat string in a cons string). If that is not 356 // this is really a flat string in a cons string). If that is not
349 // the case we would rather go to the runtime system now to flatten 357 // the case we would rather go to the runtime system now to flatten
350 // the string. 358 // the string.
351 __ bind(&cons_string); 359 __ bind(&cons_string);
352 __ ldr(result, FieldMemOperand(string, ConsString::kSecondOffset)); 360 __ ldr(result, FieldMemOperand(string, ConsString::kSecondOffset));
353 __ CompareRoot(result, Heap::kempty_stringRootIndex); 361 __ CompareRoot(result, Heap::kempty_stringRootIndex);
354 __ b(ne, call_runtime); 362 __ b(ne, call_runtime);
355 // Get the first of the two strings and load its instance type. 363 // Get the first of the two strings and load its instance type.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 patcher.masm()->add(r0, pc, Operand(-8)); 470 patcher.masm()->add(r0, pc, Operand(-8));
463 patcher.masm()->ldr(pc, MemOperand(pc, -4)); 471 patcher.masm()->ldr(pc, MemOperand(pc, -4));
464 patcher.masm()->emit_code_stub_address(stub); 472 patcher.masm()->emit_code_stub_address(stub);
465 } 473 }
466 } 474 }
467 475
468 } // namespace internal 476 } // namespace internal
469 } // namespace v8 477 } // namespace v8
470 478
471 #endif // V8_TARGET_ARCH_ARM 479 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698