Skip to content

Commit

Permalink
Merged: Revert recent ConsString-related changes
Browse files Browse the repository at this point in the history
Revision: f434acc458db917a909881461c203db1303f2622

BUG=v8:9147
LOG=N
NOTRY=true
NOPRESUBMIT=true
NOTREECHECKS=true
R=jarin@chromium.org

Change-Id: I4f23480624c06f05c6d54b7760747b7ad22b6d2c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1583764
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/branch-heads/7.5@{#4}
Cr-Branched-From: 35b9bf5-refs/heads/7.5.288@{#1}
Cr-Branched-From: 912b391-refs/heads/master@{#60911}
  • Loading branch information
GeorgNeis authored and Commit Bot committed Apr 26, 2019
1 parent 1c8d6aa commit 59a8226
Show file tree
Hide file tree
Showing 50 changed files with 528 additions and 1,010 deletions.
6 changes: 3 additions & 3 deletions include/v8-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ class Internals {
static const int kNodeIsIndependentShift = 3;
static const int kNodeIsActiveShift = 4;

static const int kFirstNonstringType = 0x80;
static const int kOddballType = 0x83;
static const int kForeignType = 0x87;
static const int kFirstNonstringType = 0x40;
static const int kOddballType = 0x43;
static const int kForeignType = 0x47;
static const int kJSSpecialApiObjectType = 0x410;
static const int kJSApiObjectType = 0x420;
static const int kJSObjectType = 0x421;
Expand Down
31 changes: 6 additions & 25 deletions src/code-stub-assembler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3331,8 +3331,7 @@ TNode<String> CodeStubAssembler::AllocateSlicedTwoByteString(

TNode<String> CodeStubAssembler::AllocateConsString(TNode<Uint32T> length,
TNode<String> left,
TNode<String> right,
Variable* var_feedback) {
TNode<String> right) {
// Added string can be a cons string.
Comment("Allocating ConsString");
Node* left_instance_type = LoadInstanceType(left);
Expand All @@ -3346,20 +3345,8 @@ TNode<String> CodeStubAssembler::AllocateConsString(TNode<Uint32T> length,
Word32And(left_instance_type, right_instance_type);
TNode<Map> result_map = CAST(Select<Object>(
IsSetWord32(combined_instance_type, kStringEncodingMask),
[=] {
if (var_feedback != nullptr) {
var_feedback->Bind(
SmiConstant(BinaryOperationFeedback::kConsOneByteString));
}
return LoadRoot(RootIndex::kConsOneByteStringMap);
},
[=] {
if (var_feedback != nullptr) {
var_feedback->Bind(
SmiConstant(BinaryOperationFeedback::kConsTwoByteString));
}
return LoadRoot(RootIndex::kConsStringMap);
}));
[=] { return LoadRoot(RootIndex::kConsOneByteStringMap); },
[=] { return LoadRoot(RootIndex::kConsStringMap); }));
Node* result = AllocateInNewSpace(ConsString::kSize);
StoreMapNoWriteBarrier(result, result_map);
StoreObjectFieldNoWriteBarrier(result, ConsString::kLengthOffset, length,
Expand Down Expand Up @@ -7200,18 +7187,12 @@ void CodeStubAssembler::MaybeDerefIndirectStrings(Variable* var_left,
}

TNode<String> CodeStubAssembler::StringAdd(Node* context, TNode<String> left,
TNode<String> right,
Variable* var_feedback) {
TNode<String> right) {
TVARIABLE(String, result);
Label check_right(this), runtime(this, Label::kDeferred), cons(this),
done(this, &result), done_native(this, &result);
Counters* counters = isolate()->counters();

// Default to "String" feedback if we don't learn anything else below.
if (var_feedback != nullptr) {
var_feedback->Bind(SmiConstant(BinaryOperationFeedback::kString));
}

TNode<Uint32T> left_length = LoadStringLengthAsWord32(left);
GotoIfNot(Word32Equal(left_length, Uint32Constant(0)), &check_right);
result = right;
Expand Down Expand Up @@ -7241,8 +7222,8 @@ TNode<String> CodeStubAssembler::StringAdd(Node* context, TNode<String> left,
GotoIf(Uint32LessThan(new_length, Uint32Constant(ConsString::kMinLength)),
&non_cons);

result = AllocateConsString(new_length, var_left.value(), var_right.value(),
var_feedback);
result =
AllocateConsString(new_length, var_left.value(), var_right.value());
Goto(&done_native);

BIND(&non_cons);
Expand Down
5 changes: 2 additions & 3 deletions src/code-stub-assembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// Allocate an appropriate one- or two-byte ConsString with the first and
// second parts specified by |left| and |right|.
TNode<String> AllocateConsString(TNode<Uint32T> length, TNode<String> left,
TNode<String> right, Variable* var_feedback);
TNode<String> right);

TNode<NameDictionary> AllocateNameDictionary(int at_least_space_for);
TNode<NameDictionary> AllocateNameDictionary(
Expand Down Expand Up @@ -2341,8 +2341,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler

// Return a new string object produced by concatenating |first| with |second|.
TNode<String> StringAdd(Node* context, TNode<String> first,
TNode<String> second,
Variable* var_feedback = nullptr);
TNode<String> second);

// Check if |string| is an indirect (thin or flat cons) string type that can
// be dereferenced by DerefIndirectString.
Expand Down
96 changes: 1 addition & 95 deletions src/compiler/effect-control-linearizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -715,15 +715,6 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kCheckInternalizedString:
result = LowerCheckInternalizedString(node, frame_state);
break;
case IrOpcode::kCheckNonEmptyOneByteString:
result = LowerCheckNonEmptyOneByteString(node, frame_state);
break;
case IrOpcode::kCheckNonEmptyTwoByteString:
result = LowerCheckNonEmptyTwoByteString(node, frame_state);
break;
case IrOpcode::kCheckNonEmptyString:
result = LowerCheckNonEmptyString(node, frame_state);
break;
case IrOpcode::kCheckIf:
LowerCheckIf(node, frame_state);
break;
Expand Down Expand Up @@ -893,12 +884,6 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kNewArgumentsElements:
result = LowerNewArgumentsElements(node);
break;
case IrOpcode::kNewConsOneByteString:
result = LowerNewConsOneByteString(node);
break;
case IrOpcode::kNewConsTwoByteString:
result = LowerNewConsTwoByteString(node);
break;
case IrOpcode::kNewConsString:
result = LowerNewConsString(node);
break;
Expand Down Expand Up @@ -1804,62 +1789,6 @@ Node* EffectControlLinearizer::LowerCheckInternalizedString(Node* node,
return value;
}

Node* EffectControlLinearizer::LowerCheckNonEmptyOneByteString(
Node* node, Node* frame_state) {
Node* value = node->InputAt(0);

Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
Node* value_instance_type =
__ LoadField(AccessBuilder::ForMapInstanceType(), value_map);

Node* check = __ Word32Equal(
__ Word32And(value_instance_type,
__ Int32Constant(kIsNotStringMask | kStringEncodingMask |
kIsEmptyStringMask)),
__ Int32Constant(kStringTag | kOneByteStringTag | kIsNotEmptyStringTag));
__ DeoptimizeIfNot(DeoptimizeReason::kWrongInstanceType, VectorSlotPair(),
check, frame_state);

return value;
}

Node* EffectControlLinearizer::LowerCheckNonEmptyTwoByteString(
Node* node, Node* frame_state) {
Node* value = node->InputAt(0);

Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
Node* value_instance_type =
__ LoadField(AccessBuilder::ForMapInstanceType(), value_map);

Node* check = __ Word32Equal(
__ Word32And(value_instance_type,
__ Int32Constant(kIsNotStringMask | kStringEncodingMask |
kIsEmptyStringMask)),
__ Int32Constant(kStringTag | kTwoByteStringTag | kIsNotEmptyStringTag));
__ DeoptimizeIfNot(DeoptimizeReason::kWrongInstanceType, VectorSlotPair(),
check, frame_state);

return value;
}

Node* EffectControlLinearizer::LowerCheckNonEmptyString(Node* node,
Node* frame_state) {
Node* value = node->InputAt(0);

Node* value_map = __ LoadField(AccessBuilder::ForMap(), value);
Node* value_instance_type =
__ LoadField(AccessBuilder::ForMapInstanceType(), value_map);

Node* check = __ Word32Equal(
__ Word32And(value_instance_type,
__ Int32Constant(kIsNotStringMask | kIsEmptyStringMask)),
__ Int32Constant(kStringTag | kIsNotEmptyStringTag));
__ DeoptimizeIfNot(DeoptimizeReason::kWrongInstanceType, VectorSlotPair(),
check, frame_state);

return value;
}

void EffectControlLinearizer::LowerCheckIf(Node* node, Node* frame_state) {
Node* value = node->InputAt(0);
const CheckIfParameters& p = CheckIfParametersOf(node->op());
Expand Down Expand Up @@ -3358,24 +3287,6 @@ Node* EffectControlLinearizer::LowerNewArgumentsElements(Node* node) {
length, __ SmiConstant(mapped_count), __ NoContextConstant());
}

Node* EffectControlLinearizer::LowerNewConsOneByteString(Node* node) {
Node* map = jsgraph()->HeapConstant(factory()->cons_one_byte_string_map());
Node* length = node->InputAt(0);
Node* first = node->InputAt(1);
Node* second = node->InputAt(2);

return AllocateConsString(map, length, first, second);
}

Node* EffectControlLinearizer::LowerNewConsTwoByteString(Node* node) {
Node* map = jsgraph()->HeapConstant(factory()->cons_string_map());
Node* length = node->InputAt(0);
Node* first = node->InputAt(1);
Node* second = node->InputAt(2);

return AllocateConsString(map, length, first, second);
}

Node* EffectControlLinearizer::LowerNewConsString(Node* node) {
Node* length = node->InputAt(0);
Node* first = node->InputAt(1);
Expand Down Expand Up @@ -3412,14 +3323,9 @@ Node* EffectControlLinearizer::LowerNewConsString(Node* node) {
Node* result_map = done.PhiAt(0);

// Allocate the resulting ConsString.
return AllocateConsString(result_map, length, first, second);
}

Node* EffectControlLinearizer::AllocateConsString(Node* map, Node* length,
Node* first, Node* second) {
Node* result =
__ Allocate(AllocationType::kYoung, __ IntPtrConstant(ConsString::kSize));
__ StoreField(AccessBuilder::ForMap(), result, map);
__ StoreField(AccessBuilder::ForMap(), result, result_map);
__ StoreField(AccessBuilder::ForNameHashField(), result,
__ Int32Constant(Name::kEmptyHashField));
__ StoreField(AccessBuilder::ForStringLength(), result, length);
Expand Down
6 changes: 0 additions & 6 deletions src/compiler/effect-control-linearizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ class V8_EXPORT_PRIVATE EffectControlLinearizer {
Node* LowerChangeTaggedToCompressedSigned(Node* node);
Node* LowerPoisonIndex(Node* node);
Node* LowerCheckInternalizedString(Node* node, Node* frame_state);
Node* LowerCheckNonEmptyOneByteString(Node* node, Node* frame_state);
Node* LowerCheckNonEmptyTwoByteString(Node* node, Node* frame_state);
Node* LowerCheckNonEmptyString(Node* node, Node* frame_state);
void LowerCheckMaps(Node* node, Node* frame_state);
Node* LowerCompareMaps(Node* node);
Node* LowerCheckNumber(Node* node, Node* frame_state);
Expand Down Expand Up @@ -142,8 +139,6 @@ class V8_EXPORT_PRIVATE EffectControlLinearizer {
Node* LowerNewDoubleElements(Node* node);
Node* LowerNewSmiOrObjectElements(Node* node);
Node* LowerNewArgumentsElements(Node* node);
Node* LowerNewConsOneByteString(Node* node);
Node* LowerNewConsTwoByteString(Node* node);
Node* LowerNewConsString(Node* node);
Node* LowerSameValue(Node* node);
Node* LowerNumberSameValue(Node* node);
Expand Down Expand Up @@ -200,7 +195,6 @@ class V8_EXPORT_PRIVATE EffectControlLinearizer {
Maybe<Node*> LowerFloat64RoundTruncate(Node* node);

Node* AllocateHeapNumberWithValue(Node* node);
Node* AllocateConsString(Node* map, Node* length, Node* first, Node* second);
Node* BuildCheckedFloat64ToInt32(CheckForMinusZeroMode mode,
const VectorSlotPair& feedback, Node* value,
Node* frame_state);
Expand Down
12 changes: 0 additions & 12 deletions src/compiler/js-operator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -688,12 +688,6 @@ struct JSOperatorGlobalCache final {
Name##Operator<BinaryOperationHint::kNumber> k##Name##NumberOperator; \
Name##Operator<BinaryOperationHint::kNumberOrOddball> \
k##Name##NumberOrOddballOperator; \
Name##Operator<BinaryOperationHint::kConsOneByteString> \
k##Name##ConsOneByteStringOperator; \
Name##Operator<BinaryOperationHint::kConsTwoByteString> \
k##Name##ConsTwoByteStringOperator; \
Name##Operator<BinaryOperationHint::kConsString> \
k##Name##ConsStringOperator; \
Name##Operator<BinaryOperationHint::kString> k##Name##StringOperator; \
Name##Operator<BinaryOperationHint::kBigInt> k##Name##BigIntOperator; \
Name##Operator<BinaryOperationHint::kAny> k##Name##AnyOperator;
Expand Down Expand Up @@ -756,12 +750,6 @@ CACHED_OP_LIST(CACHED_OP)
return &cache_.k##Name##NumberOperator; \
case BinaryOperationHint::kNumberOrOddball: \
return &cache_.k##Name##NumberOrOddballOperator; \
case BinaryOperationHint::kConsOneByteString: \
return &cache_.k##Name##ConsOneByteStringOperator; \
case BinaryOperationHint::kConsTwoByteString: \
return &cache_.k##Name##ConsTwoByteStringOperator; \
case BinaryOperationHint::kConsString: \
return &cache_.k##Name##ConsStringOperator; \
case BinaryOperationHint::kString: \
return &cache_.k##Name##StringOperator; \
case BinaryOperationHint::kBigInt: \
Expand Down
3 changes: 0 additions & 3 deletions src/compiler/js-type-hint-lowering.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ bool BinaryOperationHintToNumberOperationHint(
return true;
case BinaryOperationHint::kAny:
case BinaryOperationHint::kNone:
case BinaryOperationHint::kConsOneByteString:
case BinaryOperationHint::kConsTwoByteString:
case BinaryOperationHint::kConsString:
case BinaryOperationHint::kString:
case BinaryOperationHint::kBigInt:
break;
Expand Down
Loading

0 comments on commit 59a8226

Please sign in to comment.