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/ia32/codegen-ia32.h" | 5 #include "src/ia32/codegen-ia32.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 // Fetch the instance type of the receiver into result register. | 494 // Fetch the instance type of the receiver into result register. |
495 __ mov(result, FieldOperand(string, HeapObject::kMapOffset)); | 495 __ mov(result, FieldOperand(string, HeapObject::kMapOffset)); |
496 __ movzx_b(result, FieldOperand(result, Map::kInstanceTypeOffset)); | 496 __ movzx_b(result, FieldOperand(result, Map::kInstanceTypeOffset)); |
497 | 497 |
498 // We need special handling for indirect strings. | 498 // We need special handling for indirect strings. |
499 Label check_sequential; | 499 Label check_sequential; |
500 __ test(result, Immediate(kIsIndirectStringMask)); | 500 __ test(result, Immediate(kIsIndirectStringMask)); |
501 __ j(zero, &check_sequential, Label::kNear); | 501 __ j(zero, &check_sequential, Label::kNear); |
502 | 502 |
503 // Dispatch on the indirect string shape: slice or cons. | 503 // Dispatch on the indirect string shape: slice or cons. |
504 Label cons_string; | 504 Label cons_string, thin_string; |
505 __ test(result, Immediate(kSlicedNotConsMask)); | 505 __ and_(result, Immediate(kStringRepresentationMask)); |
506 __ j(zero, &cons_string, Label::kNear); | 506 __ cmp(result, Immediate(kConsStringTag)); |
| 507 __ j(equal, &cons_string, Label::kNear); |
| 508 __ cmp(result, Immediate(kThinStringTag)); |
| 509 __ j(equal, &thin_string, Label::kNear); |
507 | 510 |
508 // Handle slices. | 511 // Handle slices. |
509 Label indirect_string_loaded; | 512 Label indirect_string_loaded; |
510 __ mov(result, FieldOperand(string, SlicedString::kOffsetOffset)); | 513 __ mov(result, FieldOperand(string, SlicedString::kOffsetOffset)); |
511 __ SmiUntag(result); | 514 __ SmiUntag(result); |
512 __ add(index, result); | 515 __ add(index, result); |
513 __ mov(string, FieldOperand(string, SlicedString::kParentOffset)); | 516 __ mov(string, FieldOperand(string, SlicedString::kParentOffset)); |
514 __ jmp(&indirect_string_loaded, Label::kNear); | 517 __ jmp(&indirect_string_loaded, Label::kNear); |
515 | 518 |
| 519 // Handle thin strings. |
| 520 __ bind(&thin_string); |
| 521 __ mov(string, FieldOperand(string, ThinString::kActualOffset)); |
| 522 __ jmp(&indirect_string_loaded, Label::kNear); |
| 523 |
516 // Handle cons strings. | 524 // Handle cons strings. |
517 // Check whether the right hand side is the empty string (i.e. if | 525 // Check whether the right hand side is the empty string (i.e. if |
518 // this is really a flat string in a cons string). If that is not | 526 // this is really a flat string in a cons string). If that is not |
519 // the case we would rather go to the runtime system now to flatten | 527 // the case we would rather go to the runtime system now to flatten |
520 // the string. | 528 // the string. |
521 __ bind(&cons_string); | 529 __ bind(&cons_string); |
522 __ cmp(FieldOperand(string, ConsString::kSecondOffset), | 530 __ cmp(FieldOperand(string, ConsString::kSecondOffset), |
523 Immediate(factory->empty_string())); | 531 Immediate(factory->empty_string())); |
524 __ j(not_equal, call_runtime); | 532 __ j(not_equal, call_runtime); |
525 __ mov(string, FieldOperand(string, ConsString::kFirstOffset)); | 533 __ mov(string, FieldOperand(string, ConsString::kFirstOffset)); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 CodePatcher patcher(isolate, sequence, young_length); | 645 CodePatcher patcher(isolate, sequence, young_length); |
638 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 646 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
639 } | 647 } |
640 } | 648 } |
641 | 649 |
642 | 650 |
643 } // namespace internal | 651 } // namespace internal |
644 } // namespace v8 | 652 } // namespace v8 |
645 | 653 |
646 #endif // V8_TARGET_ARCH_IA32 | 654 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |