OLD | NEW |
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 Loading... |
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, thin_string; | 335 Label cons_string; |
336 __ and_(result, result, Operand(kStringRepresentationMask)); | 336 __ tst(result, Operand(kSlicedNotConsMask)); |
337 __ cmp(result, Operand(kConsStringTag)); | |
338 __ b(eq, &cons_string); | 337 __ b(eq, &cons_string); |
339 __ cmp(result, Operand(kThinStringTag)); | |
340 __ b(eq, &thin_string); | |
341 | 338 |
342 // Handle slices. | 339 // Handle slices. |
343 Label indirect_string_loaded; | 340 Label indirect_string_loaded; |
344 __ ldr(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); | 341 __ ldr(result, FieldMemOperand(string, SlicedString::kOffsetOffset)); |
345 __ ldr(string, FieldMemOperand(string, SlicedString::kParentOffset)); | 342 __ ldr(string, FieldMemOperand(string, SlicedString::kParentOffset)); |
346 __ add(index, index, Operand::SmiUntag(result)); | 343 __ add(index, index, Operand::SmiUntag(result)); |
347 __ jmp(&indirect_string_loaded); | 344 __ jmp(&indirect_string_loaded); |
348 | 345 |
349 // Handle thin strings. | |
350 __ bind(&thin_string); | |
351 __ ldr(string, FieldMemOperand(string, ThinString::kActualOffset)); | |
352 __ jmp(&indirect_string_loaded); | |
353 | |
354 // Handle cons strings. | 346 // Handle cons strings. |
355 // Check whether the right hand side is the empty string (i.e. if | 347 // Check whether the right hand side is the empty string (i.e. if |
356 // this is really a flat string in a cons string). If that is not | 348 // this is really a flat string in a cons string). If that is not |
357 // the case we would rather go to the runtime system now to flatten | 349 // the case we would rather go to the runtime system now to flatten |
358 // the string. | 350 // the string. |
359 __ bind(&cons_string); | 351 __ bind(&cons_string); |
360 __ ldr(result, FieldMemOperand(string, ConsString::kSecondOffset)); | 352 __ ldr(result, FieldMemOperand(string, ConsString::kSecondOffset)); |
361 __ CompareRoot(result, Heap::kempty_stringRootIndex); | 353 __ CompareRoot(result, Heap::kempty_stringRootIndex); |
362 __ b(ne, call_runtime); | 354 __ b(ne, call_runtime); |
363 // Get the first of the two strings and load its instance type. | 355 // Get the first of the two strings and load its instance type. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 patcher.masm()->add(r0, pc, Operand(-8)); | 462 patcher.masm()->add(r0, pc, Operand(-8)); |
471 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 463 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
472 patcher.masm()->emit_code_stub_address(stub); | 464 patcher.masm()->emit_code_stub_address(stub); |
473 } | 465 } |
474 } | 466 } |
475 | 467 |
476 } // namespace internal | 468 } // namespace internal |
477 } // namespace v8 | 469 } // namespace v8 |
478 | 470 |
479 #endif // V8_TARGET_ARCH_ARM | 471 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |