Commit 1bf1c530 authored by mvstanton's avatar mvstanton Committed by Commit bot

[turbofan] Quit storing strings in types.

BUG=

Review-Url: https://codereview.chromium.org/2402313003
Cr-Commit-Position: refs/heads/master@{#40245}
parent 232bbb1b
......@@ -1527,28 +1527,10 @@ Type* Typer::Visitor::TypeStringLessThanOrEqual(Node* node) {
}
Type* Typer::Visitor::StringFromCharCodeTyper(Type* type, Typer* t) {
type = NumberToUint32(ToNumber(type, t), t);
Factory* f = t->isolate()->factory();
double min = type->Min();
double max = type->Max();
if (min == max) {
uint32_t code = static_cast<uint32_t>(min) & String::kMaxUtf16CodeUnitU;
Handle<String> string = f->LookupSingleCharacterStringFromCode(code);
return Type::HeapConstant(string, t->zone());
}
return Type::String();
}
Type* Typer::Visitor::StringFromCodePointTyper(Type* type, Typer* t) {
type = NumberToUint32(ToNumber(type, t), t);
Factory* f = t->isolate()->factory();
double min = type->Min();
double max = type->Max();
if (min == max) {
uint32_t code = static_cast<uint32_t>(min) & String::kMaxUtf16CodeUnitU;
Handle<String> string = f->LookupSingleCharacterStringFromCode(code);
return Type::HeapConstant(string, t->zone());
}
return Type::String();
}
......
......@@ -407,6 +407,7 @@ HeapConstantType::HeapConstantType(BitsetType::bitset bitset,
i::Handle<i::HeapObject> object)
: TypeBase(kHeapConstant), bitset_(bitset), object_(object) {
DCHECK(!object->IsHeapNumber());
DCHECK(!object->IsString());
}
// -----------------------------------------------------------------------------
......@@ -782,6 +783,17 @@ Type* Type::NewConstant(i::Handle<i::Object> value, Zone* zone) {
return Range(v, v, zone);
} else if (value->IsHeapNumber()) {
return NewConstant(value->Number(), zone);
} else if (value->IsString()) {
bitset b = BitsetType::Lub(*value);
DCHECK(b == BitsetType::kInternalizedString ||
b == BitsetType::kOtherString);
if (b == BitsetType::kInternalizedString) {
return Type::InternalizedString();
} else if (b == BitsetType::kOtherString) {
return Type::OtherString();
} else {
UNREACHABLE();
}
}
return HeapConstant(i::Handle<i::HeapObject>::cast(value), zone);
}
......
......@@ -58,7 +58,7 @@ Node* GraphTest::NumberConstant(volatile double value) {
Node* GraphTest::HeapConstant(const Handle<HeapObject>& value) {
Node* node = graph()->NewNode(common()->HeapConstant(value));
Type* type = Type::HeapConstant(value, zone());
Type* type = Type::NewConstant(value, zone());
NodeProperties::SetType(node, type);
return node;
}
......
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