OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 __ movzxwl(result, Operand(result, index, times_2, 0)); | 544 __ movzxwl(result, Operand(result, index, times_2, 0)); |
545 __ jmp(&done, Label::kNear); | 545 __ jmp(&done, Label::kNear); |
546 __ bind(&ascii_external); | 546 __ bind(&ascii_external); |
547 // Ascii string. | 547 // Ascii string. |
548 __ movzxbl(result, Operand(result, index, times_1, 0)); | 548 __ movzxbl(result, Operand(result, index, times_1, 0)); |
549 __ jmp(&done, Label::kNear); | 549 __ jmp(&done, Label::kNear); |
550 | 550 |
551 // Dispatch on the encoding: ASCII or two-byte. | 551 // Dispatch on the encoding: ASCII or two-byte. |
552 Label ascii; | 552 Label ascii; |
553 __ bind(&seq_string); | 553 __ bind(&seq_string); |
554 STATIC_ASSERT((kStringEncodingMask & kAsciiStringTag) != 0); | 554 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0); |
555 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); | 555 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); |
556 __ testb(result, Immediate(kStringEncodingMask)); | 556 __ testb(result, Immediate(kStringEncodingMask)); |
557 __ j(not_zero, &ascii, Label::kNear); | 557 __ j(not_zero, &ascii, Label::kNear); |
558 | 558 |
559 // Two-byte string. | 559 // Two-byte string. |
560 // Load the two-byte character code into the result register. | 560 // Load the two-byte character code into the result register. |
561 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1); | 561 STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1); |
562 __ movzxwl(result, FieldOperand(string, | 562 __ movzxwl(result, FieldOperand(string, |
563 index, | 563 index, |
564 times_2, | 564 times_2, |
565 SeqTwoByteString::kHeaderSize)); | 565 SeqTwoByteString::kHeaderSize)); |
566 __ jmp(&done, Label::kNear); | 566 __ jmp(&done, Label::kNear); |
567 | 567 |
568 // ASCII string. | 568 // ASCII string. |
569 // Load the byte into the result register. | 569 // Load the byte into the result register. |
570 __ bind(&ascii); | 570 __ bind(&ascii); |
571 __ movzxbl(result, FieldOperand(string, | 571 __ movzxbl(result, FieldOperand(string, |
572 index, | 572 index, |
573 times_1, | 573 times_1, |
574 SeqAsciiString::kHeaderSize)); | 574 SeqAsciiString::kHeaderSize)); |
575 __ bind(&done); | 575 __ bind(&done); |
576 } | 576 } |
577 | 577 |
578 #undef __ | 578 #undef __ |
579 | 579 |
580 } } // namespace v8::internal | 580 } } // namespace v8::internal |
581 | 581 |
582 #endif // V8_TARGET_ARCH_X64 | 582 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |