OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 // Sequential strings have already been ruled out. | 561 // Sequential strings have already been ruled out. |
562 __ test(result, Immediate(kIsIndirectStringMask)); | 562 __ test(result, Immediate(kIsIndirectStringMask)); |
563 __ Assert(zero, "external string expected, but not found"); | 563 __ Assert(zero, "external string expected, but not found"); |
564 } | 564 } |
565 __ mov(result, FieldOperand(string, ExternalString::kResourceDataOffset)); | 565 __ mov(result, FieldOperand(string, ExternalString::kResourceDataOffset)); |
566 // Assert that the external string has not been finalized yet. | 566 // Assert that the external string has not been finalized yet. |
567 __ test(result, result); | 567 __ test(result, result); |
568 __ j(zero, call_runtime); | 568 __ j(zero, call_runtime); |
569 Register scratch = string; | 569 Register scratch = string; |
570 __ mov(scratch, FieldOperand(string, HeapObject::kMapOffset)); | 570 __ mov(scratch, FieldOperand(string, HeapObject::kMapOffset)); |
571 __ cmp(scratch, Immediate(factory->external_ascii_string_map())); | 571 STATIC_ASSERT(kTwoByteStringTag == 0); |
572 __ j(equal, &ascii_external, Label::kNear); | 572 __ test_b(FieldOperand(scratch, Map::kInstanceTypeOffset), |
573 __ cmp(scratch, Immediate(factory->external_ascii_symbol_map())); | 573 kStringEncodingMask); |
574 __ j(equal, &ascii_external, Label::kNear); | 574 __ j(not_zero, &ascii_external); |
575 // Two-byte string. | 575 // Two-byte string. |
576 __ movzx_w(result, Operand(result, index, times_2, 0)); | 576 __ movzx_w(result, Operand(result, index, times_2, 0)); |
577 __ jmp(&done); | 577 __ jmp(&done); |
578 __ bind(&ascii_external); | 578 __ bind(&ascii_external); |
579 // Ascii string. | 579 // Ascii string. |
580 __ movzx_b(result, Operand(result, index, times_1, 0)); | 580 __ movzx_b(result, Operand(result, index, times_1, 0)); |
581 __ jmp(&done); | 581 __ jmp(&done); |
582 | 582 |
583 // Handle conses. | 583 // Handle conses. |
584 // Check whether the right hand side is the empty string (i.e. if | 584 // Check whether the right hand side is the empty string (i.e. if |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 times_1, | 629 times_1, |
630 SeqAsciiString::kHeaderSize)); | 630 SeqAsciiString::kHeaderSize)); |
631 __ bind(&done); | 631 __ bind(&done); |
632 } | 632 } |
633 | 633 |
634 #undef __ | 634 #undef __ |
635 | 635 |
636 } } // namespace v8::internal | 636 } } // namespace v8::internal |
637 | 637 |
638 #endif // V8_TARGET_ARCH_IA32 | 638 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |