OLD | NEW |
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 Loading... |
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 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3649 var_result.Bind( | 3659 var_result.Bind( |
3650 CallRuntime(Runtime::kSubString, context, string, from, to)); | 3660 CallRuntime(Runtime::kSubString, context, string, from, to)); |
3651 Goto(&end); | 3661 Goto(&end); |
3652 } | 3662 } |
3653 | 3663 |
3654 BIND(&end); | 3664 BIND(&end); |
3655 return var_result.value(); | 3665 return var_result.value(); |
3656 } | 3666 } |
3657 | 3667 |
3658 ToDirectStringAssembler::ToDirectStringAssembler( | 3668 ToDirectStringAssembler::ToDirectStringAssembler( |
3659 compiler::CodeAssemblerState* state, Node* string) | 3669 compiler::CodeAssemblerState* state, Node* string, Flags flags) |
3660 : CodeStubAssembler(state), | 3670 : CodeStubAssembler(state), |
3661 var_string_(this, MachineRepresentation::kTagged, string), | 3671 var_string_(this, MachineRepresentation::kTagged, string), |
3662 var_instance_type_(this, MachineRepresentation::kWord32), | 3672 var_instance_type_(this, MachineRepresentation::kWord32), |
3663 var_offset_(this, MachineType::PointerRepresentation()), | 3673 var_offset_(this, MachineType::PointerRepresentation()), |
3664 var_is_external_(this, MachineRepresentation::kWord32) { | 3674 var_is_external_(this, MachineRepresentation::kWord32), |
| 3675 flags_(flags) { |
3665 CSA_ASSERT(this, TaggedIsNotSmi(string)); | 3676 CSA_ASSERT(this, TaggedIsNotSmi(string)); |
3666 CSA_ASSERT(this, IsString(string)); | 3677 CSA_ASSERT(this, IsString(string)); |
3667 | 3678 |
3668 var_string_.Bind(string); | 3679 var_string_.Bind(string); |
3669 var_offset_.Bind(IntPtrConstant(0)); | 3680 var_offset_.Bind(IntPtrConstant(0)); |
3670 var_instance_type_.Bind(LoadInstanceType(string)); | 3681 var_instance_type_.Bind(LoadInstanceType(string)); |
3671 var_is_external_.Bind(Int32Constant(0)); | 3682 var_is_external_.Bind(Int32Constant(0)); |
3672 } | 3683 } |
3673 | 3684 |
3674 Node* ToDirectStringAssembler::TryToDirect(Label* if_bailout) { | 3685 Node* ToDirectStringAssembler::TryToDirect(Label* if_bailout) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3711 Node* const lhs = LoadObjectField(string, ConsString::kFirstOffset); | 3722 Node* const lhs = LoadObjectField(string, ConsString::kFirstOffset); |
3712 var_string_.Bind(lhs); | 3723 var_string_.Bind(lhs); |
3713 var_instance_type_.Bind(LoadInstanceType(lhs)); | 3724 var_instance_type_.Bind(LoadInstanceType(lhs)); |
3714 | 3725 |
3715 Goto(&dispatch); | 3726 Goto(&dispatch); |
3716 } | 3727 } |
3717 | 3728 |
3718 // Sliced string. Fetch parent and correct start index by offset. | 3729 // Sliced string. Fetch parent and correct start index by offset. |
3719 BIND(&if_issliced); | 3730 BIND(&if_issliced); |
3720 { | 3731 { |
3721 Node* const string = var_string_.value(); | 3732 if (flags_ & kDontUnpackSlicedStrings) { |
3722 Node* const sliced_offset = | 3733 Goto(if_bailout); |
3723 LoadAndUntagObjectField(string, SlicedString::kOffsetOffset); | 3734 } else { |
3724 var_offset_.Bind(IntPtrAdd(var_offset_.value(), sliced_offset)); | 3735 Node* const string = var_string_.value(); |
| 3736 Node* const sliced_offset = |
| 3737 LoadAndUntagObjectField(string, SlicedString::kOffsetOffset); |
| 3738 var_offset_.Bind(IntPtrAdd(var_offset_.value(), sliced_offset)); |
3725 | 3739 |
3726 Node* const parent = LoadObjectField(string, SlicedString::kParentOffset); | 3740 Node* const parent = LoadObjectField(string, SlicedString::kParentOffset); |
3727 var_string_.Bind(parent); | 3741 var_string_.Bind(parent); |
3728 var_instance_type_.Bind(LoadInstanceType(parent)); | 3742 var_instance_type_.Bind(LoadInstanceType(parent)); |
3729 | 3743 |
3730 Goto(&dispatch); | 3744 Goto(&dispatch); |
| 3745 } |
3731 } | 3746 } |
3732 | 3747 |
3733 // Thin string. Fetch the actual string. | 3748 // Thin string. Fetch the actual string. |
3734 BIND(&if_isthin); | 3749 BIND(&if_isthin); |
3735 { | 3750 { |
3736 Node* const string = var_string_.value(); | 3751 Node* const string = var_string_.value(); |
3737 Node* const actual_string = | 3752 Node* const actual_string = |
3738 LoadObjectField(string, ThinString::kActualOffset); | 3753 LoadObjectField(string, ThinString::kActualOffset); |
3739 Node* const actual_instance_type = LoadInstanceType(actual_string); | 3754 Node* const actual_instance_type = LoadInstanceType(actual_string); |
3740 | 3755 |
(...skipping 5145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8886 formatted.c_str(), TENURED); | 8901 formatted.c_str(), TENURED); |
8887 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), | 8902 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), |
8888 HeapConstant(string)); | 8903 HeapConstant(string)); |
8889 } | 8904 } |
8890 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); | 8905 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); |
8891 #endif | 8906 #endif |
8892 } | 8907 } |
8893 | 8908 |
8894 } // namespace internal | 8909 } // namespace internal |
8895 } // namespace v8 | 8910 } // namespace v8 |
OLD | NEW |