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) { ...@@ -2242,9 +2242,7 @@ Type* Typer::Visitor::TypeNewArgumentsElements(Node* node) {
return Type::OtherInternal(); return Type::OtherInternal();
} }
Type* Typer::Visitor::TypeNewConsString(Node* node) { Type* Typer::Visitor::TypeNewConsString(Node* node) { return Type::String(); }
return Type::OtherString();
}
Type* Typer::Visitor::TypeArrayBufferWasNeutered(Node* node) { Type* Typer::Visitor::TypeArrayBufferWasNeutered(Node* node) {
return Type::Boolean(); return Type::Boolean();
......
...@@ -163,7 +163,7 @@ Type::bitset BitsetType::Lub(i::Map* map) { ...@@ -163,7 +163,7 @@ Type::bitset BitsetType::Lub(i::Map* map) {
case SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE: case SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE:
case STRING_TYPE: case STRING_TYPE:
case ONE_BYTE_STRING_TYPE: case ONE_BYTE_STRING_TYPE:
return kOtherString; return kString;
case EXTERNAL_INTERNALIZED_STRING_TYPE: case EXTERNAL_INTERNALIZED_STRING_TYPE:
case EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE: case EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE:
case EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE: case EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE:
...@@ -361,6 +361,7 @@ size_t BitsetType::BoundariesSize() { ...@@ -361,6 +361,7 @@ size_t BitsetType::BoundariesSize() {
} }
Type::bitset BitsetType::ExpandInternals(Type::bitset bits) { Type::bitset BitsetType::ExpandInternals(Type::bitset bits) {
DCHECK_IMPLIES(bits & kOtherString, (bits & kString) == kString);
DisallowHeapAllocation no_allocation; DisallowHeapAllocation no_allocation;
if (!(bits & kPlainNumber)) return bits; // Shortcut. if (!(bits & kPlainNumber)) return bits; // Shortcut.
const Boundary* boundaries = Boundaries(); const Boundary* boundaries = Boundaries();
...@@ -823,7 +824,7 @@ Type* Type::NewConstant(i::Handle<i::Object> value, Zone* zone) { ...@@ -823,7 +824,7 @@ Type* Type::NewConstant(i::Handle<i::Object> value, Zone* zone) {
} else if (value->IsHeapNumber()) { } else if (value->IsHeapNumber()) {
return NewConstant(value->Number(), zone); return NewConstant(value->Number(), zone);
} else if (value->IsString() && !value->IsInternalizedString()) { } else if (value->IsString() && !value->IsInternalizedString()) {
return Type::OtherString(); return Type::String();
} }
return HeapConstant(i::Handle<i::HeapObject>::cast(value), zone); return HeapConstant(i::Handle<i::HeapObject>::cast(value), zone);
} }
......
...@@ -103,31 +103,31 @@ namespace compiler { ...@@ -103,31 +103,31 @@ namespace compiler {
V(OtherUnsigned32, 1u << 2) \ V(OtherUnsigned32, 1u << 2) \
V(OtherSigned32, 1u << 3) \ V(OtherSigned32, 1u << 3) \
V(OtherNumber, 1u << 4) \ V(OtherNumber, 1u << 4) \
V(OtherString, 1u << 5) \
#define PROPER_BITSET_TYPE_LIST(V) \ #define PROPER_BITSET_TYPE_LIST(V) \
V(None, 0u) \ V(None, 0u) \
V(Negative31, 1u << 5) \ V(Negative31, 1u << 6) \
V(Null, 1u << 6) \ V(Null, 1u << 7) \
V(Undefined, 1u << 7) \ V(Undefined, 1u << 8) \
V(Boolean, 1u << 8) \ V(Boolean, 1u << 9) \
V(Unsigned30, 1u << 9) \ V(Unsigned30, 1u << 10) \
V(MinusZero, 1u << 10) \ V(MinusZero, 1u << 11) \
V(NaN, 1u << 11) \ V(NaN, 1u << 12) \
V(Symbol, 1u << 12) \ V(Symbol, 1u << 13) \
V(InternalizedString, 1u << 13) \ V(InternalizedString, 1u << 14) \
V(OtherString, 1u << 14) \ V(OtherCallable, 1u << 16) \
V(OtherCallable, 1u << 15) \ V(OtherObject, 1u << 17) \
V(OtherObject, 1u << 16) \ V(OtherUndetectable, 1u << 18) \
V(OtherUndetectable, 1u << 17) \ V(CallableProxy, 1u << 19) \
V(CallableProxy, 1u << 18) \ V(OtherProxy, 1u << 20) \
V(OtherProxy, 1u << 19) \ V(Function, 1u << 21) \
V(Function, 1u << 20) \ V(BoundFunction, 1u << 22) \
V(BoundFunction, 1u << 21) \ V(Hole, 1u << 23) \
V(Hole, 1u << 22) \ V(OtherInternal, 1u << 24) \
V(OtherInternal, 1u << 23) \ V(ExternalPointer, 1u << 25) \
V(ExternalPointer, 1u << 24) \ V(Array, 1u << 26) \
V(Array, 1u << 25) \ V(BigInt, 1u << 27) \
V(BigInt, 1u << 26) \
\ \
V(Signed31, kUnsigned30 | kNegative31) \ V(Signed31, kUnsigned30 | kNegative31) \
V(Signed32, kSigned31 | kOtherUnsigned31 | \ V(Signed32, kSigned31 | kOtherUnsigned31 | \
......
...@@ -1214,7 +1214,7 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) { ...@@ -1214,7 +1214,7 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
CheckValueInputIs(node, 0, TypeCache::Get().kStringLengthType); CheckValueInputIs(node, 0, TypeCache::Get().kStringLengthType);
CheckValueInputIs(node, 1, Type::String()); CheckValueInputIs(node, 1, Type::String());
CheckValueInputIs(node, 2, Type::String()); CheckValueInputIs(node, 2, Type::String());
CheckTypeIs(node, Type::OtherString()); CheckTypeIs(node, Type::String());
break; break;
case IrOpcode::kAllocate: case IrOpcode::kAllocate:
CheckValueInputIs(node, 0, Type::PlainNumber()); CheckValueInputIs(node, 0, Type::PlainNumber());
......
...@@ -186,9 +186,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope { ...@@ -186,9 +186,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
} }
}; };
static Type* kStringTypes[] = {Type::InternalizedString(), Type::OtherString(), static Type* kStringTypes[] = {Type::InternalizedString(), Type::String()};
Type::String()};
static Type* kInt32Types[] = {Type::UnsignedSmall(), Type::Negative32(), static Type* kInt32Types[] = {Type::UnsignedSmall(), Type::Negative32(),
Type::Unsigned31(), Type::SignedSmall(), Type::Unsigned31(), Type::SignedSmall(),
......
...@@ -624,8 +624,6 @@ struct Tests { ...@@ -624,8 +624,6 @@ struct Tests {
CheckSub(T.InternalizedString, T.String); CheckSub(T.InternalizedString, T.String);
CheckSub(T.InternalizedString, T.UniqueName); CheckSub(T.InternalizedString, T.UniqueName);
CheckSub(T.InternalizedString, T.Name); CheckSub(T.InternalizedString, T.Name);
CheckSub(T.OtherString, T.String);
CheckSub(T.OtherString, T.Name);
CheckSub(T.Symbol, T.UniqueName); CheckSub(T.Symbol, T.UniqueName);
CheckSub(T.Symbol, T.Name); CheckSub(T.Symbol, T.Name);
CheckUnordered(T.String, T.UniqueName); CheckUnordered(T.String, T.UniqueName);
...@@ -751,7 +749,6 @@ struct Tests { ...@@ -751,7 +749,6 @@ struct Tests {
CheckOverlap(T.InternalizedString, T.String); CheckOverlap(T.InternalizedString, T.String);
CheckOverlap(T.InternalizedString, T.UniqueName); CheckOverlap(T.InternalizedString, T.UniqueName);
CheckOverlap(T.InternalizedString, T.Name); CheckOverlap(T.InternalizedString, T.Name);
CheckOverlap(T.OtherString, T.String);
CheckOverlap(T.Symbol, T.UniqueName); CheckOverlap(T.Symbol, T.UniqueName);
CheckOverlap(T.Symbol, T.Name); CheckOverlap(T.Symbol, T.Name);
CheckOverlap(T.String, T.UniqueName); 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