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

Side by Side Diff: src/x87/codegen-x87.cc

Issue 565853002: X87: Rename ascii to one-byte where applicable. (Closed) Base URL: https://github.com/v8/v8.git@bleeding_edge
Patch Set: Created 6 years, 3 months 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
« no previous file with comments | « src/x87/code-stubs-x87.cc ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 // Distinguish sequential and external strings. Only these two string 524 // Distinguish sequential and external strings. Only these two string
525 // representations can reach here (slices and flat cons strings have been 525 // representations can reach here (slices and flat cons strings have been
526 // reduced to the underlying sequential or external string). 526 // reduced to the underlying sequential or external string).
527 Label seq_string; 527 Label seq_string;
528 __ bind(&check_sequential); 528 __ bind(&check_sequential);
529 STATIC_ASSERT(kSeqStringTag == 0); 529 STATIC_ASSERT(kSeqStringTag == 0);
530 __ test(result, Immediate(kStringRepresentationMask)); 530 __ test(result, Immediate(kStringRepresentationMask));
531 __ j(zero, &seq_string, Label::kNear); 531 __ j(zero, &seq_string, Label::kNear);
532 532
533 // Handle external strings. 533 // Handle external strings.
534 Label ascii_external, done; 534 Label one_byte_external, done;
535 if (FLAG_debug_code) { 535 if (FLAG_debug_code) {
536 // Assert that we do not have a cons or slice (indirect strings) here. 536 // Assert that we do not have a cons or slice (indirect strings) here.
537 // Sequential strings have already been ruled out. 537 // Sequential strings have already been ruled out.
538 __ test(result, Immediate(kIsIndirectStringMask)); 538 __ test(result, Immediate(kIsIndirectStringMask));
539 __ Assert(zero, kExternalStringExpectedButNotFound); 539 __ Assert(zero, kExternalStringExpectedButNotFound);
540 } 540 }
541 // Rule out short external strings. 541 // Rule out short external strings.
542 STATIC_ASSERT(kShortExternalStringTag != 0); 542 STATIC_ASSERT(kShortExternalStringTag != 0);
543 __ test_b(result, kShortExternalStringMask); 543 __ test_b(result, kShortExternalStringMask);
544 __ j(not_zero, call_runtime); 544 __ j(not_zero, call_runtime);
545 // Check encoding. 545 // Check encoding.
546 STATIC_ASSERT(kTwoByteStringTag == 0); 546 STATIC_ASSERT(kTwoByteStringTag == 0);
547 __ test_b(result, kStringEncodingMask); 547 __ test_b(result, kStringEncodingMask);
548 __ mov(result, FieldOperand(string, ExternalString::kResourceDataOffset)); 548 __ mov(result, FieldOperand(string, ExternalString::kResourceDataOffset));
549 __ j(not_equal, &ascii_external, Label::kNear); 549 __ j(not_equal, &one_byte_external, Label::kNear);
550 // Two-byte string. 550 // Two-byte string.
551 __ movzx_w(result, Operand(result, index, times_2, 0)); 551 __ movzx_w(result, Operand(result, index, times_2, 0));
552 __ jmp(&done, Label::kNear); 552 __ jmp(&done, Label::kNear);
553 __ bind(&ascii_external); 553 __ bind(&one_byte_external);
554 // Ascii string. 554 // One-byte string.
555 __ movzx_b(result, Operand(result, index, times_1, 0)); 555 __ movzx_b(result, Operand(result, index, times_1, 0));
556 __ jmp(&done, Label::kNear); 556 __ jmp(&done, Label::kNear);
557 557
558 // Dispatch on the encoding: ASCII or two-byte. 558 // Dispatch on the encoding: one-byte or two-byte.
559 Label ascii; 559 Label one_byte;
560 __ bind(&seq_string); 560 __ bind(&seq_string);
561 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0); 561 STATIC_ASSERT((kStringEncodingMask & kOneByteStringTag) != 0);
562 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0); 562 STATIC_ASSERT((kStringEncodingMask & kTwoByteStringTag) == 0);
563 __ test(result, Immediate(kStringEncodingMask)); 563 __ test(result, Immediate(kStringEncodingMask));
564 __ j(not_zero, &ascii, Label::kNear); 564 __ j(not_zero, &one_byte, Label::kNear);
565 565
566 // Two-byte string. 566 // Two-byte string.
567 // Load the two-byte character code into the result register. 567 // Load the two-byte character code into the result register.
568 __ movzx_w(result, FieldOperand(string, 568 __ movzx_w(result, FieldOperand(string,
569 index, 569 index,
570 times_2, 570 times_2,
571 SeqTwoByteString::kHeaderSize)); 571 SeqTwoByteString::kHeaderSize));
572 __ jmp(&done, Label::kNear); 572 __ jmp(&done, Label::kNear);
573 573
574 // Ascii string. 574 // One-byte string.
575 // Load the byte into the result register. 575 // Load the byte into the result register.
576 __ bind(&ascii); 576 __ bind(&one_byte);
577 __ movzx_b(result, FieldOperand(string, 577 __ movzx_b(result, FieldOperand(string,
578 index, 578 index,
579 times_1, 579 times_1,
580 SeqOneByteString::kHeaderSize)); 580 SeqOneByteString::kHeaderSize));
581 __ bind(&done); 581 __ bind(&done);
582 } 582 }
583 583
584 584
585 #undef __ 585 #undef __
586 586
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 Code* stub = GetCodeAgeStub(isolate, age, parity); 636 Code* stub = GetCodeAgeStub(isolate, age, parity);
637 CodePatcher patcher(sequence, young_length); 637 CodePatcher patcher(sequence, young_length);
638 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); 638 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32);
639 } 639 }
640 } 640 }
641 641
642 642
643 } } // namespace v8::internal 643 } } // namespace v8::internal
644 644
645 #endif // V8_TARGET_ARCH_X87 645 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/code-stubs-x87.cc ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698