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

Side by Side Diff: src/code-stub-assembler.cc

Issue 2859203002: [string] Move String.p.toLowerCase to CSA (Closed)
Patch Set: Address comments Created 3 years, 7 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/code-stub-assembler.h ('k') | src/external-reference-table.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 #include "src/code-stub-assembler.h" 4 #include "src/code-stub-assembler.h"
5 #include "src/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/frames-inl.h" 6 #include "src/frames-inl.h"
7 #include "src/frames.h" 7 #include "src/frames.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 if_hash_not_computed); 1231 if_hash_not_computed);
1232 } 1232 }
1233 return Word32Shr(hash_field, Int32Constant(Name::kHashShift)); 1233 return Word32Shr(hash_field, Int32Constant(Name::kHashShift));
1234 } 1234 }
1235 1235
1236 Node* CodeStubAssembler::LoadStringLength(Node* object) { 1236 Node* CodeStubAssembler::LoadStringLength(Node* object) {
1237 CSA_ASSERT(this, IsString(object)); 1237 CSA_ASSERT(this, IsString(object));
1238 return LoadObjectField(object, String::kLengthOffset); 1238 return LoadObjectField(object, String::kLengthOffset);
1239 } 1239 }
1240 1240
1241 Node* CodeStubAssembler::PointerToSeqStringData(Node* seq_string) {
1242 CSA_ASSERT(this, IsString(seq_string));
1243 CSA_ASSERT(this,
1244 IsSequentialStringInstanceType(LoadInstanceType(seq_string)));
1245 STATIC_ASSERT(SeqOneByteString::kHeaderSize == SeqTwoByteString::kHeaderSize);
1246 return IntPtrAdd(
1247 BitcastTaggedToWord(seq_string),
1248 IntPtrConstant(SeqOneByteString::kHeaderSize - kHeapObjectTag));
1249 }
1250
1241 Node* CodeStubAssembler::LoadJSValueValue(Node* object) { 1251 Node* CodeStubAssembler::LoadJSValueValue(Node* object) {
1242 CSA_ASSERT(this, IsJSValue(object)); 1252 CSA_ASSERT(this, IsJSValue(object));
1243 return LoadObjectField(object, JSValue::kValueOffset); 1253 return LoadObjectField(object, JSValue::kValueOffset);
1244 } 1254 }
1245 1255
1246 Node* CodeStubAssembler::LoadWeakCellValueUnchecked(Node* weak_cell) { 1256 Node* CodeStubAssembler::LoadWeakCellValueUnchecked(Node* weak_cell) {
1247 // TODO(ishell): fix callers. 1257 // TODO(ishell): fix callers.
1248 return LoadObjectField(weak_cell, WeakCell::kValueOffset); 1258 return LoadObjectField(weak_cell, WeakCell::kValueOffset);
1249 } 1259 }
1250 1260
(...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after
3126 Int32Constant(kSeqStringTag)); 3136 Int32Constant(kSeqStringTag));
3127 } 3137 }
3128 3138
3129 Node* CodeStubAssembler::IsConsStringInstanceType(Node* instance_type) { 3139 Node* CodeStubAssembler::IsConsStringInstanceType(Node* instance_type) {
3130 CSA_ASSERT(this, IsStringInstanceType(instance_type)); 3140 CSA_ASSERT(this, IsStringInstanceType(instance_type));
3131 return Word32Equal( 3141 return Word32Equal(
3132 Word32And(instance_type, Int32Constant(kStringRepresentationMask)), 3142 Word32And(instance_type, Int32Constant(kStringRepresentationMask)),
3133 Int32Constant(kConsStringTag)); 3143 Int32Constant(kConsStringTag));
3134 } 3144 }
3135 3145
3146 Node* CodeStubAssembler::IsIndirectStringInstanceType(Node* instance_type) {
3147 CSA_ASSERT(this, IsStringInstanceType(instance_type));
3148 STATIC_ASSERT(kIsIndirectStringMask == 0x1);
3149 STATIC_ASSERT(kIsIndirectStringTag == 0x1);
3150 return Word32And(instance_type, Int32Constant(kIsIndirectStringMask));
3151 }
3152
3136 Node* CodeStubAssembler::IsExternalStringInstanceType(Node* instance_type) { 3153 Node* CodeStubAssembler::IsExternalStringInstanceType(Node* instance_type) {
3137 CSA_ASSERT(this, IsStringInstanceType(instance_type)); 3154 CSA_ASSERT(this, IsStringInstanceType(instance_type));
3138 return Word32Equal( 3155 return Word32Equal(
3139 Word32And(instance_type, Int32Constant(kStringRepresentationMask)), 3156 Word32And(instance_type, Int32Constant(kStringRepresentationMask)),
3140 Int32Constant(kExternalStringTag)); 3157 Int32Constant(kExternalStringTag));
3141 } 3158 }
3142 3159
3143 Node* CodeStubAssembler::IsShortExternalStringInstanceType( 3160 Node* CodeStubAssembler::IsShortExternalStringInstanceType(
3144 Node* instance_type) { 3161 Node* instance_type) {
3145 CSA_ASSERT(this, IsStringInstanceType(instance_type)); 3162 CSA_ASSERT(this, IsStringInstanceType(instance_type));
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
3649 var_result.Bind( 3666 var_result.Bind(
3650 CallRuntime(Runtime::kSubString, context, string, from, to)); 3667 CallRuntime(Runtime::kSubString, context, string, from, to));
3651 Goto(&end); 3668 Goto(&end);
3652 } 3669 }
3653 3670
3654 BIND(&end); 3671 BIND(&end);
3655 return var_result.value(); 3672 return var_result.value();
3656 } 3673 }
3657 3674
3658 ToDirectStringAssembler::ToDirectStringAssembler( 3675 ToDirectStringAssembler::ToDirectStringAssembler(
3659 compiler::CodeAssemblerState* state, Node* string) 3676 compiler::CodeAssemblerState* state, Node* string, Flags flags)
3660 : CodeStubAssembler(state), 3677 : CodeStubAssembler(state),
3661 var_string_(this, MachineRepresentation::kTagged, string), 3678 var_string_(this, MachineRepresentation::kTagged, string),
3662 var_instance_type_(this, MachineRepresentation::kWord32), 3679 var_instance_type_(this, MachineRepresentation::kWord32),
3663 var_offset_(this, MachineType::PointerRepresentation()), 3680 var_offset_(this, MachineType::PointerRepresentation()),
3664 var_is_external_(this, MachineRepresentation::kWord32) { 3681 var_is_external_(this, MachineRepresentation::kWord32),
3682 flags_(flags) {
3665 CSA_ASSERT(this, TaggedIsNotSmi(string)); 3683 CSA_ASSERT(this, TaggedIsNotSmi(string));
3666 CSA_ASSERT(this, IsString(string)); 3684 CSA_ASSERT(this, IsString(string));
3667 3685
3668 var_string_.Bind(string); 3686 var_string_.Bind(string);
3669 var_offset_.Bind(IntPtrConstant(0)); 3687 var_offset_.Bind(IntPtrConstant(0));
3670 var_instance_type_.Bind(LoadInstanceType(string)); 3688 var_instance_type_.Bind(LoadInstanceType(string));
3671 var_is_external_.Bind(Int32Constant(0)); 3689 var_is_external_.Bind(Int32Constant(0));
3672 } 3690 }
3673 3691
3674 Node* ToDirectStringAssembler::TryToDirect(Label* if_bailout) { 3692 Node* ToDirectStringAssembler::TryToDirect(Label* if_bailout) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3711 Node* const lhs = LoadObjectField(string, ConsString::kFirstOffset); 3729 Node* const lhs = LoadObjectField(string, ConsString::kFirstOffset);
3712 var_string_.Bind(lhs); 3730 var_string_.Bind(lhs);
3713 var_instance_type_.Bind(LoadInstanceType(lhs)); 3731 var_instance_type_.Bind(LoadInstanceType(lhs));
3714 3732
3715 Goto(&dispatch); 3733 Goto(&dispatch);
3716 } 3734 }
3717 3735
3718 // Sliced string. Fetch parent and correct start index by offset. 3736 // Sliced string. Fetch parent and correct start index by offset.
3719 BIND(&if_issliced); 3737 BIND(&if_issliced);
3720 { 3738 {
3721 Node* const string = var_string_.value(); 3739 if (flags_ & kDontUnpackSlicedStrings) {
3722 Node* const sliced_offset = 3740 Goto(if_bailout);
3723 LoadAndUntagObjectField(string, SlicedString::kOffsetOffset); 3741 } else {
3724 var_offset_.Bind(IntPtrAdd(var_offset_.value(), sliced_offset)); 3742 Node* const string = var_string_.value();
3743 Node* const sliced_offset =
3744 LoadAndUntagObjectField(string, SlicedString::kOffsetOffset);
3745 var_offset_.Bind(IntPtrAdd(var_offset_.value(), sliced_offset));
3725 3746
3726 Node* const parent = LoadObjectField(string, SlicedString::kParentOffset); 3747 Node* const parent = LoadObjectField(string, SlicedString::kParentOffset);
3727 var_string_.Bind(parent); 3748 var_string_.Bind(parent);
3728 var_instance_type_.Bind(LoadInstanceType(parent)); 3749 var_instance_type_.Bind(LoadInstanceType(parent));
3729 3750
3730 Goto(&dispatch); 3751 Goto(&dispatch);
3752 }
3731 } 3753 }
3732 3754
3733 // Thin string. Fetch the actual string. 3755 // Thin string. Fetch the actual string.
3734 BIND(&if_isthin); 3756 BIND(&if_isthin);
3735 { 3757 {
3736 Node* const string = var_string_.value(); 3758 Node* const string = var_string_.value();
3737 Node* const actual_string = 3759 Node* const actual_string =
3738 LoadObjectField(string, ThinString::kActualOffset); 3760 LoadObjectField(string, ThinString::kActualOffset);
3739 Node* const actual_instance_type = LoadInstanceType(actual_string); 3761 Node* const actual_instance_type = LoadInstanceType(actual_string);
3740 3762
(...skipping 5145 matching lines...) Expand 10 before | Expand all | Expand 10 after
8886 formatted.c_str(), TENURED); 8908 formatted.c_str(), TENURED);
8887 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), 8909 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(),
8888 HeapConstant(string)); 8910 HeapConstant(string));
8889 } 8911 }
8890 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); 8912 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value);
8891 #endif 8913 #endif
8892 } 8914 }
8893 8915
8894 } // namespace internal 8916 } // namespace internal
8895 } // namespace v8 8917 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/external-reference-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698