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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: forgot one Created 4 years 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
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 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 // (5) One byte sequential. Load regexp code for one byte. 597 // (5) One byte sequential. Load regexp code for one byte.
598 // (E) Carry on. 598 // (E) Carry on.
599 /// [...] 599 /// [...]
600 600
601 // Deferred code at the end of the stub: 601 // Deferred code at the end of the stub:
602 // (6) Long external string? If not, go to (10). 602 // (6) Long external string? If not, go to (10).
603 // (7) External string. Make it, offset-wise, look like a sequential string. 603 // (7) External string. Make it, offset-wise, look like a sequential string.
604 // (8) Is the external string one byte? If yes, go to (5). 604 // (8) Is the external string one byte? If yes, go to (5).
605 // (9) Two byte sequential. Load regexp code for two byte. Go to (E). 605 // (9) Two byte sequential. Load regexp code for two byte. Go to (E).
606 // (10) Short external string or not a string? If yes, bail out to runtime. 606 // (10) Short external string or not a string? If yes, bail out to runtime.
607 // (11) Sliced string. Replace subject with parent. Go to (1). 607 // (11) Sliced or thin string. Replace subject with parent. Go to (1).
608 608
609 Label seq_one_byte_string /* 5 */, seq_two_byte_string /* 9 */, 609 Label seq_one_byte_string /* 5 */, seq_two_byte_string /* 9 */,
610 external_string /* 7 */, check_underlying /* 1 */, 610 external_string /* 7 */, check_underlying /* 1 */,
611 not_seq_nor_cons /* 6 */, check_code /* E */, not_long_external /* 10 */; 611 not_seq_nor_cons /* 6 */, check_code /* E */, not_long_external /* 10 */;
612 612
613 __ bind(&check_underlying); 613 __ bind(&check_underlying);
614 // (1) Sequential two byte? If yes, go to (9). 614 // (1) Sequential two byte? If yes, go to (9).
615 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); 615 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
616 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); 616 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset));
617 617
618 __ and_(ebx, kIsNotStringMask | 618 __ and_(ebx, kIsNotStringMask |
619 kStringRepresentationMask | 619 kStringRepresentationMask |
620 kStringEncodingMask | 620 kStringEncodingMask |
621 kShortExternalStringMask); 621 kShortExternalStringMask);
622 STATIC_ASSERT((kStringTag | kSeqStringTag | kTwoByteStringTag) == 0); 622 STATIC_ASSERT((kStringTag | kSeqStringTag | kTwoByteStringTag) == 0);
623 __ j(zero, &seq_two_byte_string); // Go to (9). 623 __ j(zero, &seq_two_byte_string); // Go to (9).
624 624
625 // (2) Sequential one byte? If yes, go to (5). 625 // (2) Sequential one byte? If yes, go to (5).
626 // Any other sequential string must be one byte. 626 // Any other sequential string must be one byte.
627 __ and_(ebx, Immediate(kIsNotStringMask | 627 __ and_(ebx, Immediate(kIsNotStringMask |
628 kStringRepresentationMask | 628 kStringRepresentationMask |
629 kShortExternalStringMask)); 629 kShortExternalStringMask));
630 __ j(zero, &seq_one_byte_string, Label::kNear); // Go to (5). 630 __ j(zero, &seq_one_byte_string, Label::kNear); // Go to (5).
631 631
632 // (3) Sequential or cons? If not, go to (6). 632 // (3) Sequential or cons? If not, go to (6).
633 // We check whether the subject string is a cons, since sequential strings 633 // We check whether the subject string is a cons, since sequential strings
634 // have already been covered. 634 // have already been covered.
635 STATIC_ASSERT(kConsStringTag < kExternalStringTag); 635 STATIC_ASSERT(kConsStringTag < kExternalStringTag);
636 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); 636 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
Igor Sheludko 2016/12/20 23:46:58 Maybe STATIC_ASSERT(kThinStringTag > kExternalSt
Jakob Kummerow 2017/01/04 12:45:06 Done.
637 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); 637 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag);
638 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); 638 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag);
639 __ cmp(ebx, Immediate(kExternalStringTag)); 639 __ cmp(ebx, Immediate(kExternalStringTag));
640 __ j(greater_equal, &not_seq_nor_cons); // Go to (6). 640 __ j(greater_equal, &not_seq_nor_cons); // Go to (6).
641 641
642 // (4) Cons string. Check that it's flat. 642 // (4) Cons string. Check that it's flat.
643 // Replace subject with first string and reload instance type. 643 // Replace subject with first string and reload instance type.
644 __ cmp(FieldOperand(eax, ConsString::kSecondOffset), factory->empty_string()); 644 __ cmp(FieldOperand(eax, ConsString::kSecondOffset), factory->empty_string());
645 __ j(not_equal, &runtime); 645 __ j(not_equal, &runtime);
646 __ mov(eax, FieldOperand(eax, ConsString::kFirstOffset)); 646 __ mov(eax, FieldOperand(eax, ConsString::kFirstOffset));
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 __ Move(ecx, Immediate(0)); // Type is two byte. 905 __ Move(ecx, Immediate(0)); // Type is two byte.
906 __ jmp(&check_code); // Go to (E). 906 __ jmp(&check_code); // Go to (E).
907 907
908 // (10) Not a string or a short external string? If yes, bail out to runtime. 908 // (10) Not a string or a short external string? If yes, bail out to runtime.
909 __ bind(&not_long_external); 909 __ bind(&not_long_external);
910 // Catch non-string subject or short external string. 910 // Catch non-string subject or short external string.
911 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); 911 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0);
912 __ test(ebx, Immediate(kIsNotStringMask | kShortExternalStringTag)); 912 __ test(ebx, Immediate(kIsNotStringMask | kShortExternalStringTag));
913 __ j(not_zero, &runtime); 913 __ j(not_zero, &runtime);
914 914
915 // (11) Sliced string. Replace subject with parent. Go to (1). 915 // (11) Sliced or thin string. Replace subject with parent. Go to (1).
916 Label thin_string;
917 __ cmp(ebx, Immediate(kThinStringTag));
918 __ j(equal, &thin_string, Label::kNear);
916 // Load offset into edi and replace subject string with parent. 919 // Load offset into edi and replace subject string with parent.
917 __ mov(edi, FieldOperand(eax, SlicedString::kOffsetOffset)); 920 __ mov(edi, FieldOperand(eax, SlicedString::kOffsetOffset));
918 __ mov(eax, FieldOperand(eax, SlicedString::kParentOffset)); 921 __ mov(eax, FieldOperand(eax, SlicedString::kParentOffset));
919 __ jmp(&check_underlying); // Go to (1). 922 __ jmp(&check_underlying); // Go to (1).
923
924 __ bind(&thin_string);
925 __ mov(eax, FieldOperand(eax, ThinString::kActualOffset));
926 __ jmp(&check_underlying); // Go to (1).
920 #endif // V8_INTERPRETED_REGEXP 927 #endif // V8_INTERPRETED_REGEXP
921 } 928 }
922 929
923 930
924 static int NegativeComparisonResult(Condition cc) { 931 static int NegativeComparisonResult(Condition cc) {
925 DCHECK(cc != equal); 932 DCHECK(cc != equal);
926 DCHECK((cc == less) || (cc == less_equal) 933 DCHECK((cc == less) || (cc == less_equal)
927 || (cc == greater) || (cc == greater_equal)); 934 || (cc == greater) || (cc == greater_equal));
928 return (cc == greater || cc == greater_equal) ? LESS : GREATER; 935 return (cc == greater || cc == greater_equal) ? LESS : GREATER;
929 } 936 }
(...skipping 3488 matching lines...) Expand 10 before | Expand all | Expand 10 after
4418 kStackUnwindSpace, nullptr, return_value_operand, 4425 kStackUnwindSpace, nullptr, return_value_operand,
4419 NULL); 4426 NULL);
4420 } 4427 }
4421 4428
4422 #undef __ 4429 #undef __
4423 4430
4424 } // namespace internal 4431 } // namespace internal
4425 } // namespace v8 4432 } // namespace v8
4426 4433
4427 #endif // V8_TARGET_ARCH_IA32 4434 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698