Commit fa9e404b authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Address a couple of Type-related TODOs.

This cleans up a few Type related TODOs, i.e. removing the now useless
kSmi and kHeapNumber members from TypeCache.

R=yangguo@chromium.org
BUG=v8:5267

Review-Url: https://codereview.chromium.org/2488183002
Cr-Commit-Position: refs/heads/master@{#40874}
parent 5657433e
......@@ -146,11 +146,10 @@ FieldAccess AccessBuilder::ForJSGeneratorObjectContext() {
// static
FieldAccess AccessBuilder::ForJSGeneratorObjectContinuation() {
TypeCache const& type_cache = TypeCache::Get();
FieldAccess access = {kTaggedBase,
JSGeneratorObject::kContinuationOffset,
Handle<Name>(),
type_cache.kSmi,
Type::SignedSmall(),
MachineType::TaggedSigned(),
kNoWriteBarrier};
return access;
......@@ -180,10 +179,12 @@ FieldAccess AccessBuilder::ForJSGeneratorObjectOperandStack() {
// static
FieldAccess AccessBuilder::ForJSGeneratorObjectResumeMode() {
TypeCache const& type_cache = TypeCache::Get();
FieldAccess access = {
kTaggedBase, JSGeneratorObject::kResumeModeOffset, Handle<Name>(),
type_cache.kSmi, MachineType::TaggedSigned(), kNoWriteBarrier};
FieldAccess access = {kTaggedBase,
JSGeneratorObject::kResumeModeOffset,
Handle<Name>(),
Type::SignedSmall(),
MachineType::TaggedSigned(),
kNoWriteBarrier};
return access;
}
......@@ -656,7 +657,7 @@ ElementAccess AccessBuilder::ForFixedArrayElement(ElementsKind kind) {
MachineType::AnyTagged(), kFullWriteBarrier};
switch (kind) {
case FAST_SMI_ELEMENTS:
access.type = TypeCache::Get().kSmi;
access.type = Type::SignedSmall();
access.machine_type = MachineType::TaggedSigned();
access.write_barrier_kind = kNoWriteBarrier;
break;
......
......@@ -300,7 +300,7 @@ bool AccessInfoFactory::ComputePropertyAccessInfo(
MachineRepresentation::kTagged;
MaybeHandle<Map> field_map;
if (details_representation.IsSmi()) {
field_type = type_cache_.kSmi;
field_type = Type::SignedSmall();
field_representation = MachineRepresentation::kTaggedSigned;
} else if (details_representation.IsDouble()) {
field_type = type_cache_.kFloat64;
......@@ -497,7 +497,7 @@ bool AccessInfoFactory::LookupTransition(Handle<Map> map, Handle<Name> name,
MaybeHandle<Map> field_map;
MachineRepresentation field_representation = MachineRepresentation::kTagged;
if (details_representation.IsSmi()) {
field_type = type_cache_.kSmi;
field_type = Type::SignedSmall();
field_representation = MachineRepresentation::kTaggedSigned;
} else if (details_representation.IsDouble()) {
field_type = type_cache_.kFloat64;
......
......@@ -120,12 +120,10 @@ Reduction JSGlobalObjectSpecialization::ReduceJSLoadGlobal(Node* node) {
if (property_details.cell_type() == PropertyCellType::kConstantType) {
// Compute proper type based on the current value in the cell.
if (property_cell_value->IsSmi()) {
property_cell_value_type = type_cache_.kSmi;
property_cell_value_type = Type::SignedSmall();
representation = MachineRepresentation::kTaggedSigned;
} else if (property_cell_value->IsNumber()) {
// TODO(mvstanton): Remove kHeapNumber from type cache, it's just
// Type::Number().
property_cell_value_type = type_cache_.kHeapNumber;
property_cell_value_type = Type::Number();
representation = MachineRepresentation::kTaggedPointer;
} else {
// TODO(turbofan): Track the property_cell_value_map on the FieldAccess
......
......@@ -1280,7 +1280,7 @@ JSNativeContextSpecialization::BuildElementAccess(
element_type = Type::Number();
element_machine_type = MachineType::Float64();
} else if (IsFastSmiElementsKind(elements_kind)) {
element_type = type_cache_.kSmi;
element_type = Type::SignedSmall();
element_machine_type = MachineType::TaggedSigned();
}
ElementAccess element_access = {kTaggedBase, FixedArray::kHeaderSize,
......
......@@ -35,9 +35,8 @@ class TypeCache final {
Type* const kFloat32 = Type::Number();
Type* const kFloat64 = Type::Number();
Type* const kSmi = Type::SignedSmall();
Type* const kHoleySmi = Type::Union(kSmi, Type::Hole(), zone());
Type* const kHeapNumber = Type::Number();
Type* const kHoleySmi =
Type::Union(Type::SignedSmall(), Type::Hole(), zone());
Type* const kSingletonZero = CreateRange(0.0, 0.0);
Type* const kSingletonOne = CreateRange(1.0, 1.0);
......
......@@ -1473,7 +1473,7 @@ Type* Typer::Visitor::TypeJSForInNext(Node* node) {
Type* Typer::Visitor::TypeJSForInPrepare(Node* node) {
STATIC_ASSERT(Map::EnumLengthBits::kMax <= FixedArray::kMaxLength);
Type* const cache_type =
Type::Union(typer_->cache_.kSmi, Type::OtherInternal(), zone());
Type::Union(Type::SignedSmall(), Type::OtherInternal(), zone());
Type* const cache_array = Type::OtherInternal();
Type* const cache_length = typer_->cache_.kFixedArrayLengthType;
return Type::Tuple(cache_type, cache_array, cache_length, zone());
......@@ -1494,7 +1494,7 @@ Type* Typer::Visitor::TypeJSGeneratorStore(Node* node) {
}
Type* Typer::Visitor::TypeJSGeneratorRestoreContinuation(Node* node) {
return typer_->cache_.kSmi;
return Type::SignedSmall();
}
Type* Typer::Visitor::TypeJSGeneratorRestoreRegister(Node* node) {
......@@ -1569,8 +1569,7 @@ Type* Typer::Visitor::StringFromCodePointTyper(Type* type, Typer* t) {
}
Type* Typer::Visitor::TypeStringCharCodeAt(Node* node) {
// TODO(bmeurer): We could do better here based on inputs.
return Type::Range(0, kMaxUInt16, zone());
return typer_->cache_.kUint16;
}
Type* Typer::Visitor::TypeStringFromCharCode(Node* node) {
......@@ -1650,8 +1649,6 @@ Type* Typer::Visitor::TypeLoadField(Node* node) {
}
Type* Typer::Visitor::TypeLoadBuffer(Node* node) {
// TODO(bmeurer): This typing is not yet correct. Since we can still access
// out of bounds, the type in the general case has to include Undefined.
switch (BufferAccessOf(node->op()).external_array_type()) {
#define TYPED_ARRAY_CASE(ElemType, type, TYPE, ctype, size) \
case kExternal##ElemType##Array: \
......
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