| Index: src/code-stub-assembler.cc
|
| diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
|
| index a7dc1ba1dc108eb252840d95111696925a736ca2..97f77e22244d1b043c4cadfe483a075a9425b256 100644
|
| --- a/src/code-stub-assembler.cc
|
| +++ b/src/code-stub-assembler.cc
|
| @@ -1566,9 +1566,6 @@
|
| Node* CodeStubAssembler::AllocateSeqOneByteString(int length,
|
| AllocationFlags flags) {
|
| Comment("AllocateSeqOneByteString");
|
| - if (length == 0) {
|
| - return LoadRoot(Heap::kempty_stringRootIndex);
|
| - }
|
| Node* result = Allocate(SeqOneByteString::SizeFor(length), flags);
|
| DCHECK(Heap::RootIsImmortalImmovable(Heap::kOneByteStringMapRootIndex));
|
| StoreMapNoWriteBarrier(result, Heap::kOneByteStringMapRootIndex);
|
| @@ -1588,10 +1585,8 @@
|
| Variable var_result(this, MachineRepresentation::kTagged);
|
|
|
| // Compute the SeqOneByteString size and check if it fits into new space.
|
| - Label if_lengthiszero(this), if_sizeissmall(this),
|
| - if_notsizeissmall(this, Label::kDeferred), if_join(this);
|
| - GotoIf(WordEqual(length, IntPtrOrSmiConstant(0, mode)), &if_lengthiszero);
|
| -
|
| + Label if_sizeissmall(this), if_notsizeissmall(this, Label::kDeferred),
|
| + if_join(this);
|
| Node* raw_size = GetArrayAllocationSize(
|
| length, UINT8_ELEMENTS, mode,
|
| SeqOneByteString::kHeaderSize + kObjectAlignmentMask);
|
| @@ -1624,12 +1619,6 @@
|
| Goto(&if_join);
|
| }
|
|
|
| - Bind(&if_lengthiszero);
|
| - {
|
| - var_result.Bind(LoadRoot(Heap::kempty_stringRootIndex));
|
| - Goto(&if_join);
|
| - }
|
| -
|
| Bind(&if_join);
|
| return var_result.value();
|
| }
|
| @@ -1637,9 +1626,6 @@
|
| Node* CodeStubAssembler::AllocateSeqTwoByteString(int length,
|
| AllocationFlags flags) {
|
| Comment("AllocateSeqTwoByteString");
|
| - if (length == 0) {
|
| - return LoadRoot(Heap::kempty_stringRootIndex);
|
| - }
|
| Node* result = Allocate(SeqTwoByteString::SizeFor(length), flags);
|
| DCHECK(Heap::RootIsImmortalImmovable(Heap::kStringMapRootIndex));
|
| StoreMapNoWriteBarrier(result, Heap::kStringMapRootIndex);
|
| @@ -1659,10 +1645,8 @@
|
| Variable var_result(this, MachineRepresentation::kTagged);
|
|
|
| // Compute the SeqTwoByteString size and check if it fits into new space.
|
| - Label if_lengthiszero(this), if_sizeissmall(this),
|
| - if_notsizeissmall(this, Label::kDeferred), if_join(this);
|
| - GotoIf(WordEqual(length, IntPtrOrSmiConstant(0, mode)), &if_lengthiszero);
|
| -
|
| + Label if_sizeissmall(this), if_notsizeissmall(this, Label::kDeferred),
|
| + if_join(this);
|
| Node* raw_size = GetArrayAllocationSize(
|
| length, UINT16_ELEMENTS, mode,
|
| SeqOneByteString::kHeaderSize + kObjectAlignmentMask);
|
| @@ -1694,12 +1678,6 @@
|
| CallRuntime(Runtime::kAllocateSeqTwoByteString, context,
|
| mode == SMI_PARAMETERS ? length : SmiFromWord(length));
|
| var_result.Bind(result);
|
| - Goto(&if_join);
|
| - }
|
| -
|
| - Bind(&if_lengthiszero);
|
| - {
|
| - var_result.Bind(LoadRoot(Heap::kempty_stringRootIndex));
|
| Goto(&if_join);
|
| }
|
|
|
| @@ -3165,29 +3143,14 @@
|
|
|
| Bind(&if_stringisnotexternal);
|
| {
|
| - Label if_stringissliced(this), if_stringisthin(this);
|
| - Branch(
|
| - Word32Equal(Word32And(string_instance_type,
|
| - Int32Constant(kStringRepresentationMask)),
|
| - Int32Constant(kSlicedStringTag)),
|
| - &if_stringissliced, &if_stringisthin);
|
| - Bind(&if_stringissliced);
|
| - {
|
| - // The {string} is a SlicedString, continue with its parent.
|
| - Node* string_offset =
|
| - LoadAndUntagObjectField(string, SlicedString::kOffsetOffset);
|
| - Node* string_parent =
|
| - LoadObjectField(string, SlicedString::kParentOffset);
|
| - var_index.Bind(IntPtrAdd(index, string_offset));
|
| - var_string.Bind(string_parent);
|
| - Goto(&loop);
|
| - }
|
| - Bind(&if_stringisthin);
|
| - {
|
| - // The {string} is a ThinString, continue with its actual value.
|
| - var_string.Bind(LoadObjectField(string, ThinString::kActualOffset));
|
| - Goto(&loop);
|
| - }
|
| + // The {string} is a SlicedString, continue with its parent.
|
| + Node* string_offset =
|
| + LoadAndUntagObjectField(string, SlicedString::kOffsetOffset);
|
| + Node* string_parent =
|
| + LoadObjectField(string, SlicedString::kParentOffset);
|
| + var_index.Bind(IntPtrAdd(index, string_offset));
|
| + var_string.Bind(string_parent);
|
| + Goto(&loop);
|
| }
|
| }
|
| }
|
| @@ -3363,8 +3326,7 @@
|
| // and put the underlying string into var_string.
|
|
|
| // If the string is not indirect, it can only be sequential or external.
|
| - STATIC_ASSERT(kIsIndirectStringMask ==
|
| - (kSlicedStringTag & kConsStringTag & kThinStringTag));
|
| + STATIC_ASSERT(kIsIndirectStringMask == (kSlicedStringTag & kConsStringTag));
|
| STATIC_ASSERT(kIsIndirectStringMask != 0);
|
| Label underlying_unpacked(this);
|
| GotoIf(Word32Equal(
|
| @@ -3372,13 +3334,13 @@
|
| Int32Constant(0)),
|
| &underlying_unpacked);
|
|
|
| - // The subject string is a sliced, cons, or thin string.
|
| -
|
| - Label sliced_string(this), thin_or_sliced(this);
|
| - Node* representation =
|
| - Word32And(instance_type, Int32Constant(kStringRepresentationMask));
|
| - GotoIf(Word32NotEqual(representation, Int32Constant(kConsStringTag)),
|
| - &thin_or_sliced);
|
| + // The subject string is either a sliced or cons string.
|
| +
|
| + Label sliced_string(this);
|
| + GotoIf(Word32NotEqual(
|
| + Word32And(instance_type, Int32Constant(kSlicedNotConsMask)),
|
| + Int32Constant(0)),
|
| + &sliced_string);
|
|
|
| // Cons string. Check whether it is flat, then fetch first part.
|
| // Flat cons strings have an empty second part.
|
| @@ -3391,16 +3353,6 @@
|
| var_string.Bind(first_string_part);
|
| var_instance_type.Bind(LoadInstanceType(first_string_part));
|
|
|
| - Goto(&underlying_unpacked);
|
| - }
|
| -
|
| - Bind(&thin_or_sliced);
|
| - {
|
| - GotoIf(Word32Equal(representation, Int32Constant(kSlicedStringTag)),
|
| - &sliced_string);
|
| - Node* actual_string = LoadObjectField(string, ThinString::kActualOffset);
|
| - var_string.Bind(actual_string);
|
| - var_instance_type.Bind(LoadInstanceType(actual_string));
|
| Goto(&underlying_unpacked);
|
| }
|
|
|
| @@ -4360,19 +4312,17 @@
|
|
|
| void CodeStubAssembler::TryToName(Node* key, Label* if_keyisindex,
|
| Variable* var_index, Label* if_keyisunique,
|
| - Variable* var_unique, Label* if_bailout) {
|
| + Label* if_bailout) {
|
| DCHECK_EQ(MachineType::PointerRepresentation(), var_index->rep());
|
| - DCHECK_EQ(MachineRepresentation::kTagged, var_unique->rep());
|
| Comment("TryToName");
|
|
|
| - Label if_hascachedindex(this), if_keyisnotindex(this), if_thinstring(this);
|
| + Label if_hascachedindex(this), if_keyisnotindex(this);
|
| // Handle Smi and HeapNumber keys.
|
| var_index->Bind(TryToIntptr(key, &if_keyisnotindex));
|
| Goto(if_keyisindex);
|
|
|
| Bind(&if_keyisnotindex);
|
| Node* key_map = LoadMap(key);
|
| - var_unique->Bind(key);
|
| // Symbols are unique.
|
| GotoIf(IsSymbolMap(key_map), if_keyisunique);
|
| Node* key_instance_type = LoadMapInstanceType(key_map);
|
| @@ -4389,21 +4339,11 @@
|
| Node* not_an_index =
|
| Word32And(hash, Int32Constant(Name::kIsNotArrayIndexMask));
|
| GotoIf(Word32Equal(not_an_index, Int32Constant(0)), if_bailout);
|
| - // Check if we have a ThinString.
|
| - GotoIf(Word32Equal(key_instance_type, Int32Constant(THIN_STRING_TYPE)),
|
| - &if_thinstring);
|
| - GotoIf(
|
| - Word32Equal(key_instance_type, Int32Constant(THIN_ONE_BYTE_STRING_TYPE)),
|
| - &if_thinstring);
|
| // Finally, check if |key| is internalized.
|
| STATIC_ASSERT(kNotInternalizedTag != 0);
|
| Node* not_internalized =
|
| Word32And(key_instance_type, Int32Constant(kIsNotInternalizedMask));
|
| GotoIf(Word32NotEqual(not_internalized, Int32Constant(0)), if_bailout);
|
| - Goto(if_keyisunique);
|
| -
|
| - Bind(&if_thinstring);
|
| - var_unique->Bind(LoadObjectField(key, ThinString::kActualOffset));
|
| Goto(if_keyisunique);
|
|
|
| Bind(&if_hascachedindex);
|
| @@ -5255,11 +5195,9 @@
|
| }
|
|
|
| Variable var_index(this, MachineType::PointerRepresentation());
|
| - Variable var_unique(this, MachineRepresentation::kTagged);
|
|
|
| Label if_keyisindex(this), if_iskeyunique(this);
|
| - TryToName(key, &if_keyisindex, &var_index, &if_iskeyunique, &var_unique,
|
| - if_bailout);
|
| + TryToName(key, &if_keyisindex, &var_index, &if_iskeyunique, if_bailout);
|
|
|
| Bind(&if_iskeyunique);
|
| {
|
| @@ -5281,8 +5219,8 @@
|
|
|
| Label next_proto(this);
|
| lookup_property_in_holder(receiver, var_holder.value(), holder_map,
|
| - holder_instance_type, var_unique.value(),
|
| - &next_proto, if_bailout);
|
| + holder_instance_type, key, &next_proto,
|
| + if_bailout);
|
| Bind(&next_proto);
|
|
|
| // Bailout if it can be an integer indexed exotic case.
|
|
|