Commit 32a1ebd2 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[compiler] No longer expose the OtherString type.

This type is dangerous because it can become smaller over time (as
strings get internalized).

Bug: v8:6521
Change-Id: Iea650789ab52c13a0519f46999edc8a7959ccc71
Reviewed-on: https://chromium-review.googlesource.com/968525
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52040}
parent 94833cbf
......@@ -2242,9 +2242,7 @@ Type* Typer::Visitor::TypeNewArgumentsElements(Node* node) {
return Type::OtherInternal();
}
Type* Typer::Visitor::TypeNewConsString(Node* node) {
return Type::OtherString();
}
Type* Typer::Visitor::TypeNewConsString(Node* node) { return Type::String(); }
Type* Typer::Visitor::TypeArrayBufferWasNeutered(Node* node) {
return Type::Boolean();
......
......@@ -163,7 +163,7 @@ Type::bitset BitsetType::Lub(i::Map* map) {
case SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE:
case STRING_TYPE:
case ONE_BYTE_STRING_TYPE:
return kOtherString;
return kString;
case EXTERNAL_INTERNALIZED_STRING_TYPE:
case EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE:
case EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE:
......@@ -361,6 +361,7 @@ size_t BitsetType::BoundariesSize() {
}
Type::bitset BitsetType::ExpandInternals(Type::bitset bits) {
DCHECK_IMPLIES(bits & kOtherString, (bits & kString) == kString);
DisallowHeapAllocation no_allocation;
if (!(bits & kPlainNumber)) return bits; // Shortcut.
const Boundary* boundaries = Boundaries();
......@@ -823,7 +824,7 @@ Type* Type::NewConstant(i::Handle<i::Object> value, Zone* zone) {
} else if (value->IsHeapNumber()) {
return NewConstant(value->Number(), zone);
} else if (value->IsString() && !value->IsInternalizedString()) {
return Type::OtherString();
return Type::String();
}
return HeapConstant(i::Handle<i::HeapObject>::cast(value), zone);
}
......
......@@ -103,31 +103,31 @@ namespace compiler {
V(OtherUnsigned32, 1u << 2) \
V(OtherSigned32, 1u << 3) \
V(OtherNumber, 1u << 4) \
V(OtherString, 1u << 5) \
#define PROPER_BITSET_TYPE_LIST(V) \
V(None, 0u) \
V(Negative31, 1u << 5) \
V(Null, 1u << 6) \
V(Undefined, 1u << 7) \
V(Boolean, 1u << 8) \
V(Unsigned30, 1u << 9) \
V(MinusZero, 1u << 10) \
V(NaN, 1u << 11) \
V(Symbol, 1u << 12) \
V(InternalizedString, 1u << 13) \
V(OtherString, 1u << 14) \
V(OtherCallable, 1u << 15) \
V(OtherObject, 1u << 16) \
V(OtherUndetectable, 1u << 17) \
V(CallableProxy, 1u << 18) \
V(OtherProxy, 1u << 19) \
V(Function, 1u << 20) \
V(BoundFunction, 1u << 21) \
V(Hole, 1u << 22) \
V(OtherInternal, 1u << 23) \
V(ExternalPointer, 1u << 24) \
V(Array, 1u << 25) \
V(BigInt, 1u << 26) \
V(Negative31, 1u << 6) \
V(Null, 1u << 7) \
V(Undefined, 1u << 8) \
V(Boolean, 1u << 9) \
V(Unsigned30, 1u << 10) \
V(MinusZero, 1u << 11) \
V(NaN, 1u << 12) \
V(Symbol, 1u << 13) \
V(InternalizedString, 1u << 14) \
V(OtherCallable, 1u << 16) \
V(OtherObject, 1u << 17) \
V(OtherUndetectable, 1u << 18) \
V(CallableProxy, 1u << 19) \
V(OtherProxy, 1u << 20) \
V(Function, 1u << 21) \
V(BoundFunction, 1u << 22) \
V(Hole, 1u << 23) \
V(OtherInternal, 1u << 24) \
V(ExternalPointer, 1u << 25) \
V(Array, 1u << 26) \
V(BigInt, 1u << 27) \
\
V(Signed31, kUnsigned30 | kNegative31) \
V(Signed32, kSigned31 | kOtherUnsigned31 | \
......
......@@ -1214,7 +1214,7 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
CheckValueInputIs(node, 0, TypeCache::Get().kStringLengthType);
CheckValueInputIs(node, 1, Type::String());
CheckValueInputIs(node, 2, Type::String());
CheckTypeIs(node, Type::OtherString());
CheckTypeIs(node, Type::String());
break;
case IrOpcode::kAllocate:
CheckValueInputIs(node, 0, Type::PlainNumber());
......
......@@ -186,9 +186,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
}
};
static Type* kStringTypes[] = {Type::InternalizedString(), Type::OtherString(),
Type::String()};
static Type* kStringTypes[] = {Type::InternalizedString(), Type::String()};
static Type* kInt32Types[] = {Type::UnsignedSmall(), Type::Negative32(),
Type::Unsigned31(), Type::SignedSmall(),
......
......@@ -624,8 +624,6 @@ struct Tests {
CheckSub(T.InternalizedString, T.String);
CheckSub(T.InternalizedString, T.UniqueName);
CheckSub(T.InternalizedString, T.Name);
CheckSub(T.OtherString, T.String);
CheckSub(T.OtherString, T.Name);
CheckSub(T.Symbol, T.UniqueName);
CheckSub(T.Symbol, T.Name);
CheckUnordered(T.String, T.UniqueName);
......@@ -751,7 +749,6 @@ struct Tests {
CheckOverlap(T.InternalizedString, T.String);
CheckOverlap(T.InternalizedString, T.UniqueName);
CheckOverlap(T.InternalizedString, T.Name);
CheckOverlap(T.OtherString, T.String);
CheckOverlap(T.Symbol, T.UniqueName);
CheckOverlap(T.Symbol, T.Name);
CheckOverlap(T.String, T.UniqueName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment