[turbofan] Make MachineType a pair of enums.
MachineType is now a class with two enum fields: - MachineRepresentation - MachineSemantic Both enums are usable on their own, and this change switches some places from using MachineType to use just MachineRepresentation. Most notably: - register allocator now uses just the representation. - Phi and Select nodes only refer to representations. Review URL: https://codereview.chromium.org/1513543003 Cr-Commit-Position: refs/heads/master@{#32738}
This commit is contained in:
parent
28261daa47
commit
bb2a830deb
@ -17,7 +17,8 @@ namespace compiler {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForMap() {
|
||||
FieldAccess access = {kTaggedBase, HeapObject::kMapOffset,
|
||||
MaybeHandle<Name>(), Type::Any(), kMachAnyTagged};
|
||||
MaybeHandle<Name>(), Type::Any(),
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -26,7 +27,7 @@ FieldAccess AccessBuilder::ForMap() {
|
||||
FieldAccess AccessBuilder::ForHeapNumberValue() {
|
||||
FieldAccess access = {kTaggedBase, HeapNumber::kValueOffset,
|
||||
MaybeHandle<Name>(), TypeCache().Get().kFloat64,
|
||||
kMachFloat64};
|
||||
MachineType::Float64()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -34,7 +35,8 @@ FieldAccess AccessBuilder::ForHeapNumberValue() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForJSObjectProperties() {
|
||||
FieldAccess access = {kTaggedBase, JSObject::kPropertiesOffset,
|
||||
MaybeHandle<Name>(), Type::Internal(), kMachAnyTagged};
|
||||
MaybeHandle<Name>(), Type::Internal(),
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -42,7 +44,8 @@ FieldAccess AccessBuilder::ForJSObjectProperties() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForJSObjectElements() {
|
||||
FieldAccess access = {kTaggedBase, JSObject::kElementsOffset,
|
||||
MaybeHandle<Name>(), Type::Internal(), kMachAnyTagged};
|
||||
MaybeHandle<Name>(), Type::Internal(),
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -52,7 +55,7 @@ FieldAccess AccessBuilder::ForJSObjectInObjectProperty(Handle<Map> map,
|
||||
int index) {
|
||||
int const offset = map->GetInObjectPropertyOffset(index);
|
||||
FieldAccess access = {kTaggedBase, offset, MaybeHandle<Name>(),
|
||||
Type::Tagged(), kMachAnyTagged};
|
||||
Type::Tagged(), MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -60,7 +63,8 @@ FieldAccess AccessBuilder::ForJSObjectInObjectProperty(Handle<Map> map,
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForJSFunctionContext() {
|
||||
FieldAccess access = {kTaggedBase, JSFunction::kContextOffset,
|
||||
MaybeHandle<Name>(), Type::Internal(), kMachAnyTagged};
|
||||
MaybeHandle<Name>(), Type::Internal(),
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -68,7 +72,7 @@ FieldAccess AccessBuilder::ForJSFunctionContext() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForJSFunctionSharedFunctionInfo() {
|
||||
FieldAccess access = {kTaggedBase, JSFunction::kSharedFunctionInfoOffset,
|
||||
Handle<Name>(), Type::Any(), kMachAnyTagged};
|
||||
Handle<Name>(), Type::Any(), MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -77,7 +81,8 @@ FieldAccess AccessBuilder::ForJSFunctionSharedFunctionInfo() {
|
||||
FieldAccess AccessBuilder::ForJSArrayLength(ElementsKind elements_kind) {
|
||||
TypeCache const& type_cache = TypeCache::Get();
|
||||
FieldAccess access = {kTaggedBase, JSArray::kLengthOffset, Handle<Name>(),
|
||||
type_cache.kJSArrayLengthType, kMachAnyTagged};
|
||||
type_cache.kJSArrayLengthType,
|
||||
MachineType::AnyTagged()};
|
||||
if (IsFastDoubleElementsKind(elements_kind)) {
|
||||
access.type = type_cache.kFixedDoubleArrayLengthType;
|
||||
} else if (IsFastElementsKind(elements_kind)) {
|
||||
@ -90,7 +95,8 @@ FieldAccess AccessBuilder::ForJSArrayLength(ElementsKind elements_kind) {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForJSArrayBufferBackingStore() {
|
||||
FieldAccess access = {kTaggedBase, JSArrayBuffer::kBackingStoreOffset,
|
||||
MaybeHandle<Name>(), Type::UntaggedPointer(), kMachPtr};
|
||||
MaybeHandle<Name>(), Type::UntaggedPointer(),
|
||||
MachineType::Pointer()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -98,7 +104,8 @@ FieldAccess AccessBuilder::ForJSArrayBufferBackingStore() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForJSArrayBufferBitField() {
|
||||
FieldAccess access = {kTaggedBase, JSArrayBuffer::kBitFieldOffset,
|
||||
MaybeHandle<Name>(), TypeCache::Get().kInt8, kMachInt8};
|
||||
MaybeHandle<Name>(), TypeCache::Get().kInt8,
|
||||
MachineType::Int8()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -107,25 +114,25 @@ FieldAccess AccessBuilder::ForJSArrayBufferBitField() {
|
||||
FieldAccess AccessBuilder::ForJSArrayBufferViewBuffer() {
|
||||
FieldAccess access = {kTaggedBase, JSArrayBufferView::kBufferOffset,
|
||||
MaybeHandle<Name>(), Type::TaggedPointer(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForJSDateField(JSDate::FieldIndex index) {
|
||||
FieldAccess access = {kTaggedBase,
|
||||
JSDate::kValueOffset + index * kPointerSize,
|
||||
MaybeHandle<Name>(), Type::Number(), kMachAnyTagged};
|
||||
FieldAccess access = {
|
||||
kTaggedBase, JSDate::kValueOffset + index * kPointerSize,
|
||||
MaybeHandle<Name>(), Type::Number(), MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForFixedArrayLength() {
|
||||
FieldAccess access = {kTaggedBase, FixedArray::kLengthOffset,
|
||||
MaybeHandle<Name>(),
|
||||
TypeCache::Get().kFixedArrayLengthType, kMachAnyTagged};
|
||||
FieldAccess access = {
|
||||
kTaggedBase, FixedArray::kLengthOffset, MaybeHandle<Name>(),
|
||||
TypeCache::Get().kFixedArrayLengthType, MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -133,16 +140,17 @@ FieldAccess AccessBuilder::ForFixedArrayLength() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForDescriptorArrayEnumCache() {
|
||||
FieldAccess access = {kTaggedBase, DescriptorArray::kEnumCacheOffset,
|
||||
Handle<Name>(), Type::TaggedPointer(), kMachAnyTagged};
|
||||
Handle<Name>(), Type::TaggedPointer(),
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForDescriptorArrayEnumCacheBridgeCache() {
|
||||
FieldAccess access = {kTaggedBase,
|
||||
DescriptorArray::kEnumCacheBridgeCacheOffset,
|
||||
Handle<Name>(), Type::TaggedPointer(), kMachAnyTagged};
|
||||
FieldAccess access = {
|
||||
kTaggedBase, DescriptorArray::kEnumCacheBridgeCacheOffset, Handle<Name>(),
|
||||
Type::TaggedPointer(), MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -150,7 +158,7 @@ FieldAccess AccessBuilder::ForDescriptorArrayEnumCacheBridgeCache() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForMapBitField3() {
|
||||
FieldAccess access = {kTaggedBase, Map::kBitField3Offset, Handle<Name>(),
|
||||
TypeCache::Get().kInt32, kMachInt32};
|
||||
TypeCache::Get().kInt32, MachineType::Int32()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -158,7 +166,7 @@ FieldAccess AccessBuilder::ForMapBitField3() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForMapDescriptors() {
|
||||
FieldAccess access = {kTaggedBase, Map::kDescriptorsOffset, Handle<Name>(),
|
||||
Type::TaggedPointer(), kMachAnyTagged};
|
||||
Type::TaggedPointer(), MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -166,7 +174,7 @@ FieldAccess AccessBuilder::ForMapDescriptors() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForMapInstanceType() {
|
||||
FieldAccess access = {kTaggedBase, Map::kInstanceTypeOffset, Handle<Name>(),
|
||||
TypeCache::Get().kUint8, kMachUint8};
|
||||
TypeCache::Get().kUint8, MachineType::Uint8()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -174,7 +182,7 @@ FieldAccess AccessBuilder::ForMapInstanceType() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForMapPrototype() {
|
||||
FieldAccess access = {kTaggedBase, Map::kPrototypeOffset, Handle<Name>(),
|
||||
Type::TaggedPointer(), kMachAnyTagged};
|
||||
Type::TaggedPointer(), MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -182,7 +190,8 @@ FieldAccess AccessBuilder::ForMapPrototype() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForStringLength() {
|
||||
FieldAccess access = {kTaggedBase, String::kLengthOffset, Handle<Name>(),
|
||||
TypeCache::Get().kStringLengthType, kMachAnyTagged};
|
||||
TypeCache::Get().kStringLengthType,
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -190,7 +199,8 @@ FieldAccess AccessBuilder::ForStringLength() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForJSGlobalObjectGlobalProxy() {
|
||||
FieldAccess access = {kTaggedBase, JSGlobalObject::kGlobalProxyOffset,
|
||||
Handle<Name>(), Type::Receiver(), kMachAnyTagged};
|
||||
Handle<Name>(), Type::Receiver(),
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -198,7 +208,8 @@ FieldAccess AccessBuilder::ForJSGlobalObjectGlobalProxy() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForJSGlobalObjectNativeContext() {
|
||||
FieldAccess access = {kTaggedBase, JSGlobalObject::kNativeContextOffset,
|
||||
Handle<Name>(), Type::Internal(), kMachAnyTagged};
|
||||
Handle<Name>(), Type::Internal(),
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -206,7 +217,7 @@ FieldAccess AccessBuilder::ForJSGlobalObjectNativeContext() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForValue() {
|
||||
FieldAccess access = {kTaggedBase, JSValue::kValueOffset, Handle<Name>(),
|
||||
Type::Any(), kMachAnyTagged};
|
||||
Type::Any(), MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -216,7 +227,7 @@ FieldAccess AccessBuilder::ForArgumentsLength() {
|
||||
int offset =
|
||||
JSObject::kHeaderSize + Heap::kArgumentsLengthIndex * kPointerSize;
|
||||
FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -226,7 +237,7 @@ FieldAccess AccessBuilder::ForArgumentsCallee() {
|
||||
int offset =
|
||||
JSObject::kHeaderSize + Heap::kArgumentsCalleeIndex * kPointerSize;
|
||||
FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -235,7 +246,7 @@ FieldAccess AccessBuilder::ForArgumentsCallee() {
|
||||
FieldAccess AccessBuilder::ForFixedArraySlot(size_t index) {
|
||||
int offset = FixedArray::OffsetOfElementAt(static_cast<int>(index));
|
||||
FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -246,7 +257,7 @@ FieldAccess AccessBuilder::ForContextSlot(size_t index) {
|
||||
DCHECK_EQ(offset,
|
||||
Context::SlotOffset(static_cast<int>(index)) + kHeapObjectTag);
|
||||
FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -260,7 +271,7 @@ FieldAccess AccessBuilder::ForPropertyCellValue() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForPropertyCellValue(Type* type) {
|
||||
FieldAccess access = {kTaggedBase, PropertyCell::kValueOffset, Handle<Name>(),
|
||||
type, kMachAnyTagged};
|
||||
type, MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -268,7 +279,7 @@ FieldAccess AccessBuilder::ForPropertyCellValue(Type* type) {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForSharedFunctionInfoTypeFeedbackVector() {
|
||||
FieldAccess access = {kTaggedBase, SharedFunctionInfo::kFeedbackVectorOffset,
|
||||
Handle<Name>(), Type::Any(), kMachAnyTagged};
|
||||
Handle<Name>(), Type::Any(), MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -276,7 +287,7 @@ FieldAccess AccessBuilder::ForSharedFunctionInfoTypeFeedbackVector() {
|
||||
// static
|
||||
ElementAccess AccessBuilder::ForFixedArrayElement() {
|
||||
ElementAccess access = {kTaggedBase, FixedArray::kHeaderSize, Type::Tagged(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -284,7 +295,7 @@ ElementAccess AccessBuilder::ForFixedArrayElement() {
|
||||
// static
|
||||
ElementAccess AccessBuilder::ForFixedDoubleArrayElement() {
|
||||
ElementAccess access = {kTaggedBase, FixedDoubleArray::kHeaderSize,
|
||||
TypeCache::Get().kFloat64, kMachFloat64};
|
||||
TypeCache::Get().kFloat64, MachineType::Float64()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -297,48 +308,48 @@ ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type,
|
||||
switch (type) {
|
||||
case kExternalInt8Array: {
|
||||
ElementAccess access = {taggedness, header_size, Type::Signed32(),
|
||||
kMachInt8};
|
||||
MachineType::Int8()};
|
||||
return access;
|
||||
}
|
||||
case kExternalUint8Array:
|
||||
case kExternalUint8ClampedArray: {
|
||||
ElementAccess access = {taggedness, header_size, Type::Unsigned32(),
|
||||
kMachUint8};
|
||||
MachineType::Uint8()};
|
||||
return access;
|
||||
}
|
||||
case kExternalInt16Array: {
|
||||
ElementAccess access = {taggedness, header_size, Type::Signed32(),
|
||||
kMachInt16};
|
||||
MachineType::Int16()};
|
||||
return access;
|
||||
}
|
||||
case kExternalUint16Array: {
|
||||
ElementAccess access = {taggedness, header_size, Type::Unsigned32(),
|
||||
kMachUint16};
|
||||
MachineType::Uint16()};
|
||||
return access;
|
||||
}
|
||||
case kExternalInt32Array: {
|
||||
ElementAccess access = {taggedness, header_size, Type::Signed32(),
|
||||
kMachInt32};
|
||||
MachineType::Int32()};
|
||||
return access;
|
||||
}
|
||||
case kExternalUint32Array: {
|
||||
ElementAccess access = {taggedness, header_size, Type::Unsigned32(),
|
||||
kMachUint32};
|
||||
MachineType::Uint32()};
|
||||
return access;
|
||||
}
|
||||
case kExternalFloat32Array: {
|
||||
ElementAccess access = {taggedness, header_size, Type::Number(),
|
||||
kMachFloat32};
|
||||
MachineType::Float32()};
|
||||
return access;
|
||||
}
|
||||
case kExternalFloat64Array: {
|
||||
ElementAccess access = {taggedness, header_size, Type::Number(),
|
||||
kMachFloat64};
|
||||
MachineType::Float64()};
|
||||
return access;
|
||||
}
|
||||
}
|
||||
UNREACHABLE();
|
||||
ElementAccess access = {kUntaggedBase, 0, Type::None(), kMachNone};
|
||||
ElementAccess access = {kUntaggedBase, 0, Type::None(), MachineType::None()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -346,7 +357,7 @@ ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type,
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForStatsCounter() {
|
||||
FieldAccess access = {kUntaggedBase, 0, MaybeHandle<Name>(),
|
||||
TypeCache::Get().kInt32, kMachInt32};
|
||||
TypeCache::Get().kInt32, MachineType::Int32()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -354,7 +365,8 @@ FieldAccess AccessBuilder::ForStatsCounter() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForFrameCallerFramePtr() {
|
||||
FieldAccess access = {kUntaggedBase, StandardFrameConstants::kCallerFPOffset,
|
||||
MaybeHandle<Name>(), Type::Internal(), kMachPtr};
|
||||
MaybeHandle<Name>(), Type::Internal(),
|
||||
MachineType::Pointer()};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -362,7 +374,8 @@ FieldAccess AccessBuilder::ForFrameCallerFramePtr() {
|
||||
// static
|
||||
FieldAccess AccessBuilder::ForFrameMarker() {
|
||||
FieldAccess access = {kUntaggedBase, StandardFrameConstants::kMarkerOffset,
|
||||
MaybeHandle<Name>(), Type::Tagged(), kMachAnyTagged};
|
||||
MaybeHandle<Name>(), Type::Tagged(),
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
|
@ -303,29 +303,28 @@ void VisitMod(InstructionSelector* selector, Node* node, ArchOpcode div_opcode,
|
||||
|
||||
|
||||
void InstructionSelector::VisitLoad(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<LoadRepresentation>(node));
|
||||
MachineType typ = TypeOf(OpParameter<LoadRepresentation>(node));
|
||||
LoadRepresentation load_rep = LoadRepresentationOf(node->op());
|
||||
ArmOperandGenerator g(this);
|
||||
Node* base = node->InputAt(0);
|
||||
Node* index = node->InputAt(1);
|
||||
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepFloat32:
|
||||
switch (load_rep.representation()) {
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kArmVldrF32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kArmVldrF64;
|
||||
break;
|
||||
case kRepBit: // Fall through.
|
||||
case kRepWord8:
|
||||
opcode = typ == kTypeUint32 ? kArmLdrb : kArmLdrsb;
|
||||
case MachineRepresentation::kBit: // Fall through.
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = load_rep.IsUnsigned() ? kArmLdrb : kArmLdrsb;
|
||||
break;
|
||||
case kRepWord16:
|
||||
opcode = typ == kTypeUint32 ? kArmLdrh : kArmLdrsh;
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = load_rep.IsUnsigned() ? kArmLdrh : kArmLdrsh;
|
||||
break;
|
||||
case kRepTagged: // Fall through.
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kTagged: // Fall through.
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kArmLdr;
|
||||
break;
|
||||
default:
|
||||
@ -351,10 +350,10 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
|
||||
StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node);
|
||||
WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind();
|
||||
MachineType rep = RepresentationOf(store_rep.machine_type());
|
||||
MachineRepresentation rep = store_rep.machine_type().representation();
|
||||
|
||||
if (write_barrier_kind != kNoWriteBarrier) {
|
||||
DCHECK_EQ(kRepTagged, rep);
|
||||
DCHECK_EQ(MachineRepresentation::kTagged, rep);
|
||||
InstructionOperand inputs[3];
|
||||
size_t input_count = 0;
|
||||
inputs[input_count++] = g.UseUniqueRegister(base);
|
||||
@ -385,21 +384,21 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
} else {
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kArmVstrF32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kArmVstrF64;
|
||||
break;
|
||||
case kRepBit: // Fall through.
|
||||
case kRepWord8:
|
||||
case MachineRepresentation::kBit: // Fall through.
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = kArmStrb;
|
||||
break;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = kArmStrh;
|
||||
break;
|
||||
case kRepTagged: // Fall through.
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kTagged: // Fall through.
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kArmStr;
|
||||
break;
|
||||
default:
|
||||
@ -419,27 +418,26 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
|
||||
|
||||
void InstructionSelector::VisitCheckedLoad(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
|
||||
MachineType typ = TypeOf(OpParameter<MachineType>(node));
|
||||
CheckedLoadRepresentation load_rep = CheckedLoadRepresentationOf(node->op());
|
||||
ArmOperandGenerator g(this);
|
||||
Node* const buffer = node->InputAt(0);
|
||||
Node* const offset = node->InputAt(1);
|
||||
Node* const length = node->InputAt(2);
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepWord8:
|
||||
opcode = typ == kTypeInt32 ? kCheckedLoadInt8 : kCheckedLoadUint8;
|
||||
switch (load_rep.representation()) {
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = load_rep.IsSigned() ? kCheckedLoadInt8 : kCheckedLoadUint8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
opcode = typ == kTypeInt32 ? kCheckedLoadInt16 : kCheckedLoadUint16;
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = load_rep.IsSigned() ? kCheckedLoadInt16 : kCheckedLoadUint16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kCheckedLoadWord32;
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kCheckedLoadFloat32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kCheckedLoadFloat64;
|
||||
break;
|
||||
default:
|
||||
@ -457,7 +455,8 @@ void InstructionSelector::VisitCheckedLoad(Node* node) {
|
||||
|
||||
|
||||
void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
|
||||
MachineRepresentation rep =
|
||||
CheckedStoreRepresentationOf(node->op()).representation();
|
||||
ArmOperandGenerator g(this);
|
||||
Node* const buffer = node->InputAt(0);
|
||||
Node* const offset = node->InputAt(1);
|
||||
@ -465,19 +464,19 @@ void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
Node* const value = node->InputAt(3);
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepWord8:
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = kCheckedStoreWord8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = kCheckedStoreWord16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kCheckedStoreWord32;
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kCheckedStoreFloat32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kCheckedStoreFloat64;
|
||||
break;
|
||||
default:
|
||||
|
@ -338,37 +338,36 @@ int32_t LeftShiftForReducedMultiply(Matcher* m) {
|
||||
|
||||
|
||||
void InstructionSelector::VisitLoad(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<LoadRepresentation>(node));
|
||||
MachineType typ = TypeOf(OpParameter<LoadRepresentation>(node));
|
||||
LoadRepresentation load_rep = LoadRepresentationOf(node->op());
|
||||
Arm64OperandGenerator g(this);
|
||||
Node* base = node->InputAt(0);
|
||||
Node* index = node->InputAt(1);
|
||||
ArchOpcode opcode;
|
||||
ImmediateMode immediate_mode = kNoImmediate;
|
||||
switch (rep) {
|
||||
case kRepFloat32:
|
||||
switch (load_rep.representation()) {
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kArm64LdrS;
|
||||
immediate_mode = kLoadStoreImm32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kArm64LdrD;
|
||||
immediate_mode = kLoadStoreImm64;
|
||||
break;
|
||||
case kRepBit: // Fall through.
|
||||
case kRepWord8:
|
||||
opcode = typ == kTypeInt32 ? kArm64Ldrsb : kArm64Ldrb;
|
||||
case MachineRepresentation::kBit: // Fall through.
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = load_rep.IsSigned() ? kArm64Ldrsb : kArm64Ldrb;
|
||||
immediate_mode = kLoadStoreImm8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
opcode = typ == kTypeInt32 ? kArm64Ldrsh : kArm64Ldrh;
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = load_rep.IsSigned() ? kArm64Ldrsh : kArm64Ldrh;
|
||||
immediate_mode = kLoadStoreImm16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kArm64LdrW;
|
||||
immediate_mode = kLoadStoreImm32;
|
||||
break;
|
||||
case kRepTagged: // Fall through.
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kTagged: // Fall through.
|
||||
case MachineRepresentation::kWord64:
|
||||
opcode = kArm64Ldr;
|
||||
immediate_mode = kLoadStoreImm64;
|
||||
break;
|
||||
@ -394,11 +393,11 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
|
||||
StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node);
|
||||
WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind();
|
||||
MachineType rep = RepresentationOf(store_rep.machine_type());
|
||||
MachineRepresentation rep = store_rep.machine_type().representation();
|
||||
|
||||
// TODO(arm64): I guess this could be done in a better way.
|
||||
if (write_barrier_kind != kNoWriteBarrier) {
|
||||
DCHECK_EQ(kRepTagged, rep);
|
||||
DCHECK_EQ(MachineRepresentation::kTagged, rep);
|
||||
InstructionOperand inputs[3];
|
||||
size_t input_count = 0;
|
||||
inputs[input_count++] = g.UseUniqueRegister(base);
|
||||
@ -430,29 +429,29 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
ArchOpcode opcode;
|
||||
ImmediateMode immediate_mode = kNoImmediate;
|
||||
switch (rep) {
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kArm64StrS;
|
||||
immediate_mode = kLoadStoreImm32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kArm64StrD;
|
||||
immediate_mode = kLoadStoreImm64;
|
||||
break;
|
||||
case kRepBit: // Fall through.
|
||||
case kRepWord8:
|
||||
case MachineRepresentation::kBit: // Fall through.
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = kArm64Strb;
|
||||
immediate_mode = kLoadStoreImm8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = kArm64Strh;
|
||||
immediate_mode = kLoadStoreImm16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kArm64StrW;
|
||||
immediate_mode = kLoadStoreImm32;
|
||||
break;
|
||||
case kRepTagged: // Fall through.
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kTagged: // Fall through.
|
||||
case MachineRepresentation::kWord64:
|
||||
opcode = kArm64Str;
|
||||
immediate_mode = kLoadStoreImm64;
|
||||
break;
|
||||
@ -472,30 +471,29 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
|
||||
|
||||
void InstructionSelector::VisitCheckedLoad(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
|
||||
MachineType typ = TypeOf(OpParameter<MachineType>(node));
|
||||
CheckedLoadRepresentation load_rep = CheckedLoadRepresentationOf(node->op());
|
||||
Arm64OperandGenerator g(this);
|
||||
Node* const buffer = node->InputAt(0);
|
||||
Node* const offset = node->InputAt(1);
|
||||
Node* const length = node->InputAt(2);
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepWord8:
|
||||
opcode = typ == kTypeInt32 ? kCheckedLoadInt8 : kCheckedLoadUint8;
|
||||
switch (load_rep.representation()) {
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = load_rep.IsSigned() ? kCheckedLoadInt8 : kCheckedLoadUint8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
opcode = typ == kTypeInt32 ? kCheckedLoadInt16 : kCheckedLoadUint16;
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = load_rep.IsSigned() ? kCheckedLoadInt16 : kCheckedLoadUint16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kCheckedLoadWord32;
|
||||
break;
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kWord64:
|
||||
opcode = kCheckedLoadWord64;
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kCheckedLoadFloat32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kCheckedLoadFloat64;
|
||||
break;
|
||||
default:
|
||||
@ -508,7 +506,8 @@ void InstructionSelector::VisitCheckedLoad(Node* node) {
|
||||
|
||||
|
||||
void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
|
||||
MachineRepresentation rep =
|
||||
CheckedStoreRepresentationOf(node->op()).representation();
|
||||
Arm64OperandGenerator g(this);
|
||||
Node* const buffer = node->InputAt(0);
|
||||
Node* const offset = node->InputAt(1);
|
||||
@ -516,22 +515,22 @@ void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
Node* const value = node->InputAt(3);
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepWord8:
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = kCheckedStoreWord8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = kCheckedStoreWord16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kCheckedStoreWord32;
|
||||
break;
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kWord64:
|
||||
opcode = kCheckedStoreWord64;
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kCheckedStoreFloat32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kCheckedStoreFloat64;
|
||||
break;
|
||||
default:
|
||||
|
@ -3015,7 +3015,7 @@ void AstGraphBuilder::VisitNot(UnaryOperation* expr) {
|
||||
VisitForValue(expr->expression());
|
||||
Node* operand = environment()->Pop();
|
||||
Node* input = BuildToBoolean(operand, expr->expression()->test_id());
|
||||
Node* value = NewNode(common()->Select(kMachAnyTagged), input,
|
||||
Node* value = NewNode(common()->Select(MachineRepresentation::kTagged), input,
|
||||
jsgraph()->FalseConstant(), jsgraph()->TrueConstant());
|
||||
ast_context()->ProduceValue(value);
|
||||
}
|
||||
@ -3257,8 +3257,9 @@ Node* AstGraphBuilder::BuildHoleCheckSilent(Node* value, Node* for_hole,
|
||||
Node* not_hole) {
|
||||
Node* the_hole = jsgraph()->TheHoleConstant();
|
||||
Node* check = NewNode(javascript()->StrictEqual(), value, the_hole);
|
||||
return NewNode(common()->Select(kMachAnyTagged, BranchHint::kFalse), check,
|
||||
for_hole, not_hole);
|
||||
return NewNode(
|
||||
common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse),
|
||||
check, for_hole, not_hole);
|
||||
}
|
||||
|
||||
|
||||
@ -3653,13 +3654,14 @@ Node* AstGraphBuilder::BuildGlobalStore(Handle<Name> name, Node* value,
|
||||
|
||||
|
||||
Node* AstGraphBuilder::BuildLoadObjectField(Node* object, int offset) {
|
||||
return NewNode(jsgraph()->machine()->Load(kMachAnyTagged), object,
|
||||
return NewNode(jsgraph()->machine()->Load(MachineType::AnyTagged()), object,
|
||||
jsgraph()->IntPtrConstant(offset - kHeapObjectTag));
|
||||
}
|
||||
|
||||
|
||||
Node* AstGraphBuilder::BuildLoadImmutableObjectField(Node* object, int offset) {
|
||||
return graph()->NewNode(jsgraph()->machine()->Load(kMachAnyTagged), object,
|
||||
return graph()->NewNode(jsgraph()->machine()->Load(MachineType::AnyTagged()),
|
||||
object,
|
||||
jsgraph()->IntPtrConstant(offset - kHeapObjectTag),
|
||||
graph()->start(), graph()->start());
|
||||
}
|
||||
@ -4264,7 +4266,7 @@ void AstGraphBuilder::Environment::PrepareForLoop(BitVector* assigned,
|
||||
|
||||
|
||||
Node* AstGraphBuilder::NewPhi(int count, Node* input, Node* control) {
|
||||
const Operator* phi_op = common()->Phi(kMachAnyTagged, count);
|
||||
const Operator* phi_op = common()->Phi(MachineRepresentation::kTagged, count);
|
||||
Node** buffer = EnsureInputBufferSize(count + 1);
|
||||
MemsetPointer(buffer, input, count);
|
||||
buffer[count] = control;
|
||||
@ -4326,7 +4328,8 @@ Node* AstGraphBuilder::MergeValue(Node* value, Node* other, Node* control) {
|
||||
NodeProperties::GetControlInput(value) == control) {
|
||||
// Phi already exists, add input.
|
||||
value->InsertInput(graph_zone(), inputs - 1, other);
|
||||
NodeProperties::ChangeOp(value, common()->Phi(kMachAnyTagged, inputs));
|
||||
NodeProperties::ChangeOp(
|
||||
value, common()->Phi(MachineRepresentation::kTagged, inputs));
|
||||
} else if (value != other) {
|
||||
// Phi does not exist yet, introduce one.
|
||||
value = NewPhi(inputs, value, control);
|
||||
|
@ -81,12 +81,13 @@ BasicBlockProfiler::Data* BasicBlockInstrumentor::Instrument(
|
||||
// Construct increment operation.
|
||||
Node* base = graph->NewNode(
|
||||
PointerConstant(&common, data->GetCounterAddress(block_number)));
|
||||
Node* load = graph->NewNode(machine.Load(kMachUint32), base, zero,
|
||||
Node* load = graph->NewNode(machine.Load(MachineType::Uint32()), base, zero,
|
||||
graph->start(), graph->start());
|
||||
Node* inc = graph->NewNode(machine.Int32Add(), load, one);
|
||||
Node* store = graph->NewNode(
|
||||
machine.Store(StoreRepresentation(kMachUint32, kNoWriteBarrier)), base,
|
||||
zero, inc, graph->start(), graph->start());
|
||||
Node* store =
|
||||
graph->NewNode(machine.Store(StoreRepresentation(MachineType::Uint32(),
|
||||
kNoWriteBarrier)),
|
||||
base, zero, inc, graph->start(), graph->start());
|
||||
// Insert the new nodes.
|
||||
static const int kArraySize = 6;
|
||||
Node* to_insert[kArraySize] = {zero, one, base, load, inc, store};
|
||||
|
@ -156,14 +156,15 @@ Node* BytecodeGraphBuilder::GetFunctionClosure() {
|
||||
|
||||
|
||||
Node* BytecodeGraphBuilder::BuildLoadObjectField(Node* object, int offset) {
|
||||
return NewNode(jsgraph()->machine()->Load(kMachAnyTagged), object,
|
||||
return NewNode(jsgraph()->machine()->Load(MachineType::AnyTagged()), object,
|
||||
jsgraph()->IntPtrConstant(offset - kHeapObjectTag));
|
||||
}
|
||||
|
||||
|
||||
Node* BytecodeGraphBuilder::BuildLoadImmutableObjectField(Node* object,
|
||||
int offset) {
|
||||
return graph()->NewNode(jsgraph()->machine()->Load(kMachAnyTagged), object,
|
||||
return graph()->NewNode(jsgraph()->machine()->Load(MachineType::AnyTagged()),
|
||||
object,
|
||||
jsgraph()->IntPtrConstant(offset - kHeapObjectTag),
|
||||
graph()->start(), graph()->start());
|
||||
}
|
||||
@ -1034,7 +1035,7 @@ void BytecodeGraphBuilder::VisitLogicalNot(
|
||||
const interpreter::BytecodeArrayIterator& iterator) {
|
||||
Node* value = NewNode(javascript()->ToBoolean(ToBooleanHint::kAny),
|
||||
environment()->LookupAccumulator());
|
||||
Node* node = NewNode(common()->Select(kMachAnyTagged), value,
|
||||
Node* node = NewNode(common()->Select(MachineRepresentation::kTagged), value,
|
||||
jsgraph()->FalseConstant(), jsgraph()->TrueConstant());
|
||||
environment()->BindAccumulator(node);
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ CallDescriptor* Linkage::GetSimplifiedCDescriptor(
|
||||
#endif
|
||||
|
||||
// The target for C calls is always an address (i.e. machine pointer).
|
||||
MachineType target_type = kMachPtr;
|
||||
MachineType target_type = MachineType::Pointer();
|
||||
LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
|
||||
return new (zone) CallDescriptor( // --
|
||||
CallDescriptor::kCallAddress, // kind
|
||||
|
@ -87,9 +87,10 @@ Node* ChangeLowering::AllocateHeapNumberWithValue(Node* value, Node* control) {
|
||||
}
|
||||
Node* heap_number = graph()->NewNode(allocate_heap_number_operator_.get(),
|
||||
target, context, effect, control);
|
||||
Node* store = graph()->NewNode(
|
||||
machine()->Store(StoreRepresentation(kMachFloat64, kNoWriteBarrier)),
|
||||
heap_number, HeapNumberValueIndexConstant(), value, heap_number, control);
|
||||
Node* store = graph()->NewNode(machine()->Store(StoreRepresentation(
|
||||
MachineType::Float64(), kNoWriteBarrier)),
|
||||
heap_number, HeapNumberValueIndexConstant(),
|
||||
value, heap_number, control);
|
||||
return graph()->NewNode(common()->FinishRegion(), heap_number, store);
|
||||
}
|
||||
|
||||
@ -135,7 +136,7 @@ Node* ChangeLowering::ChangeUint32ToSmi(Node* value) {
|
||||
|
||||
|
||||
Node* ChangeLowering::LoadHeapNumberValue(Node* value, Node* control) {
|
||||
return graph()->NewNode(machine()->Load(kMachFloat64), value,
|
||||
return graph()->NewNode(machine()->Load(MachineType::Float64()), value,
|
||||
HeapNumberValueIndexConstant(), graph()->start(),
|
||||
control);
|
||||
}
|
||||
@ -150,9 +151,9 @@ Node* ChangeLowering::TestNotSmi(Node* value) {
|
||||
|
||||
|
||||
Reduction ChangeLowering::ChangeBitToBool(Node* value, Node* control) {
|
||||
return Replace(graph()->NewNode(common()->Select(kMachAnyTagged), value,
|
||||
jsgraph()->TrueConstant(),
|
||||
jsgraph()->FalseConstant()));
|
||||
return Replace(
|
||||
graph()->NewNode(common()->Select(MachineRepresentation::kTagged), value,
|
||||
jsgraph()->TrueConstant(), jsgraph()->FalseConstant()));
|
||||
}
|
||||
|
||||
|
||||
@ -232,8 +233,8 @@ Reduction ChangeLowering::ChangeFloat64ToTagged(Node* value, Node* control) {
|
||||
vbox = AllocateHeapNumberWithValue(value, if_box);
|
||||
|
||||
control = graph()->NewNode(common()->Merge(2), if_smi, if_box);
|
||||
value =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), vsmi, vbox, control);
|
||||
value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
vsmi, vbox, control);
|
||||
return Replace(value);
|
||||
}
|
||||
|
||||
@ -258,8 +259,8 @@ Reduction ChangeLowering::ChangeInt32ToTagged(Node* value, Node* control) {
|
||||
Node* vfalse = graph()->NewNode(common()->Projection(0), add);
|
||||
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), vtrue, vfalse, merge);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
vtrue, vfalse, merge);
|
||||
|
||||
return Replace(phi);
|
||||
}
|
||||
@ -271,7 +272,6 @@ Reduction ChangeLowering::ChangeTaggedToUI32(Node* value, Node* control,
|
||||
return Replace(ChangeSmiToInt32(value));
|
||||
}
|
||||
|
||||
const MachineType type = (signedness == kSigned) ? kMachInt32 : kMachUint32;
|
||||
const Operator* op = (signedness == kSigned)
|
||||
? machine()->ChangeFloat64ToInt32()
|
||||
: machine()->ChangeFloat64ToUint32();
|
||||
@ -291,7 +291,8 @@ Reduction ChangeLowering::ChangeTaggedToUI32(Node* value, Node* control,
|
||||
Node* vfalse = ChangeSmiToInt32(value);
|
||||
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi = graph()->NewNode(common()->Phi(type, 2), vtrue, vfalse, merge);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
|
||||
vtrue, vfalse, merge);
|
||||
|
||||
return Replace(phi);
|
||||
}
|
||||
@ -330,7 +331,7 @@ Reduction ChangeLowering::ChangeTaggedToFloat64(Node* value, Node* control) {
|
||||
|
||||
const Operator* merge_op = common()->Merge(2);
|
||||
const Operator* ephi_op = common()->EffectPhi(2);
|
||||
const Operator* phi_op = common()->Phi(kMachFloat64, 2);
|
||||
const Operator* phi_op = common()->Phi(MachineRepresentation::kFloat64, 2);
|
||||
|
||||
Node* check1 = TestNotSmi(object);
|
||||
Node* branch1 =
|
||||
@ -387,8 +388,8 @@ Reduction ChangeLowering::ChangeTaggedToFloat64(Node* value, Node* control) {
|
||||
Node* vfalse = ChangeSmiToFloat64(value);
|
||||
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi =
|
||||
graph()->NewNode(common()->Phi(kMachFloat64, 2), vtrue, vfalse, merge);
|
||||
Node* phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kFloat64, 2), vtrue, vfalse, merge);
|
||||
|
||||
return Replace(phi);
|
||||
}
|
||||
@ -412,8 +413,8 @@ Reduction ChangeLowering::ChangeUint32ToTagged(Node* value, Node* control) {
|
||||
AllocateHeapNumberWithValue(ChangeUint32ToFloat64(value), if_false);
|
||||
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), vtrue, vfalse, merge);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
vtrue, vfalse, merge);
|
||||
|
||||
return Replace(phi);
|
||||
}
|
||||
@ -422,7 +423,7 @@ Reduction ChangeLowering::ChangeUint32ToTagged(Node* value, Node* control) {
|
||||
namespace {
|
||||
|
||||
WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged,
|
||||
MachineType representation,
|
||||
MachineRepresentation representation,
|
||||
Type* field_type, Type* input_type) {
|
||||
if (field_type->Is(Type::TaggedSigned()) ||
|
||||
input_type->Is(Type::TaggedSigned())) {
|
||||
@ -435,7 +436,7 @@ WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged,
|
||||
return kNoWriteBarrier;
|
||||
}
|
||||
if (base_is_tagged == kTaggedBase &&
|
||||
RepresentationOf(representation) == kRepTagged) {
|
||||
representation == MachineRepresentation::kTagged) {
|
||||
if (input_type->IsConstant() &&
|
||||
input_type->AsConstant()->Value()->IsHeapObject()) {
|
||||
Handle<HeapObject> input =
|
||||
@ -480,7 +481,8 @@ Reduction ChangeLowering::StoreField(Node* node) {
|
||||
const FieldAccess& access = FieldAccessOf(node->op());
|
||||
Type* type = NodeProperties::GetType(node->InputAt(1));
|
||||
WriteBarrierKind kind = ComputeWriteBarrierKind(
|
||||
access.base_is_tagged, access.machine_type, access.type, type);
|
||||
access.base_is_tagged, access.machine_type.representation(), access.type,
|
||||
type);
|
||||
Node* offset = jsgraph()->IntPtrConstant(access.offset - access.tag());
|
||||
node->InsertInput(graph()->zone(), 1, offset);
|
||||
NodeProperties::ChangeOp(
|
||||
@ -492,7 +494,8 @@ Reduction ChangeLowering::StoreField(Node* node) {
|
||||
Node* ChangeLowering::ComputeIndex(const ElementAccess& access,
|
||||
Node* const key) {
|
||||
Node* index = key;
|
||||
const int element_size_shift = ElementSizeLog2Of(access.machine_type);
|
||||
const int element_size_shift =
|
||||
ElementSizeLog2Of(access.machine_type.representation());
|
||||
if (element_size_shift) {
|
||||
index = graph()->NewNode(machine()->Word32Shl(), index,
|
||||
jsgraph()->Int32Constant(element_size_shift));
|
||||
@ -525,11 +528,11 @@ Reduction ChangeLowering::StoreElement(Node* node) {
|
||||
Type* type = NodeProperties::GetType(node->InputAt(2));
|
||||
node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
|
||||
NodeProperties::ChangeOp(
|
||||
node,
|
||||
machine()->Store(StoreRepresentation(
|
||||
access.machine_type,
|
||||
ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type,
|
||||
access.type, type))));
|
||||
node, machine()->Store(StoreRepresentation(
|
||||
access.machine_type,
|
||||
ComputeWriteBarrierKind(access.base_is_tagged,
|
||||
access.machine_type.representation(),
|
||||
access.type, type))));
|
||||
return Changed(node);
|
||||
}
|
||||
|
||||
|
@ -510,7 +510,8 @@ OperandAndType TypedOperandForFrameState(FrameStateDescriptor* descriptor,
|
||||
descriptor->GetSize(OutputFrameStateCombine::Ignore());
|
||||
// If the index is past the existing stack items, return the output.
|
||||
if (index >= size_without_output) {
|
||||
return {instr->OutputAt(index - size_without_output), kMachAnyTagged};
|
||||
return {instr->OutputAt(index - size_without_output),
|
||||
MachineType::AnyTagged()};
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -519,7 +520,8 @@ OperandAndType TypedOperandForFrameState(FrameStateDescriptor* descriptor,
|
||||
descriptor->GetSize(combine) - 1 - combine.GetOffsetToPokeAt();
|
||||
if (index >= index_from_top &&
|
||||
index < index_from_top + instr->OutputCount()) {
|
||||
return {instr->OutputAt(index - index_from_top), kMachAnyTagged};
|
||||
return {instr->OutputAt(index - index_from_top),
|
||||
MachineType::AnyTagged()};
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -603,37 +605,39 @@ void CodeGenerator::AddTranslationForOperand(Translation* translation,
|
||||
InstructionOperand* op,
|
||||
MachineType type) {
|
||||
if (op->IsStackSlot()) {
|
||||
if (type == kMachBool || type == kRepBit) {
|
||||
if (type.representation() == MachineRepresentation::kBit) {
|
||||
translation->StoreBoolStackSlot(LocationOperand::cast(op)->index());
|
||||
} else if (type == kMachInt32 || type == kMachInt8 || type == kMachInt16) {
|
||||
} else if (type == MachineType::Int8() || type == MachineType::Int16() ||
|
||||
type == MachineType::Int32()) {
|
||||
translation->StoreInt32StackSlot(LocationOperand::cast(op)->index());
|
||||
} else if (type == kMachUint32 || type == kMachUint16 ||
|
||||
type == kMachUint8) {
|
||||
} else if (type == MachineType::Uint8() || type == MachineType::Uint16() ||
|
||||
type == MachineType::Uint32()) {
|
||||
translation->StoreUint32StackSlot(LocationOperand::cast(op)->index());
|
||||
} else if ((type & kRepMask) == kRepTagged) {
|
||||
} else if (type.representation() == MachineRepresentation::kTagged) {
|
||||
translation->StoreStackSlot(LocationOperand::cast(op)->index());
|
||||
} else {
|
||||
CHECK(false);
|
||||
}
|
||||
} else if (op->IsDoubleStackSlot()) {
|
||||
DCHECK((type & (kRepFloat32 | kRepFloat64)) != 0);
|
||||
DCHECK(IsFloatingPoint(type.representation()));
|
||||
translation->StoreDoubleStackSlot(LocationOperand::cast(op)->index());
|
||||
} else if (op->IsRegister()) {
|
||||
InstructionOperandConverter converter(this, instr);
|
||||
if (type == kMachBool || type == kRepBit) {
|
||||
if (type.representation() == MachineRepresentation::kBit) {
|
||||
translation->StoreBoolRegister(converter.ToRegister(op));
|
||||
} else if (type == kMachInt32 || type == kMachInt8 || type == kMachInt16) {
|
||||
} else if (type == MachineType::Int8() || type == MachineType::Int16() ||
|
||||
type == MachineType::Int32()) {
|
||||
translation->StoreInt32Register(converter.ToRegister(op));
|
||||
} else if (type == kMachUint32 || type == kMachUint16 ||
|
||||
type == kMachUint8) {
|
||||
} else if (type == MachineType::Uint8() || type == MachineType::Uint16() ||
|
||||
type == MachineType::Uint32()) {
|
||||
translation->StoreUint32Register(converter.ToRegister(op));
|
||||
} else if ((type & kRepMask) == kRepTagged) {
|
||||
} else if (type.representation() == MachineRepresentation::kTagged) {
|
||||
translation->StoreRegister(converter.ToRegister(op));
|
||||
} else {
|
||||
CHECK(false);
|
||||
}
|
||||
} else if (op->IsDoubleRegister()) {
|
||||
DCHECK((type & (kRepFloat32 | kRepFloat64)) != 0);
|
||||
DCHECK(IsFloatingPoint(type.representation()));
|
||||
InstructionOperandConverter converter(this, instr);
|
||||
translation->StoreDoubleRegister(converter.ToDoubleRegister(op));
|
||||
} else if (op->IsImmediate()) {
|
||||
@ -642,21 +646,23 @@ void CodeGenerator::AddTranslationForOperand(Translation* translation,
|
||||
Handle<Object> constant_object;
|
||||
switch (constant.type()) {
|
||||
case Constant::kInt32:
|
||||
DCHECK(type == kMachInt32 || type == kMachUint32 || type == kMachBool ||
|
||||
type == kRepBit);
|
||||
DCHECK(type == MachineType::Int32() || type == MachineType::Uint32() ||
|
||||
type.representation() == MachineRepresentation::kBit);
|
||||
constant_object =
|
||||
isolate()->factory()->NewNumberFromInt(constant.ToInt32());
|
||||
break;
|
||||
case Constant::kFloat32:
|
||||
DCHECK((type & (kRepFloat32 | kRepTagged)) != 0);
|
||||
DCHECK(type.representation() == MachineRepresentation::kFloat32 ||
|
||||
type.representation() == MachineRepresentation::kTagged);
|
||||
constant_object = isolate()->factory()->NewNumber(constant.ToFloat32());
|
||||
break;
|
||||
case Constant::kFloat64:
|
||||
DCHECK((type & (kRepFloat64 | kRepTagged)) != 0);
|
||||
DCHECK(type.representation() == MachineRepresentation::kFloat64 ||
|
||||
type.representation() == MachineRepresentation::kTagged);
|
||||
constant_object = isolate()->factory()->NewNumber(constant.ToFloat64());
|
||||
break;
|
||||
case Constant::kHeapObject:
|
||||
DCHECK((type & kRepMask) == kRepTagged);
|
||||
DCHECK(type.representation() == MachineRepresentation::kTagged);
|
||||
constant_object = constant.ToHeapObject();
|
||||
break;
|
||||
default:
|
||||
|
@ -119,7 +119,7 @@ Node* CodeStubAssembler::WordShl(Node* value, int shift) {
|
||||
|
||||
|
||||
Node* CodeStubAssembler::LoadObjectField(Node* object, int offset) {
|
||||
return raw_assembler_->Load(kMachAnyTagged, object,
|
||||
return raw_assembler_->Load(MachineType::AnyTagged(), object,
|
||||
IntPtrConstant(offset - kHeapObjectTag));
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,8 @@ std::ostream& operator<<(std::ostream& os, IfExceptionHint hint) {
|
||||
|
||||
|
||||
bool operator==(SelectParameters const& lhs, SelectParameters const& rhs) {
|
||||
return lhs.type() == rhs.type() && lhs.hint() == rhs.hint();
|
||||
return lhs.representation() == rhs.representation() &&
|
||||
lhs.hint() == rhs.hint();
|
||||
}
|
||||
|
||||
|
||||
@ -83,12 +84,12 @@ bool operator!=(SelectParameters const& lhs, SelectParameters const& rhs) {
|
||||
|
||||
|
||||
size_t hash_value(SelectParameters const& p) {
|
||||
return base::hash_combine(p.type(), p.hint());
|
||||
return base::hash_combine(p.representation(), p.hint());
|
||||
}
|
||||
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, SelectParameters const& p) {
|
||||
return os << p.type() << "|" << p.hint();
|
||||
return os << p.representation() << "|" << p.hint();
|
||||
}
|
||||
|
||||
|
||||
@ -104,6 +105,12 @@ size_t ProjectionIndexOf(const Operator* const op) {
|
||||
}
|
||||
|
||||
|
||||
MachineRepresentation PhiRepresentationOf(const Operator* const op) {
|
||||
DCHECK_EQ(IrOpcode::kPhi, op->opcode());
|
||||
return OpParameter<MachineRepresentation>(op);
|
||||
}
|
||||
|
||||
|
||||
int ParameterIndexOf(const Operator* const op) {
|
||||
DCHECK_EQ(IrOpcode::kParameter, op->opcode());
|
||||
return OpParameter<ParameterInfo>(op).index();
|
||||
@ -203,15 +210,15 @@ std::ostream& operator<<(std::ostream& os, ParameterInfo const& i) {
|
||||
|
||||
|
||||
#define CACHED_PHI_LIST(V) \
|
||||
V(kMachAnyTagged, 1) \
|
||||
V(kMachAnyTagged, 2) \
|
||||
V(kMachAnyTagged, 3) \
|
||||
V(kMachAnyTagged, 4) \
|
||||
V(kMachAnyTagged, 5) \
|
||||
V(kMachAnyTagged, 6) \
|
||||
V(kMachBool, 2) \
|
||||
V(kMachFloat64, 2) \
|
||||
V(kMachInt32, 2)
|
||||
V(kTagged, 1) \
|
||||
V(kTagged, 2) \
|
||||
V(kTagged, 3) \
|
||||
V(kTagged, 4) \
|
||||
V(kTagged, 5) \
|
||||
V(kTagged, 6) \
|
||||
V(kBit, 2) \
|
||||
V(kFloat64, 2) \
|
||||
V(kWord32, 2)
|
||||
|
||||
|
||||
#define CACHED_PROJECTION_LIST(V) \
|
||||
@ -353,17 +360,18 @@ struct CommonOperatorGlobalCache final {
|
||||
CACHED_MERGE_LIST(CACHED_MERGE)
|
||||
#undef CACHED_MERGE
|
||||
|
||||
template <MachineType kType, int kInputCount>
|
||||
struct PhiOperator final : public Operator1<MachineType> {
|
||||
template <MachineRepresentation kRep, int kInputCount>
|
||||
struct PhiOperator final : public Operator1<MachineRepresentation> {
|
||||
PhiOperator()
|
||||
: Operator1<MachineType>( //--
|
||||
: Operator1<MachineRepresentation>( //--
|
||||
IrOpcode::kPhi, Operator::kPure, // opcode
|
||||
"Phi", // name
|
||||
kInputCount, 0, 1, 1, 0, 0, // counts
|
||||
kType) {} // parameter
|
||||
kRep) {} // parameter
|
||||
};
|
||||
#define CACHED_PHI(type, input_count) \
|
||||
PhiOperator<type, input_count> kPhi##type##input_count##Operator;
|
||||
#define CACHED_PHI(rep, input_count) \
|
||||
PhiOperator<MachineRepresentation::rep, input_count> \
|
||||
kPhi##rep##input_count##Operator;
|
||||
CACHED_PHI_LIST(CACHED_PHI)
|
||||
#undef CACHED_PHI
|
||||
|
||||
@ -661,31 +669,32 @@ const Operator* CommonOperatorBuilder::HeapConstant(
|
||||
}
|
||||
|
||||
|
||||
const Operator* CommonOperatorBuilder::Select(MachineType type,
|
||||
const Operator* CommonOperatorBuilder::Select(MachineRepresentation rep,
|
||||
BranchHint hint) {
|
||||
return new (zone()) Operator1<SelectParameters>( // --
|
||||
IrOpcode::kSelect, Operator::kPure, // opcode
|
||||
"Select", // name
|
||||
3, 0, 0, 1, 0, 0, // counts
|
||||
SelectParameters(type, hint)); // parameter
|
||||
SelectParameters(rep, hint)); // parameter
|
||||
}
|
||||
|
||||
|
||||
const Operator* CommonOperatorBuilder::Phi(MachineType type,
|
||||
const Operator* CommonOperatorBuilder::Phi(MachineRepresentation rep,
|
||||
int value_input_count) {
|
||||
DCHECK(value_input_count > 0); // Disallow empty phis.
|
||||
#define CACHED_PHI(kType, kValueInputCount) \
|
||||
if (kType == type && kValueInputCount == value_input_count) { \
|
||||
return &cache_.kPhi##kType##kValueInputCount##Operator; \
|
||||
#define CACHED_PHI(kRep, kValueInputCount) \
|
||||
if (MachineRepresentation::kRep == rep && \
|
||||
kValueInputCount == value_input_count) { \
|
||||
return &cache_.kPhi##kRep##kValueInputCount##Operator; \
|
||||
}
|
||||
CACHED_PHI_LIST(CACHED_PHI)
|
||||
#undef CACHED_PHI
|
||||
// Uncached.
|
||||
return new (zone()) Operator1<MachineType>( // --
|
||||
IrOpcode::kPhi, Operator::kPure, // opcode
|
||||
"Phi", // name
|
||||
value_input_count, 0, 1, 1, 0, 0, // counts
|
||||
type); // parameter
|
||||
return new (zone()) Operator1<MachineRepresentation>( // --
|
||||
IrOpcode::kPhi, Operator::kPure, // opcode
|
||||
"Phi", // name
|
||||
value_input_count, 0, 1, 1, 0, 0, // counts
|
||||
rep); // parameter
|
||||
}
|
||||
|
||||
|
||||
@ -832,7 +841,7 @@ const Operator* CommonOperatorBuilder::Projection(size_t index) {
|
||||
const Operator* CommonOperatorBuilder::ResizeMergeOrPhi(const Operator* op,
|
||||
int size) {
|
||||
if (op->opcode() == IrOpcode::kPhi) {
|
||||
return Phi(OpParameter<MachineType>(op), size);
|
||||
return Phi(PhiRepresentationOf(op), size);
|
||||
} else if (op->opcode() == IrOpcode::kEffectPhi) {
|
||||
return EffectPhi(size);
|
||||
} else if (op->opcode() == IrOpcode::kMerge) {
|
||||
|
@ -71,15 +71,15 @@ std::ostream& operator<<(std::ostream&, IfExceptionHint);
|
||||
|
||||
class SelectParameters final {
|
||||
public:
|
||||
explicit SelectParameters(MachineType type,
|
||||
explicit SelectParameters(MachineRepresentation representation,
|
||||
BranchHint hint = BranchHint::kNone)
|
||||
: type_(type), hint_(hint) {}
|
||||
: representation_(representation), hint_(hint) {}
|
||||
|
||||
MachineType type() const { return type_; }
|
||||
MachineRepresentation representation() const { return representation_; }
|
||||
BranchHint hint() const { return hint_; }
|
||||
|
||||
private:
|
||||
const MachineType type_;
|
||||
const MachineRepresentation representation_;
|
||||
const BranchHint hint_;
|
||||
};
|
||||
|
||||
@ -95,6 +95,8 @@ SelectParameters const& SelectParametersOf(const Operator* const);
|
||||
|
||||
size_t ProjectionIndexOf(const Operator* const);
|
||||
|
||||
MachineRepresentation PhiRepresentationOf(const Operator* const);
|
||||
|
||||
|
||||
// The {IrOpcode::kParameter} opcode represents an incoming parameter to the
|
||||
// function. This class bundles the index and a debug name for such operators.
|
||||
@ -155,8 +157,9 @@ class CommonOperatorBuilder final : public ZoneObject {
|
||||
const Operator* NumberConstant(volatile double);
|
||||
const Operator* HeapConstant(const Handle<HeapObject>&);
|
||||
|
||||
const Operator* Select(MachineType, BranchHint = BranchHint::kNone);
|
||||
const Operator* Phi(MachineType type, int value_input_count);
|
||||
const Operator* Select(MachineRepresentation, BranchHint = BranchHint::kNone);
|
||||
const Operator* Phi(MachineRepresentation representation,
|
||||
int value_input_count);
|
||||
const Operator* EffectPhi(int effect_input_count);
|
||||
const Operator* EffectSet(int arguments);
|
||||
const Operator* Guard(Type* type);
|
||||
|
@ -49,8 +49,8 @@ struct Diamond {
|
||||
}
|
||||
}
|
||||
|
||||
Node* Phi(MachineType machine_type, Node* tv, Node* fv) {
|
||||
return graph->NewNode(common->Phi(machine_type, 2), tv, fv, merge);
|
||||
Node* Phi(MachineRepresentation rep, Node* tv, Node* fv) {
|
||||
return graph->NewNode(common->Phi(rep, 2), tv, fv, merge);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -285,8 +285,8 @@ bool VirtualState::MergeFrom(VirtualState* left, VirtualState* right,
|
||||
NodeProperties::GetValueInput(rep, 0) != ls->GetField(i) ||
|
||||
NodeProperties::GetValueInput(rep, 1) != rs->GetField(i)) {
|
||||
Node* phi =
|
||||
graph->NewNode(common->Phi(kMachAnyTagged, 2), ls->GetField(i),
|
||||
rs->GetField(i), control);
|
||||
graph->NewNode(common->Phi(MachineRepresentation::kTagged, 2),
|
||||
ls->GetField(i), rs->GetField(i), control);
|
||||
if (mergeObject->SetField(i, phi)) {
|
||||
if (FLAG_trace_turbo_escape) {
|
||||
PrintF(" Creating Phi #%d as merge of #%d and #%d\n",
|
||||
@ -952,8 +952,9 @@ void EscapeAnalysis::ProcessLoadFromPhi(int offset, Node* from, Node* node,
|
||||
if (!rep || rep->opcode() != IrOpcode::kPhi ||
|
||||
NodeProperties::GetValueInput(rep, 0) != lv ||
|
||||
NodeProperties::GetValueInput(rep, 1) != rv) {
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), lv, rv,
|
||||
NodeProperties::GetControlInput(from));
|
||||
Node* phi =
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
lv, rv, NodeProperties::GetControlInput(from));
|
||||
state->GetVirtualObject(node)->SetReplacement(phi);
|
||||
state->LastChangedAt(node);
|
||||
if (FLAG_trace_turbo_escape) {
|
||||
@ -1008,7 +1009,8 @@ void EscapeAnalysis::ProcessLoadElement(Node* node) {
|
||||
NumberMatcher index(node->InputAt(1));
|
||||
ElementAccess access = OpParameter<ElementAccess>(node);
|
||||
if (index.HasValue()) {
|
||||
CHECK_EQ(ElementSizeLog2Of(access.machine_type), kPointerSizeLog2);
|
||||
CHECK_EQ(ElementSizeLog2Of(access.machine_type.representation()),
|
||||
kPointerSizeLog2);
|
||||
CHECK_EQ(access.header_size % kPointerSize, 0);
|
||||
int offset = index.Value() + access.header_size / kPointerSize;
|
||||
if (!object->IsTracked()) return;
|
||||
@ -1058,7 +1060,8 @@ void EscapeAnalysis::ProcessStoreElement(Node* node) {
|
||||
ElementAccess access = OpParameter<ElementAccess>(node);
|
||||
Node* val = NodeProperties::GetValueInput(node, 2);
|
||||
if (index.HasValue()) {
|
||||
CHECK_EQ(ElementSizeLog2Of(access.machine_type), kPointerSizeLog2);
|
||||
CHECK_EQ(ElementSizeLog2Of(access.machine_type.representation()),
|
||||
kPointerSizeLog2);
|
||||
CHECK_EQ(access.header_size % kPointerSize, 0);
|
||||
int offset = index.Value() + access.header_size / kPointerSize;
|
||||
VirtualState* states = virtual_states_[node->id()];
|
||||
|
@ -169,26 +169,25 @@ void VisitFloatUnop(InstructionSelector* selector, Node* node, Node* input,
|
||||
|
||||
|
||||
void InstructionSelector::VisitLoad(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<LoadRepresentation>(node));
|
||||
MachineType typ = TypeOf(OpParameter<LoadRepresentation>(node));
|
||||
LoadRepresentation load_rep = LoadRepresentationOf(node->op());
|
||||
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepFloat32:
|
||||
switch (load_rep.representation()) {
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kIA32Movss;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kIA32Movsd;
|
||||
break;
|
||||
case kRepBit: // Fall through.
|
||||
case kRepWord8:
|
||||
opcode = typ == kTypeInt32 ? kIA32Movsxbl : kIA32Movzxbl;
|
||||
case MachineRepresentation::kBit: // Fall through.
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = load_rep.IsSigned() ? kIA32Movsxbl : kIA32Movzxbl;
|
||||
break;
|
||||
case kRepWord16:
|
||||
opcode = typ == kTypeInt32 ? kIA32Movsxwl : kIA32Movzxwl;
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = load_rep.IsSigned() ? kIA32Movsxwl : kIA32Movzxwl;
|
||||
break;
|
||||
case kRepTagged: // Fall through.
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kTagged: // Fall through.
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kIA32Movl;
|
||||
break;
|
||||
default:
|
||||
@ -216,10 +215,10 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
|
||||
StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node);
|
||||
WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind();
|
||||
MachineType rep = RepresentationOf(store_rep.machine_type());
|
||||
MachineRepresentation rep = store_rep.machine_type().representation();
|
||||
|
||||
if (write_barrier_kind != kNoWriteBarrier) {
|
||||
DCHECK_EQ(kRepTagged, rep);
|
||||
DCHECK_EQ(MachineRepresentation::kTagged, rep);
|
||||
AddressingMode addressing_mode;
|
||||
InstructionOperand inputs[3];
|
||||
size_t input_count = 0;
|
||||
@ -258,21 +257,21 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
} else {
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kIA32Movss;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kIA32Movsd;
|
||||
break;
|
||||
case kRepBit: // Fall through.
|
||||
case kRepWord8:
|
||||
case MachineRepresentation::kBit: // Fall through.
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = kIA32Movb;
|
||||
break;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = kIA32Movw;
|
||||
break;
|
||||
case kRepTagged: // Fall through.
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kTagged: // Fall through.
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kIA32Movl;
|
||||
break;
|
||||
default:
|
||||
@ -283,7 +282,8 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
InstructionOperand val;
|
||||
if (g.CanBeImmediate(value)) {
|
||||
val = g.UseImmediate(value);
|
||||
} else if (rep == kRepWord8 || rep == kRepBit) {
|
||||
} else if (rep == MachineRepresentation::kWord8 ||
|
||||
rep == MachineRepresentation::kBit) {
|
||||
val = g.UseByteRegister(value);
|
||||
} else {
|
||||
val = g.UseRegister(value);
|
||||
@ -302,27 +302,26 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
|
||||
|
||||
void InstructionSelector::VisitCheckedLoad(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
|
||||
MachineType typ = TypeOf(OpParameter<MachineType>(node));
|
||||
CheckedLoadRepresentation load_rep = CheckedLoadRepresentationOf(node->op());
|
||||
IA32OperandGenerator g(this);
|
||||
Node* const buffer = node->InputAt(0);
|
||||
Node* const offset = node->InputAt(1);
|
||||
Node* const length = node->InputAt(2);
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepWord8:
|
||||
opcode = typ == kTypeInt32 ? kCheckedLoadInt8 : kCheckedLoadUint8;
|
||||
switch (load_rep.representation()) {
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = load_rep.IsSigned() ? kCheckedLoadInt8 : kCheckedLoadUint8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
opcode = typ == kTypeInt32 ? kCheckedLoadInt16 : kCheckedLoadUint16;
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = load_rep.IsSigned() ? kCheckedLoadInt16 : kCheckedLoadUint16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kCheckedLoadWord32;
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kCheckedLoadFloat32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kCheckedLoadFloat64;
|
||||
break;
|
||||
default:
|
||||
@ -345,7 +344,8 @@ void InstructionSelector::VisitCheckedLoad(Node* node) {
|
||||
|
||||
|
||||
void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
|
||||
MachineRepresentation rep =
|
||||
CheckedStoreRepresentationOf(node->op()).representation();
|
||||
IA32OperandGenerator g(this);
|
||||
Node* const buffer = node->InputAt(0);
|
||||
Node* const offset = node->InputAt(1);
|
||||
@ -353,19 +353,19 @@ void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
Node* const value = node->InputAt(3);
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepWord8:
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = kCheckedStoreWord8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = kCheckedStoreWord16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kCheckedStoreWord32;
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kCheckedStoreFloat32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kCheckedStoreFloat64;
|
||||
break;
|
||||
default:
|
||||
@ -373,10 +373,11 @@ void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
return;
|
||||
}
|
||||
InstructionOperand value_operand =
|
||||
g.CanBeImmediate(value)
|
||||
? g.UseImmediate(value)
|
||||
: ((rep == kRepWord8 || rep == kRepBit) ? g.UseByteRegister(value)
|
||||
: g.UseRegister(value));
|
||||
g.CanBeImmediate(value) ? g.UseImmediate(value)
|
||||
: ((rep == MachineRepresentation::kWord8 ||
|
||||
rep == MachineRepresentation::kBit)
|
||||
? g.UseByteRegister(value)
|
||||
: g.UseRegister(value));
|
||||
InstructionOperand offset_operand = g.UseRegister(offset);
|
||||
InstructionOperand length_operand =
|
||||
g.CanBeImmediate(length) ? g.UseImmediate(length) : g.UseRegister(length);
|
||||
|
@ -68,8 +68,8 @@ class OperandGenerator {
|
||||
}
|
||||
|
||||
InstructionOperand DefineAsLocation(Node* node, LinkageLocation location,
|
||||
MachineType type) {
|
||||
return Define(node, ToUnallocatedOperand(location, type, GetVReg(node)));
|
||||
MachineRepresentation rep) {
|
||||
return Define(node, ToUnallocatedOperand(location, rep, GetVReg(node)));
|
||||
}
|
||||
|
||||
InstructionOperand DefineAsDualLocation(Node* node,
|
||||
@ -129,12 +129,12 @@ class OperandGenerator {
|
||||
}
|
||||
|
||||
InstructionOperand UseExplicit(LinkageLocation location) {
|
||||
MachineType machine_type = InstructionSequence::DefaultRepresentation();
|
||||
MachineRepresentation rep = InstructionSequence::DefaultRepresentation();
|
||||
if (location.IsRegister()) {
|
||||
return ExplicitOperand(LocationOperand::REGISTER, machine_type,
|
||||
return ExplicitOperand(LocationOperand::REGISTER, rep,
|
||||
location.AsRegister());
|
||||
} else {
|
||||
return ExplicitOperand(LocationOperand::STACK_SLOT, machine_type,
|
||||
return ExplicitOperand(LocationOperand::STACK_SLOT, rep,
|
||||
location.GetLocation());
|
||||
}
|
||||
}
|
||||
@ -144,19 +144,19 @@ class OperandGenerator {
|
||||
}
|
||||
|
||||
InstructionOperand UseLocation(Node* node, LinkageLocation location,
|
||||
MachineType type) {
|
||||
return Use(node, ToUnallocatedOperand(location, type, GetVReg(node)));
|
||||
MachineRepresentation rep) {
|
||||
return Use(node, ToUnallocatedOperand(location, rep, GetVReg(node)));
|
||||
}
|
||||
|
||||
// Used to force gap moves from the from_location to the to_location
|
||||
// immediately before an instruction.
|
||||
InstructionOperand UsePointerLocation(LinkageLocation to_location,
|
||||
LinkageLocation from_location) {
|
||||
MachineType type = static_cast<MachineType>(kTypeAny | kMachPtr);
|
||||
MachineRepresentation rep = MachineType::PointerRepresentation();
|
||||
UnallocatedOperand casted_from_operand =
|
||||
UnallocatedOperand::cast(TempLocation(from_location, type));
|
||||
UnallocatedOperand::cast(TempLocation(from_location, rep));
|
||||
selector_->Emit(kArchNop, casted_from_operand);
|
||||
return ToUnallocatedOperand(to_location, type,
|
||||
return ToUnallocatedOperand(to_location, rep,
|
||||
casted_from_operand.virtual_register());
|
||||
}
|
||||
|
||||
@ -170,7 +170,8 @@ class OperandGenerator {
|
||||
UnallocatedOperand op = UnallocatedOperand(
|
||||
UnallocatedOperand::MUST_HAVE_REGISTER,
|
||||
UnallocatedOperand::USED_AT_START, sequence()->NextVirtualRegister());
|
||||
sequence()->MarkAsRepresentation(kRepFloat64, op.virtual_register());
|
||||
sequence()->MarkAsRepresentation(MachineRepresentation::kFloat64,
|
||||
op.virtual_register());
|
||||
return op;
|
||||
}
|
||||
|
||||
@ -183,8 +184,9 @@ class OperandGenerator {
|
||||
return sequence()->AddImmediate(Constant(imm));
|
||||
}
|
||||
|
||||
InstructionOperand TempLocation(LinkageLocation location, MachineType type) {
|
||||
return ToUnallocatedOperand(location, type,
|
||||
InstructionOperand TempLocation(LinkageLocation location,
|
||||
MachineRepresentation rep) {
|
||||
return ToUnallocatedOperand(location, rep,
|
||||
sequence()->NextVirtualRegister());
|
||||
}
|
||||
|
||||
@ -250,7 +252,7 @@ class OperandGenerator {
|
||||
}
|
||||
|
||||
UnallocatedOperand ToUnallocatedOperand(LinkageLocation location,
|
||||
MachineType type,
|
||||
MachineRepresentation rep,
|
||||
int virtual_register) {
|
||||
if (location.IsAnyRegister()) {
|
||||
// any machine register.
|
||||
@ -268,8 +270,7 @@ class OperandGenerator {
|
||||
location.AsCalleeFrameSlot(), virtual_register);
|
||||
}
|
||||
// a fixed register.
|
||||
MachineType rep = RepresentationOf(type);
|
||||
if (rep == kRepFloat64 || rep == kRepFloat32) {
|
||||
if (IsFloatingPoint(rep)) {
|
||||
return UnallocatedOperand(UnallocatedOperand::FIXED_DOUBLE_REGISTER,
|
||||
location.AsRegister(), virtual_register);
|
||||
}
|
||||
|
@ -241,16 +241,15 @@ void InstructionSelector::MarkAsUsed(Node* node) {
|
||||
}
|
||||
|
||||
|
||||
void InstructionSelector::MarkAsRepresentation(MachineType rep,
|
||||
void InstructionSelector::MarkAsRepresentation(MachineRepresentation rep,
|
||||
const InstructionOperand& op) {
|
||||
UnallocatedOperand unalloc = UnallocatedOperand::cast(op);
|
||||
rep = RepresentationOf(rep);
|
||||
sequence()->MarkAsRepresentation(rep, unalloc.virtual_register());
|
||||
}
|
||||
|
||||
|
||||
void InstructionSelector::MarkAsRepresentation(MachineType rep, Node* node) {
|
||||
rep = RepresentationOf(rep);
|
||||
void InstructionSelector::MarkAsRepresentation(MachineRepresentation rep,
|
||||
Node* node) {
|
||||
sequence()->MarkAsRepresentation(rep, GetVirtualRegister(node));
|
||||
}
|
||||
|
||||
@ -310,7 +309,7 @@ void AddFrameStateInputs(Node* state, OperandGenerator* g,
|
||||
size_t value_index = 0;
|
||||
inputs->push_back(
|
||||
OperandForDeopt(g, function, FrameStateInputKind::kStackSlot));
|
||||
descriptor->SetType(value_index++, kMachAnyTagged);
|
||||
descriptor->SetType(value_index++, MachineType::AnyTagged());
|
||||
for (StateValuesAccess::TypedNode input_node :
|
||||
StateValuesAccess(parameters)) {
|
||||
inputs->push_back(OperandForDeopt(g, input_node.node, kind));
|
||||
@ -319,7 +318,7 @@ void AddFrameStateInputs(Node* state, OperandGenerator* g,
|
||||
if (descriptor->HasContext()) {
|
||||
inputs->push_back(
|
||||
OperandForDeopt(g, context, FrameStateInputKind::kStackSlot));
|
||||
descriptor->SetType(value_index++, kMachAnyTagged);
|
||||
descriptor->SetType(value_index++, MachineType::AnyTagged());
|
||||
}
|
||||
for (StateValuesAccess::TypedNode input_node : StateValuesAccess(locals)) {
|
||||
inputs->push_back(OperandForDeopt(g, input_node.node, kind));
|
||||
@ -418,9 +417,10 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer,
|
||||
|
||||
Node* output = buffer->output_nodes[i];
|
||||
InstructionOperand op =
|
||||
output == NULL ? g.TempLocation(location, type)
|
||||
: g.DefineAsLocation(output, location, type);
|
||||
MarkAsRepresentation(type, op);
|
||||
output == NULL
|
||||
? g.TempLocation(location, type.representation())
|
||||
: g.DefineAsLocation(output, location, type.representation());
|
||||
MarkAsRepresentation(type.representation(), op);
|
||||
|
||||
buffer->outputs.push_back(op);
|
||||
}
|
||||
@ -448,7 +448,7 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer,
|
||||
case CallDescriptor::kCallJSFunction:
|
||||
buffer->instruction_args.push_back(
|
||||
g.UseLocation(callee, buffer->descriptor->GetInputLocation(0),
|
||||
buffer->descriptor->GetInputType(0)));
|
||||
buffer->descriptor->GetInputType(0).representation()));
|
||||
break;
|
||||
case CallDescriptor::kLazyBailout:
|
||||
// The target is ignored, but we still need to pass a value here.
|
||||
@ -495,7 +495,8 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer,
|
||||
location, stack_param_delta);
|
||||
}
|
||||
InstructionOperand op =
|
||||
g.UseLocation(*iter, location, buffer->descriptor->GetInputType(index));
|
||||
g.UseLocation(*iter, location,
|
||||
buffer->descriptor->GetInputType(index).representation());
|
||||
if (UnallocatedOperand::cast(op).HasFixedSlotPolicy() && !call_tail) {
|
||||
int stack_index = -UnallocatedOperand::cast(op).fixed_slot_index() - 1;
|
||||
if (static_cast<size_t>(stack_index) >= buffer->pushed_nodes.size()) {
|
||||
@ -681,14 +682,14 @@ void InstructionSelector::VisitNode(Node* node) {
|
||||
case IrOpcode::kParameter: {
|
||||
MachineType type =
|
||||
linkage()->GetParameterType(ParameterIndexOf(node->op()));
|
||||
MarkAsRepresentation(type, node);
|
||||
MarkAsRepresentation(type.representation(), node);
|
||||
return VisitParameter(node);
|
||||
}
|
||||
case IrOpcode::kOsrValue:
|
||||
return MarkAsReference(node), VisitOsrValue(node);
|
||||
case IrOpcode::kPhi: {
|
||||
MachineType type = OpParameter<MachineType>(node);
|
||||
MarkAsRepresentation(type, node);
|
||||
MachineRepresentation rep = PhiRepresentationOf(node->op());
|
||||
MarkAsRepresentation(rep, node);
|
||||
return VisitPhi(node);
|
||||
}
|
||||
case IrOpcode::kProjection:
|
||||
@ -714,8 +715,8 @@ void InstructionSelector::VisitNode(Node* node) {
|
||||
case IrOpcode::kStateValues:
|
||||
return;
|
||||
case IrOpcode::kLoad: {
|
||||
LoadRepresentation rep = OpParameter<LoadRepresentation>(node);
|
||||
MarkAsRepresentation(rep, node);
|
||||
LoadRepresentation type = LoadRepresentationOf(node->op());
|
||||
MarkAsRepresentation(type.representation(), node);
|
||||
return VisitLoad(node);
|
||||
}
|
||||
case IrOpcode::kStore:
|
||||
@ -937,7 +938,8 @@ void InstructionSelector::VisitNode(Node* node) {
|
||||
case IrOpcode::kLoadFramePointer:
|
||||
return VisitLoadFramePointer(node);
|
||||
case IrOpcode::kCheckedLoad: {
|
||||
MachineType rep = OpParameter<MachineType>(node);
|
||||
MachineRepresentation rep =
|
||||
CheckedLoadRepresentationOf(node->op()).representation();
|
||||
MarkAsRepresentation(rep, node);
|
||||
return VisitCheckedLoad(node);
|
||||
}
|
||||
@ -1161,8 +1163,9 @@ void InstructionSelector::VisitParameter(Node* node) {
|
||||
? g.DefineAsDualLocation(
|
||||
node, linkage()->GetParameterLocation(index),
|
||||
linkage()->GetParameterSecondaryLocation(index))
|
||||
: g.DefineAsLocation(node, linkage()->GetParameterLocation(index),
|
||||
linkage()->GetParameterType(index));
|
||||
: g.DefineAsLocation(
|
||||
node, linkage()->GetParameterLocation(index),
|
||||
linkage()->GetParameterType(index).representation());
|
||||
|
||||
Emit(kArchNop, op);
|
||||
}
|
||||
@ -1173,8 +1176,9 @@ void InstructionSelector::VisitIfException(Node* node) {
|
||||
Node* call = node->InputAt(1);
|
||||
DCHECK_EQ(IrOpcode::kCall, call->opcode());
|
||||
const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(call);
|
||||
Emit(kArchNop, g.DefineAsLocation(node, descriptor->GetReturnLocation(0),
|
||||
descriptor->GetReturnType(0)));
|
||||
Emit(kArchNop,
|
||||
g.DefineAsLocation(node, descriptor->GetReturnLocation(0),
|
||||
descriptor->GetReturnType(0).representation()));
|
||||
}
|
||||
|
||||
|
||||
@ -1182,7 +1186,7 @@ void InstructionSelector::VisitOsrValue(Node* node) {
|
||||
OperandGenerator g(this);
|
||||
int index = OpParameter<int>(node);
|
||||
Emit(kArchNop, g.DefineAsLocation(node, linkage()->GetOsrValueLocation(index),
|
||||
kMachAnyTagged));
|
||||
MachineRepresentation::kTagged));
|
||||
}
|
||||
|
||||
|
||||
@ -1399,7 +1403,7 @@ void InstructionSelector::VisitReturn(Node* ret) {
|
||||
for (int i = 0; i < ret_count; ++i) {
|
||||
value_locations[i] =
|
||||
g.UseLocation(ret->InputAt(i), linkage()->GetReturnLocation(i),
|
||||
linkage()->GetReturnType(i));
|
||||
linkage()->GetReturnType(i).representation());
|
||||
}
|
||||
Emit(kArchRet, 0, nullptr, ret_count, value_locations);
|
||||
}
|
||||
|
@ -153,16 +153,27 @@ class InstructionSelector final {
|
||||
|
||||
// Inform the register allocation of the representation of the value produced
|
||||
// by {node}.
|
||||
void MarkAsRepresentation(MachineType rep, Node* node);
|
||||
void MarkAsWord32(Node* node) { MarkAsRepresentation(kRepWord32, node); }
|
||||
void MarkAsWord64(Node* node) { MarkAsRepresentation(kRepWord64, node); }
|
||||
void MarkAsFloat32(Node* node) { MarkAsRepresentation(kRepFloat32, node); }
|
||||
void MarkAsFloat64(Node* node) { MarkAsRepresentation(kRepFloat64, node); }
|
||||
void MarkAsReference(Node* node) { MarkAsRepresentation(kRepTagged, node); }
|
||||
void MarkAsRepresentation(MachineRepresentation rep, Node* node);
|
||||
void MarkAsWord32(Node* node) {
|
||||
MarkAsRepresentation(MachineRepresentation::kWord32, node);
|
||||
}
|
||||
void MarkAsWord64(Node* node) {
|
||||
MarkAsRepresentation(MachineRepresentation::kWord64, node);
|
||||
}
|
||||
void MarkAsFloat32(Node* node) {
|
||||
MarkAsRepresentation(MachineRepresentation::kFloat32, node);
|
||||
}
|
||||
void MarkAsFloat64(Node* node) {
|
||||
MarkAsRepresentation(MachineRepresentation::kFloat64, node);
|
||||
}
|
||||
void MarkAsReference(Node* node) {
|
||||
MarkAsRepresentation(MachineRepresentation::kTagged, node);
|
||||
}
|
||||
|
||||
// Inform the register allocation of the representation of the unallocated
|
||||
// operand {op}.
|
||||
void MarkAsRepresentation(MachineType rep, const InstructionOperand& op);
|
||||
void MarkAsRepresentation(MachineRepresentation rep,
|
||||
const InstructionOperand& op);
|
||||
|
||||
enum CallBufferFlag {
|
||||
kCallCodeImmediate = 1u << 0,
|
||||
|
@ -122,20 +122,20 @@ std::ostream& operator<<(std::ostream& os,
|
||||
if (allocated.IsExplicit()) {
|
||||
os << "|E";
|
||||
}
|
||||
switch (allocated.machine_type()) {
|
||||
case kRepWord32:
|
||||
switch (allocated.representation()) {
|
||||
case MachineRepresentation::kWord32:
|
||||
os << "|w32";
|
||||
break;
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kWord64:
|
||||
os << "|w64";
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
os << "|f32";
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
os << "|f64";
|
||||
break;
|
||||
case kRepTagged:
|
||||
case MachineRepresentation::kTagged:
|
||||
os << "|t";
|
||||
break;
|
||||
default:
|
||||
@ -195,12 +195,12 @@ MoveOperands* ParallelMove::PrepareInsertAfter(MoveOperands* move) const {
|
||||
}
|
||||
|
||||
|
||||
ExplicitOperand::ExplicitOperand(LocationKind kind, MachineType machine_type,
|
||||
ExplicitOperand::ExplicitOperand(LocationKind kind, MachineRepresentation rep,
|
||||
int index)
|
||||
: LocationOperand(EXPLICIT, kind, machine_type, index) {
|
||||
DCHECK_IMPLIES(kind == REGISTER && !IsFloatingPoint(machine_type),
|
||||
: LocationOperand(EXPLICIT, kind, rep, index) {
|
||||
DCHECK_IMPLIES(kind == REGISTER && !IsFloatingPoint(rep),
|
||||
Register::from_code(index).IsAllocatable());
|
||||
DCHECK_IMPLIES(kind == REGISTER && IsFloatingPoint(machine_type),
|
||||
DCHECK_IMPLIES(kind == REGISTER && IsFloatingPoint(rep),
|
||||
DoubleRegister::from_code(index).IsAllocatable());
|
||||
}
|
||||
|
||||
@ -656,28 +656,28 @@ InstructionBlock* InstructionSequence::GetInstructionBlock(
|
||||
}
|
||||
|
||||
|
||||
static MachineType FilterRepresentation(MachineType rep) {
|
||||
DCHECK_EQ(rep, RepresentationOf(rep));
|
||||
static MachineRepresentation FilterRepresentation(MachineRepresentation rep) {
|
||||
switch (rep) {
|
||||
case kRepBit:
|
||||
case kRepWord8:
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kBit:
|
||||
case MachineRepresentation::kWord8:
|
||||
case MachineRepresentation::kWord16:
|
||||
return InstructionSequence::DefaultRepresentation();
|
||||
case kRepWord32:
|
||||
case kRepWord64:
|
||||
case kRepFloat32:
|
||||
case kRepFloat64:
|
||||
case kRepTagged:
|
||||
case MachineRepresentation::kWord32:
|
||||
case MachineRepresentation::kWord64:
|
||||
case MachineRepresentation::kFloat32:
|
||||
case MachineRepresentation::kFloat64:
|
||||
case MachineRepresentation::kTagged:
|
||||
return rep;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
UNREACHABLE();
|
||||
return kMachNone;
|
||||
return MachineRepresentation::kNone;
|
||||
}
|
||||
|
||||
|
||||
MachineType InstructionSequence::GetRepresentation(int virtual_register) const {
|
||||
MachineRepresentation InstructionSequence::GetRepresentation(
|
||||
int virtual_register) const {
|
||||
DCHECK_LE(0, virtual_register);
|
||||
DCHECK_LT(virtual_register, VirtualRegisterCount());
|
||||
if (virtual_register >= static_cast<int>(representations_.size())) {
|
||||
@ -687,17 +687,17 @@ MachineType InstructionSequence::GetRepresentation(int virtual_register) const {
|
||||
}
|
||||
|
||||
|
||||
void InstructionSequence::MarkAsRepresentation(MachineType machine_type,
|
||||
void InstructionSequence::MarkAsRepresentation(MachineRepresentation rep,
|
||||
int virtual_register) {
|
||||
DCHECK_LE(0, virtual_register);
|
||||
DCHECK_LT(virtual_register, VirtualRegisterCount());
|
||||
if (virtual_register >= static_cast<int>(representations_.size())) {
|
||||
representations_.resize(VirtualRegisterCount(), DefaultRepresentation());
|
||||
}
|
||||
machine_type = FilterRepresentation(machine_type);
|
||||
DCHECK_IMPLIES(representations_[virtual_register] != machine_type,
|
||||
rep = FilterRepresentation(rep);
|
||||
DCHECK_IMPLIES(representations_[virtual_register] != rep,
|
||||
representations_[virtual_register] == DefaultRepresentation());
|
||||
representations_[virtual_register] = machine_type;
|
||||
representations_[virtual_register] = rep;
|
||||
}
|
||||
|
||||
|
||||
@ -759,7 +759,7 @@ FrameStateDescriptor::FrameStateDescriptor(
|
||||
types_(zone),
|
||||
shared_info_(shared_info),
|
||||
outer_state_(outer_state) {
|
||||
types_.resize(GetSize(), kMachNone);
|
||||
types_.resize(GetSize(), MachineType::None());
|
||||
}
|
||||
|
||||
|
||||
|
@ -392,12 +392,12 @@ class LocationOperand : public InstructionOperand {
|
||||
|
||||
LocationOperand(InstructionOperand::Kind operand_kind,
|
||||
LocationOperand::LocationKind location_kind,
|
||||
MachineType machine_type, int index)
|
||||
MachineRepresentation rep, int index)
|
||||
: InstructionOperand(operand_kind) {
|
||||
DCHECK_IMPLIES(location_kind == REGISTER, index >= 0);
|
||||
DCHECK(IsSupportedMachineType(machine_type));
|
||||
DCHECK(IsSupportedRepresentation(rep));
|
||||
value_ |= LocationKindField::encode(location_kind);
|
||||
value_ |= MachineTypeField::encode(machine_type);
|
||||
value_ |= RepresentationField::encode(rep);
|
||||
value_ |= static_cast<int64_t>(index) << IndexField::kShift;
|
||||
}
|
||||
|
||||
@ -422,16 +422,17 @@ class LocationOperand : public InstructionOperand {
|
||||
return LocationKindField::decode(value_);
|
||||
}
|
||||
|
||||
MachineType machine_type() const { return MachineTypeField::decode(value_); }
|
||||
MachineRepresentation representation() const {
|
||||
return RepresentationField::decode(value_);
|
||||
}
|
||||
|
||||
static bool IsSupportedMachineType(MachineType machine_type) {
|
||||
if (RepresentationOf(machine_type) != machine_type) return false;
|
||||
switch (machine_type) {
|
||||
case kRepWord32:
|
||||
case kRepWord64:
|
||||
case kRepFloat32:
|
||||
case kRepFloat64:
|
||||
case kRepTagged:
|
||||
static bool IsSupportedRepresentation(MachineRepresentation rep) {
|
||||
switch (rep) {
|
||||
case MachineRepresentation::kWord32:
|
||||
case MachineRepresentation::kWord64:
|
||||
case MachineRepresentation::kFloat32:
|
||||
case MachineRepresentation::kFloat64:
|
||||
case MachineRepresentation::kTagged:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -455,19 +456,18 @@ class LocationOperand : public InstructionOperand {
|
||||
|
||||
STATIC_ASSERT(KindField::kSize == 3);
|
||||
class LocationKindField : public BitField64<LocationKind, 3, 2> {};
|
||||
class MachineTypeField : public BitField64<MachineType, 5, 16> {};
|
||||
class RepresentationField : public BitField64<MachineRepresentation, 5, 8> {};
|
||||
class IndexField : public BitField64<int32_t, 35, 29> {};
|
||||
};
|
||||
|
||||
|
||||
class ExplicitOperand : public LocationOperand {
|
||||
public:
|
||||
ExplicitOperand(LocationKind kind, MachineType machine_type, int index);
|
||||
ExplicitOperand(LocationKind kind, MachineRepresentation rep, int index);
|
||||
|
||||
static ExplicitOperand* New(Zone* zone, LocationKind kind,
|
||||
MachineType machine_type, int index) {
|
||||
return InstructionOperand::New(zone,
|
||||
ExplicitOperand(kind, machine_type, index));
|
||||
MachineRepresentation rep, int index) {
|
||||
return InstructionOperand::New(zone, ExplicitOperand(kind, rep, index));
|
||||
}
|
||||
|
||||
INSTRUCTION_OPERAND_CASTS(ExplicitOperand, EXPLICIT);
|
||||
@ -476,13 +476,12 @@ class ExplicitOperand : public LocationOperand {
|
||||
|
||||
class AllocatedOperand : public LocationOperand {
|
||||
public:
|
||||
AllocatedOperand(LocationKind kind, MachineType machine_type, int index)
|
||||
: LocationOperand(ALLOCATED, kind, machine_type, index) {}
|
||||
AllocatedOperand(LocationKind kind, MachineRepresentation rep, int index)
|
||||
: LocationOperand(ALLOCATED, kind, rep, index) {}
|
||||
|
||||
static AllocatedOperand* New(Zone* zone, LocationKind kind,
|
||||
MachineType machine_type, int index) {
|
||||
return InstructionOperand::New(zone,
|
||||
AllocatedOperand(kind, machine_type, index));
|
||||
MachineRepresentation rep, int index) {
|
||||
return InstructionOperand::New(zone, AllocatedOperand(kind, rep, index));
|
||||
}
|
||||
|
||||
INSTRUCTION_OPERAND_CASTS(AllocatedOperand, ALLOCATED);
|
||||
@ -496,40 +495,40 @@ bool InstructionOperand::IsRegister() const {
|
||||
return (IsAllocated() || IsExplicit()) &&
|
||||
LocationOperand::cast(this)->location_kind() ==
|
||||
LocationOperand::REGISTER &&
|
||||
!IsFloatingPoint(LocationOperand::cast(this)->machine_type());
|
||||
!IsFloatingPoint(LocationOperand::cast(this)->representation());
|
||||
}
|
||||
|
||||
bool InstructionOperand::IsDoubleRegister() const {
|
||||
return (IsAllocated() || IsExplicit()) &&
|
||||
LocationOperand::cast(this)->location_kind() ==
|
||||
LocationOperand::REGISTER &&
|
||||
IsFloatingPoint(LocationOperand::cast(this)->machine_type());
|
||||
IsFloatingPoint(LocationOperand::cast(this)->representation());
|
||||
}
|
||||
|
||||
bool InstructionOperand::IsStackSlot() const {
|
||||
return (IsAllocated() || IsExplicit()) &&
|
||||
LocationOperand::cast(this)->location_kind() ==
|
||||
LocationOperand::STACK_SLOT &&
|
||||
!IsFloatingPoint(LocationOperand::cast(this)->machine_type());
|
||||
!IsFloatingPoint(LocationOperand::cast(this)->representation());
|
||||
}
|
||||
|
||||
bool InstructionOperand::IsDoubleStackSlot() const {
|
||||
return (IsAllocated() || IsExplicit()) &&
|
||||
LocationOperand::cast(this)->location_kind() ==
|
||||
LocationOperand::STACK_SLOT &&
|
||||
IsFloatingPoint(LocationOperand::cast(this)->machine_type());
|
||||
IsFloatingPoint(LocationOperand::cast(this)->representation());
|
||||
}
|
||||
|
||||
uint64_t InstructionOperand::GetCanonicalizedValue() const {
|
||||
if (IsAllocated() || IsExplicit()) {
|
||||
// TODO(dcarney): put machine type last and mask.
|
||||
MachineType canonicalized_machine_type =
|
||||
IsFloatingPoint(LocationOperand::cast(this)->machine_type())
|
||||
? kMachFloat64
|
||||
: kMachNone;
|
||||
MachineRepresentation canonicalized_representation =
|
||||
IsFloatingPoint(LocationOperand::cast(this)->representation())
|
||||
? MachineRepresentation::kFloat64
|
||||
: MachineRepresentation::kNone;
|
||||
return InstructionOperand::KindField::update(
|
||||
LocationOperand::MachineTypeField::update(this->value_,
|
||||
canonicalized_machine_type),
|
||||
LocationOperand::RepresentationField::update(
|
||||
this->value_, canonicalized_representation),
|
||||
LocationOperand::EXPLICIT);
|
||||
}
|
||||
return this->value_;
|
||||
@ -1131,19 +1130,20 @@ class InstructionSequence final : public ZoneObject {
|
||||
|
||||
InstructionBlock* GetInstructionBlock(int instruction_index) const;
|
||||
|
||||
static MachineType DefaultRepresentation() {
|
||||
return kPointerSize == 8 ? kRepWord64 : kRepWord32;
|
||||
static MachineRepresentation DefaultRepresentation() {
|
||||
return MachineType::PointerRepresentation();
|
||||
}
|
||||
MachineType GetRepresentation(int virtual_register) const;
|
||||
void MarkAsRepresentation(MachineType machine_type, int virtual_register);
|
||||
MachineRepresentation GetRepresentation(int virtual_register) const;
|
||||
void MarkAsRepresentation(MachineRepresentation rep, int virtual_register);
|
||||
|
||||
bool IsReference(int virtual_register) const {
|
||||
return GetRepresentation(virtual_register) == kRepTagged;
|
||||
return GetRepresentation(virtual_register) ==
|
||||
MachineRepresentation::kTagged;
|
||||
}
|
||||
bool IsFloat(int virtual_register) const {
|
||||
switch (GetRepresentation(virtual_register)) {
|
||||
case kRepFloat32:
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat32:
|
||||
case MachineRepresentation::kFloat64:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -1263,7 +1263,7 @@ class InstructionSequence final : public ZoneObject {
|
||||
InstructionDeque instructions_;
|
||||
int next_virtual_register_;
|
||||
ReferenceMapDeque reference_maps_;
|
||||
ZoneVector<MachineType> representations_;
|
||||
ZoneVector<MachineRepresentation> representations_;
|
||||
DeoptimizationVector deoptimization_entries_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(InstructionSequence);
|
||||
|
@ -30,7 +30,8 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone,
|
||||
: bytecode_(bytecode),
|
||||
raw_assembler_(new RawMachineAssembler(
|
||||
isolate, new (zone) Graph(zone),
|
||||
Linkage::GetInterpreterDispatchDescriptor(zone), kMachPtr,
|
||||
Linkage::GetInterpreterDispatchDescriptor(zone),
|
||||
MachineType::PointerRepresentation(),
|
||||
InstructionSelector::SupportedMachineOperatorFlags())),
|
||||
accumulator_(
|
||||
raw_assembler_->Parameter(Linkage::kInterpreterAccumulatorParameter)),
|
||||
@ -112,21 +113,22 @@ Node* InterpreterAssembler::RegisterLocation(Node* reg_index) {
|
||||
|
||||
Node* InterpreterAssembler::LoadRegister(interpreter::Register reg) {
|
||||
return raw_assembler_->Load(
|
||||
kMachAnyTagged, RegisterFileRawPointer(),
|
||||
MachineType::AnyTagged(), RegisterFileRawPointer(),
|
||||
RegisterFrameOffset(Int32Constant(reg.ToOperand())));
|
||||
}
|
||||
|
||||
|
||||
Node* InterpreterAssembler::LoadRegister(Node* reg_index) {
|
||||
return raw_assembler_->Load(kMachAnyTagged, RegisterFileRawPointer(),
|
||||
return raw_assembler_->Load(MachineType::AnyTagged(),
|
||||
RegisterFileRawPointer(),
|
||||
RegisterFrameOffset(reg_index));
|
||||
}
|
||||
|
||||
|
||||
Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) {
|
||||
return raw_assembler_->Store(kMachAnyTagged, RegisterFileRawPointer(),
|
||||
RegisterFrameOffset(reg_index), value,
|
||||
kNoWriteBarrier);
|
||||
return raw_assembler_->Store(
|
||||
MachineType::AnyTagged(), RegisterFileRawPointer(),
|
||||
RegisterFrameOffset(reg_index), value, kNoWriteBarrier);
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +137,7 @@ Node* InterpreterAssembler::BytecodeOperand(int operand_index) {
|
||||
DCHECK_EQ(interpreter::OperandSize::kByte,
|
||||
interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index));
|
||||
return raw_assembler_->Load(
|
||||
kMachUint8, BytecodeArrayTaggedPointer(),
|
||||
MachineType::Uint8(), BytecodeArrayTaggedPointer(),
|
||||
IntPtrAdd(BytecodeOffset(),
|
||||
Int32Constant(interpreter::Bytecodes::GetOperandOffset(
|
||||
bytecode_, operand_index))));
|
||||
@ -147,7 +149,7 @@ Node* InterpreterAssembler::BytecodeOperandSignExtended(int operand_index) {
|
||||
DCHECK_EQ(interpreter::OperandSize::kByte,
|
||||
interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index));
|
||||
Node* load = raw_assembler_->Load(
|
||||
kMachInt8, BytecodeArrayTaggedPointer(),
|
||||
MachineType::Int8(), BytecodeArrayTaggedPointer(),
|
||||
IntPtrAdd(BytecodeOffset(),
|
||||
Int32Constant(interpreter::Bytecodes::GetOperandOffset(
|
||||
bytecode_, operand_index))));
|
||||
@ -165,7 +167,7 @@ Node* InterpreterAssembler::BytecodeOperandShort(int operand_index) {
|
||||
interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index));
|
||||
if (TargetSupportsUnalignedAccess()) {
|
||||
return raw_assembler_->Load(
|
||||
kMachUint16, BytecodeArrayTaggedPointer(),
|
||||
MachineType::Uint16(), BytecodeArrayTaggedPointer(),
|
||||
IntPtrAdd(BytecodeOffset(),
|
||||
Int32Constant(interpreter::Bytecodes::GetOperandOffset(
|
||||
bytecode_, operand_index))));
|
||||
@ -173,10 +175,10 @@ Node* InterpreterAssembler::BytecodeOperandShort(int operand_index) {
|
||||
int offset =
|
||||
interpreter::Bytecodes::GetOperandOffset(bytecode_, operand_index);
|
||||
Node* first_byte = raw_assembler_->Load(
|
||||
kMachUint8, BytecodeArrayTaggedPointer(),
|
||||
MachineType::Uint8(), BytecodeArrayTaggedPointer(),
|
||||
IntPtrAdd(BytecodeOffset(), Int32Constant(offset)));
|
||||
Node* second_byte = raw_assembler_->Load(
|
||||
kMachUint8, BytecodeArrayTaggedPointer(),
|
||||
MachineType::Uint8(), BytecodeArrayTaggedPointer(),
|
||||
IntPtrAdd(BytecodeOffset(), Int32Constant(offset + 1)));
|
||||
#if V8_TARGET_LITTLE_ENDIAN
|
||||
return raw_assembler_->WordOr(WordShl(second_byte, kBitsPerByte),
|
||||
@ -308,7 +310,8 @@ Node* InterpreterAssembler::LoadConstantPoolEntry(Node* index) {
|
||||
Node* entry_offset =
|
||||
IntPtrAdd(IntPtrConstant(FixedArray::kHeaderSize - kHeapObjectTag),
|
||||
WordShl(index, kPointerSizeLog2));
|
||||
return raw_assembler_->Load(kMachAnyTagged, constant_pool, entry_offset);
|
||||
return raw_assembler_->Load(MachineType::AnyTagged(), constant_pool,
|
||||
entry_offset);
|
||||
}
|
||||
|
||||
|
||||
@ -317,18 +320,19 @@ Node* InterpreterAssembler::LoadFixedArrayElement(Node* fixed_array,
|
||||
Node* entry_offset =
|
||||
IntPtrAdd(IntPtrConstant(FixedArray::kHeaderSize - kHeapObjectTag),
|
||||
WordShl(Int32Constant(index), kPointerSizeLog2));
|
||||
return raw_assembler_->Load(kMachAnyTagged, fixed_array, entry_offset);
|
||||
return raw_assembler_->Load(MachineType::AnyTagged(), fixed_array,
|
||||
entry_offset);
|
||||
}
|
||||
|
||||
|
||||
Node* InterpreterAssembler::LoadObjectField(Node* object, int offset) {
|
||||
return raw_assembler_->Load(kMachAnyTagged, object,
|
||||
return raw_assembler_->Load(MachineType::AnyTagged(), object,
|
||||
IntPtrConstant(offset - kHeapObjectTag));
|
||||
}
|
||||
|
||||
|
||||
Node* InterpreterAssembler::LoadContextSlot(Node* context, int slot_index) {
|
||||
return raw_assembler_->Load(kMachAnyTagged, context,
|
||||
return raw_assembler_->Load(MachineType::AnyTagged(), context,
|
||||
IntPtrConstant(Context::SlotOffset(slot_index)));
|
||||
}
|
||||
|
||||
@ -337,7 +341,7 @@ Node* InterpreterAssembler::LoadContextSlot(Node* context, Node* slot_index) {
|
||||
Node* offset =
|
||||
IntPtrAdd(WordShl(slot_index, kPointerSizeLog2),
|
||||
Int32Constant(Context::kHeaderSize - kHeapObjectTag));
|
||||
return raw_assembler_->Load(kMachAnyTagged, context, offset);
|
||||
return raw_assembler_->Load(MachineType::AnyTagged(), context, offset);
|
||||
}
|
||||
|
||||
|
||||
@ -346,14 +350,14 @@ Node* InterpreterAssembler::StoreContextSlot(Node* context, Node* slot_index,
|
||||
Node* offset =
|
||||
IntPtrAdd(WordShl(slot_index, kPointerSizeLog2),
|
||||
Int32Constant(Context::kHeaderSize - kHeapObjectTag));
|
||||
return raw_assembler_->Store(kMachAnyTagged, context, offset, value,
|
||||
return raw_assembler_->Store(MachineType::AnyTagged(), context, offset, value,
|
||||
kFullWriteBarrier);
|
||||
}
|
||||
|
||||
|
||||
Node* InterpreterAssembler::LoadTypeFeedbackVector() {
|
||||
Node* function = raw_assembler_->Load(
|
||||
kMachAnyTagged, RegisterFileRawPointer(),
|
||||
MachineType::AnyTagged(), RegisterFileRawPointer(),
|
||||
IntPtrConstant(InterpreterFrameConstants::kFunctionFromRegisterPointer));
|
||||
Node* shared_info =
|
||||
LoadObjectField(function, JSFunction::kSharedFunctionInfoOffset);
|
||||
@ -477,8 +481,9 @@ Node* InterpreterAssembler::CallRuntime(Node* function_id, Node* first_arg,
|
||||
Node* function_offset = raw_assembler_->Int32Mul(
|
||||
function_id, Int32Constant(sizeof(Runtime::Function)));
|
||||
Node* function = IntPtrAdd(function_table, function_offset);
|
||||
Node* function_entry = raw_assembler_->Load(
|
||||
kMachPtr, function, Int32Constant(offsetof(Runtime::Function, entry)));
|
||||
Node* function_entry =
|
||||
raw_assembler_->Load(MachineType::Pointer(), function,
|
||||
Int32Constant(offsetof(Runtime::Function, entry)));
|
||||
|
||||
Node** args = zone()->NewArray<Node*>(4);
|
||||
args[0] = arg_count;
|
||||
@ -562,12 +567,12 @@ void InterpreterAssembler::Dispatch() {
|
||||
|
||||
void InterpreterAssembler::DispatchTo(Node* new_bytecode_offset) {
|
||||
Node* target_bytecode = raw_assembler_->Load(
|
||||
kMachUint8, BytecodeArrayTaggedPointer(), new_bytecode_offset);
|
||||
MachineType::Uint8(), BytecodeArrayTaggedPointer(), new_bytecode_offset);
|
||||
|
||||
// TODO(rmcilroy): Create a code target dispatch table to avoid conversion
|
||||
// from code object on every dispatch.
|
||||
Node* target_code_object = raw_assembler_->Load(
|
||||
kMachPtr, DispatchTableRawPointer(),
|
||||
MachineType::Pointer(), DispatchTableRawPointer(),
|
||||
raw_assembler_->Word32Shl(target_bytecode,
|
||||
Int32Constant(kPointerSizeLog2)));
|
||||
|
||||
|
@ -107,7 +107,7 @@ Reduction JSBuiltinReducer::ReduceMathMax(Node* node) {
|
||||
for (int i = 1; i < r.GetJSCallArity(); i++) {
|
||||
Node* const input = r.GetJSCallInput(i);
|
||||
value = graph()->NewNode(
|
||||
common()->Select(kMachNone),
|
||||
common()->Select(MachineRepresentation::kNone),
|
||||
graph()->NewNode(simplified()->NumberLessThan(), input, value), value,
|
||||
input);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token,
|
||||
CallDescriptor* desc_compare = Linkage::GetStubCallDescriptor(
|
||||
isolate(), zone(), callable.descriptor(), 0,
|
||||
CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node),
|
||||
Operator::kNoProperties, kMachIntPtr);
|
||||
Operator::kNoProperties, MachineType::IntPtr());
|
||||
Node* compare =
|
||||
graph()->NewNode(common()->Call(desc_compare),
|
||||
static_cast<int>(inputs.size()), &inputs.front());
|
||||
@ -204,7 +204,8 @@ void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token,
|
||||
node->ReplaceInput(0, booleanize);
|
||||
node->ReplaceInput(1, true_value);
|
||||
node->ReplaceInput(2, false_value);
|
||||
NodeProperties::ChangeOp(node, common()->Select(kMachAnyTagged));
|
||||
NodeProperties::ChangeOp(node,
|
||||
common()->Select(MachineRepresentation::kTagged));
|
||||
}
|
||||
|
||||
|
||||
@ -307,12 +308,12 @@ void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
|
||||
isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED);
|
||||
// Load global object from the context.
|
||||
Node* native_context =
|
||||
graph()->NewNode(machine()->Load(kMachAnyTagged), context,
|
||||
graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context,
|
||||
jsgraph()->IntPtrConstant(
|
||||
Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)),
|
||||
effect, graph()->start());
|
||||
Node* global = graph()->NewNode(
|
||||
machine()->Load(kMachAnyTagged), native_context,
|
||||
machine()->Load(MachineType::AnyTagged()), native_context,
|
||||
jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)),
|
||||
effect, graph()->start());
|
||||
node->InsertInput(zone(), 0, global);
|
||||
@ -357,12 +358,12 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
|
||||
isolate(), p.language_mode(), UNINITIALIZED);
|
||||
// Load global object from the context.
|
||||
Node* native_context =
|
||||
graph()->NewNode(machine()->Load(kMachAnyTagged), context,
|
||||
graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context,
|
||||
jsgraph()->IntPtrConstant(
|
||||
Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)),
|
||||
effect, graph()->start());
|
||||
Node* global = graph()->NewNode(
|
||||
machine()->Load(kMachAnyTagged), native_context,
|
||||
machine()->Load(MachineType::AnyTagged()), native_context,
|
||||
jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)),
|
||||
effect, graph()->start());
|
||||
node->InsertInput(zone(), 0, global);
|
||||
@ -398,7 +399,7 @@ void JSGenericLowering::LowerJSLoadContext(Node* node) {
|
||||
const ContextAccess& access = ContextAccessOf(node->op());
|
||||
for (size_t i = 0; i < access.depth(); ++i) {
|
||||
node->ReplaceInput(
|
||||
0, graph()->NewNode(machine()->Load(kMachAnyTagged),
|
||||
0, graph()->NewNode(machine()->Load(MachineType::AnyTagged()),
|
||||
NodeProperties::GetValueInput(node, 0),
|
||||
jsgraph()->Int32Constant(
|
||||
Context::SlotOffset(Context::PREVIOUS_INDEX)),
|
||||
@ -408,7 +409,7 @@ void JSGenericLowering::LowerJSLoadContext(Node* node) {
|
||||
node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset(
|
||||
static_cast<int>(access.index()))));
|
||||
node->AppendInput(zone(), graph()->start());
|
||||
NodeProperties::ChangeOp(node, machine()->Load(kMachAnyTagged));
|
||||
NodeProperties::ChangeOp(node, machine()->Load(MachineType::AnyTagged()));
|
||||
}
|
||||
|
||||
|
||||
@ -416,7 +417,7 @@ void JSGenericLowering::LowerJSStoreContext(Node* node) {
|
||||
const ContextAccess& access = ContextAccessOf(node->op());
|
||||
for (size_t i = 0; i < access.depth(); ++i) {
|
||||
node->ReplaceInput(
|
||||
0, graph()->NewNode(machine()->Load(kMachAnyTagged),
|
||||
0, graph()->NewNode(machine()->Load(MachineType::AnyTagged()),
|
||||
NodeProperties::GetValueInput(node, 0),
|
||||
jsgraph()->Int32Constant(
|
||||
Context::SlotOffset(Context::PREVIOUS_INDEX)),
|
||||
@ -426,8 +427,9 @@ void JSGenericLowering::LowerJSStoreContext(Node* node) {
|
||||
node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1));
|
||||
node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset(
|
||||
static_cast<int>(access.index()))));
|
||||
NodeProperties::ChangeOp(node, machine()->Store(StoreRepresentation(
|
||||
kMachAnyTagged, kFullWriteBarrier)));
|
||||
NodeProperties::ChangeOp(
|
||||
node, machine()->Store(StoreRepresentation(MachineType::AnyTagged(),
|
||||
kFullWriteBarrier)));
|
||||
}
|
||||
|
||||
|
||||
@ -626,11 +628,11 @@ void JSGenericLowering::LowerJSForInPrepare(Node* node) {
|
||||
control = graph()->NewNode(common()->IfSuccess(), cache_type);
|
||||
|
||||
Node* object_map = effect = graph()->NewNode(
|
||||
machine()->Load(kMachAnyTagged), object,
|
||||
machine()->Load(MachineType::AnyTagged()), object,
|
||||
jsgraph()->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag),
|
||||
effect, control);
|
||||
Node* cache_type_map = effect = graph()->NewNode(
|
||||
machine()->Load(kMachAnyTagged), cache_type,
|
||||
machine()->Load(MachineType::AnyTagged()), cache_type,
|
||||
jsgraph()->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag),
|
||||
effect, control);
|
||||
Node* meta_map = jsgraph()->HeapConstant(isolate()->factory()->meta_map());
|
||||
@ -651,7 +653,7 @@ void JSGenericLowering::LowerJSForInPrepare(Node* node) {
|
||||
{
|
||||
// Enum cache case.
|
||||
Node* cache_type_enum_length = etrue0 = graph()->NewNode(
|
||||
machine()->Load(kMachUint32), cache_type,
|
||||
machine()->Load(MachineType::Uint32()), cache_type,
|
||||
jsgraph()->IntPtrConstant(Map::kBitField3Offset - kHeapObjectTag),
|
||||
effect, if_true0);
|
||||
cache_type_enum_length =
|
||||
@ -680,16 +682,16 @@ void JSGenericLowering::LowerJSForInPrepare(Node* node) {
|
||||
{
|
||||
// Load the enumeration cache from the instance descriptors of {object}.
|
||||
Node* object_map_descriptors = efalse1 = graph()->NewNode(
|
||||
machine()->Load(kMachAnyTagged), object_map,
|
||||
machine()->Load(MachineType::AnyTagged()), object_map,
|
||||
jsgraph()->IntPtrConstant(Map::kDescriptorsOffset - kHeapObjectTag),
|
||||
etrue0, if_false1);
|
||||
Node* object_map_enum_cache = efalse1 = graph()->NewNode(
|
||||
machine()->Load(kMachAnyTagged), object_map_descriptors,
|
||||
machine()->Load(MachineType::AnyTagged()), object_map_descriptors,
|
||||
jsgraph()->IntPtrConstant(DescriptorArray::kEnumCacheOffset -
|
||||
kHeapObjectTag),
|
||||
efalse1, if_false1);
|
||||
cache_array_false1 = efalse1 = graph()->NewNode(
|
||||
machine()->Load(kMachAnyTagged), object_map_enum_cache,
|
||||
machine()->Load(MachineType::AnyTagged()), object_map_enum_cache,
|
||||
jsgraph()->IntPtrConstant(
|
||||
DescriptorArray::kEnumCacheBridgeCacheOffset - kHeapObjectTag),
|
||||
efalse1, if_false1);
|
||||
@ -699,8 +701,8 @@ void JSGenericLowering::LowerJSForInPrepare(Node* node) {
|
||||
etrue0 =
|
||||
graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_true0);
|
||||
cache_array_true0 =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_array_true1,
|
||||
cache_array_false1, if_true0);
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
cache_array_true1, cache_array_false1, if_true0);
|
||||
|
||||
cache_length_true0 = graph()->NewNode(
|
||||
machine()->WordShl(),
|
||||
@ -720,7 +722,7 @@ void JSGenericLowering::LowerJSForInPrepare(Node* node) {
|
||||
{
|
||||
// FixedArray case.
|
||||
Node* object_instance_type = efalse0 = graph()->NewNode(
|
||||
machine()->Load(kMachUint8), object_map,
|
||||
machine()->Load(MachineType::Uint8()), object_map,
|
||||
jsgraph()->IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag),
|
||||
effect, if_false0);
|
||||
|
||||
@ -738,12 +740,12 @@ void JSGenericLowering::LowerJSForInPrepare(Node* node) {
|
||||
|
||||
if_false0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1);
|
||||
cache_type_false0 =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_type_true1,
|
||||
cache_type_false1, if_false0);
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
cache_type_true1, cache_type_false1, if_false0);
|
||||
|
||||
cache_array_false0 = cache_type;
|
||||
cache_length_false0 = efalse0 = graph()->NewNode(
|
||||
machine()->Load(kMachAnyTagged), cache_array_false0,
|
||||
machine()->Load(MachineType::AnyTagged()), cache_array_false0,
|
||||
jsgraph()->IntPtrConstant(FixedArray::kLengthOffset - kHeapObjectTag),
|
||||
efalse0, if_false0);
|
||||
}
|
||||
@ -751,13 +753,14 @@ void JSGenericLowering::LowerJSForInPrepare(Node* node) {
|
||||
control = graph()->NewNode(common()->Merge(2), if_true0, if_false0);
|
||||
effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control);
|
||||
Node* cache_array =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_array_true0,
|
||||
cache_array_false0, control);
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
cache_array_true0, cache_array_false0, control);
|
||||
Node* cache_length =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_length_true0,
|
||||
cache_length_false0, control);
|
||||
cache_type = graph()->NewNode(common()->Phi(kMachAnyTagged, 2),
|
||||
cache_type_true0, cache_type_false0, control);
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
cache_length_true0, cache_length_false0, control);
|
||||
cache_type =
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
cache_type_true0, cache_type_false0, control);
|
||||
|
||||
for (auto edge : node->use_edges()) {
|
||||
if (NodeProperties::IsEffectEdge(edge)) {
|
||||
@ -807,7 +810,7 @@ void JSGenericLowering::LowerJSLoadMessage(Node* node) {
|
||||
node->RemoveInput(NodeProperties::FirstContextIndex(node));
|
||||
node->InsertInput(zone(), 0, jsgraph()->ExternalConstant(message_address));
|
||||
node->InsertInput(zone(), 1, jsgraph()->IntPtrConstant(0));
|
||||
NodeProperties::ChangeOp(node, machine()->Load(kMachAnyTagged));
|
||||
NodeProperties::ChangeOp(node, machine()->Load(MachineType::AnyTagged()));
|
||||
}
|
||||
|
||||
|
||||
@ -817,7 +820,7 @@ void JSGenericLowering::LowerJSStoreMessage(Node* node) {
|
||||
node->RemoveInput(NodeProperties::FirstContextIndex(node));
|
||||
node->InsertInput(zone(), 0, jsgraph()->ExternalConstant(message_address));
|
||||
node->InsertInput(zone(), 1, jsgraph()->IntPtrConstant(0));
|
||||
StoreRepresentation representation(kMachAnyTagged, kNoWriteBarrier);
|
||||
StoreRepresentation representation(MachineType::AnyTagged(), kNoWriteBarrier);
|
||||
NodeProperties::ChangeOp(node, machine()->Store(representation));
|
||||
}
|
||||
|
||||
@ -830,7 +833,7 @@ void JSGenericLowering::LowerJSStackCheck(Node* node) {
|
||||
Node* control = NodeProperties::GetControlInput(node);
|
||||
|
||||
Node* limit = graph()->NewNode(
|
||||
machine()->Load(kMachPtr),
|
||||
machine()->Load(MachineType::Pointer()),
|
||||
jsgraph()->ExternalConstant(
|
||||
ExternalReference::address_of_stack_limit(isolate())),
|
||||
jsgraph()->IntPtrConstant(0), effect, control);
|
||||
|
@ -223,7 +223,7 @@ Reduction JSInliner::InlineCall(Node* call, Node* new_target, Node* context,
|
||||
values.push_back(control_output);
|
||||
effects.push_back(control_output);
|
||||
Node* value_output = jsgraph_->graph()->NewNode(
|
||||
jsgraph_->common()->Phi(kMachAnyTagged, input_count),
|
||||
jsgraph_->common()->Phi(MachineRepresentation::kTagged, input_count),
|
||||
static_cast<int>(values.size()), &values.front());
|
||||
Node* effect_output = jsgraph_->graph()->NewNode(
|
||||
jsgraph_->common()->EffectPhi(input_count),
|
||||
@ -455,7 +455,8 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
|
||||
jsgraph_->javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1),
|
||||
node, context, node, start);
|
||||
Node* select = jsgraph_->graph()->NewNode(
|
||||
jsgraph_->common()->Select(kMachAnyTagged), check, node, create);
|
||||
jsgraph_->common()->Select(MachineRepresentation::kTagged), check, node,
|
||||
create);
|
||||
NodeProperties::ReplaceUses(node, select, check, node, node);
|
||||
NodeProperties::ReplaceValueInput(select, node, 1);
|
||||
NodeProperties::ReplaceValueInput(check, node, 0);
|
||||
|
@ -210,8 +210,6 @@ Reduction JSIntrinsicLowering::ReduceIsInstanceType(
|
||||
// } else {
|
||||
// return %_GetInstanceType(%_GetMap(value)) == instance_type;
|
||||
// }
|
||||
MachineType const type = static_cast<MachineType>(kTypeBool | kRepTagged);
|
||||
|
||||
Node* value = NodeProperties::GetValueInput(node, 0);
|
||||
Node* effect = NodeProperties::GetEffectInput(node);
|
||||
Node* control = NodeProperties::GetControlInput(node);
|
||||
@ -239,7 +237,8 @@ Reduction JSIntrinsicLowering::ReduceIsInstanceType(
|
||||
ReplaceWithValue(node, node, ephi);
|
||||
|
||||
// Turn the {node} into a Phi.
|
||||
return Change(node, common()->Phi(type, 2), vtrue, vfalse, merge);
|
||||
return Change(node, common()->Phi(MachineRepresentation::kTagged, 2), vtrue,
|
||||
vfalse, merge);
|
||||
}
|
||||
|
||||
|
||||
@ -279,8 +278,8 @@ Reduction JSIntrinsicLowering::ReduceIsJSReceiver(Node* node) {
|
||||
|
||||
control = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control);
|
||||
value = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), vtrue, vfalse,
|
||||
control);
|
||||
value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
vtrue, vfalse, control);
|
||||
}
|
||||
ReplaceWithValue(node, node, effect, control);
|
||||
return Replace(value);
|
||||
@ -346,7 +345,8 @@ Reduction JSIntrinsicLowering::ReduceValueOf(Node* node) {
|
||||
// }
|
||||
const Operator* const merge_op = common()->Merge(2);
|
||||
const Operator* const ephi_op = common()->EffectPhi(2);
|
||||
const Operator* const phi_op = common()->Phi(kMachAnyTagged, 2);
|
||||
const Operator* const phi_op =
|
||||
common()->Phi(MachineRepresentation::kTagged, 2);
|
||||
|
||||
Node* value = NodeProperties::GetValueInput(node, 0);
|
||||
Node* effect = NodeProperties::GetEffectInput(node);
|
||||
@ -511,7 +511,7 @@ Reduction JSIntrinsicLowering::ReduceToLength(Node* node) {
|
||||
} else {
|
||||
if (value_type->Min() <= 0.0) {
|
||||
value = graph()->NewNode(
|
||||
common()->Select(kMachAnyTagged),
|
||||
common()->Select(MachineRepresentation::kTagged),
|
||||
graph()->NewNode(simplified()->NumberLessThanOrEqual(), value,
|
||||
jsgraph()->ZeroConstant()),
|
||||
jsgraph()->ZeroConstant(), value);
|
||||
@ -520,7 +520,7 @@ Reduction JSIntrinsicLowering::ReduceToLength(Node* node) {
|
||||
}
|
||||
if (value_type->Max() > kMaxSafeInteger) {
|
||||
value = graph()->NewNode(
|
||||
common()->Select(kMachAnyTagged),
|
||||
common()->Select(MachineRepresentation::kTagged),
|
||||
graph()->NewNode(simplified()->NumberLessThanOrEqual(),
|
||||
jsgraph()->Constant(kMaxSafeInteger), value),
|
||||
jsgraph()->Constant(kMaxSafeInteger), value);
|
||||
|
@ -254,7 +254,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
|
||||
this_storage, this_effect, this_control);
|
||||
}
|
||||
FieldAccess field_access = {kTaggedBase, field_index.offset(), name,
|
||||
field_type, kMachAnyTagged};
|
||||
field_type, MachineType::AnyTagged()};
|
||||
if (access_mode == AccessMode::kLoad) {
|
||||
if (field_type->Is(Type::UntaggedFloat64())) {
|
||||
if (!field_index.is_inobject() || field_index.is_hidden_field() ||
|
||||
@ -265,7 +265,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
|
||||
field_access.offset = HeapNumber::kValueOffset;
|
||||
field_access.name = MaybeHandle<Name>();
|
||||
}
|
||||
field_access.machine_type = kMachFloat64;
|
||||
field_access.machine_type = MachineType::Float64();
|
||||
}
|
||||
this_value = this_effect =
|
||||
graph()->NewNode(simplified()->LoadField(field_access),
|
||||
@ -309,11 +309,11 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
|
||||
this_storage, this_effect, this_control);
|
||||
field_access.offset = HeapNumber::kValueOffset;
|
||||
field_access.name = MaybeHandle<Name>();
|
||||
field_access.machine_type = kMachFloat64;
|
||||
field_access.machine_type = MachineType::Float64();
|
||||
}
|
||||
} else {
|
||||
// Unboxed double field, we store directly to the field.
|
||||
field_access.machine_type = kMachFloat64;
|
||||
field_access.machine_type = MachineType::Float64();
|
||||
}
|
||||
} else if (field_type->Is(Type::TaggedSigned())) {
|
||||
Node* check =
|
||||
@ -429,8 +429,9 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
|
||||
control = graph()->NewNode(common()->Merge(control_count), control_count,
|
||||
&controls.front());
|
||||
values.push_back(control);
|
||||
value = graph()->NewNode(common()->Phi(kMachAnyTagged, control_count),
|
||||
control_count + 1, &values.front());
|
||||
value = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, control_count),
|
||||
control_count + 1, &values.front());
|
||||
effects.push_back(control);
|
||||
effect = graph()->NewNode(common()->EffectPhi(control_count),
|
||||
control_count + 1, &effects.front());
|
||||
@ -700,10 +701,10 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
|
||||
|
||||
// Compute the element access.
|
||||
Type* element_type = Type::Any();
|
||||
MachineType element_machine_type = kMachAnyTagged;
|
||||
MachineType element_machine_type = MachineType::AnyTagged();
|
||||
if (IsFastDoubleElementsKind(elements_kind)) {
|
||||
element_type = type_cache_.kFloat64;
|
||||
element_machine_type = kMachFloat64;
|
||||
element_machine_type = MachineType::Float64();
|
||||
} else if (IsFastSmiElementsKind(elements_kind)) {
|
||||
element_type = type_cache_.kSmi;
|
||||
}
|
||||
@ -752,9 +753,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
|
||||
// Turn the hole into undefined.
|
||||
this_control =
|
||||
graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
this_value = graph()->NewNode(common()->Phi(kMachAnyTagged, 2),
|
||||
jsgraph()->UndefinedConstant(),
|
||||
this_value, this_control);
|
||||
this_value = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
jsgraph()->UndefinedConstant(), this_value, this_control);
|
||||
element_type =
|
||||
Type::Union(element_type, Type::Undefined(), graph()->zone());
|
||||
} else {
|
||||
@ -782,8 +783,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
|
||||
dependencies()->AssumePropertyCell(factory()->array_protector());
|
||||
// Turn the hole into undefined.
|
||||
this_value = graph()->NewNode(
|
||||
common()->Select(kMachAnyTagged, BranchHint::kFalse), check,
|
||||
jsgraph()->UndefinedConstant(), this_value);
|
||||
common()->Select(MachineRepresentation::kTagged,
|
||||
BranchHint::kFalse),
|
||||
check, jsgraph()->UndefinedConstant(), this_value);
|
||||
} else {
|
||||
// Deoptimize in case of the hole.
|
||||
Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse),
|
||||
@ -857,8 +859,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
|
||||
control = graph()->NewNode(common()->Merge(control_count), control_count,
|
||||
&controls.front());
|
||||
values.push_back(control);
|
||||
value = graph()->NewNode(common()->Phi(kMachAnyTagged, control_count),
|
||||
control_count + 1, &values.front());
|
||||
value = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, control_count),
|
||||
control_count + 1, &values.front());
|
||||
effects.push_back(control);
|
||||
effect = graph()->NewNode(common()->EffectPhi(control_count),
|
||||
control_count + 1, &effects.front());
|
||||
|
@ -384,8 +384,8 @@ class JSBinopReduction final {
|
||||
// Wire conversions to existing {IfException} continuation.
|
||||
Node* exception_merge = if_exception;
|
||||
Node* exception_value =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), left_exception,
|
||||
right_exception, exception_merge);
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
left_exception, right_exception, exception_merge);
|
||||
Node* exception_effect =
|
||||
graph()->NewNode(common()->EffectPhi(2), left_exception,
|
||||
right_exception, exception_merge);
|
||||
@ -829,10 +829,10 @@ Reduction JSTypedLowering::ReduceJSToStringInput(Node* input) {
|
||||
return Changed(input); // JSToString(x:string) => x
|
||||
}
|
||||
if (input_type->Is(Type::Boolean())) {
|
||||
return Replace(
|
||||
graph()->NewNode(common()->Select(kMachAnyTagged), input,
|
||||
jsgraph()->HeapConstant(factory()->true_string()),
|
||||
jsgraph()->HeapConstant(factory()->false_string())));
|
||||
return Replace(graph()->NewNode(
|
||||
common()->Select(MachineRepresentation::kTagged), input,
|
||||
jsgraph()->HeapConstant(factory()->true_string()),
|
||||
jsgraph()->HeapConstant(factory()->false_string())));
|
||||
}
|
||||
if (input_type->Is(Type::Undefined())) {
|
||||
return Replace(jsgraph()->HeapConstant(factory()->undefined_string()));
|
||||
@ -928,8 +928,9 @@ Reduction JSTypedLowering::ReduceJSToObject(Node* node) {
|
||||
|
||||
control = graph()->NewNode(common()->Merge(2), if_convert, if_done);
|
||||
effect = graph()->NewNode(common()->EffectPhi(2), econvert, edone, control);
|
||||
receiver = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), rconvert,
|
||||
rdone, control);
|
||||
receiver =
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
rconvert, rdone, control);
|
||||
}
|
||||
ReplaceWithValue(node, receiver, effect, control);
|
||||
return Changed(receiver);
|
||||
@ -988,7 +989,8 @@ Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) {
|
||||
if (!array->GetBuffer()->was_neutered()) {
|
||||
array->GetBuffer()->set_is_neuterable(false);
|
||||
BufferAccess const access(array->type());
|
||||
size_t const k = ElementSizeLog2Of(access.machine_type());
|
||||
size_t const k =
|
||||
ElementSizeLog2Of(access.machine_type().representation());
|
||||
double const byte_length = array->byte_length()->Number();
|
||||
CHECK_LT(k, arraysize(shifted_int32_ranges_));
|
||||
if (key_type->Is(shifted_int32_ranges_[k]) && byte_length <= kMaxInt) {
|
||||
@ -1034,7 +1036,8 @@ Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) {
|
||||
if (!array->GetBuffer()->was_neutered()) {
|
||||
array->GetBuffer()->set_is_neuterable(false);
|
||||
BufferAccess const access(array->type());
|
||||
size_t const k = ElementSizeLog2Of(access.machine_type());
|
||||
size_t const k =
|
||||
ElementSizeLog2Of(access.machine_type().representation());
|
||||
double const byte_length = array->byte_length()->Number();
|
||||
CHECK_LT(k, arraysize(shifted_int32_ranges_));
|
||||
if (access.external_array_type() != kExternalUint8ClampedArray &&
|
||||
@ -1061,10 +1064,11 @@ Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) {
|
||||
}
|
||||
}
|
||||
// For integer-typed arrays, convert to the integer type.
|
||||
if (TypeOf(access.machine_type()) == kTypeInt32 &&
|
||||
if (access.machine_type().semantic() == MachineSemantic::kInt32 &&
|
||||
!value_type->Is(Type::Signed32())) {
|
||||
value = graph()->NewNode(simplified()->NumberToInt32(), value);
|
||||
} else if (TypeOf(access.machine_type()) == kTypeUint32 &&
|
||||
} else if (access.machine_type().semantic() ==
|
||||
MachineSemantic::kUint32 &&
|
||||
!value_type->Is(Type::Unsigned32())) {
|
||||
value = graph()->NewNode(simplified()->NumberToUint32(), value);
|
||||
}
|
||||
@ -1150,8 +1154,9 @@ Reduction JSTypedLowering::ReduceJSInstanceOf(Node* node) {
|
||||
Node* loop_effect = effect =
|
||||
graph()->NewNode(common()->EffectPhi(2), effect, effect, loop);
|
||||
|
||||
Node* loop_object_map = graph()->NewNode(common()->Phi(kMachAnyTagged, 2),
|
||||
object_map, r.left(), loop);
|
||||
Node* loop_object_map =
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
object_map, r.left(), loop);
|
||||
|
||||
|
||||
Node* object_prototype = effect = graph()->NewNode(
|
||||
@ -1194,17 +1199,18 @@ Reduction JSTypedLowering::ReduceJSInstanceOf(Node* node) {
|
||||
e_null_proto, control);
|
||||
|
||||
|
||||
Node* result = graph()->NewNode(common()->Phi(kTypeBool, 2),
|
||||
jsgraph()->TrueConstant(),
|
||||
jsgraph()->FalseConstant(), control);
|
||||
Node* result = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
jsgraph()->TrueConstant(), jsgraph()->FalseConstant(), control);
|
||||
|
||||
if (if_is_smi != nullptr) {
|
||||
DCHECK(e_is_smi != nullptr);
|
||||
control = graph()->NewNode(common()->Merge(2), if_is_smi, control);
|
||||
effect =
|
||||
graph()->NewNode(common()->EffectPhi(2), e_is_smi, effect, control);
|
||||
result = graph()->NewNode(common()->Phi(kTypeBool, 2),
|
||||
jsgraph()->FalseConstant(), result, control);
|
||||
result =
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
jsgraph()->FalseConstant(), result, control);
|
||||
}
|
||||
ReplaceWithValue(node, result, effect, control);
|
||||
return Changed(result);
|
||||
@ -1343,8 +1349,9 @@ Reduction JSTypedLowering::ReduceJSConvertReceiver(Node* node) {
|
||||
control = graph()->NewNode(common()->Merge(2), if_convert, if_global);
|
||||
effect =
|
||||
graph()->NewNode(common()->EffectPhi(2), econvert, eglobal, control);
|
||||
receiver = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), rconvert,
|
||||
rglobal, control);
|
||||
receiver =
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
rconvert, rglobal, control);
|
||||
}
|
||||
}
|
||||
ReplaceWithValue(node, receiver, effect, control);
|
||||
@ -2212,8 +2219,8 @@ Reduction JSTypedLowering::ReduceJSForInPrepare(Node* node) {
|
||||
etrue0 =
|
||||
graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_true0);
|
||||
cache_array_true0 =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_array_true1,
|
||||
cache_array_false1, if_true0);
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
cache_array_true1, cache_array_false1, if_true0);
|
||||
|
||||
cache_type_true0 = cache_type;
|
||||
}
|
||||
@ -2230,7 +2237,7 @@ Reduction JSTypedLowering::ReduceJSForInPrepare(Node* node) {
|
||||
receiver_map, effect, if_false0);
|
||||
|
||||
cache_type_false0 = graph()->NewNode(
|
||||
common()->Select(kMachAnyTagged, BranchHint::kFalse),
|
||||
common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse),
|
||||
graph()->NewNode(machine()->Word32Equal(), receiver_instance_type,
|
||||
jsgraph()->Uint32Constant(JS_PROXY_TYPE)),
|
||||
jsgraph()->ZeroConstant(), // Zero indicagtes proxy.
|
||||
@ -2245,13 +2252,14 @@ Reduction JSTypedLowering::ReduceJSForInPrepare(Node* node) {
|
||||
control = graph()->NewNode(common()->Merge(2), if_true0, if_false0);
|
||||
effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control);
|
||||
Node* cache_array =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_array_true0,
|
||||
cache_array_false0, control);
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
cache_array_true0, cache_array_false0, control);
|
||||
Node* cache_length =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_length_true0,
|
||||
cache_length_false0, control);
|
||||
cache_type = graph()->NewNode(common()->Phi(kMachAnyTagged, 2),
|
||||
cache_type_true0, cache_type_false0, control);
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
cache_length_true0, cache_length_false0, control);
|
||||
cache_type =
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
cache_type_true0, cache_type_false0, control);
|
||||
|
||||
for (auto edge : node->use_edges()) {
|
||||
Node* const use = edge.from();
|
||||
@ -2364,8 +2372,8 @@ Reduction JSTypedLowering::ReduceJSForInNext(Node* node) {
|
||||
if_false0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1);
|
||||
efalse0 =
|
||||
graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_false0);
|
||||
vfalse0 = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), vtrue1,
|
||||
vfalse1, if_false0);
|
||||
vfalse0 = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
vtrue1, vfalse1, if_false0);
|
||||
}
|
||||
|
||||
control = graph()->NewNode(common()->Merge(2), if_true0, if_false0);
|
||||
@ -2375,7 +2383,8 @@ Reduction JSTypedLowering::ReduceJSForInNext(Node* node) {
|
||||
node->ReplaceInput(1, vfalse0);
|
||||
node->ReplaceInput(2, control);
|
||||
node->TrimInputCount(3);
|
||||
NodeProperties::ChangeOp(node, common()->Phi(kMachAnyTagged, 2));
|
||||
NodeProperties::ChangeOp(node,
|
||||
common()->Phi(MachineRepresentation::kTagged, 2));
|
||||
return Changed(node);
|
||||
}
|
||||
|
||||
|
@ -25,29 +25,29 @@ LinkageLocation regloc(Register reg) {
|
||||
MachineType reptyp(Representation representation) {
|
||||
switch (representation.kind()) {
|
||||
case Representation::kInteger8:
|
||||
return kMachInt8;
|
||||
return MachineType::Int8();
|
||||
case Representation::kUInteger8:
|
||||
return kMachUint8;
|
||||
return MachineType::Uint8();
|
||||
case Representation::kInteger16:
|
||||
return kMachInt16;
|
||||
return MachineType::Int16();
|
||||
case Representation::kUInteger16:
|
||||
return kMachUint16;
|
||||
return MachineType::Uint16();
|
||||
case Representation::kInteger32:
|
||||
return kMachInt32;
|
||||
return MachineType::Int32();
|
||||
case Representation::kSmi:
|
||||
case Representation::kTagged:
|
||||
case Representation::kHeapObject:
|
||||
return kMachAnyTagged;
|
||||
return MachineType::AnyTagged();
|
||||
case Representation::kDouble:
|
||||
return kMachFloat64;
|
||||
return MachineType::Float64();
|
||||
case Representation::kExternal:
|
||||
return kMachPtr;
|
||||
return MachineType::Pointer();
|
||||
case Representation::kNone:
|
||||
case Representation::kNumRepresentations:
|
||||
break;
|
||||
}
|
||||
UNREACHABLE();
|
||||
return kMachNone;
|
||||
return MachineType::None();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -242,26 +242,26 @@ CallDescriptor* Linkage::GetRuntimeCallDescriptor(
|
||||
locations.AddReturn(regloc(kReturnRegister1));
|
||||
}
|
||||
for (size_t i = 0; i < return_count; i++) {
|
||||
types.AddReturn(kMachAnyTagged);
|
||||
types.AddReturn(MachineType::AnyTagged());
|
||||
}
|
||||
|
||||
// All parameters to the runtime call go on the stack.
|
||||
for (int i = 0; i < js_parameter_count; i++) {
|
||||
locations.AddParam(
|
||||
LinkageLocation::ForCallerFrameSlot(i - js_parameter_count));
|
||||
types.AddParam(kMachAnyTagged);
|
||||
types.AddParam(MachineType::AnyTagged());
|
||||
}
|
||||
// Add runtime function itself.
|
||||
locations.AddParam(regloc(kRuntimeCallFunctionRegister));
|
||||
types.AddParam(kMachAnyTagged);
|
||||
types.AddParam(MachineType::AnyTagged());
|
||||
|
||||
// Add runtime call argument count.
|
||||
locations.AddParam(regloc(kRuntimeCallArgCountRegister));
|
||||
types.AddParam(kMachPtr);
|
||||
types.AddParam(MachineType::Pointer());
|
||||
|
||||
// Add context.
|
||||
locations.AddParam(regloc(kContextRegister));
|
||||
types.AddParam(kMachAnyTagged);
|
||||
types.AddParam(MachineType::AnyTagged());
|
||||
|
||||
if (Linkage::FrameStateInputCount(function_id) == 0) {
|
||||
flags = static_cast<CallDescriptor::Flags>(
|
||||
@ -269,7 +269,7 @@ CallDescriptor* Linkage::GetRuntimeCallDescriptor(
|
||||
}
|
||||
|
||||
// The target for runtime calls is a code object.
|
||||
MachineType target_type = kMachAnyTagged;
|
||||
MachineType target_type = MachineType::AnyTagged();
|
||||
LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
|
||||
return new (zone) CallDescriptor( // --
|
||||
CallDescriptor::kCallCodeObject, // kind
|
||||
@ -294,7 +294,7 @@ CallDescriptor* Linkage::GetLazyBailoutDescriptor(Zone* zone) {
|
||||
MachineSignature::Builder types(zone, return_count, parameter_count);
|
||||
|
||||
// The target is ignored, but we need to give some values here.
|
||||
MachineType target_type = kMachAnyTagged;
|
||||
MachineType target_type = MachineType::AnyTagged();
|
||||
LinkageLocation target_loc = regloc(kJSFunctionRegister);
|
||||
return new (zone) CallDescriptor( // --
|
||||
CallDescriptor::kLazyBailout, // kind
|
||||
@ -326,29 +326,29 @@ CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
|
||||
|
||||
// All JS calls have exactly one return value.
|
||||
locations.AddReturn(regloc(kReturnRegister0));
|
||||
types.AddReturn(kMachAnyTagged);
|
||||
types.AddReturn(MachineType::AnyTagged());
|
||||
|
||||
// All parameters to JS calls go on the stack.
|
||||
for (int i = 0; i < js_parameter_count; i++) {
|
||||
int spill_slot_index = i - js_parameter_count;
|
||||
locations.AddParam(LinkageLocation::ForCallerFrameSlot(spill_slot_index));
|
||||
types.AddParam(kMachAnyTagged);
|
||||
types.AddParam(MachineType::AnyTagged());
|
||||
}
|
||||
|
||||
// Add JavaScript call new target value.
|
||||
locations.AddParam(regloc(kJavaScriptCallNewTargetRegister));
|
||||
types.AddParam(kMachAnyTagged);
|
||||
types.AddParam(MachineType::AnyTagged());
|
||||
|
||||
// Add JavaScript call argument count.
|
||||
locations.AddParam(regloc(kJavaScriptCallArgCountRegister));
|
||||
types.AddParam(kMachInt32);
|
||||
types.AddParam(MachineType::Int32());
|
||||
|
||||
// Add context.
|
||||
locations.AddParam(regloc(kContextRegister));
|
||||
types.AddParam(kMachAnyTagged);
|
||||
types.AddParam(MachineType::AnyTagged());
|
||||
|
||||
// The target for JS function calls is the JSFunction object.
|
||||
MachineType target_type = kMachAnyTagged;
|
||||
MachineType target_type = MachineType::AnyTagged();
|
||||
// TODO(titzer): When entering into an OSR function from unoptimized code,
|
||||
// the JSFunction is not in a register, but it is on the stack in an
|
||||
// unaddressable spill slot. We hack this in the OSR prologue. Fix.
|
||||
@ -375,23 +375,23 @@ CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) {
|
||||
|
||||
// Add registers for fixed parameters passed via interpreter dispatch.
|
||||
STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter);
|
||||
types.AddParam(kMachAnyTagged);
|
||||
types.AddParam(MachineType::AnyTagged());
|
||||
locations.AddParam(regloc(kInterpreterAccumulatorRegister));
|
||||
|
||||
STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter);
|
||||
types.AddParam(kMachPtr);
|
||||
types.AddParam(MachineType::Pointer());
|
||||
locations.AddParam(regloc(kInterpreterRegisterFileRegister));
|
||||
|
||||
STATIC_ASSERT(2 == Linkage::kInterpreterBytecodeOffsetParameter);
|
||||
types.AddParam(kMachIntPtr);
|
||||
types.AddParam(MachineType::IntPtr());
|
||||
locations.AddParam(regloc(kInterpreterBytecodeOffsetRegister));
|
||||
|
||||
STATIC_ASSERT(3 == Linkage::kInterpreterBytecodeArrayParameter);
|
||||
types.AddParam(kMachAnyTagged);
|
||||
types.AddParam(MachineType::AnyTagged());
|
||||
locations.AddParam(regloc(kInterpreterBytecodeArrayRegister));
|
||||
|
||||
STATIC_ASSERT(4 == Linkage::kInterpreterDispatchTableParameter);
|
||||
types.AddParam(kMachPtr);
|
||||
types.AddParam(MachineType::Pointer());
|
||||
#if defined(V8_TARGET_ARCH_IA32) || defined(V8_TARGET_ARCH_X87)
|
||||
// TODO(rmcilroy): Make the context param the one spilled to the stack once
|
||||
// Turbofan supports modified stack arguments in tail calls.
|
||||
@ -402,13 +402,13 @@ CallDescriptor* Linkage::GetInterpreterDispatchDescriptor(Zone* zone) {
|
||||
#endif
|
||||
|
||||
STATIC_ASSERT(5 == Linkage::kInterpreterContextParameter);
|
||||
types.AddParam(kMachAnyTagged);
|
||||
types.AddParam(MachineType::AnyTagged());
|
||||
locations.AddParam(regloc(kContextRegister));
|
||||
|
||||
LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
|
||||
return new (zone) CallDescriptor( // --
|
||||
CallDescriptor::kCallCodeObject, // kind
|
||||
kMachNone, // target MachineType
|
||||
MachineType::None(), // target MachineType
|
||||
target_loc, // target location
|
||||
types.Build(), // machine_sig
|
||||
locations.Build(), // location_sig
|
||||
@ -457,15 +457,15 @@ CallDescriptor* Linkage::GetStubCallDescriptor(
|
||||
// The rest of the parameters go on the stack.
|
||||
int stack_slot = i - register_parameter_count - stack_parameter_count;
|
||||
locations.AddParam(LinkageLocation::ForCallerFrameSlot(stack_slot));
|
||||
types.AddParam(kMachAnyTagged);
|
||||
types.AddParam(MachineType::AnyTagged());
|
||||
}
|
||||
}
|
||||
// Add context.
|
||||
locations.AddParam(regloc(kContextRegister));
|
||||
types.AddParam(kMachAnyTagged);
|
||||
types.AddParam(MachineType::AnyTagged());
|
||||
|
||||
// The target for stub calls is a code object.
|
||||
MachineType target_type = kMachAnyTagged;
|
||||
MachineType target_type = MachineType::AnyTagged();
|
||||
LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
|
||||
return new (zone) CallDescriptor( // --
|
||||
CallDescriptor::kCallCodeObject, // kind
|
||||
|
@ -319,7 +319,7 @@ class Linkage : public ZoneObject {
|
||||
Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
|
||||
int stack_parameter_count, CallDescriptor::Flags flags,
|
||||
Operator::Properties properties = Operator::kNoProperties,
|
||||
MachineType return_type = kMachAnyTagged);
|
||||
MachineType return_type = MachineType::AnyTagged());
|
||||
|
||||
// Creates a call descriptor for simplified C calls that is appropriate
|
||||
// for the host platform. This simplified calling convention only supports
|
||||
|
@ -45,7 +45,8 @@ void CreateSplinter(TopLevelLiveRange *range, RegisterAllocationData *data,
|
||||
data->CreateSpillRangeForLiveRange(range);
|
||||
}
|
||||
if (range->splinter() == nullptr) {
|
||||
TopLevelLiveRange *splinter = data->NextLiveRange(range->machine_type());
|
||||
TopLevelLiveRange *splinter =
|
||||
data->NextLiveRange(range->representation());
|
||||
DCHECK_NULL(data->live_ranges()[splinter->vreg()]);
|
||||
data->live_ranges()[splinter->vreg()] = splinter;
|
||||
range->SetSplinter(splinter);
|
||||
|
@ -311,8 +311,9 @@ PeeledIteration* LoopPeeler::Peel(Graph* graph, CommonOperatorBuilder* common,
|
||||
// Update all the value and effect edges at once.
|
||||
if (!value_edges.empty()) {
|
||||
// TODO(titzer): machine type is wrong here.
|
||||
Node* phi = graph->NewNode(common->Phi(kMachAnyTagged, 2), node,
|
||||
peeling.map(node), merge);
|
||||
Node* phi =
|
||||
graph->NewNode(common->Phi(MachineRepresentation::kTagged, 2), node,
|
||||
peeling.map(node), merge);
|
||||
for (Edge edge : value_edges) edge.UpdateTo(phi);
|
||||
value_edges.clear();
|
||||
}
|
||||
|
@ -600,7 +600,8 @@ Reduction MachineOperatorReducer::ReduceInt32Mod(Node* node) {
|
||||
1, Int32Sub(zero, Word32And(Int32Sub(zero, dividend), mask)));
|
||||
node->ReplaceInput(2, Word32And(dividend, mask));
|
||||
NodeProperties::ChangeOp(
|
||||
node, common()->Select(kMachInt32, BranchHint::kFalse));
|
||||
node,
|
||||
common()->Select(MachineRepresentation::kWord32, BranchHint::kFalse));
|
||||
} else {
|
||||
Node* quotient = Int32Div(dividend, divisor);
|
||||
DCHECK_EQ(dividend, node->InputAt(0));
|
||||
@ -650,7 +651,7 @@ Reduction MachineOperatorReducer::ReduceTruncateFloat64ToInt32(Node* node) {
|
||||
if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0));
|
||||
if (m.IsPhi()) {
|
||||
Node* const phi = m.node();
|
||||
DCHECK_EQ(kRepFloat64, RepresentationOf(OpParameter<MachineType>(phi)));
|
||||
DCHECK_EQ(MachineRepresentation::kFloat64, PhiRepresentationOf(phi->op()));
|
||||
if (phi->OwnedBy(node)) {
|
||||
// TruncateFloat64ToInt32[mode](Phi[Float64](x1,...,xn))
|
||||
// => Phi[Int32](TruncateFloat64ToInt32[mode](x1),
|
||||
@ -665,8 +666,9 @@ Reduction MachineOperatorReducer::ReduceTruncateFloat64ToInt32(Node* node) {
|
||||
if (reduction.Changed()) input = reduction.replacement();
|
||||
phi->ReplaceInput(i, input);
|
||||
}
|
||||
NodeProperties::ChangeOp(phi,
|
||||
common()->Phi(kMachInt32, value_input_count));
|
||||
NodeProperties::ChangeOp(
|
||||
phi,
|
||||
common()->Phi(MachineRepresentation::kWord32, value_input_count));
|
||||
return Replace(phi);
|
||||
}
|
||||
}
|
||||
@ -675,15 +677,16 @@ Reduction MachineOperatorReducer::ReduceTruncateFloat64ToInt32(Node* node) {
|
||||
|
||||
|
||||
Reduction MachineOperatorReducer::ReduceStore(Node* node) {
|
||||
MachineType const rep =
|
||||
RepresentationOf(StoreRepresentationOf(node->op()).machine_type());
|
||||
MachineRepresentation const rep =
|
||||
StoreRepresentationOf(node->op()).machine_type().representation();
|
||||
Node* const value = node->InputAt(2);
|
||||
switch (value->opcode()) {
|
||||
case IrOpcode::kWord32And: {
|
||||
Uint32BinopMatcher m(value);
|
||||
if (m.right().HasValue() &&
|
||||
((rep == kRepWord8 && (m.right().Value() & 0xff) == 0xff) ||
|
||||
(rep == kRepWord16 && (m.right().Value() & 0xffff) == 0xffff))) {
|
||||
if (m.right().HasValue() && ((rep == MachineRepresentation::kWord8 &&
|
||||
(m.right().Value() & 0xff) == 0xff) ||
|
||||
(rep == MachineRepresentation::kWord16 &&
|
||||
(m.right().Value() & 0xffff) == 0xffff))) {
|
||||
node->ReplaceInput(2, m.left().node());
|
||||
return Changed(node);
|
||||
}
|
||||
@ -691,9 +694,10 @@ Reduction MachineOperatorReducer::ReduceStore(Node* node) {
|
||||
}
|
||||
case IrOpcode::kWord32Sar: {
|
||||
Int32BinopMatcher m(value);
|
||||
if (m.left().IsWord32Shl() &&
|
||||
((rep == kRepWord8 && m.right().IsInRange(1, 24)) ||
|
||||
(rep == kRepWord16 && m.right().IsInRange(1, 16)))) {
|
||||
if (m.left().IsWord32Shl() && ((rep == MachineRepresentation::kWord8 &&
|
||||
m.right().IsInRange(1, 24)) ||
|
||||
(rep == MachineRepresentation::kWord16 &&
|
||||
m.right().IsInRange(1, 16)))) {
|
||||
Int32BinopMatcher mleft(m.left().node());
|
||||
if (mleft.right().Is(m.right().Value())) {
|
||||
node->ReplaceInput(2, mleft.left().node());
|
||||
@ -811,12 +815,14 @@ Reduction MachineOperatorReducer::ReduceWord32Sar(Node* node) {
|
||||
}
|
||||
} else if (mleft.left().IsLoad()) {
|
||||
LoadRepresentation const rep =
|
||||
OpParameter<LoadRepresentation>(mleft.left().node());
|
||||
if (m.right().Is(24) && mleft.right().Is(24) && rep == kMachInt8) {
|
||||
LoadRepresentationOf(mleft.left().node()->op());
|
||||
if (m.right().Is(24) && mleft.right().Is(24) &&
|
||||
rep == MachineType::Int8()) {
|
||||
// Load[kMachInt8] << 24 >> 24 => Load[kMachInt8]
|
||||
return Replace(mleft.left().node());
|
||||
}
|
||||
if (m.right().Is(16) && mleft.right().Is(16) && rep == kMachInt16) {
|
||||
if (m.right().Is(16) && mleft.right().Is(16) &&
|
||||
rep == MachineType::Int16()) {
|
||||
// Load[kMachInt16] << 16 >> 16 => Load[kMachInt8]
|
||||
return Replace(mleft.left().node());
|
||||
}
|
||||
|
@ -68,6 +68,12 @@ std::ostream& operator<<(std::ostream& os, StoreRepresentation rep) {
|
||||
}
|
||||
|
||||
|
||||
LoadRepresentation LoadRepresentationOf(Operator const* op) {
|
||||
DCHECK_EQ(IrOpcode::kLoad, op->opcode());
|
||||
return OpParameter<LoadRepresentation>(op);
|
||||
}
|
||||
|
||||
|
||||
StoreRepresentation const& StoreRepresentationOf(Operator const* op) {
|
||||
DCHECK_EQ(IrOpcode::kStore, op->opcode());
|
||||
return OpParameter<StoreRepresentation>(op);
|
||||
@ -200,18 +206,18 @@ CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) {
|
||||
|
||||
|
||||
#define MACHINE_TYPE_LIST(V) \
|
||||
V(MachFloat32) \
|
||||
V(MachFloat64) \
|
||||
V(MachInt8) \
|
||||
V(MachUint8) \
|
||||
V(MachInt16) \
|
||||
V(MachUint16) \
|
||||
V(MachInt32) \
|
||||
V(MachUint32) \
|
||||
V(MachInt64) \
|
||||
V(MachUint64) \
|
||||
V(MachPtr) \
|
||||
V(MachAnyTagged)
|
||||
V(Float32) \
|
||||
V(Float64) \
|
||||
V(Int8) \
|
||||
V(Uint8) \
|
||||
V(Int16) \
|
||||
V(Uint16) \
|
||||
V(Int32) \
|
||||
V(Uint32) \
|
||||
V(Int64) \
|
||||
V(Uint64) \
|
||||
V(Pointer) \
|
||||
V(AnyTagged)
|
||||
|
||||
|
||||
struct MachineOperatorGlobalCache {
|
||||
@ -246,14 +252,14 @@ struct MachineOperatorGlobalCache {
|
||||
Load##Type##Operator() \
|
||||
: Operator1<LoadRepresentation>( \
|
||||
IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \
|
||||
"Load", 2, 1, 1, 1, 1, 0, k##Type) {} \
|
||||
"Load", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \
|
||||
}; \
|
||||
struct CheckedLoad##Type##Operator final \
|
||||
: public Operator1<CheckedLoadRepresentation> { \
|
||||
CheckedLoad##Type##Operator() \
|
||||
: Operator1<CheckedLoadRepresentation>( \
|
||||
IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \
|
||||
"CheckedLoad", 3, 1, 1, 1, 1, 0, k##Type) {} \
|
||||
"CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \
|
||||
}; \
|
||||
Load##Type##Operator kLoad##Type; \
|
||||
CheckedLoad##Type##Operator kCheckedLoad##Type;
|
||||
@ -266,7 +272,7 @@ struct MachineOperatorGlobalCache {
|
||||
: Operator1<StoreRepresentation>( \
|
||||
IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, \
|
||||
"Store", 3, 1, 1, 0, 1, 0, \
|
||||
StoreRepresentation(k##Type, write_barrier_kind)) {} \
|
||||
StoreRepresentation(MachineType::Type(), write_barrier_kind)) {} \
|
||||
}; \
|
||||
struct Store##Type##NoWriteBarrier##Operator final \
|
||||
: public Store##Type##Operator { \
|
||||
@ -293,7 +299,7 @@ struct MachineOperatorGlobalCache {
|
||||
CheckedStore##Type##Operator() \
|
||||
: Operator1<CheckedStoreRepresentation>( \
|
||||
IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow, \
|
||||
"CheckedStore", 4, 1, 1, 0, 1, 0, k##Type) {} \
|
||||
"CheckedStore", 4, 1, 1, 0, 1, 0, MachineType::Type()) {} \
|
||||
}; \
|
||||
Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier; \
|
||||
Store##Type##MapWriteBarrier##Operator kStore##Type##MapWriteBarrier; \
|
||||
@ -310,10 +316,12 @@ static base::LazyInstance<MachineOperatorGlobalCache>::type kCache =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
|
||||
MachineOperatorBuilder::MachineOperatorBuilder(Zone* zone, MachineType word,
|
||||
MachineOperatorBuilder::MachineOperatorBuilder(Zone* zone,
|
||||
MachineRepresentation word,
|
||||
Flags flags)
|
||||
: cache_(kCache.Get()), word_(word), flags_(flags) {
|
||||
DCHECK(word == kRepWord32 || word == kRepWord64);
|
||||
DCHECK(word == MachineRepresentation::kWord32 ||
|
||||
word == MachineRepresentation::kWord64);
|
||||
}
|
||||
|
||||
|
||||
@ -346,25 +354,22 @@ const Operator* MachineOperatorBuilder::TruncateFloat64ToInt32(
|
||||
|
||||
|
||||
const Operator* MachineOperatorBuilder::Load(LoadRepresentation rep) {
|
||||
switch (rep) {
|
||||
#define LOAD(Type) \
|
||||
case k##Type: \
|
||||
return &cache_.kLoad##Type;
|
||||
#define LOAD(Type) \
|
||||
if (rep == MachineType::Type()) { \
|
||||
return &cache_.kLoad##Type; \
|
||||
}
|
||||
MACHINE_TYPE_LIST(LOAD)
|
||||
#undef LOAD
|
||||
default:
|
||||
break;
|
||||
}
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
const Operator* MachineOperatorBuilder::Store(StoreRepresentation rep) {
|
||||
switch (rep.machine_type()) {
|
||||
const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) {
|
||||
MachineType type = store_rep.machine_type();
|
||||
#define STORE(Type) \
|
||||
case k##Type: \
|
||||
switch (rep.write_barrier_kind()) { \
|
||||
if (type == MachineType::Type()) { \
|
||||
switch (store_rep.write_barrier_kind()) { \
|
||||
case kNoWriteBarrier: \
|
||||
return &cache_.k##Store##Type##NoWriteBarrier; \
|
||||
case kMapWriteBarrier: \
|
||||
@ -374,13 +379,9 @@ const Operator* MachineOperatorBuilder::Store(StoreRepresentation rep) {
|
||||
case kFullWriteBarrier: \
|
||||
return &cache_.k##Store##Type##FullWriteBarrier; \
|
||||
} \
|
||||
break;
|
||||
}
|
||||
MACHINE_TYPE_LIST(STORE)
|
||||
#undef STORE
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
@ -388,15 +389,12 @@ const Operator* MachineOperatorBuilder::Store(StoreRepresentation rep) {
|
||||
|
||||
const Operator* MachineOperatorBuilder::CheckedLoad(
|
||||
CheckedLoadRepresentation rep) {
|
||||
switch (rep) {
|
||||
#define LOAD(Type) \
|
||||
case k##Type: \
|
||||
return &cache_.kCheckedLoad##Type;
|
||||
#define LOAD(Type) \
|
||||
if (rep == MachineType::Type()) { \
|
||||
return &cache_.kCheckedLoad##Type; \
|
||||
}
|
||||
MACHINE_TYPE_LIST(LOAD)
|
||||
#undef LOAD
|
||||
default:
|
||||
break;
|
||||
}
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
@ -404,15 +402,12 @@ const Operator* MachineOperatorBuilder::CheckedLoad(
|
||||
|
||||
const Operator* MachineOperatorBuilder::CheckedStore(
|
||||
CheckedStoreRepresentation rep) {
|
||||
switch (rep) {
|
||||
#define STORE(Type) \
|
||||
case k##Type: \
|
||||
return &cache_.kCheckedStore##Type;
|
||||
#define STORE(Type) \
|
||||
if (rep == MachineType::Type()) { \
|
||||
return &cache_.kCheckedStore##Type; \
|
||||
}
|
||||
MACHINE_TYPE_LIST(STORE)
|
||||
#undef STORE
|
||||
default:
|
||||
break;
|
||||
}
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ std::ostream& operator<<(std::ostream& os, WriteBarrierKind);
|
||||
// A Load needs a MachineType.
|
||||
typedef MachineType LoadRepresentation;
|
||||
|
||||
LoadRepresentation LoadRepresentationOf(Operator const*);
|
||||
|
||||
// A Store needs a MachineType and a WriteBarrierKind in order to emit the
|
||||
// correct write barrier.
|
||||
@ -141,8 +142,10 @@ class MachineOperatorBuilder final : public ZoneObject {
|
||||
};
|
||||
typedef base::Flags<Flag, unsigned> Flags;
|
||||
|
||||
explicit MachineOperatorBuilder(Zone* zone, MachineType word = kMachPtr,
|
||||
Flags supportedOperators = kNoFlags);
|
||||
explicit MachineOperatorBuilder(
|
||||
Zone* zone,
|
||||
MachineRepresentation word = MachineType::PointerRepresentation(),
|
||||
Flags supportedOperators = kNoFlags);
|
||||
|
||||
const Operator* Word32And();
|
||||
const Operator* Word32Or();
|
||||
@ -307,9 +310,9 @@ class MachineOperatorBuilder final : public ZoneObject {
|
||||
const Operator* CheckedStore(CheckedStoreRepresentation);
|
||||
|
||||
// Target machine word-size assumed by this builder.
|
||||
bool Is32() const { return word() == kRepWord32; }
|
||||
bool Is64() const { return word() == kRepWord64; }
|
||||
MachineType word() const { return word_; }
|
||||
bool Is32() const { return word() == MachineRepresentation::kWord32; }
|
||||
bool Is64() const { return word() == MachineRepresentation::kWord64; }
|
||||
MachineRepresentation word() const { return word_; }
|
||||
|
||||
// Pseudo operators that translate to 32/64-bit operators depending on the
|
||||
// word-size of the target machine assumed by this builder.
|
||||
@ -342,7 +345,7 @@ class MachineOperatorBuilder final : public ZoneObject {
|
||||
|
||||
private:
|
||||
MachineOperatorGlobalCache const& cache_;
|
||||
MachineType const word_;
|
||||
MachineRepresentation const word_;
|
||||
Flags const flags_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MachineOperatorBuilder);
|
||||
|
@ -127,29 +127,28 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
|
||||
|
||||
|
||||
void InstructionSelector::VisitLoad(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<LoadRepresentation>(node));
|
||||
MachineType typ = TypeOf(OpParameter<LoadRepresentation>(node));
|
||||
LoadRepresentation load_rep = LoadRepresentationOf(node->op());
|
||||
MipsOperandGenerator g(this);
|
||||
Node* base = node->InputAt(0);
|
||||
Node* index = node->InputAt(1);
|
||||
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepFloat32:
|
||||
switch (load_rep.representation()) {
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kMipsLwc1;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kMipsLdc1;
|
||||
break;
|
||||
case kRepBit: // Fall through.
|
||||
case kRepWord8:
|
||||
opcode = typ == kTypeUint32 ? kMipsLbu : kMipsLb;
|
||||
case MachineRepresentation::kBit: // Fall through.
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = load_rep.IsUnsigned() ? kMipsLbu : kMipsLb;
|
||||
break;
|
||||
case kRepWord16:
|
||||
opcode = typ == kTypeUint32 ? kMipsLhu : kMipsLh;
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = load_rep.IsUnsigned() ? kMipsLhu : kMipsLh;
|
||||
break;
|
||||
case kRepTagged: // Fall through.
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kTagged: // Fall through.
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kMipsLw;
|
||||
break;
|
||||
default:
|
||||
@ -179,11 +178,11 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
|
||||
StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node);
|
||||
WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind();
|
||||
MachineType rep = RepresentationOf(store_rep.machine_type());
|
||||
MachineRepresentation rep = store_rep.machine_type().representation();
|
||||
|
||||
// TODO(mips): I guess this could be done in a better way.
|
||||
if (write_barrier_kind != kNoWriteBarrier) {
|
||||
DCHECK_EQ(kRepTagged, rep);
|
||||
DCHECK_EQ(MachineRepresentation::kTagged, rep);
|
||||
InstructionOperand inputs[3];
|
||||
size_t input_count = 0;
|
||||
inputs[input_count++] = g.UseUniqueRegister(base);
|
||||
@ -214,21 +213,21 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
} else {
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kMipsSwc1;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kMipsSdc1;
|
||||
break;
|
||||
case kRepBit: // Fall through.
|
||||
case kRepWord8:
|
||||
case MachineRepresentation::kBit: // Fall through.
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = kMipsSb;
|
||||
break;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = kMipsSh;
|
||||
break;
|
||||
case kRepTagged: // Fall through.
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kTagged: // Fall through.
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kMipsSw;
|
||||
break;
|
||||
default:
|
||||
@ -803,27 +802,26 @@ bool InstructionSelector::IsTailCallAddressImmediate() { return false; }
|
||||
|
||||
|
||||
void InstructionSelector::VisitCheckedLoad(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
|
||||
MachineType typ = TypeOf(OpParameter<MachineType>(node));
|
||||
CheckedLoadRepresentation load_rep = CheckedLoadRepresentationOf(node->op());
|
||||
MipsOperandGenerator g(this);
|
||||
Node* const buffer = node->InputAt(0);
|
||||
Node* const offset = node->InputAt(1);
|
||||
Node* const length = node->InputAt(2);
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepWord8:
|
||||
opcode = typ == kTypeInt32 ? kCheckedLoadInt8 : kCheckedLoadUint8;
|
||||
switch (load_rep.representation()) {
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = load_rep.IsSigned() ? kCheckedLoadInt8 : kCheckedLoadUint8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
opcode = typ == kTypeInt32 ? kCheckedLoadInt16 : kCheckedLoadUint16;
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = load_rep.IsSigned() ? kCheckedLoadInt16 : kCheckedLoadUint16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kCheckedLoadWord32;
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kCheckedLoadFloat32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kCheckedLoadFloat64;
|
||||
break;
|
||||
default:
|
||||
@ -847,7 +845,8 @@ void InstructionSelector::VisitCheckedLoad(Node* node) {
|
||||
|
||||
|
||||
void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
|
||||
MachineRepresentation rep =
|
||||
CheckedStoreRepresentationOf(node->op()).representation();
|
||||
MipsOperandGenerator g(this);
|
||||
Node* const buffer = node->InputAt(0);
|
||||
Node* const offset = node->InputAt(1);
|
||||
@ -855,19 +854,19 @@ void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
Node* const value = node->InputAt(3);
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepWord8:
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = kCheckedStoreWord8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = kCheckedStoreWord16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kCheckedStoreWord32;
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kCheckedStoreFloat32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kCheckedStoreFloat64;
|
||||
break;
|
||||
default:
|
||||
|
@ -132,32 +132,31 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
|
||||
|
||||
|
||||
void InstructionSelector::VisitLoad(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<LoadRepresentation>(node));
|
||||
MachineType typ = TypeOf(OpParameter<LoadRepresentation>(node));
|
||||
LoadRepresentation load_rep = LoadRepresentationOf(node->op());
|
||||
Mips64OperandGenerator g(this);
|
||||
Node* base = node->InputAt(0);
|
||||
Node* index = node->InputAt(1);
|
||||
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepFloat32:
|
||||
switch (load_rep.representation()) {
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kMips64Lwc1;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kMips64Ldc1;
|
||||
break;
|
||||
case kRepBit: // Fall through.
|
||||
case kRepWord8:
|
||||
opcode = typ == kTypeUint32 ? kMips64Lbu : kMips64Lb;
|
||||
case MachineRepresentation::kBit: // Fall through.
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = load_rep.IsUnsigned() ? kMips64Lbu : kMips64Lb;
|
||||
break;
|
||||
case kRepWord16:
|
||||
opcode = typ == kTypeUint32 ? kMips64Lhu : kMips64Lh;
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = load_rep.IsUnsigned() ? kMips64Lhu : kMips64Lh;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kMips64Lw;
|
||||
break;
|
||||
case kRepTagged: // Fall through.
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kTagged: // Fall through.
|
||||
case MachineRepresentation::kWord64:
|
||||
opcode = kMips64Ld;
|
||||
break;
|
||||
default:
|
||||
@ -187,11 +186,11 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
|
||||
StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node);
|
||||
WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind();
|
||||
MachineType rep = RepresentationOf(store_rep.machine_type());
|
||||
MachineRepresentation rep = store_rep.machine_type().representation();
|
||||
|
||||
// TODO(mips): I guess this could be done in a better way.
|
||||
if (write_barrier_kind != kNoWriteBarrier) {
|
||||
DCHECK_EQ(kRepTagged, rep);
|
||||
DCHECK_EQ(MachineRepresentation::kTagged, rep);
|
||||
InstructionOperand inputs[3];
|
||||
size_t input_count = 0;
|
||||
inputs[input_count++] = g.UseUniqueRegister(base);
|
||||
@ -222,24 +221,24 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
} else {
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kMips64Swc1;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kMips64Sdc1;
|
||||
break;
|
||||
case kRepBit: // Fall through.
|
||||
case kRepWord8:
|
||||
case MachineRepresentation::kBit: // Fall through.
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = kMips64Sb;
|
||||
break;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = kMips64Sh;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kMips64Sw;
|
||||
break;
|
||||
case kRepTagged: // Fall through.
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kTagged: // Fall through.
|
||||
case MachineRepresentation::kWord64:
|
||||
opcode = kMips64Sd;
|
||||
break;
|
||||
default:
|
||||
@ -1227,30 +1226,29 @@ bool InstructionSelector::IsTailCallAddressImmediate() { return false; }
|
||||
|
||||
|
||||
void InstructionSelector::VisitCheckedLoad(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
|
||||
MachineType typ = TypeOf(OpParameter<MachineType>(node));
|
||||
CheckedLoadRepresentation load_rep = CheckedLoadRepresentationOf(node->op());
|
||||
Mips64OperandGenerator g(this);
|
||||
Node* const buffer = node->InputAt(0);
|
||||
Node* const offset = node->InputAt(1);
|
||||
Node* const length = node->InputAt(2);
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepWord8:
|
||||
opcode = typ == kTypeInt32 ? kCheckedLoadInt8 : kCheckedLoadUint8;
|
||||
switch (load_rep.representation()) {
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = load_rep.IsSigned() ? kCheckedLoadInt8 : kCheckedLoadUint8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
opcode = typ == kTypeInt32 ? kCheckedLoadInt16 : kCheckedLoadUint16;
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = load_rep.IsSigned() ? kCheckedLoadInt16 : kCheckedLoadUint16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kCheckedLoadWord32;
|
||||
break;
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kWord64:
|
||||
opcode = kCheckedLoadWord64;
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kCheckedLoadFloat32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kCheckedLoadFloat64;
|
||||
break;
|
||||
default:
|
||||
@ -1274,7 +1272,8 @@ void InstructionSelector::VisitCheckedLoad(Node* node) {
|
||||
|
||||
|
||||
void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
|
||||
MachineRepresentation rep =
|
||||
CheckedStoreRepresentationOf(node->op()).representation();
|
||||
Mips64OperandGenerator g(this);
|
||||
Node* const buffer = node->InputAt(0);
|
||||
Node* const offset = node->InputAt(1);
|
||||
@ -1282,22 +1281,22 @@ void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
Node* const value = node->InputAt(3);
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepWord8:
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = kCheckedStoreWord8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = kCheckedStoreWord16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kCheckedStoreWord32;
|
||||
break;
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kWord64:
|
||||
opcode = kCheckedStoreWord64;
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kCheckedStoreFloat32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kCheckedStoreFloat64;
|
||||
break;
|
||||
default:
|
||||
|
@ -105,7 +105,7 @@ class PipelineData {
|
||||
source_positions_.Reset(new SourcePositionTable(graph_));
|
||||
simplified_ = new (graph_zone_) SimplifiedOperatorBuilder(graph_zone_);
|
||||
machine_ = new (graph_zone_) MachineOperatorBuilder(
|
||||
graph_zone_, kMachPtr,
|
||||
graph_zone_, MachineType::PointerRepresentation(),
|
||||
InstructionSelector::SupportedMachineOperatorFlags());
|
||||
common_ = new (graph_zone_) CommonOperatorBuilder(graph_zone_);
|
||||
javascript_ = new (graph_zone_) JSOperatorBuilder(graph_zone_);
|
||||
|
@ -15,7 +15,7 @@ namespace compiler {
|
||||
|
||||
RawMachineAssembler::RawMachineAssembler(Isolate* isolate, Graph* graph,
|
||||
CallDescriptor* call_descriptor,
|
||||
MachineType word,
|
||||
MachineRepresentation word,
|
||||
MachineOperatorBuilder::Flags flags)
|
||||
: isolate_(isolate),
|
||||
graph_(graph),
|
||||
|
@ -36,11 +36,11 @@ class Schedule;
|
||||
// non-schedulable due to missing control and effect dependencies.
|
||||
class RawMachineAssembler {
|
||||
public:
|
||||
RawMachineAssembler(Isolate* isolate, Graph* graph,
|
||||
CallDescriptor* call_descriptor,
|
||||
MachineType word = kMachPtr,
|
||||
MachineOperatorBuilder::Flags flags =
|
||||
MachineOperatorBuilder::Flag::kNoFlags);
|
||||
RawMachineAssembler(
|
||||
Isolate* isolate, Graph* graph, CallDescriptor* call_descriptor,
|
||||
MachineRepresentation word = MachineType::PointerRepresentation(),
|
||||
MachineOperatorBuilder::Flags flags =
|
||||
MachineOperatorBuilder::Flag::kNoFlags);
|
||||
~RawMachineAssembler() {}
|
||||
|
||||
Isolate* isolate() const { return isolate_; }
|
||||
@ -611,14 +611,14 @@ class RawMachineAssembler {
|
||||
void Deoptimize(Node* state);
|
||||
|
||||
// Variables.
|
||||
Node* Phi(MachineType type, Node* n1, Node* n2) {
|
||||
return AddNode(common()->Phi(type, 2), n1, n2);
|
||||
Node* Phi(MachineRepresentation rep, Node* n1, Node* n2) {
|
||||
return AddNode(common()->Phi(rep, 2), n1, n2);
|
||||
}
|
||||
Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3) {
|
||||
return AddNode(common()->Phi(type, 3), n1, n2, n3);
|
||||
Node* Phi(MachineRepresentation rep, Node* n1, Node* n2, Node* n3) {
|
||||
return AddNode(common()->Phi(rep, 3), n1, n2, n3);
|
||||
}
|
||||
Node* Phi(MachineType type, Node* n1, Node* n2, Node* n3, Node* n4) {
|
||||
return AddNode(common()->Phi(type, 4), n1, n2, n3, n4);
|
||||
Node* Phi(MachineRepresentation rep, Node* n1, Node* n2, Node* n3, Node* n4) {
|
||||
return AddNode(common()->Phi(rep, 4), n1, n2, n3, n4);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
@ -717,9 +717,9 @@ void RegisterAllocatorVerifier::VerifyGapMoves(BlockMaps* block_maps,
|
||||
if (op_constraints[count].type_ == kRegisterAndSlot) {
|
||||
const AllocatedOperand* reg_op =
|
||||
AllocatedOperand::cast(instr->OutputAt(i));
|
||||
MachineType mt = reg_op->machine_type();
|
||||
MachineRepresentation rep = reg_op->representation();
|
||||
const AllocatedOperand* stack_op = AllocatedOperand::New(
|
||||
zone(), LocationOperand::LocationKind::STACK_SLOT, mt,
|
||||
zone(), LocationOperand::LocationKind::STACK_SLOT, rep,
|
||||
op_constraints[i].spilled_slot_);
|
||||
auto insert_result =
|
||||
current->map().insert(std::make_pair(stack_op, value));
|
||||
|
@ -92,18 +92,17 @@ bool IsOutputDoubleRegisterOf(Instruction* instr, DoubleRegister reg) {
|
||||
|
||||
|
||||
// TODO(dcarney): fix frame to allow frame accesses to half size location.
|
||||
int GetByteWidth(MachineType machine_type) {
|
||||
DCHECK_EQ(RepresentationOf(machine_type), machine_type);
|
||||
switch (machine_type) {
|
||||
case kRepBit:
|
||||
case kRepWord8:
|
||||
case kRepWord16:
|
||||
case kRepWord32:
|
||||
case kRepTagged:
|
||||
int GetByteWidth(MachineRepresentation rep) {
|
||||
switch (rep) {
|
||||
case MachineRepresentation::kBit:
|
||||
case MachineRepresentation::kWord8:
|
||||
case MachineRepresentation::kWord16:
|
||||
case MachineRepresentation::kWord32:
|
||||
case MachineRepresentation::kTagged:
|
||||
return kPointerSize;
|
||||
case kRepFloat32:
|
||||
case kRepWord64:
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat32:
|
||||
case MachineRepresentation::kWord64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
return 8;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -251,7 +250,7 @@ const float LiveRange::kInvalidWeight = -1;
|
||||
const float LiveRange::kMaxWeight = std::numeric_limits<float>::max();
|
||||
|
||||
|
||||
LiveRange::LiveRange(int relative_id, MachineType machine_type,
|
||||
LiveRange::LiveRange(int relative_id, MachineRepresentation rep,
|
||||
TopLevelLiveRange* top_level)
|
||||
: relative_id_(relative_id),
|
||||
bits_(0),
|
||||
@ -267,9 +266,9 @@ LiveRange::LiveRange(int relative_id, MachineType machine_type,
|
||||
size_(kInvalidSize),
|
||||
weight_(kInvalidWeight),
|
||||
group_(nullptr) {
|
||||
DCHECK(AllocatedOperand::IsSupportedMachineType(machine_type));
|
||||
DCHECK(AllocatedOperand::IsSupportedRepresentation(rep));
|
||||
bits_ = AssignedRegisterField::encode(kUnassignedRegister) |
|
||||
MachineTypeField::encode(machine_type);
|
||||
RepresentationField::encode(rep);
|
||||
}
|
||||
|
||||
|
||||
@ -309,14 +308,8 @@ void LiveRange::Spill() {
|
||||
|
||||
|
||||
RegisterKind LiveRange::kind() const {
|
||||
switch (RepresentationOf(machine_type())) {
|
||||
case kRepFloat32:
|
||||
case kRepFloat64:
|
||||
return DOUBLE_REGISTERS;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return GENERAL_REGISTERS;
|
||||
return IsFloatingPoint(representation()) ? DOUBLE_REGISTERS
|
||||
: GENERAL_REGISTERS;
|
||||
}
|
||||
|
||||
|
||||
@ -397,7 +390,7 @@ bool LiveRange::IsTopLevel() const { return top_level_ == this; }
|
||||
InstructionOperand LiveRange::GetAssignedOperand() const {
|
||||
if (HasRegisterAssigned()) {
|
||||
DCHECK(!spilled());
|
||||
return AllocatedOperand(LocationOperand::REGISTER, machine_type(),
|
||||
return AllocatedOperand(LocationOperand::REGISTER, representation(),
|
||||
assigned_register());
|
||||
}
|
||||
DCHECK(spilled());
|
||||
@ -436,7 +429,7 @@ void LiveRange::AdvanceLastProcessedMarker(
|
||||
|
||||
LiveRange* LiveRange::SplitAt(LifetimePosition position, Zone* zone) {
|
||||
int new_id = TopLevel()->GetNextChildId();
|
||||
LiveRange* child = new (zone) LiveRange(new_id, machine_type(), TopLevel());
|
||||
LiveRange* child = new (zone) LiveRange(new_id, representation(), TopLevel());
|
||||
DetachAt(position, child, zone);
|
||||
|
||||
child->top_level_ = TopLevel();
|
||||
@ -681,8 +674,8 @@ struct TopLevelLiveRange::SpillMoveInsertionList : ZoneObject {
|
||||
};
|
||||
|
||||
|
||||
TopLevelLiveRange::TopLevelLiveRange(int vreg, MachineType machine_type)
|
||||
: LiveRange(0, machine_type, this),
|
||||
TopLevelLiveRange::TopLevelLiveRange(int vreg, MachineRepresentation rep)
|
||||
: LiveRange(0, rep, this),
|
||||
vreg_(vreg),
|
||||
last_child_id_(0),
|
||||
splintered_from_(nullptr),
|
||||
@ -797,7 +790,7 @@ void TopLevelLiveRange::SetSpillRange(SpillRange* spill_range) {
|
||||
AllocatedOperand TopLevelLiveRange::GetSpillRangeOperand() const {
|
||||
auto spill_range = GetSpillRange();
|
||||
int index = spill_range->assigned_slot();
|
||||
return AllocatedOperand(LocationOperand::STACK_SLOT, machine_type(), index);
|
||||
return AllocatedOperand(LocationOperand::STACK_SLOT, representation(), index);
|
||||
}
|
||||
|
||||
|
||||
@ -806,7 +799,7 @@ void TopLevelLiveRange::Splinter(LifetimePosition start, LifetimePosition end,
|
||||
DCHECK(start != Start() || end != End());
|
||||
DCHECK(start < end);
|
||||
|
||||
TopLevelLiveRange splinter_temp(-1, machine_type());
|
||||
TopLevelLiveRange splinter_temp(-1, representation());
|
||||
UsePosition* last_in_splinter = nullptr;
|
||||
// Live ranges defined in deferred blocks stay in deferred blocks, so we
|
||||
// don't need to splinter them. That means that start should always be
|
||||
@ -824,7 +817,7 @@ void TopLevelLiveRange::Splinter(LifetimePosition start, LifetimePosition end,
|
||||
|
||||
UsePosition* last = DetachAt(start, &splinter_temp, zone);
|
||||
|
||||
LiveRange end_part(kInvalidId, this->machine_type(), nullptr);
|
||||
LiveRange end_part(kInvalidId, this->representation(), nullptr);
|
||||
last_in_splinter = splinter_temp.DetachAt(end, &end_part, zone);
|
||||
|
||||
next_ = end_part.next_;
|
||||
@ -1088,7 +1081,7 @@ std::ostream& operator<<(std::ostream& os,
|
||||
SpillRange::SpillRange(TopLevelLiveRange* parent, Zone* zone)
|
||||
: live_ranges_(zone),
|
||||
assigned_slot_(kUnassignedSlot),
|
||||
byte_width_(GetByteWidth(parent->machine_type())),
|
||||
byte_width_(GetByteWidth(parent->representation())),
|
||||
kind_(parent->kind()) {
|
||||
// Spill ranges are created for top level, non-splintered ranges. This is so
|
||||
// that, when merging decisions are made, we consider the full extent of the
|
||||
@ -1118,7 +1111,7 @@ SpillRange::SpillRange(TopLevelLiveRange* parent, Zone* zone)
|
||||
|
||||
|
||||
int SpillRange::ByteWidth() const {
|
||||
return GetByteWidth(live_ranges_[0]->machine_type());
|
||||
return GetByteWidth(live_ranges_[0]->representation());
|
||||
}
|
||||
|
||||
|
||||
@ -1257,7 +1250,8 @@ MoveOperands* RegisterAllocationData::AddGapMove(
|
||||
}
|
||||
|
||||
|
||||
MachineType RegisterAllocationData::MachineTypeFor(int virtual_register) {
|
||||
MachineRepresentation RegisterAllocationData::RepresentationFor(
|
||||
int virtual_register) {
|
||||
DCHECK_LT(virtual_register, code()->VirtualRegisterCount());
|
||||
return code()->GetRepresentation(virtual_register);
|
||||
}
|
||||
@ -1269,7 +1263,7 @@ TopLevelLiveRange* RegisterAllocationData::GetOrCreateLiveRangeFor(int index) {
|
||||
}
|
||||
auto result = live_ranges()[index];
|
||||
if (result == nullptr) {
|
||||
result = NewLiveRange(index, MachineTypeFor(index));
|
||||
result = NewLiveRange(index, RepresentationFor(index));
|
||||
live_ranges()[index] = result;
|
||||
}
|
||||
return result;
|
||||
@ -1277,8 +1271,8 @@ TopLevelLiveRange* RegisterAllocationData::GetOrCreateLiveRangeFor(int index) {
|
||||
|
||||
|
||||
TopLevelLiveRange* RegisterAllocationData::NewLiveRange(
|
||||
int index, MachineType machine_type) {
|
||||
return new (allocation_zone()) TopLevelLiveRange(index, machine_type);
|
||||
int index, MachineRepresentation rep) {
|
||||
return new (allocation_zone()) TopLevelLiveRange(index, rep);
|
||||
}
|
||||
|
||||
|
||||
@ -1292,9 +1286,9 @@ int RegisterAllocationData::GetNextLiveRangeId() {
|
||||
|
||||
|
||||
TopLevelLiveRange* RegisterAllocationData::NextLiveRange(
|
||||
MachineType machine_type) {
|
||||
MachineRepresentation rep) {
|
||||
int vreg = GetNextLiveRangeId();
|
||||
TopLevelLiveRange* ret = NewLiveRange(vreg, machine_type);
|
||||
TopLevelLiveRange* ret = NewLiveRange(vreg, rep);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1501,22 +1495,22 @@ InstructionOperand* ConstraintBuilder::AllocateFixed(
|
||||
TRACE("Allocating fixed reg for op %d\n", operand->virtual_register());
|
||||
DCHECK(operand->HasFixedPolicy());
|
||||
InstructionOperand allocated;
|
||||
MachineType machine_type = InstructionSequence::DefaultRepresentation();
|
||||
MachineRepresentation rep = InstructionSequence::DefaultRepresentation();
|
||||
int virtual_register = operand->virtual_register();
|
||||
if (virtual_register != InstructionOperand::kInvalidVirtualRegister) {
|
||||
machine_type = data()->MachineTypeFor(virtual_register);
|
||||
rep = data()->RepresentationFor(virtual_register);
|
||||
}
|
||||
if (operand->HasFixedSlotPolicy()) {
|
||||
allocated = AllocatedOperand(AllocatedOperand::STACK_SLOT, machine_type,
|
||||
allocated = AllocatedOperand(AllocatedOperand::STACK_SLOT, rep,
|
||||
operand->fixed_slot_index());
|
||||
} else if (operand->HasFixedRegisterPolicy()) {
|
||||
DCHECK(!IsFloatingPoint(machine_type));
|
||||
allocated = AllocatedOperand(AllocatedOperand::REGISTER, machine_type,
|
||||
DCHECK(!IsFloatingPoint(rep));
|
||||
allocated = AllocatedOperand(AllocatedOperand::REGISTER, rep,
|
||||
operand->fixed_register_index());
|
||||
} else if (operand->HasFixedDoubleRegisterPolicy()) {
|
||||
DCHECK(IsFloatingPoint(machine_type));
|
||||
DCHECK(IsFloatingPoint(rep));
|
||||
DCHECK_NE(InstructionOperand::kInvalidVirtualRegister, virtual_register);
|
||||
allocated = AllocatedOperand(AllocatedOperand::REGISTER, machine_type,
|
||||
allocated = AllocatedOperand(AllocatedOperand::REGISTER, rep,
|
||||
operand->fixed_register_index());
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
@ -1628,7 +1622,7 @@ void ConstraintBuilder::MeetConstraintsAfter(int instr_index) {
|
||||
range->MarkHasPreassignedSlot();
|
||||
InstructionOperand* spill_op = AllocatedOperand::New(
|
||||
data()->code_zone(), LocationOperand::LocationKind::STACK_SLOT,
|
||||
range->machine_type(), first_output->GetSecondaryStorage());
|
||||
range->representation(), first_output->GetSecondaryStorage());
|
||||
range->RecordSpillLocation(allocation_zone(), instr_index + 1,
|
||||
first_output);
|
||||
range->SetSpillOperand(spill_op);
|
||||
@ -1827,7 +1821,8 @@ TopLevelLiveRange* LiveRangeBuilder::FixedDoubleLiveRangeFor(int index) {
|
||||
DCHECK(index < config()->num_double_registers());
|
||||
auto result = data()->fixed_double_live_ranges()[index];
|
||||
if (result == nullptr) {
|
||||
result = data()->NewLiveRange(FixedDoubleLiveRangeID(index), kRepFloat64);
|
||||
result = data()->NewLiveRange(FixedDoubleLiveRangeID(index),
|
||||
MachineRepresentation::kFloat64);
|
||||
DCHECK(result->IsFixed());
|
||||
result->set_assigned_register(index);
|
||||
data()->MarkAllocated(DOUBLE_REGISTERS, index);
|
||||
@ -3100,8 +3095,8 @@ void ReferenceMapPopulator::PopulateReferenceMaps() {
|
||||
spill_operand = range->GetSpillRangeOperand();
|
||||
}
|
||||
DCHECK(spill_operand.IsStackSlot());
|
||||
DCHECK_EQ(kRepTagged,
|
||||
AllocatedOperand::cast(spill_operand).machine_type());
|
||||
DCHECK_EQ(MachineRepresentation::kTagged,
|
||||
AllocatedOperand::cast(spill_operand).representation());
|
||||
}
|
||||
|
||||
// Step through the safe points to see whether they are in the range.
|
||||
@ -3142,7 +3137,8 @@ void ReferenceMapPopulator::PopulateReferenceMaps() {
|
||||
safe_point);
|
||||
auto operand = cur->GetAssignedOperand();
|
||||
DCHECK(!operand.IsStackSlot());
|
||||
DCHECK_EQ(kRepTagged, AllocatedOperand::cast(operand).machine_type());
|
||||
DCHECK_EQ(MachineRepresentation::kTagged,
|
||||
AllocatedOperand::cast(operand).representation());
|
||||
map->RecordReference(AllocatedOperand::cast(operand));
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +315,9 @@ class LiveRange : public ZoneObject {
|
||||
|
||||
InstructionOperand GetAssignedOperand() const;
|
||||
|
||||
MachineType machine_type() const { return MachineTypeField::decode(bits_); }
|
||||
MachineRepresentation representation() const {
|
||||
return RepresentationField::decode(bits_);
|
||||
}
|
||||
|
||||
int assigned_register() const { return AssignedRegisterField::decode(bits_); }
|
||||
bool HasRegisterAssigned() const {
|
||||
@ -414,7 +416,7 @@ class LiveRange : public ZoneObject {
|
||||
|
||||
private:
|
||||
friend class TopLevelLiveRange;
|
||||
explicit LiveRange(int relative_id, MachineType machine_type,
|
||||
explicit LiveRange(int relative_id, MachineRepresentation rep,
|
||||
TopLevelLiveRange* top_level);
|
||||
|
||||
void AppendAsChild(TopLevelLiveRange* other);
|
||||
@ -428,7 +430,7 @@ class LiveRange : public ZoneObject {
|
||||
|
||||
typedef BitField<bool, 0, 1> SpilledField;
|
||||
typedef BitField<int32_t, 6, 6> AssignedRegisterField;
|
||||
typedef BitField<MachineType, 12, 15> MachineTypeField;
|
||||
typedef BitField<MachineRepresentation, 12, 15> RepresentationField;
|
||||
|
||||
// Unique among children and splinters of the same virtual register.
|
||||
int relative_id_;
|
||||
@ -481,7 +483,7 @@ class LiveRangeGroup final : public ZoneObject {
|
||||
|
||||
class TopLevelLiveRange final : public LiveRange {
|
||||
public:
|
||||
explicit TopLevelLiveRange(int vreg, MachineType machine_type);
|
||||
explicit TopLevelLiveRange(int vreg, MachineRepresentation rep);
|
||||
int spill_start_index() const { return spill_start_index_; }
|
||||
|
||||
bool IsFixed() const { return vreg_ < 0; }
|
||||
@ -773,12 +775,12 @@ class RegisterAllocationData final : public ZoneObject {
|
||||
const char* debug_name() const { return debug_name_; }
|
||||
const RegisterConfiguration* config() const { return config_; }
|
||||
|
||||
MachineType MachineTypeFor(int virtual_register);
|
||||
MachineRepresentation RepresentationFor(int virtual_register);
|
||||
|
||||
TopLevelLiveRange* GetOrCreateLiveRangeFor(int index);
|
||||
// Creates a new live range.
|
||||
TopLevelLiveRange* NewLiveRange(int index, MachineType machine_type);
|
||||
TopLevelLiveRange* NextLiveRange(MachineType machine_type);
|
||||
TopLevelLiveRange* NewLiveRange(int index, MachineRepresentation rep);
|
||||
TopLevelLiveRange* NextLiveRange(MachineRepresentation rep);
|
||||
|
||||
SpillRange* AssignSpillRangeToLiveRange(TopLevelLiveRange* range);
|
||||
SpillRange* CreateSpillRangeForLiveRange(TopLevelLiveRange* range);
|
||||
|
@ -98,8 +98,10 @@ bool Truncation::LessGeneral(TruncationKind rep1, TruncationKind rep2) {
|
||||
namespace {
|
||||
|
||||
// TODO(titzer): should Word64 also be implicitly convertable to others?
|
||||
bool IsWord(MachineTypeUnion type) {
|
||||
return (type & (kRepWord8 | kRepWord16 | kRepWord32)) != 0;
|
||||
bool IsWord(MachineRepresentation rep) {
|
||||
return rep == MachineRepresentation::kWord8 ||
|
||||
rep == MachineRepresentation::kWord16 ||
|
||||
rep == MachineRepresentation::kWord32;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@ -110,62 +112,66 @@ bool IsWord(MachineTypeUnion type) {
|
||||
// out signedness for the word32->float64 conversion, then we check that the
|
||||
// uses truncate to word32 (so they do not care about signedness).
|
||||
Node* RepresentationChanger::GetRepresentationFor(Node* node,
|
||||
MachineTypeUnion output_type,
|
||||
MachineTypeUnion use_rep,
|
||||
MachineType output_type,
|
||||
MachineRepresentation use_rep,
|
||||
Truncation truncation) {
|
||||
DCHECK((use_rep & kRepMask) == use_rep);
|
||||
if (!base::bits::IsPowerOfTwo32(output_type & kRepMask)) {
|
||||
// There should be only one output representation.
|
||||
if (output_type.representation() == MachineRepresentation::kNone) {
|
||||
// The output representation should be set.
|
||||
return TypeError(node, output_type, use_rep);
|
||||
}
|
||||
if (use_rep == (output_type & kRepMask)) {
|
||||
if (use_rep == output_type.representation()) {
|
||||
// Representations are the same. That's a no-op.
|
||||
return node;
|
||||
}
|
||||
if (IsWord(use_rep) && IsWord(output_type)) {
|
||||
if (IsWord(use_rep) && IsWord(output_type.representation())) {
|
||||
// Both are words less than or equal to 32-bits.
|
||||
// Since loads of integers from memory implicitly sign or zero extend the
|
||||
// value to the full machine word size and stores implicitly truncate,
|
||||
// no representation change is necessary.
|
||||
return node;
|
||||
}
|
||||
if (use_rep & kRepTagged) {
|
||||
return GetTaggedRepresentationFor(node, output_type);
|
||||
} else if (use_rep & kRepFloat32) {
|
||||
return GetFloat32RepresentationFor(node, output_type, truncation);
|
||||
} else if (use_rep & kRepFloat64) {
|
||||
return GetFloat64RepresentationFor(node, output_type, truncation);
|
||||
} else if (use_rep & kRepBit) {
|
||||
return GetBitRepresentationFor(node, output_type);
|
||||
} else if (IsWord(use_rep)) {
|
||||
return GetWord32RepresentationFor(node, output_type);
|
||||
} else if (use_rep & kRepWord64) {
|
||||
return GetWord64RepresentationFor(node, output_type);
|
||||
} else {
|
||||
return node;
|
||||
switch (use_rep) {
|
||||
case MachineRepresentation::kTagged:
|
||||
return GetTaggedRepresentationFor(node, output_type);
|
||||
case MachineRepresentation::kFloat32:
|
||||
return GetFloat32RepresentationFor(node, output_type, truncation);
|
||||
case MachineRepresentation::kFloat64:
|
||||
return GetFloat64RepresentationFor(node, output_type, truncation);
|
||||
case MachineRepresentation::kBit:
|
||||
return GetBitRepresentationFor(node, output_type);
|
||||
case MachineRepresentation::kWord8:
|
||||
case MachineRepresentation::kWord16:
|
||||
case MachineRepresentation::kWord32:
|
||||
return GetWord32RepresentationFor(node, output_type);
|
||||
case MachineRepresentation::kWord64:
|
||||
return GetWord64RepresentationFor(node, output_type);
|
||||
default:
|
||||
return node;
|
||||
}
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Node* RepresentationChanger::GetTaggedRepresentationFor(
|
||||
Node* node, MachineTypeUnion output_type) {
|
||||
Node* node, MachineType output_type) {
|
||||
// Eagerly fold representation changes for constants.
|
||||
switch (node->opcode()) {
|
||||
case IrOpcode::kNumberConstant:
|
||||
case IrOpcode::kHeapConstant:
|
||||
return node; // No change necessary.
|
||||
case IrOpcode::kInt32Constant:
|
||||
if (output_type & kTypeUint32) {
|
||||
if (output_type.semantic() == MachineSemantic::kUint32) {
|
||||
uint32_t value = static_cast<uint32_t>(OpParameter<int32_t>(node));
|
||||
return jsgraph()->Constant(static_cast<double>(value));
|
||||
} else if (output_type & kTypeInt32) {
|
||||
} else if (output_type.semantic() == MachineSemantic::kInt32) {
|
||||
int32_t value = OpParameter<int32_t>(node);
|
||||
return jsgraph()->Constant(value);
|
||||
} else if (output_type & kRepBit) {
|
||||
} else if (output_type.representation() == MachineRepresentation::kBit) {
|
||||
return OpParameter<int32_t>(node) == 0 ? jsgraph()->FalseConstant()
|
||||
: jsgraph()->TrueConstant();
|
||||
} else {
|
||||
return TypeError(node, output_type, kRepTagged);
|
||||
return TypeError(node, output_type, MachineRepresentation::kTagged);
|
||||
}
|
||||
case IrOpcode::kFloat64Constant:
|
||||
return jsgraph()->Constant(OpParameter<double>(node));
|
||||
@ -176,30 +182,31 @@ Node* RepresentationChanger::GetTaggedRepresentationFor(
|
||||
}
|
||||
// Select the correct X -> Tagged operator.
|
||||
const Operator* op;
|
||||
if (output_type & kRepBit) {
|
||||
if (output_type.representation() == MachineRepresentation::kBit) {
|
||||
op = simplified()->ChangeBitToBool();
|
||||
} else if (IsWord(output_type)) {
|
||||
if (output_type & kTypeUint32) {
|
||||
} else if (IsWord(output_type.representation())) {
|
||||
if (output_type.semantic() == MachineSemantic::kUint32) {
|
||||
op = simplified()->ChangeUint32ToTagged();
|
||||
} else if (output_type & kTypeInt32) {
|
||||
} else if (output_type.semantic() == MachineSemantic::kInt32) {
|
||||
op = simplified()->ChangeInt32ToTagged();
|
||||
} else {
|
||||
return TypeError(node, output_type, kRepTagged);
|
||||
return TypeError(node, output_type, MachineRepresentation::kTagged);
|
||||
}
|
||||
} else if (output_type & kRepFloat32) { // float32 -> float64 -> tagged
|
||||
} else if (output_type.representation() ==
|
||||
MachineRepresentation::kFloat32) { // float32 -> float64 -> tagged
|
||||
node = InsertChangeFloat32ToFloat64(node);
|
||||
op = simplified()->ChangeFloat64ToTagged();
|
||||
} else if (output_type & kRepFloat64) {
|
||||
} else if (output_type.representation() == MachineRepresentation::kFloat64) {
|
||||
op = simplified()->ChangeFloat64ToTagged();
|
||||
} else {
|
||||
return TypeError(node, output_type, kRepTagged);
|
||||
return TypeError(node, output_type, MachineRepresentation::kTagged);
|
||||
}
|
||||
return jsgraph()->graph()->NewNode(op, node);
|
||||
}
|
||||
|
||||
|
||||
Node* RepresentationChanger::GetFloat32RepresentationFor(
|
||||
Node* node, MachineTypeUnion output_type, Truncation truncation) {
|
||||
Node* node, MachineType output_type, Truncation truncation) {
|
||||
// Eagerly fold representation changes for constants.
|
||||
switch (node->opcode()) {
|
||||
case IrOpcode::kFloat64Constant:
|
||||
@ -207,7 +214,7 @@ Node* RepresentationChanger::GetFloat32RepresentationFor(
|
||||
return jsgraph()->Float32Constant(
|
||||
DoubleToFloat32(OpParameter<double>(node)));
|
||||
case IrOpcode::kInt32Constant:
|
||||
if (output_type & kTypeUint32) {
|
||||
if (output_type.semantic() == MachineSemantic::kUint32) {
|
||||
uint32_t value = static_cast<uint32_t>(OpParameter<int32_t>(node));
|
||||
return jsgraph()->Float32Constant(static_cast<float>(value));
|
||||
} else {
|
||||
@ -221,41 +228,42 @@ Node* RepresentationChanger::GetFloat32RepresentationFor(
|
||||
}
|
||||
// Select the correct X -> Float32 operator.
|
||||
const Operator* op;
|
||||
if (output_type & kRepBit) {
|
||||
return TypeError(node, output_type, kRepFloat32);
|
||||
} else if (IsWord(output_type)) {
|
||||
if (output_type & kTypeUint32) {
|
||||
if (output_type.representation() == MachineRepresentation::kBit) {
|
||||
return TypeError(node, output_type, MachineRepresentation::kFloat32);
|
||||
} else if (IsWord(output_type.representation())) {
|
||||
if (output_type.semantic() == MachineSemantic::kUint32) {
|
||||
op = machine()->ChangeUint32ToFloat64();
|
||||
} else {
|
||||
// Either the output is int32 or the uses only care about the
|
||||
// low 32 bits (so we can pick int32 safely).
|
||||
DCHECK(output_type & kTypeInt32 || truncation.TruncatesToWord32());
|
||||
DCHECK(output_type.semantic() == MachineSemantic::kInt32 ||
|
||||
truncation.TruncatesToWord32());
|
||||
op = machine()->ChangeInt32ToFloat64();
|
||||
}
|
||||
// int32 -> float64 -> float32
|
||||
node = jsgraph()->graph()->NewNode(op, node);
|
||||
op = machine()->TruncateFloat64ToFloat32();
|
||||
} else if (output_type & kRepTagged) {
|
||||
} else if (output_type.representation() == MachineRepresentation::kTagged) {
|
||||
op = simplified()->ChangeTaggedToFloat64(); // tagged -> float64 -> float32
|
||||
node = jsgraph()->graph()->NewNode(op, node);
|
||||
op = machine()->TruncateFloat64ToFloat32();
|
||||
} else if (output_type & kRepFloat64) {
|
||||
} else if (output_type.representation() == MachineRepresentation::kFloat64) {
|
||||
op = machine()->TruncateFloat64ToFloat32();
|
||||
} else {
|
||||
return TypeError(node, output_type, kRepFloat32);
|
||||
return TypeError(node, output_type, MachineRepresentation::kFloat32);
|
||||
}
|
||||
return jsgraph()->graph()->NewNode(op, node);
|
||||
}
|
||||
|
||||
|
||||
Node* RepresentationChanger::GetFloat64RepresentationFor(
|
||||
Node* node, MachineTypeUnion output_type, Truncation truncation) {
|
||||
Node* node, MachineType output_type, Truncation truncation) {
|
||||
// Eagerly fold representation changes for constants.
|
||||
switch (node->opcode()) {
|
||||
case IrOpcode::kNumberConstant:
|
||||
return jsgraph()->Float64Constant(OpParameter<double>(node));
|
||||
case IrOpcode::kInt32Constant:
|
||||
if (output_type & kTypeUint32) {
|
||||
if (output_type.semantic() == MachineSemantic::kUint32) {
|
||||
uint32_t value = static_cast<uint32_t>(OpParameter<int32_t>(node));
|
||||
return jsgraph()->Float64Constant(static_cast<double>(value));
|
||||
} else {
|
||||
@ -271,23 +279,24 @@ Node* RepresentationChanger::GetFloat64RepresentationFor(
|
||||
}
|
||||
// Select the correct X -> Float64 operator.
|
||||
const Operator* op;
|
||||
if (output_type & kRepBit) {
|
||||
return TypeError(node, output_type, kRepFloat64);
|
||||
} else if (IsWord(output_type)) {
|
||||
if (output_type & kTypeUint32) {
|
||||
if (output_type.representation() == MachineRepresentation::kBit) {
|
||||
return TypeError(node, output_type, MachineRepresentation::kFloat64);
|
||||
} else if (IsWord(output_type.representation())) {
|
||||
if (output_type.semantic() == MachineSemantic::kUint32) {
|
||||
op = machine()->ChangeUint32ToFloat64();
|
||||
} else {
|
||||
// Either the output is int32 or the uses only care about the
|
||||
// low 32 bits (so we can pick int32 safely).
|
||||
DCHECK(output_type & kTypeInt32 || truncation.TruncatesToWord32());
|
||||
DCHECK(output_type.semantic() == MachineSemantic::kInt32 ||
|
||||
truncation.TruncatesToWord32());
|
||||
op = machine()->ChangeInt32ToFloat64();
|
||||
}
|
||||
} else if (output_type & kRepTagged) {
|
||||
} else if (output_type.representation() == MachineRepresentation::kTagged) {
|
||||
op = simplified()->ChangeTaggedToFloat64();
|
||||
} else if (output_type & kRepFloat32) {
|
||||
} else if (output_type.representation() == MachineRepresentation::kFloat32) {
|
||||
op = machine()->ChangeFloat32ToFloat64();
|
||||
} else {
|
||||
return TypeError(node, output_type, kRepFloat64);
|
||||
return TypeError(node, output_type, MachineRepresentation::kFloat64);
|
||||
}
|
||||
return jsgraph()->graph()->NewNode(op, node);
|
||||
}
|
||||
@ -299,7 +308,7 @@ Node* RepresentationChanger::MakeTruncatedInt32Constant(double value) {
|
||||
|
||||
|
||||
Node* RepresentationChanger::GetWord32RepresentationFor(
|
||||
Node* node, MachineTypeUnion output_type) {
|
||||
Node* node, MachineType output_type) {
|
||||
// Eagerly fold representation changes for constants.
|
||||
switch (node->opcode()) {
|
||||
case IrOpcode::kInt32Constant:
|
||||
@ -316,43 +325,49 @@ Node* RepresentationChanger::GetWord32RepresentationFor(
|
||||
const Operator* op;
|
||||
Type* type = NodeProperties::GetType(node);
|
||||
|
||||
if (output_type & kRepBit) {
|
||||
if (output_type.representation() == MachineRepresentation::kBit) {
|
||||
return node; // Sloppy comparison -> word32
|
||||
} else if (output_type & kRepFloat64) {
|
||||
if (output_type & kTypeUint32 || type->Is(Type::Unsigned32())) {
|
||||
} else if (output_type.representation() == MachineRepresentation::kFloat64) {
|
||||
if (output_type.semantic() == MachineSemantic::kUint32 ||
|
||||
type->Is(Type::Unsigned32())) {
|
||||
op = machine()->ChangeFloat64ToUint32();
|
||||
} else if (output_type & kTypeInt32 || type->Is(Type::Signed32())) {
|
||||
} else if (output_type.semantic() == MachineSemantic::kInt32 ||
|
||||
type->Is(Type::Signed32())) {
|
||||
op = machine()->ChangeFloat64ToInt32();
|
||||
} else {
|
||||
op = machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript);
|
||||
}
|
||||
} else if (output_type & kRepFloat32) {
|
||||
} else if (output_type.representation() == MachineRepresentation::kFloat32) {
|
||||
node = InsertChangeFloat32ToFloat64(node); // float32 -> float64 -> int32
|
||||
if (output_type & kTypeUint32 || type->Is(Type::Unsigned32())) {
|
||||
if (output_type.semantic() == MachineSemantic::kUint32 ||
|
||||
type->Is(Type::Unsigned32())) {
|
||||
op = machine()->ChangeFloat64ToUint32();
|
||||
} else if (output_type & kTypeInt32 || type->Is(Type::Signed32())) {
|
||||
} else if (output_type.semantic() == MachineSemantic::kInt32 ||
|
||||
type->Is(Type::Signed32())) {
|
||||
op = machine()->ChangeFloat64ToInt32();
|
||||
} else {
|
||||
op = machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript);
|
||||
}
|
||||
} else if (output_type & kRepTagged) {
|
||||
if (output_type & kTypeUint32 || type->Is(Type::Unsigned32())) {
|
||||
} else if (output_type.representation() == MachineRepresentation::kTagged) {
|
||||
if (output_type.semantic() == MachineSemantic::kUint32 ||
|
||||
type->Is(Type::Unsigned32())) {
|
||||
op = simplified()->ChangeTaggedToUint32();
|
||||
} else if (output_type & kTypeInt32 || type->Is(Type::Signed32())) {
|
||||
} else if (output_type.semantic() == MachineSemantic::kInt32 ||
|
||||
type->Is(Type::Signed32())) {
|
||||
op = simplified()->ChangeTaggedToInt32();
|
||||
} else {
|
||||
node = InsertChangeTaggedToFloat64(node);
|
||||
op = machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript);
|
||||
}
|
||||
} else {
|
||||
return TypeError(node, output_type, kRepWord32);
|
||||
return TypeError(node, output_type, MachineRepresentation::kWord32);
|
||||
}
|
||||
return jsgraph()->graph()->NewNode(op, node);
|
||||
}
|
||||
|
||||
|
||||
Node* RepresentationChanger::GetBitRepresentationFor(
|
||||
Node* node, MachineTypeUnion output_type) {
|
||||
Node* RepresentationChanger::GetBitRepresentationFor(Node* node,
|
||||
MachineType output_type) {
|
||||
// Eagerly fold representation changes for constants.
|
||||
switch (node->opcode()) {
|
||||
case IrOpcode::kHeapConstant: {
|
||||
@ -367,22 +382,22 @@ Node* RepresentationChanger::GetBitRepresentationFor(
|
||||
}
|
||||
// Select the correct X -> Bit operator.
|
||||
const Operator* op;
|
||||
if (output_type & kRepTagged) {
|
||||
if (output_type.representation() == MachineRepresentation::kTagged) {
|
||||
op = simplified()->ChangeBoolToBit();
|
||||
} else {
|
||||
return TypeError(node, output_type, kRepBit);
|
||||
return TypeError(node, output_type, MachineRepresentation::kBit);
|
||||
}
|
||||
return jsgraph()->graph()->NewNode(op, node);
|
||||
}
|
||||
|
||||
|
||||
Node* RepresentationChanger::GetWord64RepresentationFor(
|
||||
Node* node, MachineTypeUnion output_type) {
|
||||
if (output_type & kRepBit) {
|
||||
Node* node, MachineType output_type) {
|
||||
if (output_type.representation() == MachineRepresentation::kBit) {
|
||||
return node; // Sloppy comparison -> word64
|
||||
}
|
||||
// Can't really convert Word64 to anything else. Purported to be internal.
|
||||
return TypeError(node, output_type, kRepWord64);
|
||||
return TypeError(node, output_type, MachineRepresentation::kWord64);
|
||||
}
|
||||
|
||||
|
||||
@ -470,25 +485,25 @@ const Operator* RepresentationChanger::Float64OperatorFor(
|
||||
}
|
||||
|
||||
|
||||
MachineType RepresentationChanger::TypeFromUpperBound(Type* type) {
|
||||
MachineSemantic RepresentationChanger::TypeFromUpperBound(Type* type) {
|
||||
CHECK(!type->Is(Type::None()));
|
||||
if (type->Is(Type::Signed32())) return kTypeInt32;
|
||||
if (type->Is(Type::Unsigned32())) return kTypeUint32;
|
||||
if (type->Is(Type::Number())) return kTypeNumber;
|
||||
if (type->Is(Type::Boolean())) return kTypeBool;
|
||||
return kTypeAny;
|
||||
if (type->Is(Type::Signed32())) return MachineSemantic::kInt32;
|
||||
if (type->Is(Type::Unsigned32())) return MachineSemantic::kUint32;
|
||||
if (type->Is(Type::Number())) return MachineSemantic::kNumber;
|
||||
if (type->Is(Type::Boolean())) return MachineSemantic::kBool;
|
||||
return MachineSemantic::kAny;
|
||||
}
|
||||
|
||||
|
||||
Node* RepresentationChanger::TypeError(Node* node, MachineTypeUnion output_type,
|
||||
MachineTypeUnion use) {
|
||||
Node* RepresentationChanger::TypeError(Node* node, MachineType output_type,
|
||||
MachineRepresentation use) {
|
||||
type_error_ = true;
|
||||
if (!testing_type_errors_) {
|
||||
std::ostringstream out_str;
|
||||
out_str << static_cast<MachineType>(output_type);
|
||||
out_str << output_type;
|
||||
|
||||
std::ostringstream use_str;
|
||||
use_str << static_cast<MachineType>(use);
|
||||
use_str << use;
|
||||
|
||||
V8_Fatal(__FILE__, __LINE__,
|
||||
"RepresentationChangerError: node #%d:%s of "
|
||||
|
@ -86,20 +86,22 @@ class RepresentationChanger final {
|
||||
// parameter is only used for sanity checking - if the changer cannot figure
|
||||
// out signedness for the word32->float64 conversion, then we check that the
|
||||
// uses truncate to word32 (so they do not care about signedness).
|
||||
Node* GetRepresentationFor(Node* node, MachineTypeUnion output_type,
|
||||
MachineTypeUnion use_rep,
|
||||
Node* GetRepresentationFor(Node* node, MachineType output_type,
|
||||
MachineRepresentation use_rep,
|
||||
Truncation truncation = Truncation::None());
|
||||
const Operator* Int32OperatorFor(IrOpcode::Value opcode);
|
||||
const Operator* Uint32OperatorFor(IrOpcode::Value opcode);
|
||||
const Operator* Float64OperatorFor(IrOpcode::Value opcode);
|
||||
MachineType TypeFromUpperBound(Type* type);
|
||||
MachineSemantic TypeFromUpperBound(Type* type);
|
||||
|
||||
MachineType TypeForBasePointer(const FieldAccess& access) {
|
||||
return access.tag() != 0 ? kMachAnyTagged : kMachPtr;
|
||||
return access.tag() != 0 ? MachineType::AnyTagged()
|
||||
: MachineType::Pointer();
|
||||
}
|
||||
|
||||
MachineType TypeForBasePointer(const ElementAccess& access) {
|
||||
return access.tag() != 0 ? kMachAnyTagged : kMachPtr;
|
||||
return access.tag() != 0 ? MachineType::AnyTagged()
|
||||
: MachineType::Pointer();
|
||||
}
|
||||
|
||||
private:
|
||||
@ -111,16 +113,16 @@ class RepresentationChanger final {
|
||||
bool testing_type_errors_; // If {true}, don't abort on a type error.
|
||||
bool type_error_; // Set when a type error is detected.
|
||||
|
||||
Node* GetTaggedRepresentationFor(Node* node, MachineTypeUnion output_type);
|
||||
Node* GetFloat32RepresentationFor(Node* node, MachineTypeUnion output_type,
|
||||
Node* GetTaggedRepresentationFor(Node* node, MachineType output_type);
|
||||
Node* GetFloat32RepresentationFor(Node* node, MachineType output_type,
|
||||
Truncation truncation);
|
||||
Node* GetFloat64RepresentationFor(Node* node, MachineTypeUnion output_type,
|
||||
Node* GetFloat64RepresentationFor(Node* node, MachineType output_type,
|
||||
Truncation truncation);
|
||||
Node* GetWord32RepresentationFor(Node* node, MachineTypeUnion output_type);
|
||||
Node* GetBitRepresentationFor(Node* node, MachineTypeUnion output_type);
|
||||
Node* GetWord64RepresentationFor(Node* node, MachineTypeUnion output_type);
|
||||
Node* TypeError(Node* node, MachineTypeUnion output_type,
|
||||
MachineTypeUnion use);
|
||||
Node* GetWord32RepresentationFor(Node* node, MachineType output_type);
|
||||
Node* GetBitRepresentationFor(Node* node, MachineType output_type);
|
||||
Node* GetWord64RepresentationFor(Node* node, MachineType output_type);
|
||||
Node* TypeError(Node* node, MachineType output_type,
|
||||
MachineRepresentation use);
|
||||
Node* MakeTruncatedInt32Constant(double value);
|
||||
Node* InsertChangeFloat32ToFloat64(Node* node);
|
||||
Node* InsertChangeTaggedToFloat64(Node* node);
|
||||
|
@ -55,7 +55,7 @@ Reduction SelectLowering::Reduce(Node* node) {
|
||||
node->ReplaceInput(0, vthen);
|
||||
node->ReplaceInput(1, velse);
|
||||
node->ReplaceInput(2, merge);
|
||||
NodeProperties::ChangeOp(node, common()->Phi(p.type(), 2));
|
||||
NodeProperties::ChangeOp(node, common()->Phi(p.representation(), 2));
|
||||
return Changed(node);
|
||||
}
|
||||
|
||||
|
@ -73,75 +73,80 @@ namespace {
|
||||
// need the signedness information to produce the correct value.
|
||||
class UseInfo {
|
||||
public:
|
||||
UseInfo(MachineType preferred, Truncation truncation)
|
||||
: preferred_(preferred), truncation_(truncation) {
|
||||
DCHECK(preferred == (preferred & kRepMask));
|
||||
}
|
||||
UseInfo(MachineRepresentation preferred, Truncation truncation)
|
||||
: preferred_(preferred), truncation_(truncation) {}
|
||||
static UseInfo TruncatingWord32() {
|
||||
return UseInfo(kRepWord32, Truncation::Word32());
|
||||
return UseInfo(MachineRepresentation::kWord32, Truncation::Word32());
|
||||
}
|
||||
static UseInfo TruncatingWord64() {
|
||||
return UseInfo(kRepWord64, Truncation::Word64());
|
||||
return UseInfo(MachineRepresentation::kWord64, Truncation::Word64());
|
||||
}
|
||||
static UseInfo Bool() {
|
||||
return UseInfo(MachineRepresentation::kBit, Truncation::Bool());
|
||||
}
|
||||
static UseInfo Bool() { return UseInfo(kRepBit, Truncation::Bool()); }
|
||||
static UseInfo Float32() {
|
||||
return UseInfo(kRepFloat32, Truncation::Float32());
|
||||
return UseInfo(MachineRepresentation::kFloat32, Truncation::Float32());
|
||||
}
|
||||
static UseInfo Float64() {
|
||||
return UseInfo(kRepFloat64, Truncation::Float64());
|
||||
return UseInfo(MachineRepresentation::kFloat64, Truncation::Float64());
|
||||
}
|
||||
static UseInfo PointerInt() {
|
||||
return kPointerSize == 4 ? TruncatingWord32() : TruncatingWord64();
|
||||
}
|
||||
static UseInfo AnyTagged() { return UseInfo(kRepTagged, Truncation::Any()); }
|
||||
static UseInfo AnyTagged() {
|
||||
return UseInfo(MachineRepresentation::kTagged, Truncation::Any());
|
||||
}
|
||||
|
||||
// Undetermined representation.
|
||||
static UseInfo Any() { return UseInfo(kMachNone, Truncation::Any()); }
|
||||
static UseInfo None() { return UseInfo(kMachNone, Truncation::None()); }
|
||||
static UseInfo Any() {
|
||||
return UseInfo(MachineRepresentation::kNone, Truncation::Any());
|
||||
}
|
||||
static UseInfo None() {
|
||||
return UseInfo(MachineRepresentation::kNone, Truncation::None());
|
||||
}
|
||||
|
||||
// Truncation to a representation that is smaller than the preferred
|
||||
// one.
|
||||
static UseInfo Float64TruncatingToWord32() {
|
||||
return UseInfo(kRepFloat64, Truncation::Word32());
|
||||
return UseInfo(MachineRepresentation::kFloat64, Truncation::Word32());
|
||||
}
|
||||
static UseInfo Word64TruncatingToWord32() {
|
||||
return UseInfo(kRepWord64, Truncation::Word32());
|
||||
return UseInfo(MachineRepresentation::kWord64, Truncation::Word32());
|
||||
}
|
||||
static UseInfo AnyTruncatingToBool() {
|
||||
return UseInfo(kMachNone, Truncation::Bool());
|
||||
return UseInfo(MachineRepresentation::kNone, Truncation::Bool());
|
||||
}
|
||||
|
||||
MachineType preferred() const { return preferred_; }
|
||||
MachineRepresentation preferred() const { return preferred_; }
|
||||
Truncation truncation() const { return truncation_; }
|
||||
|
||||
private:
|
||||
MachineType preferred_;
|
||||
MachineRepresentation preferred_;
|
||||
Truncation truncation_;
|
||||
};
|
||||
|
||||
|
||||
UseInfo UseInfoFromMachineType(MachineType type) {
|
||||
MachineTypeUnion rep = RepresentationOf(type);
|
||||
DCHECK((rep & kTypeMask) == 0);
|
||||
|
||||
if (rep & kRepTagged) return UseInfo::AnyTagged();
|
||||
if (rep & kRepFloat64) {
|
||||
DCHECK((rep & kRepWord64) == 0);
|
||||
UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) {
|
||||
switch (rep) {
|
||||
case MachineRepresentation::kTagged:
|
||||
return UseInfo::AnyTagged();
|
||||
case MachineRepresentation::kFloat64:
|
||||
return UseInfo::Float64();
|
||||
}
|
||||
if (rep & kRepFloat32) {
|
||||
if (rep == kRepFloat32) return UseInfo::Float32();
|
||||
return UseInfo::AnyTagged();
|
||||
}
|
||||
if (rep & kRepWord64) {
|
||||
case MachineRepresentation::kFloat32:
|
||||
return UseInfo::Float32();
|
||||
case MachineRepresentation::kWord64:
|
||||
return UseInfo::TruncatingWord64();
|
||||
}
|
||||
if (rep & (kRepWord32 | kRepWord16 | kRepWord8)) {
|
||||
CHECK(!(rep & kRepBit));
|
||||
case MachineRepresentation::kWord8:
|
||||
case MachineRepresentation::kWord16:
|
||||
case MachineRepresentation::kWord32:
|
||||
return UseInfo::TruncatingWord32();
|
||||
case MachineRepresentation::kBit:
|
||||
return UseInfo::Bool();
|
||||
case MachineRepresentation::kNone:
|
||||
break;
|
||||
}
|
||||
DCHECK(rep & kRepBit);
|
||||
return UseInfo::Bool();
|
||||
UNREACHABLE();
|
||||
return UseInfo::None();
|
||||
}
|
||||
|
||||
|
||||
@ -158,24 +163,27 @@ UseInfo UseInfoForBasePointer(const ElementAccess& access) {
|
||||
#ifdef DEBUG
|
||||
// Helpers for monotonicity checking.
|
||||
|
||||
bool MachineTypeIsSubtype(MachineType t1, MachineType t2) {
|
||||
bool MachineTypeIsSubtype(MachineSemantic t1, MachineSemantic t2) {
|
||||
switch (t1) {
|
||||
case kMachNone:
|
||||
case MachineSemantic::kNone:
|
||||
return true;
|
||||
case kTypeBool:
|
||||
return t2 == kTypeBool || t2 == kTypeNumber || t2 == kTypeAny;
|
||||
case kTypeInt32:
|
||||
return t2 == kTypeInt32 || t2 == kTypeNumber || t2 == kTypeAny;
|
||||
case kTypeUint32:
|
||||
return t2 == kTypeUint32 || t2 == kTypeNumber || t2 == kTypeAny;
|
||||
case kTypeInt64:
|
||||
return t2 == kTypeInt64;
|
||||
case kTypeUint64:
|
||||
return t2 == kTypeUint64;
|
||||
case kTypeNumber:
|
||||
return t2 == kTypeNumber || t2 == kTypeAny;
|
||||
case kTypeAny:
|
||||
return t2 == kTypeAny;
|
||||
case MachineSemantic::kBool:
|
||||
return t2 == MachineSemantic::kBool || t2 == MachineSemantic::kNumber ||
|
||||
t2 == MachineSemantic::kAny;
|
||||
case MachineSemantic::kInt32:
|
||||
return t2 == MachineSemantic::kInt32 || t2 == MachineSemantic::kNumber ||
|
||||
t2 == MachineSemantic::kAny;
|
||||
case MachineSemantic::kUint32:
|
||||
return t2 == MachineSemantic::kUint32 || t2 == MachineSemantic::kNumber ||
|
||||
t2 == MachineSemantic::kAny;
|
||||
case MachineSemantic::kInt64:
|
||||
return t2 == MachineSemantic::kInt64;
|
||||
case MachineSemantic::kUint64:
|
||||
return t2 == MachineSemantic::kUint64;
|
||||
case MachineSemantic::kNumber:
|
||||
return t2 == MachineSemantic::kNumber || t2 == MachineSemantic::kAny;
|
||||
case MachineSemantic::kAny:
|
||||
return t2 == MachineSemantic::kAny;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -184,30 +192,45 @@ bool MachineTypeIsSubtype(MachineType t1, MachineType t2) {
|
||||
}
|
||||
|
||||
|
||||
bool MachineRepresentationIsSubtype(MachineType r1, MachineType r2) {
|
||||
bool MachineRepresentationIsSubtype(MachineRepresentation r1,
|
||||
MachineRepresentation r2) {
|
||||
switch (r1) {
|
||||
case kMachNone:
|
||||
case MachineRepresentation::kNone:
|
||||
return true;
|
||||
case kRepBit:
|
||||
return r2 == kRepBit || r2 == kRepTagged;
|
||||
case kRepWord8:
|
||||
return r2 == kRepWord8 || r2 == kRepWord16 || r2 == kRepWord32 ||
|
||||
r2 == kRepWord64 || r2 == kRepFloat32 || r2 == kRepFloat64 ||
|
||||
r2 == kRepTagged;
|
||||
case kRepWord16:
|
||||
return r2 == kRepWord16 || r2 == kRepWord32 || r2 == kRepWord64 ||
|
||||
r2 == kRepFloat32 || r2 == kRepFloat64 || r2 == kRepTagged;
|
||||
case kRepWord32:
|
||||
return r2 == kRepWord32 || r2 == kRepWord64 || r2 == kRepFloat64 ||
|
||||
r2 == kRepTagged;
|
||||
case kRepWord64:
|
||||
return r2 == kRepWord64;
|
||||
case kRepFloat32:
|
||||
return r2 == kRepFloat32 || r2 == kRepFloat64 || r2 == kRepTagged;
|
||||
case kRepFloat64:
|
||||
return r2 == kRepFloat64 || r2 == kRepTagged;
|
||||
case kRepTagged:
|
||||
return r2 == kRepTagged;
|
||||
case MachineRepresentation::kBit:
|
||||
return r2 == MachineRepresentation::kBit ||
|
||||
r2 == MachineRepresentation::kTagged;
|
||||
case MachineRepresentation::kWord8:
|
||||
return r2 == MachineRepresentation::kWord8 ||
|
||||
r2 == MachineRepresentation::kWord16 ||
|
||||
r2 == MachineRepresentation::kWord32 ||
|
||||
r2 == MachineRepresentation::kWord64 ||
|
||||
r2 == MachineRepresentation::kFloat32 ||
|
||||
r2 == MachineRepresentation::kFloat64 ||
|
||||
r2 == MachineRepresentation::kTagged;
|
||||
case MachineRepresentation::kWord16:
|
||||
return r2 == MachineRepresentation::kWord16 ||
|
||||
r2 == MachineRepresentation::kWord32 ||
|
||||
r2 == MachineRepresentation::kWord64 ||
|
||||
r2 == MachineRepresentation::kFloat32 ||
|
||||
r2 == MachineRepresentation::kFloat64 ||
|
||||
r2 == MachineRepresentation::kTagged;
|
||||
case MachineRepresentation::kWord32:
|
||||
return r2 == MachineRepresentation::kWord32 ||
|
||||
r2 == MachineRepresentation::kWord64 ||
|
||||
r2 == MachineRepresentation::kFloat64 ||
|
||||
r2 == MachineRepresentation::kTagged;
|
||||
case MachineRepresentation::kWord64:
|
||||
return r2 == MachineRepresentation::kWord64;
|
||||
case MachineRepresentation::kFloat32:
|
||||
return r2 == MachineRepresentation::kFloat32 ||
|
||||
r2 == MachineRepresentation::kFloat64 ||
|
||||
r2 == MachineRepresentation::kTagged;
|
||||
case MachineRepresentation::kFloat64:
|
||||
return r2 == MachineRepresentation::kFloat64 ||
|
||||
r2 == MachineRepresentation::kTagged;
|
||||
case MachineRepresentation::kTagged:
|
||||
return r2 == MachineRepresentation::kTagged;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -216,12 +239,10 @@ bool MachineRepresentationIsSubtype(MachineType r1, MachineType r2) {
|
||||
}
|
||||
|
||||
|
||||
bool MachineTypeRepIsSubtype(MachineTypeUnion m1, MachineTypeUnion m2) {
|
||||
return MachineTypeIsSubtype(static_cast<MachineType>(m1 & kTypeMask),
|
||||
static_cast<MachineType>(m2 & kTypeMask)) &&
|
||||
MachineRepresentationIsSubtype(
|
||||
static_cast<MachineType>(m1 & kRepMask),
|
||||
static_cast<MachineType>(m2 & kRepMask));
|
||||
bool MachineTypeRepIsSubtype(MachineType m1, MachineType m2) {
|
||||
return MachineTypeIsSubtype(m1.semantic(), m2.semantic()) &&
|
||||
MachineRepresentationIsSubtype(m1.representation(),
|
||||
m2.representation());
|
||||
}
|
||||
|
||||
|
||||
@ -271,13 +292,13 @@ class RepresentationSelector {
|
||||
void set_visited() { visited_ = true; }
|
||||
bool visited() const { return visited_; }
|
||||
Truncation truncation() const { return truncation_; }
|
||||
void set_output_type(MachineTypeUnion type) { output_ = type; }
|
||||
MachineTypeUnion output_type() const { return output_; }
|
||||
void set_output_type(MachineType type) { output_ = type; }
|
||||
MachineType output_type() const { return output_; }
|
||||
|
||||
private:
|
||||
bool queued_ = false; // Bookkeeping for the traversal.
|
||||
bool visited_ = false; // Bookkeeping for the traversal.
|
||||
MachineTypeUnion output_ = kMachNone; // Output type of the node.
|
||||
MachineType output_ = MachineType::None(); // Output type of the node.
|
||||
Truncation truncation_ = Truncation::None(); // Information about uses.
|
||||
};
|
||||
|
||||
@ -394,12 +415,10 @@ class RepresentationSelector {
|
||||
|
||||
bool lower() { return phase_ == LOWER; }
|
||||
|
||||
void SetOutput(Node* node, MachineTypeUnion output) {
|
||||
void SetOutput(Node* node, MachineType output) {
|
||||
// Every node should have at most one output representation. Note that
|
||||
// phis can have 0, if they have not been used in a representation-inducing
|
||||
// instruction.
|
||||
DCHECK((output & kRepMask) == 0 ||
|
||||
base::bits::IsPowerOfTwo32(output & kRepMask));
|
||||
NodeInfo* info = GetInfo(node);
|
||||
DCHECK(MachineTypeRepIsSubtype(info->output_type(), output));
|
||||
info->set_output_type(output);
|
||||
@ -414,10 +433,10 @@ class RepresentationSelector {
|
||||
void ConvertInput(Node* node, int index, UseInfo use) {
|
||||
Node* input = node->InputAt(index);
|
||||
// In the change phase, insert a change before the use if necessary.
|
||||
if (use.preferred() == kMachNone)
|
||||
if (use.preferred() == MachineRepresentation::kNone)
|
||||
return; // No input requirement on the use.
|
||||
MachineTypeUnion output = GetInfo(input)->output_type();
|
||||
if ((output & kRepMask) != use.preferred()) {
|
||||
MachineType output = GetInfo(input)->output_type();
|
||||
if (output.representation() != use.preferred()) {
|
||||
// Output representation doesn't match usage.
|
||||
TRACE(" change: #%d:%s(@%d #%d:%s) ", node->id(), node->op()->mnemonic(),
|
||||
index, input->id(), input->op()->mnemonic());
|
||||
@ -472,7 +491,7 @@ class RepresentationSelector {
|
||||
|
||||
// Helper for binops of the R x L -> O variety.
|
||||
void VisitBinop(Node* node, UseInfo left_use, UseInfo right_use,
|
||||
MachineTypeUnion output) {
|
||||
MachineType output) {
|
||||
DCHECK_EQ(2, node->op()->ValueInputCount());
|
||||
ProcessInput(node, 0, left_use);
|
||||
ProcessInput(node, 1, right_use);
|
||||
@ -483,95 +502,95 @@ class RepresentationSelector {
|
||||
}
|
||||
|
||||
// Helper for binops of the I x I -> O variety.
|
||||
void VisitBinop(Node* node, UseInfo input_use, MachineTypeUnion output) {
|
||||
void VisitBinop(Node* node, UseInfo input_use, MachineType output) {
|
||||
VisitBinop(node, input_use, input_use, output);
|
||||
}
|
||||
|
||||
// Helper for unops of the I -> O variety.
|
||||
void VisitUnop(Node* node, UseInfo input_use, MachineTypeUnion output) {
|
||||
void VisitUnop(Node* node, UseInfo input_use, MachineType output) {
|
||||
DCHECK_EQ(1, node->InputCount());
|
||||
ProcessInput(node, 0, input_use);
|
||||
SetOutput(node, output);
|
||||
}
|
||||
|
||||
// Helper for leaf nodes.
|
||||
void VisitLeaf(Node* node, MachineTypeUnion output) {
|
||||
void VisitLeaf(Node* node, MachineType output) {
|
||||
DCHECK_EQ(0, node->InputCount());
|
||||
SetOutput(node, output);
|
||||
}
|
||||
|
||||
// Helpers for specific types of binops.
|
||||
void VisitFloat64Binop(Node* node) {
|
||||
VisitBinop(node, UseInfo::Float64(), kMachFloat64);
|
||||
VisitBinop(node, UseInfo::Float64(), MachineType::Float64());
|
||||
}
|
||||
void VisitInt32Binop(Node* node) {
|
||||
VisitBinop(node, UseInfo::TruncatingWord32(), kMachInt32);
|
||||
VisitBinop(node, UseInfo::TruncatingWord32(), MachineType::Int32());
|
||||
}
|
||||
void VisitUint32Binop(Node* node) {
|
||||
VisitBinop(node, UseInfo::TruncatingWord32(), kMachUint32);
|
||||
VisitBinop(node, UseInfo::TruncatingWord32(), MachineType::Uint32());
|
||||
}
|
||||
void VisitInt64Binop(Node* node) {
|
||||
VisitBinop(node, UseInfo::TruncatingWord64(), kMachInt64);
|
||||
VisitBinop(node, UseInfo::TruncatingWord64(), MachineType::Int64());
|
||||
}
|
||||
void VisitUint64Binop(Node* node) {
|
||||
VisitBinop(node, UseInfo::TruncatingWord64(), kMachUint64);
|
||||
VisitBinop(node, UseInfo::TruncatingWord64(), MachineType::Uint64());
|
||||
}
|
||||
void VisitFloat64Cmp(Node* node) {
|
||||
VisitBinop(node, UseInfo::Float64(), kMachBool);
|
||||
VisitBinop(node, UseInfo::Float64(), MachineType::Bool());
|
||||
}
|
||||
void VisitInt32Cmp(Node* node) {
|
||||
VisitBinop(node, UseInfo::TruncatingWord32(), kMachBool);
|
||||
VisitBinop(node, UseInfo::TruncatingWord32(), MachineType::Bool());
|
||||
}
|
||||
void VisitUint32Cmp(Node* node) {
|
||||
VisitBinop(node, UseInfo::TruncatingWord32(), kMachBool);
|
||||
VisitBinop(node, UseInfo::TruncatingWord32(), MachineType::Bool());
|
||||
}
|
||||
void VisitInt64Cmp(Node* node) {
|
||||
VisitBinop(node, UseInfo::TruncatingWord64(), kMachBool);
|
||||
VisitBinop(node, UseInfo::TruncatingWord64(), MachineType::Bool());
|
||||
}
|
||||
void VisitUint64Cmp(Node* node) {
|
||||
VisitBinop(node, UseInfo::TruncatingWord64(), kMachBool);
|
||||
VisitBinop(node, UseInfo::TruncatingWord64(), MachineType::Bool());
|
||||
}
|
||||
|
||||
// Infer representation for phi-like nodes.
|
||||
static MachineType GetRepresentationForPhi(Node* node, Truncation use) {
|
||||
static MachineRepresentation GetRepresentationForPhi(Node* node,
|
||||
Truncation use) {
|
||||
// Phis adapt to the output representation their uses demand.
|
||||
Type* upper = NodeProperties::GetType(node);
|
||||
if (upper->Is(Type::Signed32()) || upper->Is(Type::Unsigned32())) {
|
||||
// We are within 32 bits range => pick kRepWord32.
|
||||
return kRepWord32;
|
||||
return MachineRepresentation::kWord32;
|
||||
} else if (use.TruncatesToWord32()) {
|
||||
// We only use 32 bits.
|
||||
return kRepWord32;
|
||||
return MachineRepresentation::kWord32;
|
||||
} else if (upper->Is(Type::Boolean())) {
|
||||
// multiple uses => pick kRepBit.
|
||||
return kRepBit;
|
||||
return MachineRepresentation::kBit;
|
||||
} else if (upper->Is(Type::Number())) {
|
||||
// multiple uses => pick kRepFloat64.
|
||||
return kRepFloat64;
|
||||
return MachineRepresentation::kFloat64;
|
||||
} else if (upper->Is(Type::Internal())) {
|
||||
return kMachPtr;
|
||||
return MachineType::PointerRepresentation();
|
||||
}
|
||||
return kRepTagged;
|
||||
return MachineRepresentation::kTagged;
|
||||
}
|
||||
|
||||
// Helper for handling selects.
|
||||
void VisitSelect(Node* node, Truncation truncation,
|
||||
SimplifiedLowering* lowering) {
|
||||
ProcessInput(node, 0, UseInfo::Bool());
|
||||
MachineType output = GetRepresentationForPhi(node, truncation);
|
||||
MachineRepresentation output = GetRepresentationForPhi(node, truncation);
|
||||
|
||||
Type* upper = NodeProperties::GetType(node);
|
||||
MachineType output_type =
|
||||
static_cast<MachineType>(changer_->TypeFromUpperBound(upper) | output);
|
||||
MachineType(output, changer_->TypeFromUpperBound(upper));
|
||||
SetOutput(node, output_type);
|
||||
|
||||
if (lower()) {
|
||||
// Update the select operator.
|
||||
SelectParameters p = SelectParametersOf(node->op());
|
||||
MachineType type = static_cast<MachineType>(output_type);
|
||||
if (type != p.type()) {
|
||||
if (output != p.representation()) {
|
||||
NodeProperties::ChangeOp(node,
|
||||
lowering->common()->Select(type, p.hint()));
|
||||
lowering->common()->Select(output, p.hint()));
|
||||
}
|
||||
}
|
||||
// Convert inputs to the output representation of this phi, pass the
|
||||
@ -584,20 +603,19 @@ class RepresentationSelector {
|
||||
// Helper for handling phis.
|
||||
void VisitPhi(Node* node, Truncation truncation,
|
||||
SimplifiedLowering* lowering) {
|
||||
MachineType output = GetRepresentationForPhi(node, truncation);
|
||||
MachineRepresentation output = GetRepresentationForPhi(node, truncation);
|
||||
|
||||
Type* upper = NodeProperties::GetType(node);
|
||||
MachineType output_type =
|
||||
static_cast<MachineType>(changer_->TypeFromUpperBound(upper) | output);
|
||||
MachineType(output, changer_->TypeFromUpperBound(upper));
|
||||
SetOutput(node, output_type);
|
||||
|
||||
int values = node->op()->ValueInputCount();
|
||||
|
||||
if (lower()) {
|
||||
// Update the phi operator.
|
||||
MachineType type = static_cast<MachineType>(output_type);
|
||||
if (type != OpParameter<MachineType>(node)) {
|
||||
NodeProperties::ChangeOp(node, lowering->common()->Phi(type, values));
|
||||
if (output != PhiRepresentationOf(node->op())) {
|
||||
NodeProperties::ChangeOp(node, lowering->common()->Phi(output, values));
|
||||
}
|
||||
}
|
||||
|
||||
@ -619,7 +637,8 @@ class RepresentationSelector {
|
||||
// The target of the call.
|
||||
ProcessInput(node, i, UseInfo::None());
|
||||
} else if ((i - 1) < params) {
|
||||
ProcessInput(node, i, UseInfoFromMachineType(sig->GetParam(i - 1)));
|
||||
ProcessInput(node, i, TruncatingUseInfoFromRepresentation(
|
||||
sig->GetParam(i - 1).representation()));
|
||||
} else {
|
||||
ProcessInput(node, i, UseInfo::None());
|
||||
}
|
||||
@ -628,7 +647,7 @@ class RepresentationSelector {
|
||||
if (sig->return_count() > 0) {
|
||||
SetOutput(node, desc->GetMachineSignature()->GetReturn());
|
||||
} else {
|
||||
SetOutput(node, kMachAnyTagged);
|
||||
SetOutput(node, MachineType::AnyTagged());
|
||||
}
|
||||
}
|
||||
|
||||
@ -643,13 +662,13 @@ class RepresentationSelector {
|
||||
new (zone->New(sizeof(ZoneVector<MachineType>)))
|
||||
ZoneVector<MachineType>(node->InputCount(), zone);
|
||||
for (int i = 0; i < node->InputCount(); i++) {
|
||||
MachineTypeUnion input_type = GetInfo(node->InputAt(i))->output_type();
|
||||
(*types)[i] = static_cast<MachineType>(input_type);
|
||||
MachineType input_type = GetInfo(node->InputAt(i))->output_type();
|
||||
(*types)[i] = input_type;
|
||||
}
|
||||
NodeProperties::ChangeOp(node,
|
||||
jsgraph_->common()->TypedStateValues(types));
|
||||
}
|
||||
SetOutput(node, kMachAnyTagged);
|
||||
SetOutput(node, MachineType::AnyTagged());
|
||||
}
|
||||
|
||||
const Operator* Int32Op(Node* node) {
|
||||
@ -700,28 +719,29 @@ class RepresentationSelector {
|
||||
//------------------------------------------------------------------
|
||||
case IrOpcode::kStart:
|
||||
case IrOpcode::kDead:
|
||||
return VisitLeaf(node, 0);
|
||||
return VisitLeaf(node, MachineType::None());
|
||||
case IrOpcode::kParameter: {
|
||||
// TODO(titzer): use representation from linkage.
|
||||
Type* upper = NodeProperties::GetType(node);
|
||||
ProcessInput(node, 0, UseInfo::None());
|
||||
SetOutput(node, kRepTagged | changer_->TypeFromUpperBound(upper));
|
||||
SetOutput(node, MachineType(MachineRepresentation::kTagged,
|
||||
changer_->TypeFromUpperBound(upper)));
|
||||
return;
|
||||
}
|
||||
case IrOpcode::kInt32Constant:
|
||||
return VisitLeaf(node, kRepWord32);
|
||||
return VisitLeaf(node, MachineType::RepWord32());
|
||||
case IrOpcode::kInt64Constant:
|
||||
return VisitLeaf(node, kRepWord64);
|
||||
return VisitLeaf(node, MachineType::RepWord64());
|
||||
case IrOpcode::kFloat32Constant:
|
||||
return VisitLeaf(node, kRepFloat32);
|
||||
return VisitLeaf(node, MachineType::RepFloat32());
|
||||
case IrOpcode::kFloat64Constant:
|
||||
return VisitLeaf(node, kRepFloat64);
|
||||
return VisitLeaf(node, MachineType::RepFloat64());
|
||||
case IrOpcode::kExternalConstant:
|
||||
return VisitLeaf(node, kMachPtr);
|
||||
return VisitLeaf(node, MachineType::Pointer());
|
||||
case IrOpcode::kNumberConstant:
|
||||
return VisitLeaf(node, kRepTagged);
|
||||
return VisitLeaf(node, MachineType::RepTagged());
|
||||
case IrOpcode::kHeapConstant:
|
||||
return VisitLeaf(node, kRepTagged);
|
||||
return VisitLeaf(node, MachineType::RepTagged());
|
||||
|
||||
case IrOpcode::kBranch:
|
||||
ProcessInput(node, 0, UseInfo::Bool());
|
||||
@ -750,15 +770,15 @@ class RepresentationSelector {
|
||||
JS_OP_LIST(DEFINE_JS_CASE)
|
||||
#undef DEFINE_JS_CASE
|
||||
VisitInputs(node);
|
||||
return SetOutput(node, kRepTagged);
|
||||
return SetOutput(node, MachineType::RepTagged());
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Simplified operators.
|
||||
//------------------------------------------------------------------
|
||||
case IrOpcode::kBooleanNot: {
|
||||
if (lower()) {
|
||||
MachineTypeUnion input = GetInfo(node->InputAt(0))->output_type();
|
||||
if (input & kRepBit) {
|
||||
MachineType input = GetInfo(node->InputAt(0))->output_type();
|
||||
if (input.representation() == MachineRepresentation::kBit) {
|
||||
// BooleanNot(x: kRepBit) => Word32Equal(x, #0)
|
||||
node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0));
|
||||
NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal());
|
||||
@ -770,14 +790,14 @@ class RepresentationSelector {
|
||||
} else {
|
||||
// No input representation requirement; adapt during lowering.
|
||||
ProcessInput(node, 0, UseInfo::AnyTruncatingToBool());
|
||||
SetOutput(node, kRepBit);
|
||||
SetOutput(node, MachineType::RepBit());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kBooleanToNumber: {
|
||||
if (lower()) {
|
||||
MachineTypeUnion input = GetInfo(node->InputAt(0))->output_type();
|
||||
if (input & kRepBit) {
|
||||
MachineType input = GetInfo(node->InputAt(0))->output_type();
|
||||
if (input.representation() == MachineRepresentation::kBit) {
|
||||
// BooleanToNumber(x: kRepBit) => x
|
||||
DeferReplacement(node, node->InputAt(0));
|
||||
} else {
|
||||
@ -788,7 +808,7 @@ class RepresentationSelector {
|
||||
} else {
|
||||
// No input representation requirement; adapt during lowering.
|
||||
ProcessInput(node, 0, UseInfo::AnyTruncatingToBool());
|
||||
SetOutput(node, kMachInt32);
|
||||
SetOutput(node, MachineType::Int32());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -887,36 +907,36 @@ class RepresentationSelector {
|
||||
}
|
||||
case IrOpcode::kNumberShiftLeft: {
|
||||
VisitBinop(node, UseInfo::TruncatingWord32(),
|
||||
UseInfo::TruncatingWord32(), kMachInt32);
|
||||
UseInfo::TruncatingWord32(), MachineType::Int32());
|
||||
if (lower()) lowering->DoShift(node, lowering->machine()->Word32Shl());
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kNumberShiftRight: {
|
||||
VisitBinop(node, UseInfo::TruncatingWord32(),
|
||||
UseInfo::TruncatingWord32(), kMachInt32);
|
||||
UseInfo::TruncatingWord32(), MachineType::Int32());
|
||||
if (lower()) lowering->DoShift(node, lowering->machine()->Word32Sar());
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kNumberShiftRightLogical: {
|
||||
VisitBinop(node, UseInfo::TruncatingWord32(),
|
||||
UseInfo::TruncatingWord32(), kMachUint32);
|
||||
UseInfo::TruncatingWord32(), MachineType::Uint32());
|
||||
if (lower()) lowering->DoShift(node, lowering->machine()->Word32Shr());
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kNumberToInt32: {
|
||||
// Just change representation if necessary.
|
||||
VisitUnop(node, UseInfo::TruncatingWord32(), kMachInt32);
|
||||
VisitUnop(node, UseInfo::TruncatingWord32(), MachineType::Int32());
|
||||
if (lower()) DeferReplacement(node, node->InputAt(0));
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kNumberToUint32: {
|
||||
// Just change representation if necessary.
|
||||
VisitUnop(node, UseInfo::TruncatingWord32(), kMachUint32);
|
||||
VisitUnop(node, UseInfo::TruncatingWord32(), MachineType::Uint32());
|
||||
if (lower()) DeferReplacement(node, node->InputAt(0));
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kNumberIsHoleNaN: {
|
||||
VisitUnop(node, UseInfo::Float64(), kMachBool);
|
||||
VisitUnop(node, UseInfo::Float64(), MachineType::Bool());
|
||||
if (lower()) {
|
||||
// NumberIsHoleNaN(x) => Word32Equal(Float64ExtractLowWord32(x),
|
||||
// #HoleNaNLower32)
|
||||
@ -931,7 +951,9 @@ class RepresentationSelector {
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kPlainPrimitiveToNumber: {
|
||||
VisitUnop(node, UseInfo::AnyTagged(), kTypeNumber | kRepTagged);
|
||||
VisitUnop(node, UseInfo::AnyTagged(),
|
||||
MachineType(MachineRepresentation::kTagged,
|
||||
MachineSemantic::kNumber));
|
||||
if (lower()) {
|
||||
// PlainPrimitiveToNumber(x) => Call(ToNumberStub, x, no-context)
|
||||
Operator::Properties properties = node->op()->properties();
|
||||
@ -948,31 +970,31 @@ class RepresentationSelector {
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kReferenceEqual: {
|
||||
VisitBinop(node, UseInfo::AnyTagged(), kMachBool);
|
||||
VisitBinop(node, UseInfo::AnyTagged(), MachineType::Bool());
|
||||
if (lower()) {
|
||||
NodeProperties::ChangeOp(node, lowering->machine()->WordEqual());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kStringEqual: {
|
||||
VisitBinop(node, UseInfo::AnyTagged(), kMachBool);
|
||||
VisitBinop(node, UseInfo::AnyTagged(), MachineType::Bool());
|
||||
if (lower()) lowering->DoStringEqual(node);
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kStringLessThan: {
|
||||
VisitBinop(node, UseInfo::AnyTagged(), kMachBool);
|
||||
VisitBinop(node, UseInfo::AnyTagged(), MachineType::Bool());
|
||||
if (lower()) lowering->DoStringLessThan(node);
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kStringLessThanOrEqual: {
|
||||
VisitBinop(node, UseInfo::AnyTagged(), kMachBool);
|
||||
VisitBinop(node, UseInfo::AnyTagged(), MachineType::Bool());
|
||||
if (lower()) lowering->DoStringLessThanOrEqual(node);
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kAllocate: {
|
||||
ProcessInput(node, 0, UseInfo::AnyTagged());
|
||||
ProcessRemainingInputs(node, 1);
|
||||
SetOutput(node, kMachAnyTagged);
|
||||
SetOutput(node, MachineType::AnyTagged());
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kLoadField: {
|
||||
@ -985,9 +1007,10 @@ class RepresentationSelector {
|
||||
case IrOpcode::kStoreField: {
|
||||
FieldAccess access = FieldAccessOf(node->op());
|
||||
ProcessInput(node, 0, UseInfoForBasePointer(access));
|
||||
ProcessInput(node, 1, UseInfoFromMachineType(access.machine_type));
|
||||
ProcessInput(node, 1, TruncatingUseInfoFromRepresentation(
|
||||
access.machine_type.representation()));
|
||||
ProcessRemainingInputs(node, 2);
|
||||
SetOutput(node, 0);
|
||||
SetOutput(node, MachineType::None());
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kLoadBuffer: {
|
||||
@ -1007,16 +1030,17 @@ class RepresentationSelector {
|
||||
// If undefined is truncated to a number, but the use can
|
||||
// observe NaN, we need to output at least the float32
|
||||
// representation.
|
||||
if (access.machine_type() & kRepFloat32) {
|
||||
if (access.machine_type().representation() ==
|
||||
MachineRepresentation::kFloat32) {
|
||||
output_type = access.machine_type();
|
||||
} else {
|
||||
output_type = kMachFloat64;
|
||||
output_type = MachineType::Float64();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If undefined is not truncated away, we need to have the tagged
|
||||
// representation.
|
||||
output_type = kMachAnyTagged;
|
||||
output_type = MachineType::AnyTagged();
|
||||
}
|
||||
SetOutput(node, output_type);
|
||||
if (lower()) lowering->DoLoadBuffer(node, output_type, changer_);
|
||||
@ -1028,9 +1052,10 @@ class RepresentationSelector {
|
||||
ProcessInput(node, 1, UseInfo::TruncatingWord32()); // offset
|
||||
ProcessInput(node, 2, UseInfo::TruncatingWord32()); // length
|
||||
ProcessInput(node, 3,
|
||||
UseInfoFromMachineType(access.machine_type())); // value
|
||||
TruncatingUseInfoFromRepresentation(
|
||||
access.machine_type().representation())); // value
|
||||
ProcessRemainingInputs(node, 4);
|
||||
SetOutput(node, 0);
|
||||
SetOutput(node, MachineType::None());
|
||||
if (lower()) lowering->DoStoreBuffer(node);
|
||||
break;
|
||||
}
|
||||
@ -1047,20 +1072,21 @@ class RepresentationSelector {
|
||||
ProcessInput(node, 0, UseInfoForBasePointer(access)); // base
|
||||
ProcessInput(node, 1, UseInfo::TruncatingWord32()); // index
|
||||
ProcessInput(node, 2,
|
||||
UseInfoFromMachineType(access.machine_type)); // value
|
||||
TruncatingUseInfoFromRepresentation(
|
||||
access.machine_type.representation())); // value
|
||||
ProcessRemainingInputs(node, 3);
|
||||
SetOutput(node, 0);
|
||||
SetOutput(node, MachineType::None());
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kObjectIsNumber: {
|
||||
ProcessInput(node, 0, UseInfo::AnyTagged());
|
||||
SetOutput(node, kMachBool);
|
||||
SetOutput(node, MachineType::Bool());
|
||||
if (lower()) lowering->DoObjectIsNumber(node);
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kObjectIsSmi: {
|
||||
ProcessInput(node, 0, UseInfo::AnyTagged());
|
||||
SetOutput(node, kMachBool);
|
||||
SetOutput(node, MachineType::Bool());
|
||||
if (lower()) lowering->DoObjectIsSmi(node);
|
||||
break;
|
||||
}
|
||||
@ -1071,7 +1097,7 @@ class RepresentationSelector {
|
||||
case IrOpcode::kLoad: {
|
||||
// TODO(jarin) Eventually, we should get rid of all machine stores
|
||||
// from the high-level phases, then this becomes UNREACHABLE.
|
||||
LoadRepresentation rep = OpParameter<LoadRepresentation>(node);
|
||||
LoadRepresentation rep = LoadRepresentationOf(node->op());
|
||||
ProcessInput(node, 0, UseInfo::AnyTagged()); // tagged pointer
|
||||
ProcessInput(node, 1, UseInfo::PointerInt()); // index
|
||||
ProcessRemainingInputs(node, 2);
|
||||
@ -1081,17 +1107,19 @@ class RepresentationSelector {
|
||||
case IrOpcode::kStore: {
|
||||
// TODO(jarin) Eventually, we should get rid of all machine stores
|
||||
// from the high-level phases, then this becomes UNREACHABLE.
|
||||
StoreRepresentation rep = OpParameter<StoreRepresentation>(node);
|
||||
StoreRepresentation rep = StoreRepresentationOf(node->op());
|
||||
ProcessInput(node, 0, UseInfo::AnyTagged()); // tagged pointer
|
||||
ProcessInput(node, 1, UseInfo::PointerInt()); // index
|
||||
ProcessInput(node, 2, UseInfoFromMachineType(rep.machine_type()));
|
||||
ProcessInput(node, 2, TruncatingUseInfoFromRepresentation(
|
||||
rep.machine_type().representation()));
|
||||
ProcessRemainingInputs(node, 3);
|
||||
SetOutput(node, 0);
|
||||
SetOutput(node, MachineType::None());
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kWord32Shr:
|
||||
// We output unsigned int32 for shift right because JavaScript.
|
||||
return VisitBinop(node, UseInfo::TruncatingWord32(), kMachUint32);
|
||||
return VisitBinop(node, UseInfo::TruncatingWord32(),
|
||||
MachineType::Uint32());
|
||||
case IrOpcode::kWord32And:
|
||||
case IrOpcode::kWord32Or:
|
||||
case IrOpcode::kWord32Xor:
|
||||
@ -1101,12 +1129,14 @@ class RepresentationSelector {
|
||||
// though the machine bits are the same for either signed or unsigned,
|
||||
// because JavaScript considers the result from these operations signed.
|
||||
return VisitBinop(node, UseInfo::TruncatingWord32(),
|
||||
kRepWord32 | kTypeInt32);
|
||||
MachineType::Int32());
|
||||
case IrOpcode::kWord32Equal:
|
||||
return VisitBinop(node, UseInfo::TruncatingWord32(), kMachBool);
|
||||
return VisitBinop(node, UseInfo::TruncatingWord32(),
|
||||
MachineType::Bool());
|
||||
|
||||
case IrOpcode::kWord32Clz:
|
||||
return VisitUnop(node, UseInfo::TruncatingWord32(), kMachUint32);
|
||||
return VisitUnop(node, UseInfo::TruncatingWord32(),
|
||||
MachineType::Uint32());
|
||||
|
||||
case IrOpcode::kInt32Add:
|
||||
case IrOpcode::kInt32Sub:
|
||||
@ -1150,39 +1180,46 @@ class RepresentationSelector {
|
||||
case IrOpcode::kWord64Shl:
|
||||
case IrOpcode::kWord64Shr:
|
||||
case IrOpcode::kWord64Sar:
|
||||
return VisitBinop(node, UseInfo::TruncatingWord64(), kRepWord64);
|
||||
return VisitBinop(node, UseInfo::TruncatingWord64(),
|
||||
MachineType(MachineRepresentation::kWord64,
|
||||
MachineSemantic::kNone));
|
||||
case IrOpcode::kWord64Equal:
|
||||
return VisitBinop(node, UseInfo::TruncatingWord64(), kMachBool);
|
||||
return VisitBinop(node, UseInfo::TruncatingWord64(),
|
||||
MachineType::Bool());
|
||||
|
||||
case IrOpcode::kChangeInt32ToInt64:
|
||||
return VisitUnop(node, UseInfo::TruncatingWord32(),
|
||||
kTypeInt32 | kRepWord64);
|
||||
MachineType(MachineRepresentation::kWord64,
|
||||
MachineSemantic::kInt32));
|
||||
case IrOpcode::kChangeUint32ToUint64:
|
||||
return VisitUnop(node, UseInfo::TruncatingWord32(),
|
||||
kTypeUint32 | kRepWord64);
|
||||
MachineType(MachineRepresentation::kWord64,
|
||||
MachineSemantic::kUint32));
|
||||
case IrOpcode::kTruncateFloat64ToFloat32:
|
||||
return VisitUnop(node, UseInfo::Float64(), kTypeNumber | kRepFloat32);
|
||||
return VisitUnop(node, UseInfo::Float64(), MachineType::Float32());
|
||||
case IrOpcode::kTruncateFloat64ToInt32:
|
||||
return VisitUnop(node, UseInfo::Float64(), kTypeInt32 | kRepWord32);
|
||||
return VisitUnop(node, UseInfo::Float64(), MachineType::Int32());
|
||||
case IrOpcode::kTruncateInt64ToInt32:
|
||||
// TODO(titzer): Is kTypeInt32 correct here?
|
||||
return VisitUnop(node, UseInfo::Word64TruncatingToWord32(),
|
||||
kTypeInt32 | kRepWord32);
|
||||
MachineType::Int32());
|
||||
|
||||
case IrOpcode::kChangeFloat32ToFloat64:
|
||||
return VisitUnop(node, UseInfo::Float32(), kTypeNumber | kRepFloat64);
|
||||
return VisitUnop(node, UseInfo::Float32(), MachineType::Float64());
|
||||
case IrOpcode::kChangeInt32ToFloat64:
|
||||
return VisitUnop(node, UseInfo::TruncatingWord32(),
|
||||
kTypeInt32 | kRepFloat64);
|
||||
MachineType(MachineRepresentation::kFloat64,
|
||||
MachineSemantic::kInt32));
|
||||
case IrOpcode::kChangeUint32ToFloat64:
|
||||
return VisitUnop(node, UseInfo::TruncatingWord32(),
|
||||
kTypeUint32 | kRepFloat64);
|
||||
MachineType(MachineRepresentation::kFloat64,
|
||||
MachineSemantic::kUint32));
|
||||
case IrOpcode::kChangeFloat64ToInt32:
|
||||
return VisitUnop(node, UseInfo::Float64TruncatingToWord32(),
|
||||
kTypeInt32 | kRepWord32);
|
||||
MachineType::Int32());
|
||||
case IrOpcode::kChangeFloat64ToUint32:
|
||||
return VisitUnop(node, UseInfo::Float64TruncatingToWord32(),
|
||||
kTypeUint32 | kRepWord32);
|
||||
MachineType::Uint32());
|
||||
|
||||
case IrOpcode::kFloat64Add:
|
||||
case IrOpcode::kFloat64Sub:
|
||||
@ -1196,28 +1233,28 @@ class RepresentationSelector {
|
||||
case IrOpcode::kFloat64RoundDown:
|
||||
case IrOpcode::kFloat64RoundTruncate:
|
||||
case IrOpcode::kFloat64RoundTiesAway:
|
||||
return VisitUnop(node, UseInfo::Float64(), kMachFloat64);
|
||||
return VisitUnop(node, UseInfo::Float64(), MachineType::Float64());
|
||||
case IrOpcode::kFloat64Equal:
|
||||
case IrOpcode::kFloat64LessThan:
|
||||
case IrOpcode::kFloat64LessThanOrEqual:
|
||||
return VisitFloat64Cmp(node);
|
||||
case IrOpcode::kFloat64ExtractLowWord32:
|
||||
case IrOpcode::kFloat64ExtractHighWord32:
|
||||
return VisitUnop(node, UseInfo::Float64(), kMachInt32);
|
||||
return VisitUnop(node, UseInfo::Float64(), MachineType::Int32());
|
||||
case IrOpcode::kFloat64InsertLowWord32:
|
||||
case IrOpcode::kFloat64InsertHighWord32:
|
||||
return VisitBinop(node, UseInfo::Float64(), UseInfo::TruncatingWord32(),
|
||||
kMachFloat64);
|
||||
MachineType::Float64());
|
||||
case IrOpcode::kLoadStackPointer:
|
||||
case IrOpcode::kLoadFramePointer:
|
||||
return VisitLeaf(node, kMachPtr);
|
||||
return VisitLeaf(node, MachineType::Pointer());
|
||||
case IrOpcode::kStateValues:
|
||||
VisitStateValues(node);
|
||||
break;
|
||||
default:
|
||||
VisitInputs(node);
|
||||
// Assume the output is tagged.
|
||||
SetOutput(node, kMachAnyTagged);
|
||||
SetOutput(node, MachineType::AnyTagged());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1243,10 +1280,10 @@ class RepresentationSelector {
|
||||
node->NullAllInputs(); // Node is now dead.
|
||||
}
|
||||
|
||||
void PrintInfo(MachineTypeUnion info) {
|
||||
void PrintInfo(MachineType info) {
|
||||
if (FLAG_trace_representation) {
|
||||
OFStream os(stdout);
|
||||
os << static_cast<MachineType>(info);
|
||||
os << info;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1312,7 +1349,7 @@ void SimplifiedLowering::LowerAllNodes() {
|
||||
void SimplifiedLowering::DoLoadBuffer(Node* node, MachineType output_type,
|
||||
RepresentationChanger* changer) {
|
||||
DCHECK_EQ(IrOpcode::kLoadBuffer, node->opcode());
|
||||
DCHECK_NE(kMachNone, RepresentationOf(output_type));
|
||||
DCHECK_NE(MachineRepresentation::kNone, output_type.representation());
|
||||
MachineType const type = BufferAccessOf(node->op()).machine_type();
|
||||
if (output_type != type) {
|
||||
Node* const buffer = node->InputAt(0);
|
||||
@ -1333,17 +1370,19 @@ void SimplifiedLowering::DoLoadBuffer(Node* node, MachineType output_type,
|
||||
Node* etrue =
|
||||
graph()->NewNode(machine()->Load(type), buffer, index, effect, if_true);
|
||||
Node* vtrue = changer->GetRepresentationFor(
|
||||
etrue, type, RepresentationOf(output_type), Truncation::None());
|
||||
etrue, type, output_type.representation(), Truncation::None());
|
||||
|
||||
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
|
||||
Node* efalse = effect;
|
||||
Node* vfalse;
|
||||
if (output_type & kRepTagged) {
|
||||
if (output_type.representation() == MachineRepresentation::kTagged) {
|
||||
vfalse = jsgraph()->UndefinedConstant();
|
||||
} else if (output_type & kRepFloat64) {
|
||||
} else if (output_type.representation() ==
|
||||
MachineRepresentation::kFloat64) {
|
||||
vfalse =
|
||||
jsgraph()->Float64Constant(std::numeric_limits<double>::quiet_NaN());
|
||||
} else if (output_type & kRepFloat32) {
|
||||
} else if (output_type.representation() ==
|
||||
MachineRepresentation::kFloat32) {
|
||||
vfalse =
|
||||
jsgraph()->Float32Constant(std::numeric_limits<float>::quiet_NaN());
|
||||
} else {
|
||||
@ -1361,7 +1400,8 @@ void SimplifiedLowering::DoLoadBuffer(Node* node, MachineType output_type,
|
||||
node->ReplaceInput(1, vfalse);
|
||||
node->ReplaceInput(2, merge);
|
||||
node->TrimInputCount(3);
|
||||
NodeProperties::ChangeOp(node, common()->Phi(output_type, 2));
|
||||
NodeProperties::ChangeOp(node,
|
||||
common()->Phi(output_type.representation(), 2));
|
||||
} else {
|
||||
NodeProperties::ChangeOp(node, machine()->CheckedLoad(type));
|
||||
}
|
||||
@ -1390,7 +1430,7 @@ void SimplifiedLowering::DoObjectIsNumber(Node* node) {
|
||||
Node* vfalse = graph()->NewNode(
|
||||
machine()->WordEqual(),
|
||||
graph()->NewNode(
|
||||
machine()->Load(kMachAnyTagged), input,
|
||||
machine()->Load(MachineType::AnyTagged()), input,
|
||||
jsgraph()->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag),
|
||||
graph()->start(), if_false),
|
||||
jsgraph()->HeapConstant(isolate()->factory()->heap_number_map()));
|
||||
@ -1398,7 +1438,7 @@ void SimplifiedLowering::DoObjectIsNumber(Node* node) {
|
||||
node->ReplaceInput(0, vtrue);
|
||||
node->AppendInput(graph()->zone(), vfalse);
|
||||
node->AppendInput(graph()->zone(), control);
|
||||
NodeProperties::ChangeOp(node, common()->Phi(kMachBool, 2));
|
||||
NodeProperties::ChangeOp(node, common()->Phi(MachineRepresentation::kBit, 2));
|
||||
}
|
||||
|
||||
|
||||
@ -1456,7 +1496,8 @@ Node* SimplifiedLowering::Int32Div(Node* const node) {
|
||||
// Note: We do not use the Diamond helper class here, because it really hurts
|
||||
// readability with nested diamonds.
|
||||
const Operator* const merge_op = common()->Merge(2);
|
||||
const Operator* const phi_op = common()->Phi(kMachInt32, 2);
|
||||
const Operator* const phi_op =
|
||||
common()->Phi(MachineRepresentation::kWord32, 2);
|
||||
|
||||
Node* check0 = graph()->NewNode(machine()->Int32LessThan(), zero, rhs);
|
||||
Node* branch0 = graph()->NewNode(common()->Branch(BranchHint::kTrue), check0,
|
||||
@ -1533,7 +1574,8 @@ Node* SimplifiedLowering::Int32Mod(Node* const node) {
|
||||
// Note: We do not use the Diamond helper class here, because it really hurts
|
||||
// readability with nested diamonds.
|
||||
const Operator* const merge_op = common()->Merge(2);
|
||||
const Operator* const phi_op = common()->Phi(kMachInt32, 2);
|
||||
const Operator* const phi_op =
|
||||
common()->Phi(MachineRepresentation::kWord32, 2);
|
||||
|
||||
Node* check0 = graph()->NewNode(machine()->Int32LessThan(), zero, rhs);
|
||||
Node* branch0 = graph()->NewNode(common()->Branch(BranchHint::kTrue), check0,
|
||||
@ -1612,7 +1654,7 @@ Node* SimplifiedLowering::Uint32Div(Node* const node) {
|
||||
Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, zero);
|
||||
Diamond d(graph(), common(), check, BranchHint::kFalse);
|
||||
Node* div = graph()->NewNode(machine()->Uint32Div(), lhs, rhs, d.if_false);
|
||||
return d.Phi(kMachUint32, zero, div);
|
||||
return d.Phi(MachineRepresentation::kWord32, zero, div);
|
||||
}
|
||||
|
||||
|
||||
@ -1644,7 +1686,8 @@ Node* SimplifiedLowering::Uint32Mod(Node* const node) {
|
||||
// Note: We do not use the Diamond helper class here, because it really hurts
|
||||
// readability with nested diamonds.
|
||||
const Operator* const merge_op = common()->Merge(2);
|
||||
const Operator* const phi_op = common()->Phi(kMachInt32, 2);
|
||||
const Operator* const phi_op =
|
||||
common()->Phi(MachineRepresentation::kWord32, 2);
|
||||
|
||||
Node* branch0 = graph()->NewNode(common()->Branch(BranchHint::kTrue), rhs,
|
||||
graph()->start());
|
||||
|
@ -29,24 +29,24 @@ MachineType BufferAccess::machine_type() const {
|
||||
switch (external_array_type_) {
|
||||
case kExternalUint8Array:
|
||||
case kExternalUint8ClampedArray:
|
||||
return kMachUint8;
|
||||
return MachineType::Uint8();
|
||||
case kExternalInt8Array:
|
||||
return kMachInt8;
|
||||
return MachineType::Int8();
|
||||
case kExternalUint16Array:
|
||||
return kMachUint16;
|
||||
return MachineType::Uint16();
|
||||
case kExternalInt16Array:
|
||||
return kMachInt16;
|
||||
return MachineType::Int16();
|
||||
case kExternalUint32Array:
|
||||
return kMachUint32;
|
||||
return MachineType::Uint32();
|
||||
case kExternalInt32Array:
|
||||
return kMachInt32;
|
||||
return MachineType::Int32();
|
||||
case kExternalFloat32Array:
|
||||
return kMachFloat32;
|
||||
return MachineType::Float32();
|
||||
case kExternalFloat64Array:
|
||||
return kMachFloat64;
|
||||
return MachineType::Float64();
|
||||
}
|
||||
UNREACHABLE();
|
||||
return kMachNone;
|
||||
return MachineType::None();
|
||||
}
|
||||
|
||||
|
||||
|
@ -271,7 +271,7 @@ Node* StateValuesAccess::iterator::node() {
|
||||
MachineType StateValuesAccess::iterator::type() {
|
||||
Node* state = Top()->node;
|
||||
if (state->opcode() == IrOpcode::kStateValues) {
|
||||
return kMachAnyTagged;
|
||||
return MachineType::AnyTagged();
|
||||
} else {
|
||||
DCHECK_EQ(IrOpcode::kTypedStateValues, state->opcode());
|
||||
const ZoneVector<MachineType>* types =
|
||||
|
@ -108,30 +108,29 @@ class X64OperandGenerator final : public OperandGenerator {
|
||||
|
||||
|
||||
void InstructionSelector::VisitLoad(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<LoadRepresentation>(node));
|
||||
MachineType typ = TypeOf(OpParameter<LoadRepresentation>(node));
|
||||
LoadRepresentation load_rep = LoadRepresentationOf(node->op());
|
||||
X64OperandGenerator g(this);
|
||||
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepFloat32:
|
||||
switch (load_rep.representation()) {
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kX64Movss;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kX64Movsd;
|
||||
break;
|
||||
case kRepBit: // Fall through.
|
||||
case kRepWord8:
|
||||
opcode = typ == kTypeInt32 ? kX64Movsxbl : kX64Movzxbl;
|
||||
case MachineRepresentation::kBit: // Fall through.
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = load_rep.IsSigned() ? kX64Movsxbl : kX64Movzxbl;
|
||||
break;
|
||||
case kRepWord16:
|
||||
opcode = typ == kTypeInt32 ? kX64Movsxwl : kX64Movzxwl;
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = load_rep.IsSigned() ? kX64Movsxwl : kX64Movzxwl;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kX64Movl;
|
||||
break;
|
||||
case kRepTagged: // Fall through.
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kTagged: // Fall through.
|
||||
case MachineRepresentation::kWord64:
|
||||
opcode = kX64Movq;
|
||||
break;
|
||||
default:
|
||||
@ -158,10 +157,10 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
|
||||
StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node);
|
||||
WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind();
|
||||
MachineType rep = RepresentationOf(store_rep.machine_type());
|
||||
MachineRepresentation rep = store_rep.machine_type().representation();
|
||||
|
||||
if (write_barrier_kind != kNoWriteBarrier) {
|
||||
DCHECK_EQ(kRepTagged, rep);
|
||||
DCHECK_EQ(MachineRepresentation::kTagged, rep);
|
||||
AddressingMode addressing_mode;
|
||||
InstructionOperand inputs[3];
|
||||
size_t input_count = 0;
|
||||
@ -200,24 +199,24 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
} else {
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kX64Movss;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kX64Movsd;
|
||||
break;
|
||||
case kRepBit: // Fall through.
|
||||
case kRepWord8:
|
||||
case MachineRepresentation::kBit: // Fall through.
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = kX64Movb;
|
||||
break;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = kX64Movw;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kX64Movl;
|
||||
break;
|
||||
case kRepTagged: // Fall through.
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kTagged: // Fall through.
|
||||
case MachineRepresentation::kWord64:
|
||||
opcode = kX64Movq;
|
||||
break;
|
||||
default:
|
||||
@ -239,30 +238,29 @@ void InstructionSelector::VisitStore(Node* node) {
|
||||
|
||||
|
||||
void InstructionSelector::VisitCheckedLoad(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
|
||||
MachineType typ = TypeOf(OpParameter<MachineType>(node));
|
||||
CheckedLoadRepresentation load_rep = CheckedLoadRepresentationOf(node->op());
|
||||
X64OperandGenerator g(this);
|
||||
Node* const buffer = node->InputAt(0);
|
||||
Node* const offset = node->InputAt(1);
|
||||
Node* const length = node->InputAt(2);
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepWord8:
|
||||
opcode = typ == kTypeInt32 ? kCheckedLoadInt8 : kCheckedLoadUint8;
|
||||
switch (load_rep.representation()) {
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = load_rep.IsSigned() ? kCheckedLoadInt8 : kCheckedLoadUint8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
opcode = typ == kTypeInt32 ? kCheckedLoadInt16 : kCheckedLoadUint16;
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = load_rep.IsSigned() ? kCheckedLoadInt16 : kCheckedLoadUint16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kCheckedLoadWord32;
|
||||
break;
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kWord64:
|
||||
opcode = kCheckedLoadWord64;
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kCheckedLoadFloat32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kCheckedLoadFloat64;
|
||||
break;
|
||||
default:
|
||||
@ -289,7 +287,8 @@ void InstructionSelector::VisitCheckedLoad(Node* node) {
|
||||
|
||||
|
||||
void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
|
||||
MachineRepresentation rep =
|
||||
CheckedStoreRepresentationOf(node->op()).representation();
|
||||
X64OperandGenerator g(this);
|
||||
Node* const buffer = node->InputAt(0);
|
||||
Node* const offset = node->InputAt(1);
|
||||
@ -297,22 +296,22 @@ void InstructionSelector::VisitCheckedStore(Node* node) {
|
||||
Node* const value = node->InputAt(3);
|
||||
ArchOpcode opcode;
|
||||
switch (rep) {
|
||||
case kRepWord8:
|
||||
case MachineRepresentation::kWord8:
|
||||
opcode = kCheckedStoreWord8;
|
||||
break;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
opcode = kCheckedStoreWord16;
|
||||
break;
|
||||
case kRepWord32:
|
||||
case MachineRepresentation::kWord32:
|
||||
opcode = kCheckedStoreWord32;
|
||||
break;
|
||||
case kRepWord64:
|
||||
case MachineRepresentation::kWord64:
|
||||
opcode = kCheckedStoreWord64;
|
||||
break;
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
opcode = kCheckedStoreFloat32;
|
||||
break;
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
opcode = kCheckedStoreFloat64;
|
||||
break;
|
||||
default:
|
||||
|
@ -8,37 +8,68 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
#define PRINT(bit) \
|
||||
if (type & bit) { \
|
||||
if (before) os << "|"; \
|
||||
os << #bit; \
|
||||
before = true; \
|
||||
std::ostream& operator<<(std::ostream& os, MachineRepresentation rep) {
|
||||
switch (rep) {
|
||||
case MachineRepresentation::kNone:
|
||||
return os << "kMachNone";
|
||||
case MachineRepresentation::kBit:
|
||||
return os << "kRepBit";
|
||||
case MachineRepresentation::kWord8:
|
||||
return os << "kRepWord8";
|
||||
case MachineRepresentation::kWord16:
|
||||
return os << "kRepWord16";
|
||||
case MachineRepresentation::kWord32:
|
||||
return os << "kRepWord32";
|
||||
case MachineRepresentation::kWord64:
|
||||
return os << "kRepWord64";
|
||||
case MachineRepresentation::kFloat32:
|
||||
return os << "kRepFloat32";
|
||||
case MachineRepresentation::kFloat64:
|
||||
return os << "kRepFloat64";
|
||||
case MachineRepresentation::kTagged:
|
||||
return os << "kRepTagged";
|
||||
}
|
||||
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const MachineType& type) {
|
||||
bool before = false;
|
||||
PRINT(kRepBit);
|
||||
PRINT(kRepWord8);
|
||||
PRINT(kRepWord16);
|
||||
PRINT(kRepWord32);
|
||||
PRINT(kRepWord64);
|
||||
PRINT(kRepFloat32);
|
||||
PRINT(kRepFloat64);
|
||||
PRINT(kRepTagged);
|
||||
|
||||
PRINT(kTypeBool);
|
||||
PRINT(kTypeInt32);
|
||||
PRINT(kTypeUint32);
|
||||
PRINT(kTypeInt64);
|
||||
PRINT(kTypeUint64);
|
||||
PRINT(kTypeNumber);
|
||||
PRINT(kTypeAny);
|
||||
UNREACHABLE();
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
#undef PRINT
|
||||
std::ostream& operator<<(std::ostream& os, MachineSemantic type) {
|
||||
switch (type) {
|
||||
case MachineSemantic::kNone:
|
||||
return os << "kMachNone";
|
||||
case MachineSemantic::kBool:
|
||||
return os << "kTypeBool";
|
||||
case MachineSemantic::kInt32:
|
||||
return os << "kTypeInt32";
|
||||
case MachineSemantic::kUint32:
|
||||
return os << "kTypeUint32";
|
||||
case MachineSemantic::kInt64:
|
||||
return os << "kTypeInt64";
|
||||
case MachineSemantic::kUint64:
|
||||
return os << "kTypeUint64";
|
||||
case MachineSemantic::kNumber:
|
||||
return os << "kTypeNumber";
|
||||
case MachineSemantic::kAny:
|
||||
return os << "kTypeAny";
|
||||
}
|
||||
UNREACHABLE();
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, MachineType type) {
|
||||
if (type == MachineType::None()) {
|
||||
return os;
|
||||
} else if (type.representation() == MachineRepresentation::kNone) {
|
||||
return os << type.semantic();
|
||||
} else if (type.semantic() == MachineSemantic::kNone) {
|
||||
return os << type.representation();
|
||||
} else {
|
||||
return os << type.representation() << "|" << type.semantic();
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
@ -15,91 +15,179 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// Machine-level types and representations.
|
||||
// TODO(titzer): Use the real type system instead of MachineType.
|
||||
enum MachineType : uint16_t {
|
||||
// Representations.
|
||||
kRepBit = 1u << 0,
|
||||
kRepWord8 = 1u << 1,
|
||||
kRepWord16 = 1u << 2,
|
||||
kRepWord32 = 1u << 3,
|
||||
kRepWord64 = 1u << 4,
|
||||
kRepFloat32 = 1u << 5,
|
||||
kRepFloat64 = 1u << 6,
|
||||
kRepTagged = 1u << 7,
|
||||
|
||||
// Types.
|
||||
kTypeBool = 1u << 8,
|
||||
kTypeInt32 = 1u << 9,
|
||||
kTypeUint32 = 1u << 10,
|
||||
kTypeInt64 = 1u << 11,
|
||||
kTypeUint64 = 1u << 12,
|
||||
kTypeNumber = 1u << 13,
|
||||
kTypeAny = 1u << 14,
|
||||
|
||||
// Machine types.
|
||||
kMachNone = 0u,
|
||||
kMachBool = kRepBit | kTypeBool,
|
||||
kMachFloat32 = kRepFloat32 | kTypeNumber,
|
||||
kMachFloat64 = kRepFloat64 | kTypeNumber,
|
||||
kMachInt8 = kRepWord8 | kTypeInt32,
|
||||
kMachUint8 = kRepWord8 | kTypeUint32,
|
||||
kMachInt16 = kRepWord16 | kTypeInt32,
|
||||
kMachUint16 = kRepWord16 | kTypeUint32,
|
||||
kMachInt32 = kRepWord32 | kTypeInt32,
|
||||
kMachUint32 = kRepWord32 | kTypeUint32,
|
||||
kMachInt64 = kRepWord64 | kTypeInt64,
|
||||
kMachUint64 = kRepWord64 | kTypeUint64,
|
||||
kMachIntPtr = (kPointerSize == 4) ? kMachInt32 : kMachInt64,
|
||||
kMachUintPtr = (kPointerSize == 4) ? kMachUint32 : kMachUint64,
|
||||
kMachPtr = (kPointerSize == 4) ? kRepWord32 : kRepWord64,
|
||||
kMachAnyTagged = kRepTagged | kTypeAny
|
||||
enum class MachineRepresentation : uint8_t {
|
||||
kNone,
|
||||
kBit,
|
||||
kWord8,
|
||||
kWord16,
|
||||
kWord32,
|
||||
kWord64,
|
||||
kFloat32,
|
||||
kFloat64,
|
||||
kTagged
|
||||
};
|
||||
|
||||
enum class MachineSemantic : uint8_t {
|
||||
kNone,
|
||||
kBool,
|
||||
kInt32,
|
||||
kUint32,
|
||||
kInt64,
|
||||
kUint64,
|
||||
kNumber,
|
||||
kAny
|
||||
};
|
||||
|
||||
class MachineType {
|
||||
public:
|
||||
MachineType()
|
||||
: representation_(MachineRepresentation::kNone),
|
||||
semantic_(MachineSemantic::kNone) {}
|
||||
MachineType(MachineRepresentation representation, MachineSemantic semantic)
|
||||
: representation_(representation), semantic_(semantic) {}
|
||||
|
||||
bool operator==(MachineType other) const {
|
||||
return representation() == other.representation() &&
|
||||
semantic() == other.semantic();
|
||||
}
|
||||
|
||||
bool operator!=(MachineType other) const { return !(*this == other); }
|
||||
|
||||
|
||||
MachineRepresentation representation() const { return representation_; }
|
||||
MachineSemantic semantic() const { return semantic_; }
|
||||
|
||||
bool IsSigned() {
|
||||
return semantic() == MachineSemantic::kInt32 ||
|
||||
semantic() == MachineSemantic::kInt64;
|
||||
}
|
||||
bool IsUnsigned() {
|
||||
return semantic() == MachineSemantic::kUint32 ||
|
||||
semantic() == MachineSemantic::kUint64;
|
||||
}
|
||||
|
||||
static MachineRepresentation PointerRepresentation() {
|
||||
return (kPointerSize == 4) ? MachineRepresentation::kWord32
|
||||
: MachineRepresentation::kWord64;
|
||||
}
|
||||
static MachineType Pointer() {
|
||||
return MachineType(PointerRepresentation(), MachineSemantic::kNone);
|
||||
}
|
||||
static MachineType IntPtr() {
|
||||
return (kPointerSize == 4) ? Int32() : Int64();
|
||||
}
|
||||
static MachineType Float32() {
|
||||
return MachineType(MachineRepresentation::kFloat32,
|
||||
MachineSemantic::kNumber);
|
||||
}
|
||||
static MachineType Float64() {
|
||||
return MachineType(MachineRepresentation::kFloat64,
|
||||
MachineSemantic::kNumber);
|
||||
}
|
||||
static MachineType Int8() {
|
||||
return MachineType(MachineRepresentation::kWord8, MachineSemantic::kInt32);
|
||||
}
|
||||
static MachineType Uint8() {
|
||||
return MachineType(MachineRepresentation::kWord8, MachineSemantic::kUint32);
|
||||
}
|
||||
static MachineType Int16() {
|
||||
return MachineType(MachineRepresentation::kWord16, MachineSemantic::kInt32);
|
||||
}
|
||||
static MachineType Uint16() {
|
||||
return MachineType(MachineRepresentation::kWord16,
|
||||
MachineSemantic::kUint32);
|
||||
}
|
||||
static MachineType Int32() {
|
||||
return MachineType(MachineRepresentation::kWord32, MachineSemantic::kInt32);
|
||||
}
|
||||
static MachineType Uint32() {
|
||||
return MachineType(MachineRepresentation::kWord32,
|
||||
MachineSemantic::kUint32);
|
||||
}
|
||||
static MachineType Int64() {
|
||||
return MachineType(MachineRepresentation::kWord64, MachineSemantic::kInt64);
|
||||
}
|
||||
static MachineType Uint64() {
|
||||
return MachineType(MachineRepresentation::kWord64,
|
||||
MachineSemantic::kUint64);
|
||||
}
|
||||
static MachineType AnyTagged() {
|
||||
return MachineType(MachineRepresentation::kTagged, MachineSemantic::kAny);
|
||||
}
|
||||
static MachineType Bool() {
|
||||
return MachineType(MachineRepresentation::kBit, MachineSemantic::kBool);
|
||||
}
|
||||
static MachineType TaggedBool() {
|
||||
return MachineType(MachineRepresentation::kTagged, MachineSemantic::kBool);
|
||||
}
|
||||
static MachineType None() {
|
||||
return MachineType(MachineRepresentation::kNone, MachineSemantic::kNone);
|
||||
}
|
||||
|
||||
// These naked representations should eventually go away.
|
||||
static MachineType RepWord8() {
|
||||
return MachineType(MachineRepresentation::kWord8, MachineSemantic::kNone);
|
||||
}
|
||||
static MachineType RepWord16() {
|
||||
return MachineType(MachineRepresentation::kWord16, MachineSemantic::kNone);
|
||||
}
|
||||
static MachineType RepWord32() {
|
||||
return MachineType(MachineRepresentation::kWord32, MachineSemantic::kNone);
|
||||
}
|
||||
static MachineType RepWord64() {
|
||||
return MachineType(MachineRepresentation::kWord64, MachineSemantic::kNone);
|
||||
}
|
||||
static MachineType RepFloat32() {
|
||||
return MachineType(MachineRepresentation::kFloat32, MachineSemantic::kNone);
|
||||
}
|
||||
static MachineType RepFloat64() {
|
||||
return MachineType(MachineRepresentation::kFloat64, MachineSemantic::kNone);
|
||||
}
|
||||
static MachineType RepTagged() {
|
||||
return MachineType(MachineRepresentation::kTagged, MachineSemantic::kNone);
|
||||
}
|
||||
static MachineType RepBit() {
|
||||
return MachineType(MachineRepresentation::kBit, MachineSemantic::kNone);
|
||||
}
|
||||
|
||||
private:
|
||||
MachineRepresentation representation_;
|
||||
MachineSemantic semantic_;
|
||||
};
|
||||
|
||||
V8_INLINE size_t hash_value(MachineRepresentation rep) {
|
||||
return static_cast<size_t>(rep);
|
||||
}
|
||||
|
||||
V8_INLINE size_t hash_value(MachineType type) {
|
||||
return static_cast<size_t>(type);
|
||||
return static_cast<size_t>(type.representation()) +
|
||||
static_cast<size_t>(type.semantic()) * 16;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const MachineType& type);
|
||||
std::ostream& operator<<(std::ostream& os, MachineRepresentation rep);
|
||||
std::ostream& operator<<(std::ostream& os, MachineSemantic type);
|
||||
std::ostream& operator<<(std::ostream& os, MachineType type);
|
||||
|
||||
typedef uint16_t MachineTypeUnion;
|
||||
|
||||
// Globally useful machine types and constants.
|
||||
const MachineTypeUnion kRepMask = kRepBit | kRepWord8 | kRepWord16 |
|
||||
kRepWord32 | kRepWord64 | kRepFloat32 |
|
||||
kRepFloat64 | kRepTagged;
|
||||
const MachineTypeUnion kTypeMask = kTypeBool | kTypeInt32 | kTypeUint32 |
|
||||
kTypeInt64 | kTypeUint64 | kTypeNumber |
|
||||
kTypeAny;
|
||||
|
||||
// Gets only the type of the given type.
|
||||
inline MachineType TypeOf(MachineType machine_type) {
|
||||
int result = machine_type & kTypeMask;
|
||||
return static_cast<MachineType>(result);
|
||||
}
|
||||
|
||||
// Gets only the representation of the given type.
|
||||
inline MachineType RepresentationOf(MachineType machine_type) {
|
||||
int result = machine_type & kRepMask;
|
||||
CHECK(base::bits::IsPowerOfTwo32(result));
|
||||
return static_cast<MachineType>(result);
|
||||
inline bool IsFloatingPoint(MachineRepresentation rep) {
|
||||
return rep == MachineRepresentation::kFloat32 ||
|
||||
rep == MachineRepresentation::kFloat64;
|
||||
}
|
||||
|
||||
// Gets the log2 of the element size in bytes of the machine type.
|
||||
inline int ElementSizeLog2Of(MachineType machine_type) {
|
||||
switch (RepresentationOf(machine_type)) {
|
||||
case kRepBit:
|
||||
case kRepWord8:
|
||||
inline int ElementSizeLog2Of(MachineRepresentation rep) {
|
||||
switch (rep) {
|
||||
case MachineRepresentation::kBit:
|
||||
case MachineRepresentation::kWord8:
|
||||
return 0;
|
||||
case kRepWord16:
|
||||
case MachineRepresentation::kWord16:
|
||||
return 1;
|
||||
case kRepWord32:
|
||||
case kRepFloat32:
|
||||
case MachineRepresentation::kWord32:
|
||||
case MachineRepresentation::kFloat32:
|
||||
return 2;
|
||||
case kRepWord64:
|
||||
case kRepFloat64:
|
||||
case MachineRepresentation::kWord64:
|
||||
case MachineRepresentation::kFloat64:
|
||||
return 3;
|
||||
case kRepTagged:
|
||||
case MachineRepresentation::kTagged:
|
||||
return kPointerSizeLog2;
|
||||
default:
|
||||
break;
|
||||
@ -108,18 +196,6 @@ inline int ElementSizeLog2Of(MachineType machine_type) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Gets the element size in bytes of the machine type.
|
||||
inline int ElementSizeOf(MachineType machine_type) {
|
||||
const int shift = ElementSizeLog2Of(machine_type);
|
||||
DCHECK_NE(-1, shift);
|
||||
return 1 << shift;
|
||||
}
|
||||
|
||||
inline bool IsFloatingPoint(MachineType type) {
|
||||
MachineType rep = RepresentationOf(type);
|
||||
return rep == kRepFloat32 || rep == kRepFloat64;
|
||||
}
|
||||
|
||||
typedef Signature<MachineType> MachineSignature;
|
||||
|
||||
} // namespace internal
|
||||
|
@ -12,20 +12,20 @@ namespace internal {
|
||||
namespace compiler {
|
||||
|
||||
#define FOREACH_CTYPE_MACHINE_TYPE_MAPPING(V) \
|
||||
V(void, kMachNone) \
|
||||
V(bool, kMachUint8) \
|
||||
V(int8_t, kMachInt8) \
|
||||
V(uint8_t, kMachUint8) \
|
||||
V(int16_t, kMachInt16) \
|
||||
V(uint16_t, kMachUint16) \
|
||||
V(int32_t, kMachInt32) \
|
||||
V(uint32_t, kMachUint32) \
|
||||
V(int64_t, kMachInt64) \
|
||||
V(uint64_t, kMachUint64) \
|
||||
V(float, kMachFloat32) \
|
||||
V(double, kMachFloat64) \
|
||||
V(void*, kMachPtr) \
|
||||
V(int*, kMachPtr)
|
||||
V(void, MachineType::None()) \
|
||||
V(bool, MachineType::Uint8()) \
|
||||
V(int8_t, MachineType::Int8()) \
|
||||
V(uint8_t, MachineType::Uint8()) \
|
||||
V(int16_t, MachineType::Int16()) \
|
||||
V(uint16_t, MachineType::Uint16()) \
|
||||
V(int32_t, MachineType::Int32()) \
|
||||
V(uint32_t, MachineType::Uint32()) \
|
||||
V(int64_t, MachineType::Int64()) \
|
||||
V(uint64_t, MachineType::Uint64()) \
|
||||
V(float, MachineType::Float32()) \
|
||||
V(double, MachineType::Float64()) \
|
||||
V(void*, MachineType::Pointer()) \
|
||||
V(int*, MachineType::Pointer())
|
||||
|
||||
template <typename T>
|
||||
inline MachineType MachineTypeForC() {
|
||||
@ -33,7 +33,7 @@ inline MachineType MachineTypeForC() {
|
||||
// All other types T must be assignable to Object*
|
||||
*(static_cast<Object* volatile*>(0)) = static_cast<T>(0);
|
||||
}
|
||||
return kMachAnyTagged;
|
||||
return MachineType::AnyTagged();
|
||||
}
|
||||
|
||||
#define DECLARE_TEMPLATE_SPECIALIZATION(ctype, mtype) \
|
||||
@ -64,7 +64,7 @@ class CSignature : public MachineSignature {
|
||||
if (p < static_cast<int>(parameter_count())) {
|
||||
CHECK_EQ(GetParam(p), params[p]);
|
||||
} else {
|
||||
CHECK_EQ(kMachNone, params[p]);
|
||||
CHECK_EQ(MachineType::None(), params[p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -74,13 +74,15 @@ class CSignature : public MachineSignature {
|
||||
}
|
||||
|
||||
static CSignature* New(Zone* zone, MachineType ret,
|
||||
MachineType p1 = kMachNone, MachineType p2 = kMachNone,
|
||||
MachineType p3 = kMachNone, MachineType p4 = kMachNone,
|
||||
MachineType p5 = kMachNone) {
|
||||
MachineType p1 = MachineType::None(),
|
||||
MachineType p2 = MachineType::None(),
|
||||
MachineType p3 = MachineType::None(),
|
||||
MachineType p4 = MachineType::None(),
|
||||
MachineType p5 = MachineType::None()) {
|
||||
MachineType* buffer = zone->NewArray<MachineType>(6);
|
||||
int pos = 0;
|
||||
size_t return_count = 0;
|
||||
if (ret != kMachNone) {
|
||||
if (ret != MachineType::None()) {
|
||||
buffer[pos++] = ret;
|
||||
return_count++;
|
||||
}
|
||||
@ -90,14 +92,15 @@ class CSignature : public MachineSignature {
|
||||
buffer[pos++] = p4;
|
||||
buffer[pos++] = p5;
|
||||
size_t param_count = 5;
|
||||
if (p5 == kMachNone) param_count--;
|
||||
if (p4 == kMachNone) param_count--;
|
||||
if (p3 == kMachNone) param_count--;
|
||||
if (p2 == kMachNone) param_count--;
|
||||
if (p1 == kMachNone) param_count--;
|
||||
if (p5 == MachineType::None()) param_count--;
|
||||
if (p4 == MachineType::None()) param_count--;
|
||||
if (p3 == MachineType::None()) param_count--;
|
||||
if (p2 == MachineType::None()) param_count--;
|
||||
if (p1 == MachineType::None()) param_count--;
|
||||
for (size_t i = 0; i < param_count; i++) {
|
||||
// Check that there are no kMachNone's in the middle of parameters.
|
||||
CHECK_NE(kMachNone, buffer[return_count + i]);
|
||||
// Check that there are no MachineType::None()'s in the middle of
|
||||
// parameters.
|
||||
CHECK_NE(MachineType::None(), buffer[return_count + i]);
|
||||
}
|
||||
return new (zone) CSignature(return_count, param_count, buffer);
|
||||
}
|
||||
@ -110,8 +113,8 @@ class CSignatureOf : public CSignature {
|
||||
MachineType storage_[1 + kParamCount];
|
||||
|
||||
CSignatureOf()
|
||||
: CSignature(MachineTypeForC<Ret>() != kMachNone ? 1 : 0, kParamCount,
|
||||
reinterpret_cast<MachineType*>(&storage_)) {
|
||||
: CSignature(MachineTypeForC<Ret>() != MachineType::None() ? 1 : 0,
|
||||
kParamCount, reinterpret_cast<MachineType*>(&storage_)) {
|
||||
if (return_count_ == 1) storage_[0] = MachineTypeForC<Ret>();
|
||||
}
|
||||
void Set(int index, MachineType type) {
|
||||
|
@ -291,7 +291,8 @@ void Int32BinopInputShapeTester::TestAllInputShapes() {
|
||||
for (int i = -2; i < num_int_inputs; i++) { // for all left shapes
|
||||
for (int j = -2; j < num_int_inputs; j++) { // for all right shapes
|
||||
if (i >= 0 && j >= 0) break; // No constant/constant combos
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
|
||||
MachineType::Int32());
|
||||
Node* p0 = m.Parameter(0);
|
||||
Node* p1 = m.Parameter(1);
|
||||
Node* n0;
|
||||
@ -301,7 +302,7 @@ void Int32BinopInputShapeTester::TestAllInputShapes() {
|
||||
if (i == -2) {
|
||||
n0 = p0;
|
||||
} else if (i == -1) {
|
||||
n0 = m.LoadFromPointer(&input_a, kMachInt32);
|
||||
n0 = m.LoadFromPointer(&input_a, MachineType::Int32());
|
||||
} else {
|
||||
n0 = m.Int32Constant(inputs[i]);
|
||||
}
|
||||
@ -310,7 +311,7 @@ void Int32BinopInputShapeTester::TestAllInputShapes() {
|
||||
if (j == -2) {
|
||||
n1 = p1;
|
||||
} else if (j == -1) {
|
||||
n1 = m.LoadFromPointer(&input_b, kMachInt32);
|
||||
n1 = m.LoadFromPointer(&input_b, MachineType::Int32());
|
||||
} else {
|
||||
n1 = m.Int32Constant(inputs[j]);
|
||||
}
|
||||
@ -368,7 +369,8 @@ void Int32BinopInputShapeTester::RunRight(
|
||||
|
||||
|
||||
TEST(ParametersEqual) {
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
|
||||
MachineType::Int32());
|
||||
Node* p1 = m.Parameter(1);
|
||||
CHECK(p1);
|
||||
Node* p0 = m.Parameter(0);
|
||||
@ -482,7 +484,7 @@ TEST(RunHeapNumberConstant) {
|
||||
|
||||
|
||||
TEST(RunParam1) {
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
|
||||
m.Return(m.Parameter(0));
|
||||
|
||||
FOR_INT32_INPUTS(i) {
|
||||
@ -493,7 +495,8 @@ TEST(RunParam1) {
|
||||
|
||||
|
||||
TEST(RunParam2_1) {
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
|
||||
MachineType::Int32());
|
||||
Node* p0 = m.Parameter(0);
|
||||
Node* p1 = m.Parameter(1);
|
||||
m.Return(p0);
|
||||
@ -507,7 +510,8 @@ TEST(RunParam2_1) {
|
||||
|
||||
|
||||
TEST(RunParam2_2) {
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
|
||||
MachineType::Int32());
|
||||
Node* p0 = m.Parameter(0);
|
||||
Node* p1 = m.Parameter(1);
|
||||
m.Return(p1);
|
||||
@ -522,7 +526,8 @@ TEST(RunParam2_2) {
|
||||
|
||||
TEST(RunParam3) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32());
|
||||
Node* nodes[] = {m.Parameter(0), m.Parameter(1), m.Parameter(2)};
|
||||
m.Return(nodes[i]);
|
||||
|
||||
@ -580,12 +585,13 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
|
||||
CHECK_EQ(0x12500000000, m.Call());
|
||||
}
|
||||
{
|
||||
BufferedRawMachineAssemblerTester<double> m(kMachFloat64);
|
||||
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
|
||||
m.Return(m.Parameter(0));
|
||||
FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(*i, m.Call(*i)); }
|
||||
}
|
||||
{
|
||||
BufferedRawMachineAssemblerTester<int64_t> m(kMachInt64, kMachInt64);
|
||||
BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Int64(),
|
||||
MachineType::Int64());
|
||||
m.Return(m.Int64Add(m.Parameter(0), m.Parameter(1)));
|
||||
FOR_INT64_INPUTS(i) {
|
||||
FOR_INT64_INPUTS(j) {
|
||||
@ -595,8 +601,8 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
|
||||
}
|
||||
}
|
||||
{
|
||||
BufferedRawMachineAssemblerTester<int64_t> m(kMachInt64, kMachInt64,
|
||||
kMachInt64);
|
||||
BufferedRawMachineAssemblerTester<int64_t> m(
|
||||
MachineType::Int64(), MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(
|
||||
m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)));
|
||||
FOR_INT64_INPUTS(i) {
|
||||
@ -608,8 +614,9 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
|
||||
}
|
||||
}
|
||||
{
|
||||
BufferedRawMachineAssemblerTester<int64_t> m(kMachInt64, kMachInt64,
|
||||
kMachInt64, kMachInt64);
|
||||
BufferedRawMachineAssemblerTester<int64_t> m(
|
||||
MachineType::Int64(), MachineType::Int64(), MachineType::Int64(),
|
||||
MachineType::Int64());
|
||||
m.Return(m.Int64Add(
|
||||
m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)),
|
||||
m.Parameter(3)));
|
||||
@ -632,7 +639,7 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
|
||||
CHECK_EQ(0x12500000000, result);
|
||||
}
|
||||
{
|
||||
BufferedRawMachineAssemblerTester<void> m(kMachFloat64);
|
||||
BufferedRawMachineAssemblerTester<void> m(MachineType::Float64());
|
||||
double result;
|
||||
m.Store(MachineTypeForC<double>(), m.PointerConstant(&result),
|
||||
m.Parameter(0), kNoWriteBarrier);
|
||||
@ -643,7 +650,8 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
|
||||
}
|
||||
}
|
||||
{
|
||||
BufferedRawMachineAssemblerTester<void> m(kMachInt64, kMachInt64);
|
||||
BufferedRawMachineAssemblerTester<void> m(MachineType::Int64(),
|
||||
MachineType::Int64());
|
||||
int64_t result;
|
||||
m.Store(MachineTypeForC<int64_t>(), m.PointerConstant(&result),
|
||||
m.Int64Add(m.Parameter(0), m.Parameter(1)), kNoWriteBarrier);
|
||||
@ -659,8 +667,8 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
|
||||
}
|
||||
}
|
||||
{
|
||||
BufferedRawMachineAssemblerTester<void> m(kMachInt64, kMachInt64,
|
||||
kMachInt64);
|
||||
BufferedRawMachineAssemblerTester<void> m(
|
||||
MachineType::Int64(), MachineType::Int64(), MachineType::Int64());
|
||||
int64_t result;
|
||||
m.Store(
|
||||
MachineTypeForC<int64_t>(), m.PointerConstant(&result),
|
||||
@ -681,8 +689,9 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
|
||||
}
|
||||
}
|
||||
{
|
||||
BufferedRawMachineAssemblerTester<void> m(kMachInt64, kMachInt64,
|
||||
kMachInt64, kMachInt64);
|
||||
BufferedRawMachineAssemblerTester<void> m(
|
||||
MachineType::Int64(), MachineType::Int64(), MachineType::Int64(),
|
||||
MachineType::Int64());
|
||||
int64_t result;
|
||||
m.Store(MachineTypeForC<int64_t>(), m.PointerConstant(&result),
|
||||
m.Int64Add(m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)),
|
||||
|
@ -20,11 +20,11 @@ class RawMachineAssemblerTester : public HandleAndZoneScope,
|
||||
public CallHelper<ReturnType>,
|
||||
public RawMachineAssembler {
|
||||
public:
|
||||
RawMachineAssemblerTester(MachineType p0 = kMachNone,
|
||||
MachineType p1 = kMachNone,
|
||||
MachineType p2 = kMachNone,
|
||||
MachineType p3 = kMachNone,
|
||||
MachineType p4 = kMachNone)
|
||||
RawMachineAssemblerTester(MachineType p0 = MachineType::None(),
|
||||
MachineType p1 = MachineType::None(),
|
||||
MachineType p2 = MachineType::None(),
|
||||
MachineType p3 = MachineType::None(),
|
||||
MachineType p4 = MachineType::None())
|
||||
: HandleAndZoneScope(),
|
||||
CallHelper<ReturnType>(
|
||||
main_isolate(),
|
||||
@ -36,7 +36,8 @@ class RawMachineAssemblerTester : public HandleAndZoneScope,
|
||||
main_zone(),
|
||||
CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p0,
|
||||
p1, p2, p3, p4)),
|
||||
kMachPtr, InstructionSelector::SupportedMachineOperatorFlags()) {}
|
||||
MachineType::PointerRepresentation(),
|
||||
InstructionSelector::SupportedMachineOperatorFlags()) {}
|
||||
|
||||
void CheckNumber(double expected, Object* number) {
|
||||
CHECK(this->isolate()->factory()->NewNumber(expected)->SameValue(number));
|
||||
@ -77,10 +78,10 @@ template <typename ReturnType>
|
||||
class BufferedRawMachineAssemblerTester
|
||||
: public RawMachineAssemblerTester<int32_t> {
|
||||
public:
|
||||
BufferedRawMachineAssemblerTester(MachineType p0 = kMachNone,
|
||||
MachineType p1 = kMachNone,
|
||||
MachineType p2 = kMachNone,
|
||||
MachineType p3 = kMachNone)
|
||||
BufferedRawMachineAssemblerTester(MachineType p0 = MachineType::None(),
|
||||
MachineType p1 = MachineType::None(),
|
||||
MachineType p2 = MachineType::None(),
|
||||
MachineType p3 = MachineType::None())
|
||||
: BufferedRawMachineAssemblerTester(ComputeParameterCount(p0, p1, p2, p3),
|
||||
p0, p1, p2, p3) {}
|
||||
|
||||
@ -159,36 +160,45 @@ class BufferedRawMachineAssemblerTester
|
||||
MachineType p0, MachineType p1,
|
||||
MachineType p2, MachineType p3)
|
||||
: RawMachineAssemblerTester<int32_t>(
|
||||
kMachPtr, p0 == kMachNone ? kMachNone : kMachPtr,
|
||||
p1 == kMachNone ? kMachNone : kMachPtr,
|
||||
p2 == kMachNone ? kMachNone : kMachPtr,
|
||||
p3 == kMachNone ? kMachNone : kMachPtr),
|
||||
MachineType::Pointer(),
|
||||
p0 == MachineType::None() ? MachineType::None()
|
||||
: MachineType::Pointer(),
|
||||
p1 == MachineType::None() ? MachineType::None()
|
||||
: MachineType::Pointer(),
|
||||
p2 == MachineType::None() ? MachineType::None()
|
||||
: MachineType::Pointer(),
|
||||
p3 == MachineType::None() ? MachineType::None()
|
||||
: MachineType::Pointer()),
|
||||
test_graph_signature_(
|
||||
CSignature::New(main_zone(), kMachInt32, p0, p1, p2, p3)),
|
||||
CSignature::New(main_zone(), MachineType::Int32(), p0, p1, p2, p3)),
|
||||
return_parameter_index_(return_parameter_index) {
|
||||
parameter_nodes_[0] =
|
||||
p0 == kMachNone ? nullptr : Load(p0, RawMachineAssembler::Parameter(0));
|
||||
parameter_nodes_[1] =
|
||||
p1 == kMachNone ? nullptr : Load(p1, RawMachineAssembler::Parameter(1));
|
||||
parameter_nodes_[2] =
|
||||
p2 == kMachNone ? nullptr : Load(p2, RawMachineAssembler::Parameter(2));
|
||||
parameter_nodes_[3] =
|
||||
p3 == kMachNone ? nullptr : Load(p3, RawMachineAssembler::Parameter(3));
|
||||
parameter_nodes_[0] = p0 == MachineType::None()
|
||||
? nullptr
|
||||
: Load(p0, RawMachineAssembler::Parameter(0));
|
||||
parameter_nodes_[1] = p1 == MachineType::None()
|
||||
? nullptr
|
||||
: Load(p1, RawMachineAssembler::Parameter(1));
|
||||
parameter_nodes_[2] = p2 == MachineType::None()
|
||||
? nullptr
|
||||
: Load(p2, RawMachineAssembler::Parameter(2));
|
||||
parameter_nodes_[3] = p3 == MachineType::None()
|
||||
? nullptr
|
||||
: Load(p3, RawMachineAssembler::Parameter(3));
|
||||
}
|
||||
|
||||
|
||||
static uint32_t ComputeParameterCount(MachineType p0, MachineType p1,
|
||||
MachineType p2, MachineType p3) {
|
||||
if (p0 == kMachNone) {
|
||||
if (p0 == MachineType::None()) {
|
||||
return 0;
|
||||
}
|
||||
if (p1 == kMachNone) {
|
||||
if (p1 == MachineType::None()) {
|
||||
return 1;
|
||||
}
|
||||
if (p2 == kMachNone) {
|
||||
if (p2 == MachineType::None()) {
|
||||
return 2;
|
||||
}
|
||||
if (p3 == kMachNone) {
|
||||
if (p3 == MachineType::None()) {
|
||||
return 3;
|
||||
}
|
||||
return 4;
|
||||
@ -205,25 +215,34 @@ template <>
|
||||
class BufferedRawMachineAssemblerTester<void>
|
||||
: public RawMachineAssemblerTester<void> {
|
||||
public:
|
||||
BufferedRawMachineAssemblerTester(MachineType p0 = kMachNone,
|
||||
MachineType p1 = kMachNone,
|
||||
MachineType p2 = kMachNone,
|
||||
MachineType p3 = kMachNone)
|
||||
: RawMachineAssemblerTester<void>(p0 == kMachNone ? kMachNone : kMachPtr,
|
||||
p1 == kMachNone ? kMachNone : kMachPtr,
|
||||
p2 == kMachNone ? kMachNone : kMachPtr,
|
||||
p3 == kMachNone ? kMachNone : kMachPtr),
|
||||
BufferedRawMachineAssemblerTester(MachineType p0 = MachineType::None(),
|
||||
MachineType p1 = MachineType::None(),
|
||||
MachineType p2 = MachineType::None(),
|
||||
MachineType p3 = MachineType::None())
|
||||
: RawMachineAssemblerTester<void>(
|
||||
p0 == MachineType::None() ? MachineType::None()
|
||||
: MachineType::Pointer(),
|
||||
p1 == MachineType::None() ? MachineType::None()
|
||||
: MachineType::Pointer(),
|
||||
p2 == MachineType::None() ? MachineType::None()
|
||||
: MachineType::Pointer(),
|
||||
p3 == MachineType::None() ? MachineType::None()
|
||||
: MachineType::Pointer()),
|
||||
test_graph_signature_(
|
||||
CSignature::New(RawMachineAssemblerTester<void>::main_zone(),
|
||||
kMachNone, p0, p1, p2, p3)) {
|
||||
parameter_nodes_[0] =
|
||||
p0 == kMachNone ? nullptr : Load(p0, RawMachineAssembler::Parameter(0));
|
||||
parameter_nodes_[1] =
|
||||
p1 == kMachNone ? nullptr : Load(p1, RawMachineAssembler::Parameter(1));
|
||||
parameter_nodes_[2] =
|
||||
p2 == kMachNone ? nullptr : Load(p2, RawMachineAssembler::Parameter(2));
|
||||
parameter_nodes_[3] =
|
||||
p3 == kMachNone ? nullptr : Load(p3, RawMachineAssembler::Parameter(3));
|
||||
MachineType::None(), p0, p1, p2, p3)) {
|
||||
parameter_nodes_[0] = p0 == MachineType::None()
|
||||
? nullptr
|
||||
: Load(p0, RawMachineAssembler::Parameter(0));
|
||||
parameter_nodes_[1] = p1 == MachineType::None()
|
||||
? nullptr
|
||||
: Load(p1, RawMachineAssembler::Parameter(1));
|
||||
parameter_nodes_[2] = p2 == MachineType::None()
|
||||
? nullptr
|
||||
: Load(p2, RawMachineAssembler::Parameter(2));
|
||||
parameter_nodes_[3] = p3 == MachineType::None()
|
||||
? nullptr
|
||||
: Load(p3, RawMachineAssembler::Parameter(3));
|
||||
}
|
||||
|
||||
|
||||
@ -283,13 +302,15 @@ static const int32_t CHECK_VALUE = 0x99BEEDCE;
|
||||
|
||||
// TODO(titzer): use the C-style calling convention, or any register-based
|
||||
// calling convention for binop tests.
|
||||
template <typename CType, MachineType rep, bool use_result_buffer>
|
||||
template <typename CType, bool use_result_buffer>
|
||||
class BinopTester {
|
||||
public:
|
||||
explicit BinopTester(RawMachineAssemblerTester<int32_t>* tester)
|
||||
explicit BinopTester(RawMachineAssemblerTester<int32_t>* tester,
|
||||
MachineType rep)
|
||||
: T(tester),
|
||||
param0(T->LoadFromPointer(&p0, rep)),
|
||||
param1(T->LoadFromPointer(&p1, rep)),
|
||||
rep(rep),
|
||||
p0(static_cast<CType>(0)),
|
||||
p1(static_cast<CType>(0)),
|
||||
result(static_cast<CType>(0)) {}
|
||||
@ -331,6 +352,7 @@ class BinopTester {
|
||||
}
|
||||
|
||||
protected:
|
||||
MachineType rep;
|
||||
CType p0;
|
||||
CType p1;
|
||||
CType result;
|
||||
@ -339,21 +361,21 @@ class BinopTester {
|
||||
|
||||
// A helper class for testing code sequences that take two int parameters and
|
||||
// return an int value.
|
||||
class Int32BinopTester
|
||||
: public BinopTester<int32_t, kMachInt32, USE_RETURN_REGISTER> {
|
||||
class Int32BinopTester : public BinopTester<int32_t, USE_RETURN_REGISTER> {
|
||||
public:
|
||||
explicit Int32BinopTester(RawMachineAssemblerTester<int32_t>* tester)
|
||||
: BinopTester<int32_t, kMachInt32, USE_RETURN_REGISTER>(tester) {}
|
||||
: BinopTester<int32_t, USE_RETURN_REGISTER>(tester,
|
||||
MachineType::Int32()) {}
|
||||
};
|
||||
|
||||
|
||||
// A helper class for testing code sequences that take two uint parameters and
|
||||
// return an uint value.
|
||||
class Uint32BinopTester
|
||||
: public BinopTester<uint32_t, kMachUint32, USE_RETURN_REGISTER> {
|
||||
class Uint32BinopTester : public BinopTester<uint32_t, USE_RETURN_REGISTER> {
|
||||
public:
|
||||
explicit Uint32BinopTester(RawMachineAssemblerTester<int32_t>* tester)
|
||||
: BinopTester<uint32_t, kMachUint32, USE_RETURN_REGISTER>(tester) {}
|
||||
: BinopTester<uint32_t, USE_RETURN_REGISTER>(tester,
|
||||
MachineType::Uint32()) {}
|
||||
|
||||
uint32_t call(uint32_t a0, uint32_t a1) {
|
||||
p0 = a0;
|
||||
@ -366,22 +388,21 @@ class Uint32BinopTester
|
||||
// A helper class for testing code sequences that take two float parameters and
|
||||
// return a float value.
|
||||
// TODO(titzer): figure out how to return floats correctly on ia32.
|
||||
class Float32BinopTester
|
||||
: public BinopTester<float, kMachFloat32, USE_RESULT_BUFFER> {
|
||||
class Float32BinopTester : public BinopTester<float, USE_RESULT_BUFFER> {
|
||||
public:
|
||||
explicit Float32BinopTester(RawMachineAssemblerTester<int32_t>* tester)
|
||||
: BinopTester<float, kMachFloat32, USE_RESULT_BUFFER>(tester) {}
|
||||
: BinopTester<float, USE_RESULT_BUFFER>(tester, MachineType::Float32()) {}
|
||||
};
|
||||
|
||||
|
||||
// A helper class for testing code sequences that take two double parameters and
|
||||
// return a double value.
|
||||
// TODO(titzer): figure out how to return doubles correctly on ia32.
|
||||
class Float64BinopTester
|
||||
: public BinopTester<double, kMachFloat64, USE_RESULT_BUFFER> {
|
||||
class Float64BinopTester : public BinopTester<double, USE_RESULT_BUFFER> {
|
||||
public:
|
||||
explicit Float64BinopTester(RawMachineAssemblerTester<int32_t>* tester)
|
||||
: BinopTester<double, kMachFloat64, USE_RESULT_BUFFER>(tester) {}
|
||||
: BinopTester<double, USE_RESULT_BUFFER>(tester, MachineType::Float64()) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -389,22 +410,22 @@ class Float64BinopTester
|
||||
// and return a pointer value.
|
||||
// TODO(titzer): pick word size of pointers based on V8_TARGET.
|
||||
template <typename Type>
|
||||
class PointerBinopTester
|
||||
: public BinopTester<Type*, kMachPtr, USE_RETURN_REGISTER> {
|
||||
class PointerBinopTester : public BinopTester<Type*, USE_RETURN_REGISTER> {
|
||||
public:
|
||||
explicit PointerBinopTester(RawMachineAssemblerTester<int32_t>* tester)
|
||||
: BinopTester<Type*, kMachPtr, USE_RETURN_REGISTER>(tester) {}
|
||||
: BinopTester<Type*, USE_RETURN_REGISTER>(tester,
|
||||
MachineType::Pointer()) {}
|
||||
};
|
||||
|
||||
|
||||
// A helper class for testing code sequences that take two tagged parameters and
|
||||
// return a tagged value.
|
||||
template <typename Type>
|
||||
class TaggedBinopTester
|
||||
: public BinopTester<Type*, kMachAnyTagged, USE_RETURN_REGISTER> {
|
||||
class TaggedBinopTester : public BinopTester<Type*, USE_RETURN_REGISTER> {
|
||||
public:
|
||||
explicit TaggedBinopTester(RawMachineAssemblerTester<int32_t>* tester)
|
||||
: BinopTester<Type*, kMachAnyTagged, USE_RETURN_REGISTER>(tester) {}
|
||||
: BinopTester<Type*, USE_RETURN_REGISTER>(tester,
|
||||
MachineType::AnyTagged()) {}
|
||||
};
|
||||
|
||||
// A helper class for testing compares. Wraps a machine opcode and provides
|
||||
|
@ -24,7 +24,7 @@ class GraphAndBuilders {
|
||||
explicit GraphAndBuilders(Zone* zone)
|
||||
: main_graph_(new (zone) Graph(zone)),
|
||||
main_common_(zone),
|
||||
main_machine_(zone, kMachPtr,
|
||||
main_machine_(zone, MachineType::PointerRepresentation(),
|
||||
InstructionSelector::SupportedMachineOperatorFlags()),
|
||||
main_simplified_(zone) {}
|
||||
|
||||
@ -48,11 +48,11 @@ class GraphBuilderTester : public HandleAndZoneScope,
|
||||
public GraphAndBuilders,
|
||||
public CallHelper<ReturnType> {
|
||||
public:
|
||||
explicit GraphBuilderTester(MachineType p0 = kMachNone,
|
||||
MachineType p1 = kMachNone,
|
||||
MachineType p2 = kMachNone,
|
||||
MachineType p3 = kMachNone,
|
||||
MachineType p4 = kMachNone)
|
||||
explicit GraphBuilderTester(MachineType p0 = MachineType::None(),
|
||||
MachineType p1 = MachineType::None(),
|
||||
MachineType p2 = MachineType::None(),
|
||||
MachineType p3 = MachineType::None(),
|
||||
MachineType p4 = MachineType::None())
|
||||
: GraphAndBuilders(main_zone()),
|
||||
CallHelper<ReturnType>(
|
||||
main_isolate(),
|
||||
|
@ -12,7 +12,8 @@ namespace compiler {
|
||||
|
||||
class BasicBlockProfilerTest : public RawMachineAssemblerTester<int32_t> {
|
||||
public:
|
||||
BasicBlockProfilerTest() : RawMachineAssemblerTester<int32_t>(kMachInt32) {
|
||||
BasicBlockProfilerTest()
|
||||
: RawMachineAssemblerTester<int32_t>(MachineType::Int32()) {
|
||||
FLAG_turbo_profiling = true;
|
||||
}
|
||||
|
||||
@ -81,7 +82,7 @@ TEST(ProfileLoop) {
|
||||
m.Goto(&header);
|
||||
|
||||
m.Bind(&header);
|
||||
Node* count = m.Phi(kMachInt32, m.Parameter(0), one);
|
||||
Node* count = m.Phi(MachineRepresentation::kWord32, m.Parameter(0), one);
|
||||
m.Branch(count, &body, &end);
|
||||
|
||||
m.Bind(&body);
|
||||
|
@ -18,7 +18,7 @@ static IrOpcode::Value int32cmp_opcodes[] = {
|
||||
|
||||
TEST(BranchCombineWord32EqualZero_1) {
|
||||
// Test combining a branch with x == 0
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
|
||||
int32_t eq_constant = -1033;
|
||||
int32_t ne_constant = 825118;
|
||||
Node* p0 = m.Parameter(0);
|
||||
@ -44,7 +44,7 @@ TEST(BranchCombineWord32EqualZero_chain) {
|
||||
int32_t ne_constant = 815118;
|
||||
|
||||
for (int k = 0; k < 6; k++) {
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
|
||||
Node* p0 = m.Parameter(0);
|
||||
RawMachineLabel blocka, blockb;
|
||||
Node* cond = p0;
|
||||
@ -69,7 +69,7 @@ TEST(BranchCombineWord32EqualZero_chain) {
|
||||
|
||||
TEST(BranchCombineInt32LessThanZero_1) {
|
||||
// Test combining a branch with x < 0
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
|
||||
int32_t eq_constant = -1433;
|
||||
int32_t ne_constant = 845118;
|
||||
Node* p0 = m.Parameter(0);
|
||||
@ -91,7 +91,7 @@ TEST(BranchCombineInt32LessThanZero_1) {
|
||||
|
||||
TEST(BranchCombineUint32LessThan100_1) {
|
||||
// Test combining a branch with x < 100
|
||||
RawMachineAssemblerTester<int32_t> m(kMachUint32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
|
||||
int32_t eq_constant = 1471;
|
||||
int32_t ne_constant = 88845718;
|
||||
Node* p0 = m.Parameter(0);
|
||||
@ -113,7 +113,7 @@ TEST(BranchCombineUint32LessThan100_1) {
|
||||
|
||||
TEST(BranchCombineUint32LessThanOrEqual100_1) {
|
||||
// Test combining a branch with x <= 100
|
||||
RawMachineAssemblerTester<int32_t> m(kMachUint32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
|
||||
int32_t eq_constant = 1479;
|
||||
int32_t ne_constant = 77845719;
|
||||
Node* p0 = m.Parameter(0);
|
||||
@ -135,7 +135,7 @@ TEST(BranchCombineUint32LessThanOrEqual100_1) {
|
||||
|
||||
TEST(BranchCombineZeroLessThanInt32_1) {
|
||||
// Test combining a branch with 0 < x
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
|
||||
int32_t eq_constant = -2033;
|
||||
int32_t ne_constant = 225118;
|
||||
Node* p0 = m.Parameter(0);
|
||||
@ -157,7 +157,7 @@ TEST(BranchCombineZeroLessThanInt32_1) {
|
||||
|
||||
TEST(BranchCombineInt32GreaterThanZero_1) {
|
||||
// Test combining a branch with x > 0
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
|
||||
int32_t eq_constant = -1073;
|
||||
int32_t ne_constant = 825178;
|
||||
Node* p0 = m.Parameter(0);
|
||||
@ -179,7 +179,8 @@ TEST(BranchCombineInt32GreaterThanZero_1) {
|
||||
|
||||
TEST(BranchCombineWord32EqualP) {
|
||||
// Test combining a branch with an Word32Equal.
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
|
||||
MachineType::Int32());
|
||||
int32_t eq_constant = -1035;
|
||||
int32_t ne_constant = 825018;
|
||||
Node* p0 = m.Parameter(0);
|
||||
@ -209,7 +210,7 @@ TEST(BranchCombineWord32EqualI) {
|
||||
|
||||
for (int left = 0; left < 2; left++) {
|
||||
FOR_INT32_INPUTS(i) {
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
|
||||
int32_t a = *i;
|
||||
|
||||
Node* p0 = m.Int32Constant(a);
|
||||
@ -238,7 +239,8 @@ TEST(BranchCombineInt32CmpP) {
|
||||
int32_t ne_constant = 725018;
|
||||
|
||||
for (int op = 0; op < 2; op++) {
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
|
||||
MachineType::Int32());
|
||||
Node* p0 = m.Parameter(0);
|
||||
Node* p1 = m.Parameter(1);
|
||||
|
||||
@ -270,7 +272,7 @@ TEST(BranchCombineInt32CmpI) {
|
||||
|
||||
for (int op = 0; op < 2; op++) {
|
||||
FOR_INT32_INPUTS(i) {
|
||||
RawMachineAssemblerTester<int32_t> m(kMachInt32);
|
||||
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
|
||||
int32_t a = *i;
|
||||
Node* p0 = m.Int32Constant(a);
|
||||
Node* p1 = m.Parameter(0);
|
||||
@ -427,8 +429,8 @@ TEST(BranchCombineFloat64Compares) {
|
||||
CompareWrapper cmp = cmps[c];
|
||||
for (int invert = 0; invert < 2; invert++) {
|
||||
RawMachineAssemblerTester<int32_t> m;
|
||||
Node* a = m.LoadFromPointer(&input_a, kMachFloat64);
|
||||
Node* b = m.LoadFromPointer(&input_b, kMachFloat64);
|
||||
Node* a = m.LoadFromPointer(&input_a, MachineType::Float64());
|
||||
Node* b = m.LoadFromPointer(&input_b, MachineType::Float64());
|
||||
|
||||
RawMachineLabel blocka, blockb;
|
||||
Node* cond = cmp.MakeNode(&m, a, b);
|
||||
|
@ -31,7 +31,7 @@ namespace compiler {
|
||||
template <typename ReturnType>
|
||||
class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
|
||||
public:
|
||||
explicit ChangesLoweringTester(MachineType p0 = kMachNone)
|
||||
explicit ChangesLoweringTester(MachineType p0 = MachineType::None())
|
||||
: GraphBuilderTester<ReturnType>(p0),
|
||||
javascript(this->zone()),
|
||||
jsgraph(this->isolate(), this->graph(), this->common(), &javascript,
|
||||
@ -60,22 +60,22 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
|
||||
|
||||
void StoreFloat64(Node* node, double* ptr) {
|
||||
Node* ptr_node = this->PointerConstant(ptr);
|
||||
this->Store(kMachFloat64, ptr_node, node);
|
||||
this->Store(MachineType::Float64(), ptr_node, node);
|
||||
}
|
||||
|
||||
Node* LoadInt32(int32_t* ptr) {
|
||||
Node* ptr_node = this->PointerConstant(ptr);
|
||||
return this->Load(kMachInt32, ptr_node);
|
||||
return this->Load(MachineType::Int32(), ptr_node);
|
||||
}
|
||||
|
||||
Node* LoadUint32(uint32_t* ptr) {
|
||||
Node* ptr_node = this->PointerConstant(ptr);
|
||||
return this->Load(kMachUint32, ptr_node);
|
||||
return this->Load(MachineType::Uint32(), ptr_node);
|
||||
}
|
||||
|
||||
Node* LoadFloat64(double* ptr) {
|
||||
Node* ptr_node = this->PointerConstant(ptr);
|
||||
return this->Load(kMachFloat64, ptr_node);
|
||||
return this->Load(MachineType::Float64(), ptr_node);
|
||||
}
|
||||
|
||||
void CheckNumber(double expected, Object* number) {
|
||||
@ -145,7 +145,7 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
|
||||
|
||||
TEST(RunChangeTaggedToInt32) {
|
||||
// Build and lower a graph by hand.
|
||||
ChangesLoweringTester<int32_t> t(kMachAnyTagged);
|
||||
ChangesLoweringTester<int32_t> t(MachineType::AnyTagged());
|
||||
t.BuildAndLower(t.simplified()->ChangeTaggedToInt32());
|
||||
|
||||
FOR_INT32_INPUTS(i) {
|
||||
@ -173,7 +173,7 @@ TEST(RunChangeTaggedToInt32) {
|
||||
|
||||
TEST(RunChangeTaggedToUint32) {
|
||||
// Build and lower a graph by hand.
|
||||
ChangesLoweringTester<uint32_t> t(kMachAnyTagged);
|
||||
ChangesLoweringTester<uint32_t> t(MachineType::AnyTagged());
|
||||
t.BuildAndLower(t.simplified()->ChangeTaggedToUint32());
|
||||
|
||||
FOR_UINT32_INPUTS(i) {
|
||||
@ -200,13 +200,13 @@ TEST(RunChangeTaggedToUint32) {
|
||||
|
||||
|
||||
TEST(RunChangeTaggedToFloat64) {
|
||||
ChangesLoweringTester<int32_t> t(kMachAnyTagged);
|
||||
ChangesLoweringTester<int32_t> t(MachineType::AnyTagged());
|
||||
double result;
|
||||
|
||||
t.BuildStoreAndLower(
|
||||
t.simplified()->ChangeTaggedToFloat64(),
|
||||
t.machine()->Store(StoreRepresentation(kMachFloat64, kNoWriteBarrier)),
|
||||
&result);
|
||||
t.BuildStoreAndLower(t.simplified()->ChangeTaggedToFloat64(),
|
||||
t.machine()->Store(StoreRepresentation(
|
||||
MachineType::Float64(), kNoWriteBarrier)),
|
||||
&result);
|
||||
|
||||
{
|
||||
FOR_INT32_INPUTS(i) {
|
||||
@ -251,7 +251,7 @@ TEST(RunChangeTaggedToFloat64) {
|
||||
|
||||
|
||||
TEST(RunChangeBoolToBit) {
|
||||
ChangesLoweringTester<int32_t> t(kMachAnyTagged);
|
||||
ChangesLoweringTester<int32_t> t(MachineType::AnyTagged());
|
||||
t.BuildAndLower(t.simplified()->ChangeBoolToBit());
|
||||
|
||||
{
|
||||
@ -269,7 +269,7 @@ TEST(RunChangeBoolToBit) {
|
||||
|
||||
|
||||
TEST(RunChangeBitToBool) {
|
||||
ChangesLoweringTester<Object*> t(kMachInt32);
|
||||
ChangesLoweringTester<Object*> t(MachineType::Int32());
|
||||
t.BuildAndLower(t.simplified()->ChangeBitToBool());
|
||||
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ class InterpreterState {
|
||||
} else {
|
||||
index = LocationOperand::cast(op).index();
|
||||
}
|
||||
is_float = IsFloatingPoint(LocationOperand::cast(op).machine_type());
|
||||
is_float = IsFloatingPoint(LocationOperand::cast(op).representation());
|
||||
kind = LocationOperand::cast(op).location_kind();
|
||||
} else {
|
||||
index = ConstantOperand::cast(op).virtual_register();
|
||||
@ -178,24 +178,24 @@ class ParallelMoveCreator : public HandleAndZoneScope {
|
||||
}
|
||||
|
||||
private:
|
||||
MachineType RandomType() {
|
||||
MachineRepresentation RandomRepresentation() {
|
||||
int index = rng_->NextInt(3);
|
||||
switch (index) {
|
||||
case 0:
|
||||
return kRepWord32;
|
||||
return MachineRepresentation::kWord32;
|
||||
case 1:
|
||||
return kRepWord64;
|
||||
return MachineRepresentation::kWord64;
|
||||
case 2:
|
||||
return kRepTagged;
|
||||
return MachineRepresentation::kTagged;
|
||||
}
|
||||
UNREACHABLE();
|
||||
return kMachNone;
|
||||
return MachineRepresentation::kNone;
|
||||
}
|
||||
|
||||
MachineType RandomDoubleType() {
|
||||
MachineRepresentation RandomDoubleRepresentation() {
|
||||
int index = rng_->NextInt(2);
|
||||
if (index == 0) return kRepFloat64;
|
||||
return kRepFloat32;
|
||||
if (index == 0) return MachineRepresentation::kFloat64;
|
||||
return MachineRepresentation::kFloat32;
|
||||
}
|
||||
|
||||
InstructionOperand CreateRandomOperand(bool is_source) {
|
||||
@ -203,24 +203,25 @@ class ParallelMoveCreator : public HandleAndZoneScope {
|
||||
// destination can't be Constant.
|
||||
switch (rng_->NextInt(is_source ? 7 : 6)) {
|
||||
case 0:
|
||||
return AllocatedOperand(LocationOperand::STACK_SLOT, RandomType(),
|
||||
index);
|
||||
return AllocatedOperand(LocationOperand::STACK_SLOT,
|
||||
RandomRepresentation(), index);
|
||||
case 1:
|
||||
return AllocatedOperand(LocationOperand::STACK_SLOT, RandomDoubleType(),
|
||||
index);
|
||||
return AllocatedOperand(LocationOperand::STACK_SLOT,
|
||||
RandomDoubleRepresentation(), index);
|
||||
case 2:
|
||||
return AllocatedOperand(LocationOperand::REGISTER, RandomType(), index);
|
||||
return AllocatedOperand(LocationOperand::REGISTER,
|
||||
RandomRepresentation(), index);
|
||||
case 3:
|
||||
return AllocatedOperand(LocationOperand::REGISTER, RandomDoubleType(),
|
||||
index);
|
||||
return AllocatedOperand(LocationOperand::REGISTER,
|
||||
RandomDoubleRepresentation(), index);
|
||||
case 4:
|
||||
return ExplicitOperand(
|
||||
LocationOperand::REGISTER, RandomType(),
|
||||
LocationOperand::REGISTER, RandomRepresentation(),
|
||||
RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
|
||||
->GetAllocatableGeneralCode(1));
|
||||
case 5:
|
||||
return ExplicitOperand(
|
||||
LocationOperand::STACK_SLOT, RandomType(),
|
||||
LocationOperand::STACK_SLOT, RandomRepresentation(),
|
||||
RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN)
|
||||
->GetAllocatableGeneralCode(index));
|
||||
case 6:
|
||||
|
@ -33,7 +33,8 @@ TEST(NodeWithNullInputReachableFromEnd) {
|
||||
Node* start = graph.NewNode(common.Start(0));
|
||||
graph.SetStart(start);
|
||||
Node* k = graph.NewNode(common.Int32Constant(0));
|
||||
Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start);
|
||||
Node* phi =
|
||||
graph.NewNode(common.Phi(MachineRepresentation::kTagged, 1), k, start);
|
||||
phi->ReplaceInput(0, NULL);
|
||||
graph.SetEnd(phi);
|
||||
|
||||
@ -52,7 +53,8 @@ TEST(NodeWithNullControlReachableFromEnd) {
|
||||
Node* start = graph.NewNode(common.Start(0));
|
||||
graph.SetStart(start);
|
||||
Node* k = graph.NewNode(common.Int32Constant(0));
|
||||
Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start);
|
||||
Node* phi =
|
||||
graph.NewNode(common.Phi(MachineRepresentation::kTagged, 1), k, start);
|
||||
phi->ReplaceInput(1, NULL);
|
||||
graph.SetEnd(phi);
|
||||
|
||||
@ -71,7 +73,8 @@ TEST(NodeWithNullInputReachableFromStart) {
|
||||
Node* start = graph.NewNode(common.Start(0));
|
||||
graph.SetStart(start);
|
||||
Node* k = graph.NewNode(common.Int32Constant(0));
|
||||
Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start);
|
||||
Node* phi =
|
||||
graph.NewNode(common.Phi(MachineRepresentation::kTagged, 1), k, start);
|
||||
phi->ReplaceInput(0, NULL);
|
||||
graph.SetEnd(start);
|
||||
|
||||
|
@ -57,16 +57,18 @@ class TestCode : public HandleAndZoneScope {
|
||||
Start();
|
||||
sequence_.AddInstruction(Instruction::New(main_zone(), kArchNop));
|
||||
int index = static_cast<int>(sequence_.instructions().size()) - 1;
|
||||
AddGapMove(index,
|
||||
AllocatedOperand(LocationOperand::REGISTER, kRepWord32, 13),
|
||||
AllocatedOperand(LocationOperand::REGISTER, kRepWord32, 13));
|
||||
AddGapMove(index, AllocatedOperand(LocationOperand::REGISTER,
|
||||
MachineRepresentation::kWord32, 13),
|
||||
AllocatedOperand(LocationOperand::REGISTER,
|
||||
MachineRepresentation::kWord32, 13));
|
||||
}
|
||||
void NonRedundantMoves() {
|
||||
Start();
|
||||
sequence_.AddInstruction(Instruction::New(main_zone(), kArchNop));
|
||||
int index = static_cast<int>(sequence_.instructions().size()) - 1;
|
||||
AddGapMove(index, ConstantOperand(11),
|
||||
AllocatedOperand(LocationOperand::REGISTER, kRepWord32, 11));
|
||||
AllocatedOperand(LocationOperand::REGISTER,
|
||||
MachineRepresentation::kWord32, 11));
|
||||
}
|
||||
void Other() {
|
||||
Start();
|
||||
|
@ -111,7 +111,8 @@ class LoopFinderTester : HandleAndZoneScope {
|
||||
}
|
||||
|
||||
const Operator* op(int count, bool effect) {
|
||||
return effect ? common.EffectPhi(count) : common.Phi(kMachAnyTagged, count);
|
||||
return effect ? common.EffectPhi(count)
|
||||
: common.Phi(MachineRepresentation::kTagged, count);
|
||||
}
|
||||
|
||||
Node* Return(Node* val, Node* effect, Node* control) {
|
||||
@ -266,8 +267,8 @@ TEST(LaLoop1phi) {
|
||||
// One loop with a simple phi.
|
||||
LoopFinderTester t;
|
||||
While w(t, t.p0);
|
||||
Node* phi =
|
||||
t.graph.NewNode(t.common.Phi(kMachAnyTagged, 2), t.zero, t.one, w.loop);
|
||||
Node* phi = t.graph.NewNode(t.common.Phi(MachineRepresentation::kTagged, 2),
|
||||
t.zero, t.one, w.loop);
|
||||
t.Return(phi, t.start, w.exit);
|
||||
|
||||
Node* chain[] = {w.loop};
|
||||
@ -475,7 +476,7 @@ TEST(LaNestedLoop1x) {
|
||||
While w2(t, t.p0);
|
||||
w2.nest(w1);
|
||||
|
||||
const Operator* op = t.common.Phi(kMachInt32, 2);
|
||||
const Operator* op = t.common.Phi(MachineRepresentation::kWord32, 2);
|
||||
Node* p1a = t.graph.NewNode(op, t.p0, t.p0, w1.loop);
|
||||
Node* p1b = t.graph.NewNode(op, t.p0, t.p0, w1.loop);
|
||||
Node* p2a = t.graph.NewNode(op, p1a, t.p0, w2.loop);
|
||||
@ -688,8 +689,8 @@ TEST(LaEdgeMatrix1) {
|
||||
Node* p3 = t.jsgraph.Int32Constant(33);
|
||||
|
||||
Node* loop = t.graph.NewNode(t.common.Loop(2), t.start, t.start);
|
||||
Node* phi =
|
||||
t.graph.NewNode(t.common.Phi(kMachInt32, 2), t.one, p1, loop);
|
||||
Node* phi = t.graph.NewNode(
|
||||
t.common.Phi(MachineRepresentation::kWord32, 2), t.one, p1, loop);
|
||||
Node* cond = t.graph.NewNode(&kIntAdd, phi, p2);
|
||||
Node* branch = t.graph.NewNode(t.common.Branch(), cond, loop);
|
||||
Node* if_true = t.graph.NewNode(t.common.IfTrue(), branch);
|
||||
@ -724,8 +725,8 @@ void RunEdgeMatrix2(int i) {
|
||||
|
||||
// outer loop.
|
||||
Node* loop1 = t.graph.NewNode(t.common.Loop(2), t.start, t.start);
|
||||
Node* phi1 =
|
||||
t.graph.NewNode(t.common.Phi(kMachInt32, 2), t.one, p1, loop1);
|
||||
Node* phi1 = t.graph.NewNode(
|
||||
t.common.Phi(MachineRepresentation::kWord32, 2), t.one, p1, loop1);
|
||||
Node* cond1 = t.graph.NewNode(&kIntAdd, phi1, t.one);
|
||||
Node* branch1 = t.graph.NewNode(t.common.Branch(), cond1, loop1);
|
||||
Node* if_true1 = t.graph.NewNode(t.common.IfTrue(), branch1);
|
||||
@ -733,8 +734,8 @@ void RunEdgeMatrix2(int i) {
|
||||
|
||||
// inner loop.
|
||||
Node* loop2 = t.graph.NewNode(t.common.Loop(2), if_true1, t.start);
|
||||
Node* phi2 =
|
||||
t.graph.NewNode(t.common.Phi(kMachInt32, 2), t.one, p2, loop2);
|
||||
Node* phi2 = t.graph.NewNode(
|
||||
t.common.Phi(MachineRepresentation::kWord32, 2), t.one, p2, loop2);
|
||||
Node* cond2 = t.graph.NewNode(&kIntAdd, phi2, p3);
|
||||
Node* branch2 = t.graph.NewNode(t.common.Branch(), cond2, loop2);
|
||||
Node* if_true2 = t.graph.NewNode(t.common.IfTrue(), branch2);
|
||||
@ -800,7 +801,8 @@ void RunEdgeMatrix3(int c1a, int c1b, int c1c, // line break
|
||||
|
||||
// L1 depth = 0
|
||||
Node* loop1 = t.graph.NewNode(t.common.Loop(2), t.start, t.start);
|
||||
Node* phi1 = t.graph.NewNode(t.common.Phi(kMachInt32, 2), p1a, p1c, loop1);
|
||||
Node* phi1 = t.graph.NewNode(t.common.Phi(MachineRepresentation::kWord32, 2),
|
||||
p1a, p1c, loop1);
|
||||
Node* cond1 = t.graph.NewNode(&kIntAdd, phi1, p1b);
|
||||
Node* branch1 = t.graph.NewNode(t.common.Branch(), cond1, loop1);
|
||||
Node* if_true1 = t.graph.NewNode(t.common.IfTrue(), branch1);
|
||||
@ -808,7 +810,8 @@ void RunEdgeMatrix3(int c1a, int c1b, int c1c, // line break
|
||||
|
||||
// L2 depth = 1
|
||||
Node* loop2 = t.graph.NewNode(t.common.Loop(2), if_true1, t.start);
|
||||
Node* phi2 = t.graph.NewNode(t.common.Phi(kMachInt32, 2), p2a, p2c, loop2);
|
||||
Node* phi2 = t.graph.NewNode(t.common.Phi(MachineRepresentation::kWord32, 2),
|
||||
p2a, p2c, loop2);
|
||||
Node* cond2 = t.graph.NewNode(&kIntAdd, phi2, p2b);
|
||||
Node* branch2 = t.graph.NewNode(t.common.Branch(), cond2, loop2);
|
||||
Node* if_true2 = t.graph.NewNode(t.common.IfTrue(), branch2);
|
||||
@ -816,7 +819,8 @@ void RunEdgeMatrix3(int c1a, int c1b, int c1c, // line break
|
||||
|
||||
// L3 depth = 2
|
||||
Node* loop3 = t.graph.NewNode(t.common.Loop(2), if_true2, t.start);
|
||||
Node* phi3 = t.graph.NewNode(t.common.Phi(kMachInt32, 2), p3a, p3c, loop3);
|
||||
Node* phi3 = t.graph.NewNode(t.common.Phi(MachineRepresentation::kWord32, 2),
|
||||
p3a, p3c, loop3);
|
||||
Node* cond3 = t.graph.NewNode(&kIntAdd, phi3, p3b);
|
||||
Node* branch3 = t.graph.NewNode(t.common.Branch(), cond3, loop3);
|
||||
Node* if_true3 = t.graph.NewNode(t.common.IfTrue(), branch3);
|
||||
@ -924,7 +928,8 @@ static void RunManyChainedLoops_i(int count) {
|
||||
// Build loops.
|
||||
for (int i = 0; i < count; i++) {
|
||||
Node* loop = t.graph.NewNode(t.common.Loop(2), last, t.start);
|
||||
Node* phi = t.graph.NewNode(t.common.Phi(kMachInt32, 2), k11, k12, loop);
|
||||
Node* phi = t.graph.NewNode(t.common.Phi(MachineRepresentation::kWord32, 2),
|
||||
k11, k12, loop);
|
||||
Node* branch = t.graph.NewNode(t.common.Branch(), phi, loop);
|
||||
Node* if_true = t.graph.NewNode(t.common.IfTrue(), branch);
|
||||
Node* exit = t.graph.NewNode(t.common.IfFalse(), branch);
|
||||
@ -959,7 +964,8 @@ static void RunManyNestedLoops_i(int count) {
|
||||
// Build loops.
|
||||
for (int i = 0; i < count; i++) {
|
||||
Node* loop = t.graph.NewNode(t.common.Loop(2), entry, t.start);
|
||||
Node* phi = t.graph.NewNode(t.common.Phi(kMachInt32, 2), k11, k12, loop);
|
||||
Node* phi = t.graph.NewNode(t.common.Phi(MachineRepresentation::kWord32, 2),
|
||||
k11, k12, loop);
|
||||
Node* branch = t.graph.NewNode(t.common.Branch(), phi, loop);
|
||||
Node* if_true = t.graph.NewNode(t.common.IfTrue(), branch);
|
||||
Node* exit = t.graph.NewNode(t.common.IfFalse(), branch);
|
||||
|
@ -56,7 +56,7 @@ class ReducerTester : public HandleAndZoneScope {
|
||||
: isolate(main_isolate()),
|
||||
binop(NULL),
|
||||
unop(NULL),
|
||||
machine(main_zone(), kMachPtr, flags),
|
||||
machine(main_zone(), MachineType::PointerRepresentation(), flags),
|
||||
common(main_zone()),
|
||||
graph(main_zone()),
|
||||
javascript(main_zone()),
|
||||
@ -703,8 +703,8 @@ TEST(ReduceLoadStore) {
|
||||
|
||||
Node* base = R.Constant<int32_t>(11);
|
||||
Node* index = R.Constant<int32_t>(4);
|
||||
Node* load = R.graph.NewNode(R.machine.Load(kMachInt32), base, index,
|
||||
R.graph.start(), R.graph.start());
|
||||
Node* load = R.graph.NewNode(R.machine.Load(MachineType::Int32()), base,
|
||||
index, R.graph.start(), R.graph.start());
|
||||
|
||||
{
|
||||
MachineOperatorReducer reducer(&R.jsgraph);
|
||||
@ -713,9 +713,9 @@ TEST(ReduceLoadStore) {
|
||||
}
|
||||
|
||||
{
|
||||
Node* store = R.graph.NewNode(
|
||||
R.machine.Store(StoreRepresentation(kMachInt32, kNoWriteBarrier)), base,
|
||||
index, load, load, R.graph.start());
|
||||
Node* store = R.graph.NewNode(R.machine.Store(StoreRepresentation(
|
||||
MachineType::Int32(), kNoWriteBarrier)),
|
||||
base, index, load, load, R.graph.start());
|
||||
MachineOperatorReducer reducer(&R.jsgraph);
|
||||
Reduction reduction = reducer.Reduce(store);
|
||||
CHECK(!reduction.Changed()); // stores should not be reduced.
|
||||
|
@ -33,7 +33,7 @@ CallDescriptor* GetCallDescriptor(Zone* zone, int return_count,
|
||||
// Add return location(s).
|
||||
CHECK(return_count <= config->num_allocatable_general_registers());
|
||||
for (int i = 0; i < return_count; i++) {
|
||||
msig.AddReturn(kMachInt32);
|
||||
msig.AddReturn(MachineType::Int32());
|
||||
locations.AddReturn(
|
||||
LinkageLocation::ForRegister(config->allocatable_general_codes()[i]));
|
||||
}
|
||||
@ -41,7 +41,7 @@ CallDescriptor* GetCallDescriptor(Zone* zone, int return_count,
|
||||
// Add register and/or stack parameter(s).
|
||||
CHECK(param_count <= config->num_allocatable_general_registers());
|
||||
for (int i = 0; i < param_count; i++) {
|
||||
msig.AddParam(kMachInt32);
|
||||
msig.AddParam(MachineType::Int32());
|
||||
locations.AddParam(
|
||||
LinkageLocation::ForRegister(config->allocatable_general_codes()[i]));
|
||||
}
|
||||
@ -50,7 +50,7 @@ CallDescriptor* GetCallDescriptor(Zone* zone, int return_count,
|
||||
const RegList kCalleeSaveFPRegisters = 0;
|
||||
|
||||
// The target for WASM calls is always a code object.
|
||||
MachineType target_type = kMachAnyTagged;
|
||||
MachineType target_type = MachineType::AnyTagged();
|
||||
LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
|
||||
return new (zone) CallDescriptor( // --
|
||||
CallDescriptor::kCallCodeObject, // kind
|
||||
@ -74,7 +74,7 @@ TEST(ReturnThreeValues) {
|
||||
HandleAndZoneScope handles;
|
||||
RawMachineAssembler m(handles.main_isolate(),
|
||||
new (handles.main_zone()) Graph(handles.main_zone()),
|
||||
desc, kMachPtr,
|
||||
desc, MachineType::PointerRepresentation(),
|
||||
InstructionSelector::SupportedMachineOperatorFlags());
|
||||
|
||||
Node* p0 = m.Parameter(0);
|
||||
|
@ -91,7 +91,8 @@ class OsrDeconstructorTester : public HandleAndZoneScope {
|
||||
if (count > 3) inputs[3] = back2;
|
||||
if (count > 4) inputs[4] = back3;
|
||||
inputs[count] = loop;
|
||||
return graph.NewNode(common.Phi(kMachAnyTagged, count), count + 1, inputs);
|
||||
return graph.NewNode(common.Phi(MachineRepresentation::kTagged, count),
|
||||
count + 1, inputs);
|
||||
}
|
||||
|
||||
Node* NewLoop(bool is_osr, int num_backedges, Node* entry = nullptr) {
|
||||
@ -314,9 +315,11 @@ struct While {
|
||||
|
||||
Node* Phi(Node* i1, Node* i2, Node* i3) {
|
||||
if (loop->InputCount() == 2) {
|
||||
return t.graph.NewNode(t.common.Phi(kMachAnyTagged, 2), i1, i2, loop);
|
||||
return t.graph.NewNode(t.common.Phi(MachineRepresentation::kTagged, 2),
|
||||
i1, i2, loop);
|
||||
} else {
|
||||
return t.graph.NewNode(t.common.Phi(kMachAnyTagged, 3), i1, i2, i3, loop);
|
||||
return t.graph.NewNode(t.common.Phi(MachineRepresentation::kTagged, 3),
|
||||
i1, i2, i3, loop);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -473,7 +476,8 @@ Node* MakeCounter(JSGraph* jsgraph, Node* start, Node* loop) {
|
||||
tmp_inputs.push_back(loop);
|
||||
|
||||
Node* phi = jsgraph->graph()->NewNode(
|
||||
jsgraph->common()->Phi(kMachInt32, count), count + 1, &tmp_inputs[0]);
|
||||
jsgraph->common()->Phi(MachineRepresentation::kWord32, count), count + 1,
|
||||
&tmp_inputs[0]);
|
||||
Node* inc = jsgraph->graph()->NewNode(&kIntAdd, phi, jsgraph->OneConstant());
|
||||
|
||||
for (int i = 1; i < count; i++) {
|
||||
@ -493,8 +497,9 @@ TEST(Deconstruct_osr_nested3) {
|
||||
|
||||
// middle loop.
|
||||
Node* loop1 = T.graph.NewNode(T.common.Loop(1), loop0.if_true);
|
||||
Node* loop1_phi = T.graph.NewNode(T.common.Phi(kMachAnyTagged, 2), loop0_cntr,
|
||||
loop0_cntr, loop1);
|
||||
Node* loop1_phi =
|
||||
T.graph.NewNode(T.common.Phi(MachineRepresentation::kTagged, 2),
|
||||
loop0_cntr, loop0_cntr, loop1);
|
||||
|
||||
// innermost (OSR) loop.
|
||||
While loop2(T, T.p0, true, 1);
|
||||
|
@ -83,7 +83,7 @@ class RepresentationChangerTester : public HandleAndZoneScope,
|
||||
return n;
|
||||
}
|
||||
|
||||
void CheckTypeError(MachineTypeUnion from, MachineTypeUnion to) {
|
||||
void CheckTypeError(MachineType from, MachineRepresentation to) {
|
||||
changer()->testing_type_errors_ = true;
|
||||
changer()->type_error_ = false;
|
||||
Node* n = Parameter(0);
|
||||
@ -92,7 +92,7 @@ class RepresentationChangerTester : public HandleAndZoneScope,
|
||||
CHECK_EQ(n, c);
|
||||
}
|
||||
|
||||
void CheckNop(MachineTypeUnion from, MachineTypeUnion to) {
|
||||
void CheckNop(MachineType from, MachineRepresentation to) {
|
||||
Node* n = Parameter(0);
|
||||
Node* c = changer()->GetRepresentationFor(n, from, to);
|
||||
CHECK_EQ(n, c);
|
||||
@ -100,21 +100,24 @@ class RepresentationChangerTester : public HandleAndZoneScope,
|
||||
};
|
||||
|
||||
|
||||
static const MachineType all_reps[] = {kRepBit, kRepWord32, kRepWord64,
|
||||
kRepFloat32, kRepFloat64, kRepTagged};
|
||||
const MachineType kMachineTypes[] = {
|
||||
MachineType::Float32(), MachineType::Float64(), MachineType::Int8(),
|
||||
MachineType::Uint8(), MachineType::Int16(), MachineType::Uint16(),
|
||||
MachineType::Int32(), MachineType::Uint32(), MachineType::Int64(),
|
||||
MachineType::Uint64(), MachineType::AnyTagged()};
|
||||
|
||||
|
||||
TEST(BoolToBit_constant) {
|
||||
RepresentationChangerTester r;
|
||||
|
||||
Node* true_node = r.jsgraph()->TrueConstant();
|
||||
Node* true_bit =
|
||||
r.changer()->GetRepresentationFor(true_node, kRepTagged, kRepBit);
|
||||
Node* true_bit = r.changer()->GetRepresentationFor(
|
||||
true_node, MachineType::RepTagged(), MachineRepresentation::kBit);
|
||||
r.CheckInt32Constant(true_bit, 1);
|
||||
|
||||
Node* false_node = r.jsgraph()->FalseConstant();
|
||||
Node* false_bit =
|
||||
r.changer()->GetRepresentationFor(false_node, kRepTagged, kRepBit);
|
||||
Node* false_bit = r.changer()->GetRepresentationFor(
|
||||
false_node, MachineType::RepTagged(), MachineRepresentation::kBit);
|
||||
r.CheckInt32Constant(false_bit, 0);
|
||||
}
|
||||
|
||||
@ -124,7 +127,8 @@ TEST(BitToBool_constant) {
|
||||
|
||||
for (int i = -5; i < 5; i++) {
|
||||
Node* node = r.jsgraph()->Int32Constant(i);
|
||||
Node* val = r.changer()->GetRepresentationFor(node, kRepBit, kRepTagged);
|
||||
Node* val = r.changer()->GetRepresentationFor(
|
||||
node, MachineType::RepBit(), MachineRepresentation::kTagged);
|
||||
r.CheckHeapConstant(val, i == 0 ? r.isolate()->heap()->false_value()
|
||||
: r.isolate()->heap()->true_value());
|
||||
}
|
||||
@ -137,7 +141,8 @@ TEST(ToTagged_constant) {
|
||||
{
|
||||
FOR_FLOAT64_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Float64Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepFloat64, kRepTagged);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::RepFloat64(), MachineRepresentation::kTagged);
|
||||
r.CheckNumberConstant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -145,7 +150,8 @@ TEST(ToTagged_constant) {
|
||||
{
|
||||
FOR_FLOAT64_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepFloat64, kRepTagged);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::RepFloat64(), MachineRepresentation::kTagged);
|
||||
r.CheckNumberConstant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -153,7 +159,8 @@ TEST(ToTagged_constant) {
|
||||
{
|
||||
FOR_FLOAT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Float32Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepFloat32, kRepTagged);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::RepFloat32(), MachineRepresentation::kTagged);
|
||||
r.CheckNumberConstant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -161,8 +168,8 @@ TEST(ToTagged_constant) {
|
||||
{
|
||||
FOR_INT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Int32Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepWord32 | kTypeInt32,
|
||||
kRepTagged);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::Int32(), MachineRepresentation::kTagged);
|
||||
r.CheckNumberConstant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -170,8 +177,8 @@ TEST(ToTagged_constant) {
|
||||
{
|
||||
FOR_UINT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Int32Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepWord32 | kTypeUint32,
|
||||
kRepTagged);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::Uint32(), MachineRepresentation::kTagged);
|
||||
r.CheckNumberConstant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -184,7 +191,8 @@ TEST(ToFloat64_constant) {
|
||||
{
|
||||
FOR_FLOAT64_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Float64Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepFloat64, kRepFloat64);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::RepFloat64(), MachineRepresentation::kFloat64);
|
||||
CHECK_EQ(n, c);
|
||||
}
|
||||
}
|
||||
@ -192,7 +200,8 @@ TEST(ToFloat64_constant) {
|
||||
{
|
||||
FOR_FLOAT64_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepTagged, kRepFloat64);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::RepTagged(), MachineRepresentation::kFloat64);
|
||||
r.CheckFloat64Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -200,7 +209,8 @@ TEST(ToFloat64_constant) {
|
||||
{
|
||||
FOR_FLOAT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Float32Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepFloat32, kRepFloat64);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::RepFloat32(), MachineRepresentation::kFloat64);
|
||||
r.CheckFloat64Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -208,8 +218,8 @@ TEST(ToFloat64_constant) {
|
||||
{
|
||||
FOR_INT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Int32Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepWord32 | kTypeInt32,
|
||||
kRepFloat64);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::Int32(), MachineRepresentation::kFloat64);
|
||||
r.CheckFloat64Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -217,8 +227,8 @@ TEST(ToFloat64_constant) {
|
||||
{
|
||||
FOR_UINT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Int32Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepWord32 | kTypeUint32,
|
||||
kRepFloat64);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::Uint32(), MachineRepresentation::kFloat64);
|
||||
r.CheckFloat64Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -239,7 +249,8 @@ TEST(ToFloat32_constant) {
|
||||
{
|
||||
FOR_FLOAT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Float32Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepFloat32, kRepFloat32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::RepFloat32(), MachineRepresentation::kFloat32);
|
||||
CHECK_EQ(n, c);
|
||||
}
|
||||
}
|
||||
@ -247,7 +258,8 @@ TEST(ToFloat32_constant) {
|
||||
{
|
||||
FOR_FLOAT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepTagged, kRepFloat32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::RepTagged(), MachineRepresentation::kFloat32);
|
||||
r.CheckFloat32Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -255,7 +267,8 @@ TEST(ToFloat32_constant) {
|
||||
{
|
||||
FOR_FLOAT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Float64Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepFloat64, kRepFloat32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::RepFloat64(), MachineRepresentation::kFloat32);
|
||||
r.CheckFloat32Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -264,8 +277,8 @@ TEST(ToFloat32_constant) {
|
||||
FOR_INT32_INPUTS(i) {
|
||||
if (!IsFloat32Int32(*i)) continue;
|
||||
Node* n = r.jsgraph()->Int32Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepWord32 | kTypeInt32,
|
||||
kRepFloat32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::Int32(), MachineRepresentation::kFloat32);
|
||||
r.CheckFloat32Constant(c, static_cast<float>(*i));
|
||||
}
|
||||
}
|
||||
@ -274,8 +287,8 @@ TEST(ToFloat32_constant) {
|
||||
FOR_UINT32_INPUTS(i) {
|
||||
if (!IsFloat32Uint32(*i)) continue;
|
||||
Node* n = r.jsgraph()->Int32Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepWord32 | kTypeUint32,
|
||||
kRepFloat32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::Uint32(), MachineRepresentation::kFloat32);
|
||||
r.CheckFloat32Constant(c, static_cast<float>(*i));
|
||||
}
|
||||
}
|
||||
@ -288,8 +301,8 @@ TEST(ToInt32_constant) {
|
||||
{
|
||||
FOR_INT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Int32Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepWord32 | kTypeInt32,
|
||||
kRepWord32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::Int32(), MachineRepresentation::kWord32);
|
||||
r.CheckInt32Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -298,8 +311,10 @@ TEST(ToInt32_constant) {
|
||||
FOR_INT32_INPUTS(i) {
|
||||
if (!IsFloat32Int32(*i)) continue;
|
||||
Node* n = r.jsgraph()->Float32Constant(static_cast<float>(*i));
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepFloat32 | kTypeInt32,
|
||||
kRepWord32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n,
|
||||
MachineType(MachineRepresentation::kFloat32, MachineSemantic::kInt32),
|
||||
MachineRepresentation::kWord32);
|
||||
r.CheckInt32Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -307,8 +322,10 @@ TEST(ToInt32_constant) {
|
||||
{
|
||||
FOR_INT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Float64Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepFloat64 | kTypeInt32,
|
||||
kRepWord32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n,
|
||||
MachineType(MachineRepresentation::kFloat64, MachineSemantic::kInt32),
|
||||
MachineRepresentation::kWord32);
|
||||
r.CheckInt32Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -316,8 +333,10 @@ TEST(ToInt32_constant) {
|
||||
{
|
||||
FOR_INT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepTagged | kTypeInt32,
|
||||
kRepWord32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n,
|
||||
MachineType(MachineRepresentation::kTagged, MachineSemantic::kInt32),
|
||||
MachineRepresentation::kWord32);
|
||||
r.CheckInt32Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -330,8 +349,8 @@ TEST(ToUint32_constant) {
|
||||
{
|
||||
FOR_UINT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Int32Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepWord32 | kTypeUint32,
|
||||
kRepWord32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType::Uint32(), MachineRepresentation::kWord32);
|
||||
r.CheckUint32Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -340,8 +359,10 @@ TEST(ToUint32_constant) {
|
||||
FOR_UINT32_INPUTS(i) {
|
||||
if (!IsFloat32Uint32(*i)) continue;
|
||||
Node* n = r.jsgraph()->Float32Constant(static_cast<float>(*i));
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepFloat32 | kTypeUint32,
|
||||
kRepWord32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType(MachineRepresentation::kFloat32,
|
||||
MachineSemantic::kUint32),
|
||||
MachineRepresentation::kWord32);
|
||||
r.CheckUint32Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -349,8 +370,10 @@ TEST(ToUint32_constant) {
|
||||
{
|
||||
FOR_UINT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Float64Constant(*i);
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepFloat64 | kTypeUint32,
|
||||
kRepWord32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n, MachineType(MachineRepresentation::kFloat64,
|
||||
MachineSemantic::kUint32),
|
||||
MachineRepresentation::kWord32);
|
||||
r.CheckUint32Constant(c, *i);
|
||||
}
|
||||
}
|
||||
@ -358,16 +381,18 @@ TEST(ToUint32_constant) {
|
||||
{
|
||||
FOR_UINT32_INPUTS(i) {
|
||||
Node* n = r.jsgraph()->Constant(static_cast<double>(*i));
|
||||
Node* c = r.changer()->GetRepresentationFor(n, kRepTagged | kTypeUint32,
|
||||
kRepWord32);
|
||||
Node* c = r.changer()->GetRepresentationFor(
|
||||
n,
|
||||
MachineType(MachineRepresentation::kTagged, MachineSemantic::kUint32),
|
||||
MachineRepresentation::kWord32);
|
||||
r.CheckUint32Constant(c, *i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void CheckChange(IrOpcode::Value expected, MachineTypeUnion from,
|
||||
MachineTypeUnion to) {
|
||||
static void CheckChange(IrOpcode::Value expected, MachineType from,
|
||||
MachineRepresentation to) {
|
||||
RepresentationChangerTester r;
|
||||
|
||||
Node* n = r.Parameter();
|
||||
@ -380,8 +405,8 @@ static void CheckChange(IrOpcode::Value expected, MachineTypeUnion from,
|
||||
|
||||
|
||||
static void CheckTwoChanges(IrOpcode::Value expected2,
|
||||
IrOpcode::Value expected1, MachineTypeUnion from,
|
||||
MachineTypeUnion to) {
|
||||
IrOpcode::Value expected1, MachineType from,
|
||||
MachineRepresentation to) {
|
||||
RepresentationChangerTester r;
|
||||
|
||||
Node* n = r.Parameter();
|
||||
@ -397,71 +422,98 @@ static void CheckTwoChanges(IrOpcode::Value expected2,
|
||||
|
||||
|
||||
TEST(SingleChanges) {
|
||||
CheckChange(IrOpcode::kChangeBoolToBit, kRepTagged, kRepBit);
|
||||
CheckChange(IrOpcode::kChangeBitToBool, kRepBit, kRepTagged);
|
||||
CheckChange(IrOpcode::kChangeBoolToBit, MachineType::RepTagged(),
|
||||
MachineRepresentation::kBit);
|
||||
CheckChange(IrOpcode::kChangeBitToBool, MachineType::RepBit(),
|
||||
MachineRepresentation::kTagged);
|
||||
|
||||
CheckChange(IrOpcode::kChangeInt32ToTagged, kRepWord32 | kTypeInt32,
|
||||
kRepTagged);
|
||||
CheckChange(IrOpcode::kChangeUint32ToTagged, kRepWord32 | kTypeUint32,
|
||||
kRepTagged);
|
||||
CheckChange(IrOpcode::kChangeFloat64ToTagged, kRepFloat64, kRepTagged);
|
||||
CheckChange(IrOpcode::kChangeInt32ToTagged, MachineType::Int32(),
|
||||
MachineRepresentation::kTagged);
|
||||
CheckChange(IrOpcode::kChangeUint32ToTagged, MachineType::Uint32(),
|
||||
MachineRepresentation::kTagged);
|
||||
CheckChange(IrOpcode::kChangeFloat64ToTagged, MachineType::RepFloat64(),
|
||||
MachineRepresentation::kTagged);
|
||||
|
||||
CheckChange(IrOpcode::kChangeTaggedToInt32, kRepTagged | kTypeInt32,
|
||||
kRepWord32);
|
||||
CheckChange(IrOpcode::kChangeTaggedToUint32, kRepTagged | kTypeUint32,
|
||||
kRepWord32);
|
||||
CheckChange(IrOpcode::kChangeTaggedToFloat64, kRepTagged, kRepFloat64);
|
||||
CheckChange(
|
||||
IrOpcode::kChangeTaggedToInt32,
|
||||
MachineType(MachineRepresentation::kTagged, MachineSemantic::kInt32),
|
||||
MachineRepresentation::kWord32);
|
||||
CheckChange(
|
||||
IrOpcode::kChangeTaggedToUint32,
|
||||
MachineType(MachineRepresentation::kTagged, MachineSemantic::kUint32),
|
||||
MachineRepresentation::kWord32);
|
||||
CheckChange(IrOpcode::kChangeTaggedToFloat64, MachineType::RepTagged(),
|
||||
MachineRepresentation::kFloat64);
|
||||
|
||||
// Int32,Uint32 <-> Float64 are actually machine conversions.
|
||||
CheckChange(IrOpcode::kChangeInt32ToFloat64, kRepWord32 | kTypeInt32,
|
||||
kRepFloat64);
|
||||
CheckChange(IrOpcode::kChangeUint32ToFloat64, kRepWord32 | kTypeUint32,
|
||||
kRepFloat64);
|
||||
CheckChange(IrOpcode::kChangeFloat64ToInt32, kRepFloat64 | kTypeInt32,
|
||||
kRepWord32);
|
||||
CheckChange(IrOpcode::kChangeFloat64ToUint32, kRepFloat64 | kTypeUint32,
|
||||
kRepWord32);
|
||||
CheckChange(IrOpcode::kChangeInt32ToFloat64, MachineType::Int32(),
|
||||
MachineRepresentation::kFloat64);
|
||||
CheckChange(IrOpcode::kChangeUint32ToFloat64, MachineType::Uint32(),
|
||||
MachineRepresentation::kFloat64);
|
||||
CheckChange(
|
||||
IrOpcode::kChangeFloat64ToInt32,
|
||||
MachineType(MachineRepresentation::kFloat64, MachineSemantic::kInt32),
|
||||
MachineRepresentation::kWord32);
|
||||
CheckChange(
|
||||
IrOpcode::kChangeFloat64ToUint32,
|
||||
MachineType(MachineRepresentation::kFloat64, MachineSemantic::kUint32),
|
||||
MachineRepresentation::kWord32);
|
||||
|
||||
CheckChange(IrOpcode::kTruncateFloat64ToFloat32, kRepFloat64, kRepFloat32);
|
||||
CheckChange(IrOpcode::kTruncateFloat64ToFloat32, MachineType::RepFloat64(),
|
||||
MachineRepresentation::kFloat32);
|
||||
|
||||
// Int32,Uint32 <-> Float32 require two changes.
|
||||
CheckTwoChanges(IrOpcode::kChangeInt32ToFloat64,
|
||||
IrOpcode::kTruncateFloat64ToFloat32, kRepWord32 | kTypeInt32,
|
||||
kRepFloat32);
|
||||
IrOpcode::kTruncateFloat64ToFloat32, MachineType::Int32(),
|
||||
MachineRepresentation::kFloat32);
|
||||
CheckTwoChanges(IrOpcode::kChangeUint32ToFloat64,
|
||||
IrOpcode::kTruncateFloat64ToFloat32, kRepWord32 | kTypeUint32,
|
||||
kRepFloat32);
|
||||
CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64,
|
||||
IrOpcode::kChangeFloat64ToInt32, kRepFloat32 | kTypeInt32,
|
||||
kRepWord32);
|
||||
CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64,
|
||||
IrOpcode::kChangeFloat64ToUint32, kRepFloat32 | kTypeUint32,
|
||||
kRepWord32);
|
||||
IrOpcode::kTruncateFloat64ToFloat32, MachineType::Uint32(),
|
||||
MachineRepresentation::kFloat32);
|
||||
CheckTwoChanges(
|
||||
IrOpcode::kChangeFloat32ToFloat64, IrOpcode::kChangeFloat64ToInt32,
|
||||
MachineType(MachineRepresentation::kFloat32, MachineSemantic::kInt32),
|
||||
MachineRepresentation::kWord32);
|
||||
CheckTwoChanges(
|
||||
IrOpcode::kChangeFloat32ToFloat64, IrOpcode::kChangeFloat64ToUint32,
|
||||
MachineType(MachineRepresentation::kFloat32, MachineSemantic::kUint32),
|
||||
MachineRepresentation::kWord32);
|
||||
|
||||
// Float32 <-> Tagged require two changes.
|
||||
CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64,
|
||||
IrOpcode::kChangeFloat64ToTagged, kRepFloat32, kRepTagged);
|
||||
IrOpcode::kChangeFloat64ToTagged, MachineType::RepFloat32(),
|
||||
MachineRepresentation::kTagged);
|
||||
CheckTwoChanges(IrOpcode::kChangeTaggedToFloat64,
|
||||
IrOpcode::kTruncateFloat64ToFloat32, kRepTagged, kRepFloat32);
|
||||
IrOpcode::kTruncateFloat64ToFloat32, MachineType::RepTagged(),
|
||||
MachineRepresentation::kFloat32);
|
||||
}
|
||||
|
||||
|
||||
TEST(SignednessInWord32) {
|
||||
RepresentationChangerTester r;
|
||||
|
||||
CheckChange(IrOpcode::kChangeTaggedToInt32, kRepTagged | kTypeInt32,
|
||||
kRepWord32);
|
||||
CheckChange(IrOpcode::kChangeTaggedToUint32, kRepTagged | kTypeUint32,
|
||||
kRepWord32);
|
||||
CheckChange(IrOpcode::kChangeInt32ToFloat64, kRepWord32, kRepFloat64);
|
||||
CheckChange(IrOpcode::kChangeFloat64ToInt32, kRepFloat64 | kTypeInt32,
|
||||
kRepWord32);
|
||||
CheckChange(IrOpcode::kTruncateFloat64ToInt32, kRepFloat64, kRepWord32);
|
||||
CheckChange(
|
||||
IrOpcode::kChangeTaggedToInt32,
|
||||
MachineType(MachineRepresentation::kTagged, MachineSemantic::kInt32),
|
||||
MachineRepresentation::kWord32);
|
||||
CheckChange(
|
||||
IrOpcode::kChangeTaggedToUint32,
|
||||
MachineType(MachineRepresentation::kTagged, MachineSemantic::kUint32),
|
||||
MachineRepresentation::kWord32);
|
||||
CheckChange(IrOpcode::kChangeInt32ToFloat64, MachineType::RepWord32(),
|
||||
MachineRepresentation::kFloat64);
|
||||
CheckChange(
|
||||
IrOpcode::kChangeFloat64ToInt32,
|
||||
MachineType(MachineRepresentation::kFloat64, MachineSemantic::kInt32),
|
||||
MachineRepresentation::kWord32);
|
||||
CheckChange(IrOpcode::kTruncateFloat64ToInt32, MachineType::RepFloat64(),
|
||||
MachineRepresentation::kWord32);
|
||||
|
||||
CheckTwoChanges(IrOpcode::kChangeInt32ToFloat64,
|
||||
IrOpcode::kTruncateFloat64ToFloat32, kRepWord32, kRepFloat32);
|
||||
IrOpcode::kTruncateFloat64ToFloat32, MachineType::RepWord32(),
|
||||
MachineRepresentation::kFloat32);
|
||||
CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64,
|
||||
IrOpcode::kTruncateFloat64ToInt32, kRepFloat32, kRepWord32);
|
||||
IrOpcode::kTruncateFloat64ToInt32, MachineType::RepFloat32(),
|
||||
MachineRepresentation::kWord32);
|
||||
}
|
||||
|
||||
|
||||
@ -469,32 +521,32 @@ TEST(Nops) {
|
||||
RepresentationChangerTester r;
|
||||
|
||||
// X -> X is always a nop for any single representation X.
|
||||
for (size_t i = 0; i < arraysize(all_reps); i++) {
|
||||
r.CheckNop(all_reps[i], all_reps[i]);
|
||||
for (size_t i = 0; i < arraysize(kMachineTypes); i++) {
|
||||
r.CheckNop(kMachineTypes[i], kMachineTypes[i].representation());
|
||||
}
|
||||
|
||||
// 32-bit floats.
|
||||
r.CheckNop(kRepFloat32, kRepFloat32);
|
||||
r.CheckNop(kRepFloat32 | kTypeNumber, kRepFloat32);
|
||||
r.CheckNop(MachineType::RepFloat32(), MachineRepresentation::kFloat32);
|
||||
r.CheckNop(MachineType::Float32(), MachineRepresentation::kFloat32);
|
||||
|
||||
// 32-bit words can be used as smaller word sizes and vice versa, because
|
||||
// loads from memory implicitly sign or zero extend the value to the
|
||||
// full machine word size, and stores implicitly truncate.
|
||||
r.CheckNop(kRepWord32, kRepWord8);
|
||||
r.CheckNop(kRepWord32, kRepWord16);
|
||||
r.CheckNop(kRepWord32, kRepWord32);
|
||||
r.CheckNop(kRepWord8, kRepWord32);
|
||||
r.CheckNop(kRepWord16, kRepWord32);
|
||||
r.CheckNop(MachineType::Int32(), MachineRepresentation::kWord8);
|
||||
r.CheckNop(MachineType::Int32(), MachineRepresentation::kWord16);
|
||||
r.CheckNop(MachineType::Int32(), MachineRepresentation::kWord32);
|
||||
r.CheckNop(MachineType::Int8(), MachineRepresentation::kWord32);
|
||||
r.CheckNop(MachineType::Int16(), MachineRepresentation::kWord32);
|
||||
|
||||
// kRepBit (result of comparison) is implicitly a wordish thing.
|
||||
r.CheckNop(kRepBit, kRepWord8);
|
||||
r.CheckNop(kRepBit | kTypeBool, kRepWord8);
|
||||
r.CheckNop(kRepBit, kRepWord16);
|
||||
r.CheckNop(kRepBit | kTypeBool, kRepWord16);
|
||||
r.CheckNop(kRepBit, kRepWord32);
|
||||
r.CheckNop(kRepBit | kTypeBool, kRepWord32);
|
||||
r.CheckNop(kRepBit, kRepWord64);
|
||||
r.CheckNop(kRepBit | kTypeBool, kRepWord64);
|
||||
r.CheckNop(MachineType::RepBit(), MachineRepresentation::kWord8);
|
||||
r.CheckNop(MachineType::RepBit(), MachineRepresentation::kWord16);
|
||||
r.CheckNop(MachineType::RepBit(), MachineRepresentation::kWord32);
|
||||
r.CheckNop(MachineType::RepBit(), MachineRepresentation::kWord64);
|
||||
r.CheckNop(MachineType::Bool(), MachineRepresentation::kWord8);
|
||||
r.CheckNop(MachineType::Bool(), MachineRepresentation::kWord16);
|
||||
r.CheckNop(MachineType::Bool(), MachineRepresentation::kWord32);
|
||||
r.CheckNop(MachineType::Bool(), MachineRepresentation::kWord64);
|
||||
}
|
||||
|
||||
|
||||
@ -502,39 +554,31 @@ TEST(TypeErrors) {
|
||||
RepresentationChangerTester r;
|
||||
|
||||
// Wordish cannot be implicitly converted to/from comparison conditions.
|
||||
r.CheckTypeError(kRepWord8, kRepBit);
|
||||
r.CheckTypeError(kRepWord16, kRepBit);
|
||||
r.CheckTypeError(kRepWord32, kRepBit);
|
||||
r.CheckTypeError(kRepWord64, kRepBit);
|
||||
r.CheckTypeError(MachineType::RepWord8(), MachineRepresentation::kBit);
|
||||
r.CheckTypeError(MachineType::RepWord16(), MachineRepresentation::kBit);
|
||||
r.CheckTypeError(MachineType::RepWord32(), MachineRepresentation::kBit);
|
||||
r.CheckTypeError(MachineType::RepWord64(), MachineRepresentation::kBit);
|
||||
|
||||
// Floats cannot be implicitly converted to/from comparison conditions.
|
||||
r.CheckTypeError(kRepFloat64, kRepBit);
|
||||
r.CheckTypeError(kRepBit, kRepFloat64);
|
||||
r.CheckTypeError(kRepBit | kTypeBool, kRepFloat64);
|
||||
r.CheckTypeError(MachineType::RepFloat64(), MachineRepresentation::kBit);
|
||||
r.CheckTypeError(MachineType::RepBit(), MachineRepresentation::kFloat64);
|
||||
r.CheckTypeError(MachineType::Bool(), MachineRepresentation::kFloat64);
|
||||
|
||||
// Floats cannot be implicitly converted to/from comparison conditions.
|
||||
r.CheckTypeError(kRepFloat32, kRepBit);
|
||||
r.CheckTypeError(kRepBit, kRepFloat32);
|
||||
r.CheckTypeError(kRepBit | kTypeBool, kRepFloat32);
|
||||
r.CheckTypeError(MachineType::RepFloat32(), MachineRepresentation::kBit);
|
||||
r.CheckTypeError(MachineType::RepBit(), MachineRepresentation::kFloat32);
|
||||
r.CheckTypeError(MachineType::Bool(), MachineRepresentation::kFloat32);
|
||||
|
||||
// Word64 is internal and shouldn't be implicitly converted.
|
||||
r.CheckTypeError(kRepWord64, kRepTagged);
|
||||
r.CheckTypeError(kRepTagged, kRepWord64);
|
||||
r.CheckTypeError(kRepTagged | kTypeBool, kRepWord64);
|
||||
r.CheckTypeError(MachineType::RepWord64(), MachineRepresentation::kTagged);
|
||||
r.CheckTypeError(MachineType::RepTagged(), MachineRepresentation::kWord64);
|
||||
r.CheckTypeError(MachineType::TaggedBool(), MachineRepresentation::kWord64);
|
||||
|
||||
// Word64 / Word32 shouldn't be implicitly converted.
|
||||
r.CheckTypeError(kRepWord64, kRepWord32);
|
||||
r.CheckTypeError(kRepWord32, kRepWord64);
|
||||
r.CheckTypeError(kRepWord32 | kTypeInt32, kRepWord64);
|
||||
r.CheckTypeError(kRepWord32 | kTypeUint32, kRepWord64);
|
||||
|
||||
for (size_t i = 0; i < arraysize(all_reps); i++) {
|
||||
for (size_t j = 0; j < arraysize(all_reps); j++) {
|
||||
if (i == j) continue;
|
||||
// Only a single from representation is allowed.
|
||||
r.CheckTypeError(all_reps[i] | all_reps[j], kRepTagged);
|
||||
}
|
||||
}
|
||||
r.CheckTypeError(MachineType::RepWord64(), MachineRepresentation::kWord32);
|
||||
r.CheckTypeError(MachineType::RepWord32(), MachineRepresentation::kWord64);
|
||||
r.CheckTypeError(MachineType::Int32(), MachineRepresentation::kWord64);
|
||||
r.CheckTypeError(MachineType::Uint32(), MachineRepresentation::kWord64);
|
||||
}
|
||||
|
||||
} // namespace compiler
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -133,7 +133,7 @@ struct Allocator {
|
||||
int stack_offset;
|
||||
|
||||
LinkageLocation Next(MachineType type) {
|
||||
if (IsFloatingPoint(type)) {
|
||||
if (IsFloatingPoint(type.representation())) {
|
||||
// Allocate a floating point register/stack location.
|
||||
if (fp_offset < fp_count) {
|
||||
return LinkageLocation::ForRegister(fp_regs[fp_offset++]);
|
||||
@ -153,16 +153,11 @@ struct Allocator {
|
||||
}
|
||||
}
|
||||
}
|
||||
bool IsFloatingPoint(MachineType type) {
|
||||
return RepresentationOf(type) == kRepFloat32 ||
|
||||
RepresentationOf(type) == kRepFloat64;
|
||||
}
|
||||
int StackWords(MachineType type) {
|
||||
// TODO(titzer): hack. float32 occupies 8 bytes on stack.
|
||||
int size = (RepresentationOf(type) == kRepFloat32 ||
|
||||
RepresentationOf(type) == kRepFloat64)
|
||||
int size = IsFloatingPoint(type.representation())
|
||||
? kDoubleSize
|
||||
: ElementSizeOf(type);
|
||||
: (1 << ElementSizeLog2Of(type.representation()));
|
||||
return size <= kPointerSize ? 1 : size / kPointerSize;
|
||||
}
|
||||
void Reset() {
|
||||
@ -198,7 +193,7 @@ class RegisterConfig {
|
||||
const RegList kCalleeSaveRegisters = 0;
|
||||
const RegList kCalleeSaveFPRegisters = 0;
|
||||
|
||||
MachineType target_type = kMachAnyTagged;
|
||||
MachineType target_type = MachineType::AnyTagged();
|
||||
LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
|
||||
int stack_param_count = params.stack_offset;
|
||||
return new (zone) CallDescriptor( // --
|
||||
@ -223,17 +218,28 @@ class RegisterConfig {
|
||||
const int kMaxParamCount = 64;
|
||||
|
||||
MachineType kIntTypes[kMaxParamCount + 1] = {
|
||||
kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32,
|
||||
kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32,
|
||||
kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32,
|
||||
kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32,
|
||||
kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32,
|
||||
kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32,
|
||||
kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32,
|
||||
kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32,
|
||||
kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32,
|
||||
kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32,
|
||||
kMachInt32, kMachInt32, kMachInt32, kMachInt32, kMachInt32};
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32(), MachineType::Int32()};
|
||||
|
||||
|
||||
// For making uniform int32 signatures shorter.
|
||||
@ -563,7 +569,8 @@ static void CopyTwentyInt32(CallDescriptor* desc) {
|
||||
Node* base = raw.PointerConstant(output);
|
||||
for (int i = 0; i < kNumParams; i++) {
|
||||
Node* offset = raw.Int32Constant(i * sizeof(int32_t));
|
||||
raw.Store(kMachInt32, base, offset, raw.Parameter(i), kNoWriteBarrier);
|
||||
raw.Store(MachineType::Int32(), base, offset, raw.Parameter(i),
|
||||
kNoWriteBarrier);
|
||||
}
|
||||
raw.Return(raw.Int32Constant(42));
|
||||
inner = CompileGraph("CopyTwentyInt32", desc, &graph, raw.Export());
|
||||
@ -582,7 +589,7 @@ static void CopyTwentyInt32(CallDescriptor* desc) {
|
||||
Node** args = zone.NewArray<Node*>(kNumParams);
|
||||
for (int i = 0; i < kNumParams; i++) {
|
||||
Node* offset = raw.Int32Constant(i * sizeof(int32_t));
|
||||
args[i] = raw.Load(kMachInt32, base, offset);
|
||||
args[i] = raw.Load(MachineType::Int32(), base, offset);
|
||||
}
|
||||
|
||||
Node* call = raw.CallN(desc, target, args);
|
||||
@ -1016,16 +1023,21 @@ void MixedParamTest(int start) {
|
||||
// TODO(titzer): mix in 64-bit types on all platforms when supported.
|
||||
#if V8_TARGET_ARCH_32_BIT
|
||||
static MachineType types[] = {
|
||||
kMachInt32, kMachFloat32, kMachFloat64, kMachInt32, kMachFloat64,
|
||||
kMachFloat32, kMachFloat32, kMachFloat64, kMachInt32, kMachFloat32,
|
||||
kMachInt32, kMachFloat64, kMachFloat64, kMachFloat32, kMachInt32,
|
||||
kMachFloat64, kMachInt32, kMachFloat32};
|
||||
MachineType::Int32(), MachineType::Float32(), MachineType::Float64(),
|
||||
MachineType::Int32(), MachineType::Float64(), MachineType::Float32(),
|
||||
MachineType::Float32(), MachineType::Float64(), MachineType::Int32(),
|
||||
MachineType::Float32(), MachineType::Int32(), MachineType::Float64(),
|
||||
MachineType::Float64(), MachineType::Float32(), MachineType::Int32(),
|
||||
MachineType::Float64(), MachineType::Int32(), MachineType::Float32()};
|
||||
#else
|
||||
static MachineType types[] = {
|
||||
kMachInt32, kMachInt64, kMachFloat32, kMachFloat64, kMachInt32,
|
||||
kMachFloat64, kMachFloat32, kMachInt64, kMachInt64, kMachFloat32,
|
||||
kMachFloat32, kMachInt32, kMachFloat64, kMachFloat64, kMachInt64,
|
||||
kMachInt32, kMachFloat64, kMachInt32, kMachFloat32};
|
||||
MachineType::Int32(), MachineType::Int64(), MachineType::Float32(),
|
||||
MachineType::Float64(), MachineType::Int32(), MachineType::Float64(),
|
||||
MachineType::Float32(), MachineType::Int64(), MachineType::Int64(),
|
||||
MachineType::Float32(), MachineType::Float32(), MachineType::Int32(),
|
||||
MachineType::Float64(), MachineType::Float64(), MachineType::Int64(),
|
||||
MachineType::Int32(), MachineType::Float64(), MachineType::Int32(),
|
||||
MachineType::Float32()};
|
||||
#endif
|
||||
|
||||
Isolate* isolate = CcTest::InitIsolateOnce();
|
||||
@ -1094,22 +1106,22 @@ void MixedParamTest(int start) {
|
||||
for (int i = 0; i < num_params; i++) {
|
||||
MachineType param_type = sig->GetParam(i);
|
||||
Node* konst = nullptr;
|
||||
if (param_type == kMachInt32) {
|
||||
if (param_type == MachineType::Int32()) {
|
||||
int32_t value[] = {static_cast<int32_t>(constant)};
|
||||
konst = raw.Int32Constant(value[0]);
|
||||
if (i == which) memcpy(bytes, value, expected_size = 4);
|
||||
}
|
||||
if (param_type == kMachInt64) {
|
||||
if (param_type == MachineType::Int64()) {
|
||||
int64_t value[] = {static_cast<int64_t>(constant)};
|
||||
konst = raw.Int64Constant(value[0]);
|
||||
if (i == which) memcpy(bytes, value, expected_size = 8);
|
||||
}
|
||||
if (param_type == kMachFloat32) {
|
||||
if (param_type == MachineType::Float32()) {
|
||||
float32 value[] = {static_cast<float32>(constant)};
|
||||
konst = raw.Float32Constant(value[0]);
|
||||
if (i == which) memcpy(bytes, value, expected_size = 4);
|
||||
}
|
||||
if (param_type == kMachFloat64) {
|
||||
if (param_type == MachineType::Float64()) {
|
||||
float64 value[] = {static_cast<float64>(constant)};
|
||||
konst = raw.Float64Constant(value[0]);
|
||||
if (i == which) memcpy(bytes, value, expected_size = 8);
|
||||
|
@ -33,8 +33,8 @@ namespace compiler {
|
||||
template <typename ReturnType>
|
||||
class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> {
|
||||
public:
|
||||
SimplifiedLoweringTester(MachineType p0 = kMachNone,
|
||||
MachineType p1 = kMachNone)
|
||||
SimplifiedLoweringTester(MachineType p0 = MachineType::None(),
|
||||
MachineType p1 = MachineType::None())
|
||||
: GraphBuilderTester<ReturnType>(p0, p1),
|
||||
typer(this->isolate(), this->graph()),
|
||||
javascript(this->zone()),
|
||||
@ -100,12 +100,12 @@ TEST(RunNumberToInt32_float64) {
|
||||
int32_t result;
|
||||
SimplifiedLoweringTester<Object*> t;
|
||||
FieldAccess load = {kUntaggedBase, 0, Handle<Name>(), Type::Number(),
|
||||
kMachFloat64};
|
||||
MachineType::Float64()};
|
||||
Node* loaded = t.LoadField(load, t.PointerConstant(&input));
|
||||
NodeProperties::SetType(loaded, Type::Number());
|
||||
Node* convert = t.NumberToInt32(loaded);
|
||||
FieldAccess store = {kUntaggedBase, 0, Handle<Name>(), Type::Signed32(),
|
||||
kMachInt32};
|
||||
MachineType::Int32()};
|
||||
t.StoreField(store, t.PointerConstant(&result), convert);
|
||||
t.Return(t.jsgraph.TrueConstant());
|
||||
t.LowerAllNodesAndLowerChanges();
|
||||
@ -127,12 +127,12 @@ TEST(RunNumberToUint32_float64) {
|
||||
uint32_t result;
|
||||
SimplifiedLoweringTester<Object*> t;
|
||||
FieldAccess load = {kUntaggedBase, 0, Handle<Name>(), Type::Number(),
|
||||
kMachFloat64};
|
||||
MachineType::Float64()};
|
||||
Node* loaded = t.LoadField(load, t.PointerConstant(&input));
|
||||
NodeProperties::SetType(loaded, Type::Number());
|
||||
Node* convert = t.NumberToUint32(loaded);
|
||||
FieldAccess store = {kUntaggedBase, 0, Handle<Name>(), Type::Unsigned32(),
|
||||
kMachUint32};
|
||||
MachineType::Uint32()};
|
||||
t.StoreField(store, t.PointerConstant(&result), convert);
|
||||
t.Return(t.jsgraph.TrueConstant());
|
||||
t.LowerAllNodesAndLowerChanges();
|
||||
@ -157,7 +157,7 @@ static Handle<JSObject> TestObject() {
|
||||
|
||||
|
||||
TEST(RunLoadMap) {
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
FieldAccess access = AccessBuilder::ForMap();
|
||||
Node* load = t.LoadField(access, t.Parameter(0));
|
||||
t.Return(load);
|
||||
@ -173,7 +173,8 @@ TEST(RunLoadMap) {
|
||||
|
||||
|
||||
TEST(RunStoreMap) {
|
||||
SimplifiedLoweringTester<int32_t> t(kMachAnyTagged, kMachAnyTagged);
|
||||
SimplifiedLoweringTester<int32_t> t(MachineType::AnyTagged(),
|
||||
MachineType::AnyTagged());
|
||||
FieldAccess access = AccessBuilder::ForMap();
|
||||
t.StoreField(access, t.Parameter(1), t.Parameter(0));
|
||||
t.Return(t.jsgraph.TrueConstant());
|
||||
@ -191,7 +192,7 @@ TEST(RunStoreMap) {
|
||||
|
||||
|
||||
TEST(RunLoadProperties) {
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
FieldAccess access = AccessBuilder::ForJSObjectProperties();
|
||||
Node* load = t.LoadField(access, t.Parameter(0));
|
||||
t.Return(load);
|
||||
@ -207,7 +208,8 @@ TEST(RunLoadProperties) {
|
||||
|
||||
|
||||
TEST(RunLoadStoreMap) {
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged, kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged(),
|
||||
MachineType::AnyTagged());
|
||||
FieldAccess access = AccessBuilder::ForMap();
|
||||
Node* load = t.LoadField(access, t.Parameter(0));
|
||||
t.StoreField(access, t.Parameter(1), load);
|
||||
@ -228,7 +230,7 @@ TEST(RunLoadStoreMap) {
|
||||
|
||||
|
||||
TEST(RunLoadStoreFixedArrayIndex) {
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
ElementAccess access = AccessBuilder::ForFixedArrayElement();
|
||||
Node* load = t.LoadElement(access, t.Parameter(0), t.Int32Constant(0));
|
||||
t.StoreElement(access, t.Parameter(0), t.Int32Constant(1), load);
|
||||
@ -250,7 +252,7 @@ TEST(RunLoadStoreFixedArrayIndex) {
|
||||
|
||||
|
||||
TEST(RunLoadStoreArrayBuffer) {
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
const int index = 12;
|
||||
const int array_length = 2 * index;
|
||||
ElementAccess buffer_access =
|
||||
@ -290,7 +292,7 @@ TEST(RunLoadFieldFromUntaggedBase) {
|
||||
for (size_t i = 0; i < arraysize(smis); i++) {
|
||||
int offset = static_cast<int>(i * sizeof(Smi*));
|
||||
FieldAccess access = {kUntaggedBase, offset, Handle<Name>(),
|
||||
Type::Integral32(), kMachAnyTagged};
|
||||
Type::Integral32(), MachineType::AnyTagged()};
|
||||
|
||||
SimplifiedLoweringTester<Object*> t;
|
||||
Node* load = t.LoadField(access, t.PointerConstant(smis));
|
||||
@ -312,9 +314,9 @@ TEST(RunStoreFieldToUntaggedBase) {
|
||||
for (size_t i = 0; i < arraysize(smis); i++) {
|
||||
int offset = static_cast<int>(i * sizeof(Smi*));
|
||||
FieldAccess access = {kUntaggedBase, offset, Handle<Name>(),
|
||||
Type::Integral32(), kMachAnyTagged};
|
||||
Type::Integral32(), MachineType::AnyTagged()};
|
||||
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
Node* p0 = t.Parameter(0);
|
||||
t.StoreField(access, t.PointerConstant(smis), p0);
|
||||
t.Return(p0);
|
||||
@ -338,7 +340,7 @@ TEST(RunLoadElementFromUntaggedBase) {
|
||||
for (size_t j = 0; (i + j) < arraysize(smis); j++) { // for element index
|
||||
int offset = static_cast<int>(i * sizeof(Smi*));
|
||||
ElementAccess access = {kUntaggedBase, offset, Type::Integral32(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
|
||||
SimplifiedLoweringTester<Object*> t;
|
||||
Node* load = t.LoadElement(access, t.PointerConstant(smis),
|
||||
@ -364,9 +366,9 @@ TEST(RunStoreElementFromUntaggedBase) {
|
||||
for (size_t j = 0; (i + j) < arraysize(smis); j++) { // for element index
|
||||
int offset = static_cast<int>(i * sizeof(Smi*));
|
||||
ElementAccess access = {kUntaggedBase, offset, Type::Integral32(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
Node* p0 = t.Parameter(0);
|
||||
t.StoreElement(access, t.PointerConstant(smis),
|
||||
t.Int32Constant(static_cast<int>(j)), p0);
|
||||
@ -592,19 +594,19 @@ static void RunAccessTest(MachineType rep, E* original_elements, size_t num) {
|
||||
TEST(RunAccessTests_uint8) {
|
||||
uint8_t data[] = {0x07, 0x16, 0x25, 0x34, 0x43, 0x99,
|
||||
0xab, 0x78, 0x89, 0x19, 0x2b, 0x38};
|
||||
RunAccessTest<uint8_t>(kMachInt8, data, arraysize(data));
|
||||
RunAccessTest<uint8_t>(MachineType::Int8(), data, arraysize(data));
|
||||
}
|
||||
|
||||
|
||||
TEST(RunAccessTests_uint16) {
|
||||
uint16_t data[] = {0x071a, 0x162b, 0x253c, 0x344d, 0x435e, 0x7777};
|
||||
RunAccessTest<uint16_t>(kMachInt16, data, arraysize(data));
|
||||
RunAccessTest<uint16_t>(MachineType::Int16(), data, arraysize(data));
|
||||
}
|
||||
|
||||
|
||||
TEST(RunAccessTests_int32) {
|
||||
int32_t data[] = {-211, 211, 628347, 2000000000, -2000000000, -1, -100000034};
|
||||
RunAccessTest<int32_t>(kMachInt32, data, arraysize(data));
|
||||
RunAccessTest<int32_t>(MachineType::Int32(), data, arraysize(data));
|
||||
}
|
||||
|
||||
|
||||
@ -618,13 +620,13 @@ TEST(RunAccessTests_int64) {
|
||||
V8_2PART_INT64(0x30313233, 34353637),
|
||||
V8_2PART_INT64(0xa0a1a2a3, a4a5a6a7),
|
||||
V8_2PART_INT64(0xf0f1f2f3, f4f5f6f7)};
|
||||
RunAccessTest<int64_t>(kMachInt64, data, arraysize(data));
|
||||
RunAccessTest<int64_t>(MachineType::Int64(), data, arraysize(data));
|
||||
}
|
||||
|
||||
|
||||
TEST(RunAccessTests_float64) {
|
||||
double data[] = {1.25, -1.25, 2.75, 11.0, 11100.8};
|
||||
RunAccessTest<double>(kMachFloat64, data, arraysize(data));
|
||||
RunAccessTest<double>(MachineType::Float64(), data, arraysize(data));
|
||||
}
|
||||
|
||||
|
||||
@ -632,7 +634,7 @@ TEST(RunAccessTests_Smi) {
|
||||
Smi* data[] = {Smi::FromInt(-1), Smi::FromInt(-9),
|
||||
Smi::FromInt(0), Smi::FromInt(666),
|
||||
Smi::FromInt(77777), Smi::FromInt(Smi::kMaxValue)};
|
||||
RunAccessTest<Smi*>(kMachAnyTagged, data, arraysize(data));
|
||||
RunAccessTest<Smi*>(MachineType::AnyTagged(), data, arraysize(data));
|
||||
}
|
||||
|
||||
|
||||
@ -741,44 +743,43 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders {
|
||||
void Effect(Node* node) { ret->ReplaceInput(1, node); }
|
||||
|
||||
Node* ExampleWithOutput(MachineType type) {
|
||||
// TODO(titzer): use parameters with guaranteed representations.
|
||||
if (type & kTypeInt32) {
|
||||
if (type.semantic() == MachineSemantic::kInt32) {
|
||||
return graph()->NewNode(machine()->Int32Add(), jsgraph.Int32Constant(1),
|
||||
jsgraph.Int32Constant(1));
|
||||
} else if (type & kTypeUint32) {
|
||||
} else if (type.semantic() == MachineSemantic::kUint32) {
|
||||
return graph()->NewNode(machine()->Word32Shr(), jsgraph.Int32Constant(1),
|
||||
jsgraph.Int32Constant(1));
|
||||
} else if (type & kRepFloat64) {
|
||||
} else if (type.representation() == MachineRepresentation::kFloat64) {
|
||||
return graph()->NewNode(machine()->Float64Add(),
|
||||
jsgraph.Float64Constant(1),
|
||||
jsgraph.Float64Constant(1));
|
||||
} else if (type & kRepBit) {
|
||||
} else if (type.representation() == MachineRepresentation::kBit) {
|
||||
return graph()->NewNode(machine()->Word32Equal(),
|
||||
jsgraph.Int32Constant(1),
|
||||
jsgraph.Int32Constant(1));
|
||||
} else if (type & kRepWord64) {
|
||||
} else if (type.representation() == MachineRepresentation::kWord64) {
|
||||
return graph()->NewNode(machine()->Int64Add(), Int64Constant(1),
|
||||
Int64Constant(1));
|
||||
} else {
|
||||
CHECK(type & kRepTagged);
|
||||
CHECK(type.representation() == MachineRepresentation::kTagged);
|
||||
return p0;
|
||||
}
|
||||
}
|
||||
|
||||
Node* Use(Node* node, MachineType type) {
|
||||
if (type & kTypeInt32) {
|
||||
if (type.semantic() == MachineSemantic::kInt32) {
|
||||
return graph()->NewNode(machine()->Int32LessThan(), node,
|
||||
jsgraph.Int32Constant(1));
|
||||
} else if (type & kTypeUint32) {
|
||||
} else if (type.semantic() == MachineSemantic::kUint32) {
|
||||
return graph()->NewNode(machine()->Uint32LessThan(), node,
|
||||
jsgraph.Int32Constant(1));
|
||||
} else if (type & kRepFloat64) {
|
||||
} else if (type.representation() == MachineRepresentation::kFloat64) {
|
||||
return graph()->NewNode(machine()->Float64Add(), node,
|
||||
jsgraph.Float64Constant(1));
|
||||
} else if (type & kRepWord64) {
|
||||
} else if (type.representation() == MachineRepresentation::kWord64) {
|
||||
return graph()->NewNode(machine()->Int64LessThan(), node,
|
||||
Int64Constant(1));
|
||||
} else if (type & kRepWord32) {
|
||||
} else if (type.representation() == MachineRepresentation::kWord32) {
|
||||
return graph()->NewNode(machine()->Word32Equal(), node,
|
||||
jsgraph.Int32Constant(1));
|
||||
} else {
|
||||
@ -810,7 +811,7 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders {
|
||||
TEST(LowerBooleanNot_bit_bit) {
|
||||
// BooleanNot(x: kRepBit) used as kRepBit
|
||||
TestingGraph t(Type::Boolean());
|
||||
Node* b = t.ExampleWithOutput(kRepBit);
|
||||
Node* b = t.ExampleWithOutput(MachineType::Bool());
|
||||
Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b);
|
||||
Node* use = t.Branch(inv);
|
||||
t.Lower();
|
||||
@ -825,9 +826,9 @@ TEST(LowerBooleanNot_bit_bit) {
|
||||
TEST(LowerBooleanNot_bit_tagged) {
|
||||
// BooleanNot(x: kRepBit) used as kRepTagged
|
||||
TestingGraph t(Type::Boolean());
|
||||
Node* b = t.ExampleWithOutput(kRepBit);
|
||||
Node* b = t.ExampleWithOutput(MachineType::Bool());
|
||||
Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b);
|
||||
Node* use = t.Use(inv, kRepTagged);
|
||||
Node* use = t.Use(inv, MachineType::AnyTagged());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
CHECK_EQ(IrOpcode::kChangeBitToBool, use->InputAt(0)->opcode());
|
||||
@ -859,7 +860,7 @@ TEST(LowerBooleanNot_tagged_tagged) {
|
||||
TestingGraph t(Type::Boolean());
|
||||
Node* b = t.p0;
|
||||
Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b);
|
||||
Node* use = t.Use(inv, kRepTagged);
|
||||
Node* use = t.Use(inv, MachineType::AnyTagged());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
CHECK_EQ(IrOpcode::kChangeBitToBool, use->InputAt(0)->opcode());
|
||||
@ -872,11 +873,11 @@ TEST(LowerBooleanNot_tagged_tagged) {
|
||||
|
||||
|
||||
TEST(LowerBooleanToNumber_bit_int32) {
|
||||
// BooleanToNumber(x: kRepBit) used as kMachInt32
|
||||
// BooleanToNumber(x: kRepBit) used as MachineType::Int32()
|
||||
TestingGraph t(Type::Boolean());
|
||||
Node* b = t.ExampleWithOutput(kRepBit);
|
||||
Node* b = t.ExampleWithOutput(MachineType::Bool());
|
||||
Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b);
|
||||
Node* use = t.Use(cnv, kMachInt32);
|
||||
Node* use = t.Use(cnv, MachineType::Int32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
CHECK_EQ(b, use->InputAt(0));
|
||||
@ -884,11 +885,11 @@ TEST(LowerBooleanToNumber_bit_int32) {
|
||||
|
||||
|
||||
TEST(LowerBooleanToNumber_tagged_int32) {
|
||||
// BooleanToNumber(x: kRepTagged) used as kMachInt32
|
||||
// BooleanToNumber(x: kRepTagged) used as MachineType::Int32()
|
||||
TestingGraph t(Type::Boolean());
|
||||
Node* b = t.p0;
|
||||
Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b);
|
||||
Node* use = t.Use(cnv, kMachInt32);
|
||||
Node* use = t.Use(cnv, MachineType::Int32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
CHECK_EQ(t.machine()->WordEqual()->opcode(), cnv->opcode());
|
||||
@ -899,11 +900,11 @@ TEST(LowerBooleanToNumber_tagged_int32) {
|
||||
|
||||
|
||||
TEST(LowerBooleanToNumber_bit_tagged) {
|
||||
// BooleanToNumber(x: kRepBit) used as kMachAnyTagged
|
||||
// BooleanToNumber(x: kRepBit) used as MachineType::AnyTagged()
|
||||
TestingGraph t(Type::Boolean());
|
||||
Node* b = t.ExampleWithOutput(kRepBit);
|
||||
Node* b = t.ExampleWithOutput(MachineType::Bool());
|
||||
Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b);
|
||||
Node* use = t.Use(cnv, kMachAnyTagged);
|
||||
Node* use = t.Use(cnv, MachineType::AnyTagged());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
CHECK_EQ(b, use->InputAt(0)->InputAt(0));
|
||||
@ -912,11 +913,11 @@ TEST(LowerBooleanToNumber_bit_tagged) {
|
||||
|
||||
|
||||
TEST(LowerBooleanToNumber_tagged_tagged) {
|
||||
// BooleanToNumber(x: kRepTagged) used as kMachAnyTagged
|
||||
// BooleanToNumber(x: kRepTagged) used as MachineType::AnyTagged()
|
||||
TestingGraph t(Type::Boolean());
|
||||
Node* b = t.p0;
|
||||
Node* cnv = t.graph()->NewNode(t.simplified()->BooleanToNumber(), b);
|
||||
Node* use = t.Use(cnv, kMachAnyTagged);
|
||||
Node* use = t.Use(cnv, MachineType::AnyTagged());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
CHECK_EQ(cnv, use->InputAt(0)->InputAt(0));
|
||||
@ -1046,7 +1047,7 @@ TEST(LowerNumberToInt32_to_ChangeTaggedToInt32) {
|
||||
// NumberToInt32(x: kRepTagged | kTypeInt32) used as kRepWord32
|
||||
TestingGraph t(Type::Signed32());
|
||||
Node* trunc = t.graph()->NewNode(t.simplified()->NumberToInt32(), t.p0);
|
||||
Node* use = t.Use(trunc, kTypeInt32);
|
||||
Node* use = t.Use(trunc, MachineType::Int32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p0, use->InputAt(0));
|
||||
@ -1054,11 +1055,11 @@ TEST(LowerNumberToInt32_to_ChangeTaggedToInt32) {
|
||||
|
||||
|
||||
TEST(LowerNumberToInt32_to_TruncateFloat64ToInt32) {
|
||||
// NumberToInt32(x: kRepFloat64) used as kMachInt32
|
||||
// NumberToInt32(x: kRepFloat64) used as MachineType::Int32()
|
||||
TestingGraph t(Type::Number());
|
||||
Node* p0 = t.ExampleWithOutput(kMachFloat64);
|
||||
Node* p0 = t.ExampleWithOutput(MachineType::Float64());
|
||||
Node* trunc = t.graph()->NewNode(t.simplified()->NumberToInt32(), p0);
|
||||
Node* use = t.Use(trunc, kMachInt32);
|
||||
Node* use = t.Use(trunc, MachineType::Int32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
CheckChangeOf(IrOpcode::kTruncateFloat64ToInt32, p0, use->InputAt(0));
|
||||
@ -1066,10 +1067,10 @@ TEST(LowerNumberToInt32_to_TruncateFloat64ToInt32) {
|
||||
|
||||
|
||||
TEST(LowerNumberToInt32_to_TruncateFloat64ToInt32_with_change) {
|
||||
// NumberToInt32(x: kTypeNumber | kRepTagged) used as kMachInt32
|
||||
// NumberToInt32(x: kTypeNumber | kRepTagged) used as MachineType::Int32()
|
||||
TestingGraph t(Type::Number());
|
||||
Node* trunc = t.graph()->NewNode(t.simplified()->NumberToInt32(), t.p0);
|
||||
Node* use = t.Use(trunc, kMachInt32);
|
||||
Node* use = t.Use(trunc, MachineType::Int32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
Node* node = use->InputAt(0);
|
||||
@ -1084,7 +1085,7 @@ TEST(LowerNumberToUint32_to_ChangeTaggedToUint32) {
|
||||
// NumberToUint32(x: kRepTagged | kTypeUint32) used as kRepWord32
|
||||
TestingGraph t(Type::Unsigned32());
|
||||
Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), t.p0);
|
||||
Node* use = t.Use(trunc, kTypeUint32);
|
||||
Node* use = t.Use(trunc, MachineType::Uint32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
CheckChangeOf(IrOpcode::kChangeTaggedToUint32, t.p0, use->InputAt(0));
|
||||
@ -1092,13 +1093,13 @@ TEST(LowerNumberToUint32_to_ChangeTaggedToUint32) {
|
||||
|
||||
|
||||
TEST(LowerNumberToUint32_to_TruncateFloat64ToInt32) {
|
||||
// NumberToUint32(x: kRepFloat64) used as kMachUint32
|
||||
// NumberToUint32(x: kRepFloat64) used as MachineType::Uint32()
|
||||
TestingGraph t(Type::Number());
|
||||
Node* p0 = t.ExampleWithOutput(kMachFloat64);
|
||||
Node* p0 = t.ExampleWithOutput(MachineType::Float64());
|
||||
// TODO(titzer): run the typer here, or attach machine type to param.
|
||||
NodeProperties::SetType(p0, Type::Number());
|
||||
Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), p0);
|
||||
Node* use = t.Use(trunc, kMachUint32);
|
||||
Node* use = t.Use(trunc, MachineType::Uint32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
CheckChangeOf(IrOpcode::kTruncateFloat64ToInt32, p0, use->InputAt(0));
|
||||
@ -1106,10 +1107,10 @@ TEST(LowerNumberToUint32_to_TruncateFloat64ToInt32) {
|
||||
|
||||
|
||||
TEST(LowerNumberToUint32_to_TruncateFloat64ToInt32_with_change) {
|
||||
// NumberToInt32(x: kTypeNumber | kRepTagged) used as kMachUint32
|
||||
// NumberToInt32(x: kTypeNumber | kRepTagged) used as MachineType::Uint32()
|
||||
TestingGraph t(Type::Number());
|
||||
Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), t.p0);
|
||||
Node* use = t.Use(trunc, kMachUint32);
|
||||
Node* use = t.Use(trunc, MachineType::Uint32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
Node* node = use->InputAt(0);
|
||||
@ -1123,9 +1124,9 @@ TEST(LowerNumberToUint32_to_TruncateFloat64ToInt32_with_change) {
|
||||
TEST(LowerNumberToUint32_to_TruncateFloat64ToInt32_uint32) {
|
||||
// NumberToUint32(x: kRepFloat64) used as kRepWord32
|
||||
TestingGraph t(Type::Unsigned32());
|
||||
Node* input = t.ExampleWithOutput(kMachFloat64);
|
||||
Node* input = t.ExampleWithOutput(MachineType::Float64());
|
||||
Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), input);
|
||||
Node* use = t.Use(trunc, kRepWord32);
|
||||
Node* use = t.Use(trunc, MachineType::RepWord32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
CheckChangeOf(IrOpcode::kTruncateFloat64ToInt32, input, use->InputAt(0));
|
||||
@ -1170,30 +1171,33 @@ TEST(LowerStringOps_to_call_and_compare) {
|
||||
|
||||
|
||||
TEST(InsertBasicChanges) {
|
||||
CheckChangeInsertion(IrOpcode::kChangeFloat64ToInt32, kRepFloat64, kTypeInt32,
|
||||
Type::Signed32());
|
||||
CheckChangeInsertion(IrOpcode::kChangeFloat64ToUint32, kRepFloat64,
|
||||
kTypeUint32, Type::Unsigned32());
|
||||
CheckChangeInsertion(IrOpcode::kTruncateFloat64ToInt32, kRepFloat64,
|
||||
kTypeUint32, Type::Integral32());
|
||||
CheckChangeInsertion(IrOpcode::kChangeTaggedToInt32, kRepTagged, kTypeInt32,
|
||||
Type::Signed32());
|
||||
CheckChangeInsertion(IrOpcode::kChangeTaggedToUint32, kRepTagged, kTypeUint32,
|
||||
CheckChangeInsertion(IrOpcode::kChangeFloat64ToInt32, MachineType::Float64(),
|
||||
MachineType::Int32(), Type::Signed32());
|
||||
CheckChangeInsertion(IrOpcode::kChangeFloat64ToUint32, MachineType::Float64(),
|
||||
MachineType::Uint32(), Type::Unsigned32());
|
||||
CheckChangeInsertion(IrOpcode::kTruncateFloat64ToInt32,
|
||||
MachineType::Float64(), MachineType::Uint32(),
|
||||
Type::Integral32());
|
||||
CheckChangeInsertion(IrOpcode::kChangeTaggedToInt32, MachineType::AnyTagged(),
|
||||
MachineType::Int32(), Type::Signed32());
|
||||
CheckChangeInsertion(IrOpcode::kChangeTaggedToUint32,
|
||||
MachineType::AnyTagged(), MachineType::Uint32(),
|
||||
Type::Unsigned32());
|
||||
|
||||
CheckChangeInsertion(IrOpcode::kChangeFloat64ToTagged, kRepFloat64,
|
||||
kRepTagged);
|
||||
CheckChangeInsertion(IrOpcode::kChangeTaggedToFloat64, kRepTagged,
|
||||
kRepFloat64);
|
||||
CheckChangeInsertion(IrOpcode::kChangeFloat64ToTagged, MachineType::Float64(),
|
||||
MachineType::AnyTagged());
|
||||
CheckChangeInsertion(IrOpcode::kChangeTaggedToFloat64,
|
||||
MachineType::AnyTagged(), MachineType::Float64());
|
||||
|
||||
CheckChangeInsertion(IrOpcode::kChangeInt32ToFloat64, kTypeInt32,
|
||||
kRepFloat64);
|
||||
CheckChangeInsertion(IrOpcode::kChangeInt32ToTagged, kTypeInt32, kRepTagged);
|
||||
CheckChangeInsertion(IrOpcode::kChangeInt32ToFloat64, MachineType::Int32(),
|
||||
MachineType::Float64());
|
||||
CheckChangeInsertion(IrOpcode::kChangeInt32ToTagged, MachineType::Int32(),
|
||||
MachineType::AnyTagged());
|
||||
|
||||
CheckChangeInsertion(IrOpcode::kChangeUint32ToFloat64, kTypeUint32,
|
||||
kRepFloat64);
|
||||
CheckChangeInsertion(IrOpcode::kChangeUint32ToTagged, kTypeUint32,
|
||||
kRepTagged);
|
||||
CheckChangeInsertion(IrOpcode::kChangeUint32ToFloat64, MachineType::Uint32(),
|
||||
MachineType::Float64());
|
||||
CheckChangeInsertion(IrOpcode::kChangeUint32ToTagged, MachineType::Uint32(),
|
||||
MachineType::AnyTagged());
|
||||
}
|
||||
|
||||
|
||||
@ -1306,7 +1310,8 @@ Node* CheckElementAccessArithmetic(ElementAccess access, Node* load_or_store) {
|
||||
CHECK_EQ(IrOpcode::kInt32Add, mindex.node()->opcode());
|
||||
CHECK(mindex.right().Is(access.header_size - access.tag()));
|
||||
|
||||
const int element_size_shift = ElementSizeLog2Of(access.machine_type);
|
||||
const int element_size_shift =
|
||||
ElementSizeLog2Of(access.machine_type.representation());
|
||||
if (element_size_shift) {
|
||||
Int32BinopMatcher shl(mindex.left().node());
|
||||
CHECK_EQ(IrOpcode::kWord32Shl, shl.node()->opcode());
|
||||
@ -1318,9 +1323,10 @@ Node* CheckElementAccessArithmetic(ElementAccess access, Node* load_or_store) {
|
||||
}
|
||||
|
||||
|
||||
const MachineType kMachineReps[] = {kMachInt8, kMachInt16, kMachInt32,
|
||||
kMachUint32, kMachInt64, kMachFloat64,
|
||||
kMachAnyTagged};
|
||||
const MachineType kMachineReps[] = {
|
||||
MachineType::Int8(), MachineType::Int16(), MachineType::Int32(),
|
||||
MachineType::Uint32(), MachineType::Int64(), MachineType::Float64(),
|
||||
MachineType::AnyTagged()};
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -1341,7 +1347,7 @@ TEST(LowerLoadField_to_load) {
|
||||
CHECK_EQ(t.p0, load->InputAt(0));
|
||||
CheckFieldAccessArithmetic(access, load);
|
||||
|
||||
MachineType rep = OpParameter<MachineType>(load);
|
||||
MachineType rep = LoadRepresentationOf(load->op());
|
||||
CHECK_EQ(kMachineReps[i], rep);
|
||||
}
|
||||
}
|
||||
@ -1366,7 +1372,7 @@ TEST(LowerStoreField_to_store) {
|
||||
CheckFieldAccessArithmetic(access, store);
|
||||
|
||||
StoreRepresentation rep = OpParameter<StoreRepresentation>(store);
|
||||
if (kMachineReps[i] & kRepTagged) {
|
||||
if (kMachineReps[i].representation() == MachineRepresentation::kTagged) {
|
||||
CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind());
|
||||
}
|
||||
CHECK_EQ(kMachineReps[i], rep.machine_type());
|
||||
@ -1378,7 +1384,8 @@ TEST(LowerStoreField_to_store) {
|
||||
TestingGraph t(Type::Any(), Type::Intersect(Type::SignedSmall(),
|
||||
Type::TaggedSigned(), z));
|
||||
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
|
||||
Handle<Name>::null(), Type::Any(), kMachAnyTagged};
|
||||
Handle<Name>::null(), Type::Any(),
|
||||
MachineType::AnyTagged()};
|
||||
Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0,
|
||||
t.p1, t.start, t.start);
|
||||
t.Effect(store);
|
||||
@ -1407,7 +1414,7 @@ TEST(LowerLoadElement_to_load) {
|
||||
CHECK_EQ(t.p0, load->InputAt(0));
|
||||
CheckElementAccessArithmetic(access, load);
|
||||
|
||||
MachineType rep = OpParameter<MachineType>(load);
|
||||
MachineType rep = LoadRepresentationOf(load->op());
|
||||
CHECK_EQ(kMachineReps[i], rep);
|
||||
}
|
||||
}
|
||||
@ -1431,7 +1438,7 @@ TEST(LowerStoreElement_to_store) {
|
||||
CheckElementAccessArithmetic(access, store);
|
||||
|
||||
StoreRepresentation rep = OpParameter<StoreRepresentation>(store);
|
||||
if (kMachineReps[i] & kRepTagged) {
|
||||
if (kMachineReps[i].representation() == MachineRepresentation::kTagged) {
|
||||
CHECK_EQ(kFullWriteBarrier, rep.write_barrier_kind());
|
||||
}
|
||||
CHECK_EQ(kMachineReps[i], rep.machine_type());
|
||||
@ -1444,7 +1451,7 @@ TEST(LowerStoreElement_to_store) {
|
||||
Type::Any(), Type::Signed32(),
|
||||
Type::Intersect(Type::SignedSmall(), Type::TaggedSigned(), z));
|
||||
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
|
||||
Type::Any(), kMachAnyTagged};
|
||||
Type::Any(), MachineType::AnyTagged()};
|
||||
Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0,
|
||||
t.p1, t.p2, t.start, t.start);
|
||||
t.Effect(store);
|
||||
@ -1462,7 +1469,7 @@ TEST(InsertChangeForLoadElementIndex) {
|
||||
// Load(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k))
|
||||
TestingGraph t(Type::Any(), Type::Signed32());
|
||||
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
|
||||
Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0,
|
||||
t.p1, t.start, t.start);
|
||||
@ -1479,7 +1486,7 @@ TEST(InsertChangeForStoreElementIndex) {
|
||||
// Store(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k), val)
|
||||
TestingGraph t(Type::Any(), Type::Signed32());
|
||||
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
|
||||
Node* store =
|
||||
t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, t.p1,
|
||||
@ -1496,7 +1503,7 @@ TEST(InsertChangeForLoadElement) {
|
||||
// TODO(titzer): test all load/store representation change insertions.
|
||||
TestingGraph t(Type::Any(), Type::Signed32(), Type::Any());
|
||||
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(),
|
||||
kMachFloat64};
|
||||
MachineType::Float64()};
|
||||
|
||||
Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0,
|
||||
t.p1, t.start, t.start);
|
||||
@ -1512,7 +1519,8 @@ TEST(InsertChangeForLoadField) {
|
||||
// TODO(titzer): test all load/store representation change insertions.
|
||||
TestingGraph t(Type::Any(), Type::Signed32());
|
||||
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
|
||||
Handle<Name>::null(), Type::Any(), kMachFloat64};
|
||||
Handle<Name>::null(), Type::Any(),
|
||||
MachineType::Float64()};
|
||||
|
||||
Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0,
|
||||
t.start, t.start);
|
||||
@ -1528,7 +1536,7 @@ TEST(InsertChangeForStoreElement) {
|
||||
// TODO(titzer): test all load/store representation change insertions.
|
||||
TestingGraph t(Type::Any(), Type::Signed32());
|
||||
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(),
|
||||
kMachFloat64};
|
||||
MachineType::Float64()};
|
||||
|
||||
Node* store =
|
||||
t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0,
|
||||
@ -1546,7 +1554,8 @@ TEST(InsertChangeForStoreField) {
|
||||
// TODO(titzer): test all load/store representation change insertions.
|
||||
TestingGraph t(Type::Any(), Type::Signed32());
|
||||
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
|
||||
Handle<Name>::null(), Type::Any(), kMachFloat64};
|
||||
Handle<Name>::null(), Type::Any(),
|
||||
MachineType::Float64()};
|
||||
|
||||
Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0,
|
||||
t.p1, t.start, t.start);
|
||||
@ -1561,8 +1570,8 @@ TEST(InsertChangeForStoreField) {
|
||||
|
||||
TEST(UpdatePhi) {
|
||||
TestingGraph t(Type::Any(), Type::Signed32());
|
||||
static const MachineType kMachineTypes[] = {kMachInt32, kMachUint32,
|
||||
kMachFloat64};
|
||||
static const MachineType kMachineTypes[] = {
|
||||
MachineType::Int32(), MachineType::Uint32(), MachineType::Float64()};
|
||||
Type* kTypes[] = {Type::Signed32(), Type::Unsigned32(), Type::Number()};
|
||||
|
||||
for (size_t i = 0; i < arraysize(kMachineTypes); i++) {
|
||||
@ -1573,20 +1582,20 @@ TEST(UpdatePhi) {
|
||||
t.start, t.start);
|
||||
Node* load1 = t.graph()->NewNode(t.simplified()->LoadField(access), t.p1,
|
||||
t.start, t.start);
|
||||
Node* phi = t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), load0,
|
||||
load1, t.start);
|
||||
Node* phi =
|
||||
t.graph()->NewNode(t.common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
load0, load1, t.start);
|
||||
t.Return(t.Use(phi, kMachineTypes[i]));
|
||||
t.Lower();
|
||||
|
||||
CHECK_EQ(IrOpcode::kPhi, phi->opcode());
|
||||
CHECK_EQ(RepresentationOf(kMachineTypes[i]),
|
||||
RepresentationOf(OpParameter<MachineType>(phi)));
|
||||
CHECK_EQ(kMachineTypes[i].representation(), PhiRepresentationOf(phi->op()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST(RunNumberDivide_minus_1_TruncatingToInt32) {
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
Node* num = t.NumberToInt32(t.Parameter(0));
|
||||
Node* div = t.NumberDivide(num, t.jsgraph.Constant(-1));
|
||||
Node* trunc = t.NumberToInt32(div);
|
||||
@ -1607,7 +1616,7 @@ TEST(RunNumberMultiply_TruncatingToInt32) {
|
||||
|
||||
for (size_t i = 0; i < arraysize(constants); i++) {
|
||||
double k = static_cast<double>(constants[i]);
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
Node* num = t.NumberToInt32(t.Parameter(0));
|
||||
Node* mul = t.NumberMultiply(num, t.jsgraph.Constant(k));
|
||||
Node* trunc = t.NumberToInt32(mul);
|
||||
@ -1629,7 +1638,7 @@ TEST(RunNumberMultiply_TruncatingToUint32) {
|
||||
|
||||
for (size_t i = 0; i < arraysize(constants); i++) {
|
||||
double k = static_cast<double>(constants[i]);
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
Node* num = t.NumberToUint32(t.Parameter(0));
|
||||
Node* mul = t.NumberMultiply(num, t.jsgraph.Constant(k));
|
||||
Node* trunc = t.NumberToUint32(mul);
|
||||
@ -1647,7 +1656,7 @@ TEST(RunNumberMultiply_TruncatingToUint32) {
|
||||
|
||||
|
||||
TEST(RunNumberDivide_2_TruncatingToUint32) {
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
Node* num = t.NumberToUint32(t.Parameter(0));
|
||||
Node* div = t.NumberDivide(num, t.jsgraph.Constant(2));
|
||||
Node* trunc = t.NumberToUint32(div);
|
||||
@ -1693,7 +1702,7 @@ TEST(NumberDivide_TruncatingToInt32) {
|
||||
TestingGraph t(Type::Signed32());
|
||||
Node* k = t.jsgraph.Constant(constants[i]);
|
||||
Node* div = t.graph()->NewNode(t.simplified()->NumberDivide(), t.p0, k);
|
||||
Node* use = t.Use(div, kMachInt32);
|
||||
Node* use = t.Use(div, MachineType::Int32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
|
||||
@ -1707,7 +1716,7 @@ TEST(RunNumberDivide_TruncatingToInt32) {
|
||||
|
||||
for (size_t i = 0; i < arraysize(constants); i++) {
|
||||
int32_t k = constants[i];
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
Node* num = t.NumberToInt32(t.Parameter(0));
|
||||
Node* div = t.NumberDivide(num, t.jsgraph.Constant(k));
|
||||
Node* trunc = t.NumberToInt32(div);
|
||||
@ -1732,7 +1741,7 @@ TEST(NumberDivide_TruncatingToUint32) {
|
||||
TestingGraph t(Type::Unsigned32());
|
||||
Node* k = t.jsgraph.Constant(constants[i]);
|
||||
Node* div = t.graph()->NewNode(t.simplified()->NumberDivide(), t.p0, k);
|
||||
Node* use = t.Use(div, kMachUint32);
|
||||
Node* use = t.Use(div, MachineType::Uint32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
|
||||
@ -1746,7 +1755,7 @@ TEST(RunNumberDivide_TruncatingToUint32) {
|
||||
|
||||
for (size_t i = 0; i < arraysize(constants); i++) {
|
||||
uint32_t k = constants[i];
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
Node* num = t.NumberToUint32(t.Parameter(0));
|
||||
Node* div = t.NumberDivide(num, t.jsgraph.Constant(static_cast<double>(k)));
|
||||
Node* trunc = t.NumberToUint32(div);
|
||||
@ -1768,7 +1777,7 @@ TEST(NumberDivide_BadConstants) {
|
||||
TestingGraph t(Type::Signed32());
|
||||
Node* k = t.jsgraph.Constant(-1);
|
||||
Node* div = t.graph()->NewNode(t.simplified()->NumberDivide(), t.p0, k);
|
||||
Node* use = t.Use(div, kMachInt32);
|
||||
Node* use = t.Use(div, MachineType::Int32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
|
||||
@ -1779,7 +1788,7 @@ TEST(NumberDivide_BadConstants) {
|
||||
TestingGraph t(Type::Signed32());
|
||||
Node* k = t.jsgraph.Constant(0);
|
||||
Node* div = t.graph()->NewNode(t.simplified()->NumberDivide(), t.p0, k);
|
||||
Node* use = t.Use(div, kMachInt32);
|
||||
Node* use = t.Use(div, MachineType::Int32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
|
||||
@ -1791,7 +1800,7 @@ TEST(NumberDivide_BadConstants) {
|
||||
TestingGraph t(Type::Unsigned32());
|
||||
Node* k = t.jsgraph.Constant(0);
|
||||
Node* div = t.graph()->NewNode(t.simplified()->NumberDivide(), t.p0, k);
|
||||
Node* use = t.Use(div, kMachUint32);
|
||||
Node* use = t.Use(div, MachineType::Uint32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
|
||||
@ -1808,7 +1817,7 @@ TEST(NumberModulus_TruncatingToInt32) {
|
||||
TestingGraph t(Type::Signed32());
|
||||
Node* k = t.jsgraph.Constant(constants[i]);
|
||||
Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k);
|
||||
Node* use = t.Use(mod, kMachInt32);
|
||||
Node* use = t.Use(mod, MachineType::Int32());
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
|
||||
@ -1822,7 +1831,7 @@ TEST(RunNumberModulus_TruncatingToInt32) {
|
||||
|
||||
for (size_t i = 0; i < arraysize(constants); i++) {
|
||||
int32_t k = constants[i];
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
Node* num = t.NumberToInt32(t.Parameter(0));
|
||||
Node* mod = t.NumberModulus(num, t.jsgraph.Constant(k));
|
||||
Node* trunc = t.NumberToInt32(mod);
|
||||
@ -1861,7 +1870,7 @@ TEST(RunNumberModulus_TruncatingToUint32) {
|
||||
|
||||
for (size_t i = 0; i < arraysize(constants); i++) {
|
||||
uint32_t k = constants[i];
|
||||
SimplifiedLoweringTester<Object*> t(kMachAnyTagged);
|
||||
SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged());
|
||||
Node* num = t.NumberToUint32(t.Parameter(0));
|
||||
Node* mod =
|
||||
t.NumberModulus(num, t.jsgraph.Constant(static_cast<double>(k)));
|
||||
@ -1896,7 +1905,7 @@ TEST(NumberModulus_Int32) {
|
||||
|
||||
TEST(NumberModulus_Uint32) {
|
||||
const double kConstants[] = {2, 100, 1000, 1024, 2048};
|
||||
const MachineType kTypes[] = {kMachInt32, kMachUint32};
|
||||
const MachineType kTypes[] = {MachineType::Int32(), MachineType::Uint32()};
|
||||
|
||||
for (auto const type : kTypes) {
|
||||
for (auto const c : kConstants) {
|
||||
@ -1921,17 +1930,20 @@ TEST(PhiRepresentation) {
|
||||
Type* arg1;
|
||||
Type* arg2;
|
||||
MachineType use;
|
||||
MachineTypeUnion expected;
|
||||
MachineRepresentation expected;
|
||||
};
|
||||
|
||||
TestData test_data[] = {
|
||||
{Type::Signed32(), Type::Unsigned32(), kMachInt32,
|
||||
kRepWord32 | kTypeNumber},
|
||||
{Type::Signed32(), Type::Unsigned32(), kMachUint32,
|
||||
kRepWord32 | kTypeNumber},
|
||||
{Type::Signed32(), Type::Signed32(), kMachInt32, kMachInt32},
|
||||
{Type::Unsigned32(), Type::Unsigned32(), kMachInt32, kMachUint32},
|
||||
{Type::Number(), Type::Signed32(), kMachInt32, kRepWord32 | kTypeNumber}};
|
||||
{Type::Signed32(), Type::Unsigned32(), MachineType::Int32(),
|
||||
MachineRepresentation::kWord32},
|
||||
{Type::Signed32(), Type::Unsigned32(), MachineType::Uint32(),
|
||||
MachineRepresentation::kWord32},
|
||||
{Type::Signed32(), Type::Signed32(), MachineType::Int32(),
|
||||
MachineRepresentation::kWord32},
|
||||
{Type::Unsigned32(), Type::Unsigned32(), MachineType::Int32(),
|
||||
MachineRepresentation::kWord32},
|
||||
{Type::Number(), Type::Signed32(), MachineType::Int32(),
|
||||
MachineRepresentation::kWord32}};
|
||||
|
||||
for (auto const d : test_data) {
|
||||
TestingGraph t(d.arg1, d.arg2, Type::Boolean());
|
||||
@ -1941,8 +1953,8 @@ TEST(PhiRepresentation) {
|
||||
Node* fb = t.graph()->NewNode(t.common()->IfFalse(), br);
|
||||
Node* m = t.graph()->NewNode(t.common()->Merge(2), tb, fb);
|
||||
|
||||
Node* phi =
|
||||
t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), t.p0, t.p1, m);
|
||||
Node* phi = t.graph()->NewNode(
|
||||
t.common()->Phi(MachineRepresentation::kTagged, 2), t.p0, t.p1, m);
|
||||
|
||||
Type* phi_type = Type::Union(d.arg1, d.arg2, z);
|
||||
NodeProperties::SetType(phi, phi_type);
|
||||
@ -1951,7 +1963,7 @@ TEST(PhiRepresentation) {
|
||||
t.Return(use);
|
||||
t.Lower();
|
||||
|
||||
CHECK_EQ(d.expected, OpParameter<MachineType>(phi));
|
||||
CHECK_EQ(d.expected, PhiRepresentationOf(phi->op()));
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -18,7 +18,8 @@ namespace compiler {
|
||||
class BranchEliminationTest : public TypedGraphTest {
|
||||
public:
|
||||
BranchEliminationTest()
|
||||
: machine_(zone(), kMachPtr, MachineOperatorBuilder::kNoFlags) {}
|
||||
: machine_(zone(), MachineType::PointerRepresentation(),
|
||||
MachineOperatorBuilder::kNoFlags) {}
|
||||
|
||||
MachineOperatorBuilder* machine() { return &machine_; }
|
||||
|
||||
@ -54,14 +55,15 @@ TEST_F(BranchEliminationTest, NestedBranchSameTrue) {
|
||||
Node* inner_merge =
|
||||
graph()->NewNode(common()->Merge(2), inner_if_true, inner_if_false);
|
||||
Node* inner_phi =
|
||||
graph()->NewNode(common()->Phi(kMachInt32, 2), Int32Constant(1),
|
||||
Int32Constant(2), inner_merge);
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
|
||||
Int32Constant(1), Int32Constant(2), inner_merge);
|
||||
|
||||
Node* outer_if_false = graph()->NewNode(common()->IfFalse(), outer_branch);
|
||||
Node* outer_merge =
|
||||
graph()->NewNode(common()->Merge(2), inner_merge, outer_if_false);
|
||||
Node* outer_phi = graph()->NewNode(common()->Phi(kMachInt32, 2), inner_phi,
|
||||
Int32Constant(3), outer_merge);
|
||||
Node* outer_phi =
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
|
||||
inner_phi, Int32Constant(3), outer_merge);
|
||||
|
||||
Node* ret = graph()->NewNode(common()->Return(), outer_phi, graph()->start(),
|
||||
outer_merge);
|
||||
@ -72,8 +74,8 @@ TEST_F(BranchEliminationTest, NestedBranchSameTrue) {
|
||||
// Outer branch should not be rewritten, the inner branch should be discarded.
|
||||
EXPECT_THAT(outer_branch, IsBranch(condition, graph()->start()));
|
||||
EXPECT_THAT(inner_phi,
|
||||
IsPhi(kMachInt32, IsInt32Constant(1), IsInt32Constant(2),
|
||||
IsMerge(outer_if_true, IsDead())));
|
||||
IsPhi(MachineRepresentation::kWord32, IsInt32Constant(1),
|
||||
IsInt32Constant(2), IsMerge(outer_if_true, IsDead())));
|
||||
}
|
||||
|
||||
|
||||
@ -95,13 +97,14 @@ TEST_F(BranchEliminationTest, NestedBranchSameFalse) {
|
||||
Node* inner_merge =
|
||||
graph()->NewNode(common()->Merge(2), inner_if_true, inner_if_false);
|
||||
Node* inner_phi =
|
||||
graph()->NewNode(common()->Phi(kMachInt32, 2), Int32Constant(2),
|
||||
Int32Constant(3), inner_merge);
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
|
||||
Int32Constant(2), Int32Constant(3), inner_merge);
|
||||
|
||||
Node* outer_merge =
|
||||
graph()->NewNode(common()->Merge(2), outer_if_true, inner_merge);
|
||||
Node* outer_phi = graph()->NewNode(common()->Phi(kMachInt32, 2),
|
||||
Int32Constant(1), inner_phi, outer_merge);
|
||||
Node* outer_phi =
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
|
||||
Int32Constant(1), inner_phi, outer_merge);
|
||||
|
||||
Node* ret = graph()->NewNode(common()->Return(), outer_phi, graph()->start(),
|
||||
outer_merge);
|
||||
@ -112,8 +115,8 @@ TEST_F(BranchEliminationTest, NestedBranchSameFalse) {
|
||||
// Outer branch should not be rewritten, the inner branch should be discarded.
|
||||
EXPECT_THAT(outer_branch, IsBranch(condition, graph()->start()));
|
||||
EXPECT_THAT(inner_phi,
|
||||
IsPhi(kMachInt32, IsInt32Constant(2), IsInt32Constant(3),
|
||||
IsMerge(IsDead(), outer_if_false)));
|
||||
IsPhi(MachineRepresentation::kWord32, IsInt32Constant(2),
|
||||
IsInt32Constant(3), IsMerge(IsDead(), outer_if_false)));
|
||||
}
|
||||
|
||||
|
||||
@ -127,15 +130,17 @@ TEST_F(BranchEliminationTest, BranchAfterDiamond) {
|
||||
Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
|
||||
Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
|
||||
Node* merge1 = graph()->NewNode(common()->Merge(2), if_true1, if_false1);
|
||||
Node* phi1 = graph()->NewNode(common()->Phi(kMachInt32, 2), Int32Constant(1),
|
||||
Int32Constant(2), merge1);
|
||||
Node* phi1 =
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
|
||||
Int32Constant(1), Int32Constant(2), merge1);
|
||||
|
||||
Node* branch2 = graph()->NewNode(common()->Branch(), condition, merge1);
|
||||
Node* if_true2 = graph()->NewNode(common()->IfTrue(), branch2);
|
||||
Node* if_false2 = graph()->NewNode(common()->IfFalse(), branch2);
|
||||
Node* merge2 = graph()->NewNode(common()->Merge(2), if_true2, if_false2);
|
||||
Node* phi2 = graph()->NewNode(common()->Phi(kMachInt32, 2), Int32Constant(3),
|
||||
Int32Constant(4), merge1);
|
||||
Node* phi2 =
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
|
||||
Int32Constant(3), Int32Constant(4), merge1);
|
||||
|
||||
|
||||
Node* add = graph()->NewNode(machine()->Int32Add(), phi1, phi2);
|
||||
|
@ -27,11 +27,15 @@ class ChangeLoweringTest : public TypedGraphTest {
|
||||
public:
|
||||
ChangeLoweringTest() : simplified_(zone()) {}
|
||||
|
||||
virtual MachineType WordRepresentation() const = 0;
|
||||
virtual MachineRepresentation WordRepresentation() const = 0;
|
||||
|
||||
protected:
|
||||
bool Is32() const { return WordRepresentation() == kRepWord32; }
|
||||
bool Is64() const { return WordRepresentation() == kRepWord64; }
|
||||
bool Is32() const {
|
||||
return WordRepresentation() == MachineRepresentation::kWord32;
|
||||
}
|
||||
bool Is64() const {
|
||||
return WordRepresentation() == MachineRepresentation::kWord64;
|
||||
}
|
||||
|
||||
Reduction Reduce(Node* node) {
|
||||
MachineOperatorBuilder machine(zone(), WordRepresentation());
|
||||
@ -67,7 +71,7 @@ class ChangeLoweringTest : public TypedGraphTest {
|
||||
}
|
||||
Matcher<Node*> IsLoadHeapNumber(const Matcher<Node*>& value_matcher,
|
||||
const Matcher<Node*>& control_matcher) {
|
||||
return IsLoad(kMachFloat64, value_matcher,
|
||||
return IsLoad(MachineType::Float64(), value_matcher,
|
||||
IsIntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag),
|
||||
graph()->start(), control_matcher);
|
||||
}
|
||||
@ -94,11 +98,11 @@ class ChangeLoweringTest : public TypedGraphTest {
|
||||
|
||||
class ChangeLoweringCommonTest
|
||||
: public ChangeLoweringTest,
|
||||
public ::testing::WithParamInterface<MachineType> {
|
||||
public ::testing::WithParamInterface<MachineRepresentation> {
|
||||
public:
|
||||
~ChangeLoweringCommonTest() override {}
|
||||
|
||||
MachineType WordRepresentation() const final { return GetParam(); }
|
||||
MachineRepresentation WordRepresentation() const final { return GetParam(); }
|
||||
};
|
||||
|
||||
|
||||
@ -107,8 +111,8 @@ TARGET_TEST_P(ChangeLoweringCommonTest, ChangeBitToBool) {
|
||||
Reduction r =
|
||||
Reduce(graph()->NewNode(simplified()->ChangeBitToBool(), value));
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsSelect(kMachAnyTagged, value, IsTrueConstant(),
|
||||
IsFalseConstant()));
|
||||
EXPECT_THAT(r.replacement(), IsSelect(MachineRepresentation::kTagged, value,
|
||||
IsTrueConstant(), IsFalseConstant()));
|
||||
}
|
||||
|
||||
|
||||
@ -179,7 +183,8 @@ TARGET_TEST_P(ChangeLoweringCommonTest, ChangeTaggedToUint32WithTaggedPointer) {
|
||||
|
||||
TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldSmi) {
|
||||
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
|
||||
Handle<Name>::null(), Type::Any(), kMachAnyTagged};
|
||||
Handle<Name>::null(), Type::Any(),
|
||||
MachineType::AnyTagged()};
|
||||
Node* p0 = Parameter(Type::TaggedPointer());
|
||||
Node* p1 = Parameter(Type::TaggedSigned());
|
||||
Node* store = graph()->NewNode(simplified()->StoreField(access), p0, p1,
|
||||
@ -187,16 +192,18 @@ TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldSmi) {
|
||||
Reduction r = Reduce(store);
|
||||
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(),
|
||||
IsStore(StoreRepresentation(kMachAnyTagged, kNoWriteBarrier), p0,
|
||||
IsIntPtrConstant(access.offset - access.tag()), p1,
|
||||
graph()->start(), graph()->start()));
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsStore(StoreRepresentation(MachineType::AnyTagged(), kNoWriteBarrier),
|
||||
p0, IsIntPtrConstant(access.offset - access.tag()), p1,
|
||||
graph()->start(), graph()->start()));
|
||||
}
|
||||
|
||||
|
||||
TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldTagged) {
|
||||
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
|
||||
Handle<Name>::null(), Type::Any(), kMachAnyTagged};
|
||||
Handle<Name>::null(), Type::Any(),
|
||||
MachineType::AnyTagged()};
|
||||
Node* p0 = Parameter(Type::TaggedPointer());
|
||||
Node* p1 = Parameter(Type::Tagged());
|
||||
Node* store = graph()->NewNode(simplified()->StoreField(access), p0, p1,
|
||||
@ -204,16 +211,18 @@ TARGET_TEST_P(ChangeLoweringCommonTest, StoreFieldTagged) {
|
||||
Reduction r = Reduce(store);
|
||||
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(),
|
||||
IsStore(StoreRepresentation(kMachAnyTagged, kFullWriteBarrier),
|
||||
p0, IsIntPtrConstant(access.offset - access.tag()), p1,
|
||||
graph()->start(), graph()->start()));
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsStore(StoreRepresentation(MachineType::AnyTagged(), kFullWriteBarrier),
|
||||
p0, IsIntPtrConstant(access.offset - access.tag()), p1,
|
||||
graph()->start(), graph()->start()));
|
||||
}
|
||||
|
||||
|
||||
TARGET_TEST_P(ChangeLoweringCommonTest, LoadField) {
|
||||
FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
|
||||
Handle<Name>::null(), Type::Any(), kMachAnyTagged};
|
||||
Handle<Name>::null(), Type::Any(),
|
||||
MachineType::AnyTagged()};
|
||||
Node* p0 = Parameter(Type::TaggedPointer());
|
||||
Node* load = graph()->NewNode(simplified()->LoadField(access), p0,
|
||||
graph()->start(), graph()->start());
|
||||
@ -221,16 +230,16 @@ TARGET_TEST_P(ChangeLoweringCommonTest, LoadField) {
|
||||
|
||||
ASSERT_TRUE(r.Changed());
|
||||
Matcher<Node*> index_match = IsIntPtrConstant(access.offset - access.tag());
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsLoad(kMachAnyTagged, p0, IsIntPtrConstant(access.offset - access.tag()),
|
||||
graph()->start(), graph()->start()));
|
||||
EXPECT_THAT(r.replacement(),
|
||||
IsLoad(MachineType::AnyTagged(), p0,
|
||||
IsIntPtrConstant(access.offset - access.tag()),
|
||||
graph()->start(), graph()->start()));
|
||||
}
|
||||
|
||||
|
||||
TARGET_TEST_P(ChangeLoweringCommonTest, StoreElementTagged) {
|
||||
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
Node* p0 = Parameter(Type::TaggedPointer());
|
||||
Node* p1 = Parameter(Type::Signed32());
|
||||
Node* p2 = Parameter(Type::Tagged());
|
||||
@ -238,7 +247,8 @@ TARGET_TEST_P(ChangeLoweringCommonTest, StoreElementTagged) {
|
||||
graph()->start(), graph()->start());
|
||||
Reduction r = Reduce(store);
|
||||
|
||||
const int element_size_shift = ElementSizeLog2Of(access.machine_type);
|
||||
const int element_size_shift =
|
||||
ElementSizeLog2Of(access.machine_type.representation());
|
||||
ASSERT_TRUE(r.Changed());
|
||||
Matcher<Node*> index_match =
|
||||
IsInt32Add(IsWord32Shl(p1, IsInt32Constant(element_size_shift)),
|
||||
@ -247,15 +257,16 @@ TARGET_TEST_P(ChangeLoweringCommonTest, StoreElementTagged) {
|
||||
index_match = IsChangeUint32ToUint64(index_match);
|
||||
}
|
||||
|
||||
EXPECT_THAT(r.replacement(),
|
||||
IsStore(StoreRepresentation(kMachAnyTagged, kFullWriteBarrier),
|
||||
p0, index_match, p2, graph()->start(), graph()->start()));
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsStore(StoreRepresentation(MachineType::AnyTagged(), kFullWriteBarrier),
|
||||
p0, index_match, p2, graph()->start(), graph()->start()));
|
||||
}
|
||||
|
||||
|
||||
TARGET_TEST_P(ChangeLoweringCommonTest, StoreElementUint8) {
|
||||
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
|
||||
Type::Signed32(), kMachUint8};
|
||||
Type::Signed32(), MachineType::Uint8()};
|
||||
Node* p0 = Parameter(Type::TaggedPointer());
|
||||
Node* p1 = Parameter(Type::Signed32());
|
||||
Node* p2 = Parameter(Type::Signed32());
|
||||
@ -270,22 +281,24 @@ TARGET_TEST_P(ChangeLoweringCommonTest, StoreElementUint8) {
|
||||
index_match = IsChangeUint32ToUint64(index_match);
|
||||
}
|
||||
|
||||
EXPECT_THAT(r.replacement(),
|
||||
IsStore(StoreRepresentation(kMachUint8, kNoWriteBarrier), p0,
|
||||
index_match, p2, graph()->start(), graph()->start()));
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsStore(StoreRepresentation(MachineType::Uint8(), kNoWriteBarrier), p0,
|
||||
index_match, p2, graph()->start(), graph()->start()));
|
||||
}
|
||||
|
||||
|
||||
TARGET_TEST_P(ChangeLoweringCommonTest, LoadElementTagged) {
|
||||
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
Node* p0 = Parameter(Type::TaggedPointer());
|
||||
Node* p1 = Parameter(Type::Signed32());
|
||||
Node* load = graph()->NewNode(simplified()->LoadElement(access), p0, p1,
|
||||
graph()->start(), graph()->start());
|
||||
Reduction r = Reduce(load);
|
||||
|
||||
const int element_size_shift = ElementSizeLog2Of(access.machine_type);
|
||||
const int element_size_shift =
|
||||
ElementSizeLog2Of(access.machine_type.representation());
|
||||
ASSERT_TRUE(r.Changed());
|
||||
Matcher<Node*> index_match =
|
||||
IsInt32Add(IsWord32Shl(p1, IsInt32Constant(element_size_shift)),
|
||||
@ -294,14 +307,14 @@ TARGET_TEST_P(ChangeLoweringCommonTest, LoadElementTagged) {
|
||||
index_match = IsChangeUint32ToUint64(index_match);
|
||||
}
|
||||
|
||||
EXPECT_THAT(r.replacement(), IsLoad(kMachAnyTagged, p0, index_match,
|
||||
EXPECT_THAT(r.replacement(), IsLoad(MachineType::AnyTagged(), p0, index_match,
|
||||
graph()->start(), graph()->start()));
|
||||
}
|
||||
|
||||
|
||||
TARGET_TEST_P(ChangeLoweringCommonTest, LoadElementInt8) {
|
||||
ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize,
|
||||
Type::Signed32(), kMachInt8};
|
||||
Type::Signed32(), MachineType::Int8()};
|
||||
Node* p0 = Parameter(Type::TaggedPointer());
|
||||
Node* p1 = Parameter(Type::Signed32());
|
||||
Node* load = graph()->NewNode(simplified()->LoadElement(access), p0, p1,
|
||||
@ -315,7 +328,7 @@ TARGET_TEST_P(ChangeLoweringCommonTest, LoadElementInt8) {
|
||||
index_match = IsChangeUint32ToUint64(index_match);
|
||||
}
|
||||
|
||||
EXPECT_THAT(r.replacement(), IsLoad(kMachInt8, p0, index_match,
|
||||
EXPECT_THAT(r.replacement(), IsLoad(MachineType::Int8(), p0, index_match,
|
||||
graph()->start(), graph()->start()));
|
||||
}
|
||||
|
||||
@ -333,7 +346,8 @@ TARGET_TEST_P(ChangeLoweringCommonTest, Allocate) {
|
||||
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(ChangeLoweringTest, ChangeLoweringCommonTest,
|
||||
::testing::Values(kRepWord32, kRepWord64));
|
||||
::testing::Values(MachineRepresentation::kWord32,
|
||||
MachineRepresentation::kWord64));
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -343,7 +357,9 @@ INSTANTIATE_TEST_CASE_P(ChangeLoweringTest, ChangeLoweringCommonTest,
|
||||
class ChangeLowering32Test : public ChangeLoweringTest {
|
||||
public:
|
||||
~ChangeLowering32Test() override {}
|
||||
MachineType WordRepresentation() const final { return kRepWord32; }
|
||||
MachineRepresentation WordRepresentation() const final {
|
||||
return MachineRepresentation::kWord32;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -355,22 +371,23 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeInt32ToTagged) {
|
||||
Capture<Node*> add, branch, heap_number, if_true;
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsPhi(kMachAnyTagged,
|
||||
IsFinishRegion(
|
||||
AllOf(CaptureEq(&heap_number),
|
||||
IsAllocateHeapNumber(_, CaptureEq(&if_true))),
|
||||
IsStore(
|
||||
StoreRepresentation(kMachFloat64, kNoWriteBarrier),
|
||||
CaptureEq(&heap_number),
|
||||
IsIntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag),
|
||||
IsChangeInt32ToFloat64(value), CaptureEq(&heap_number),
|
||||
CaptureEq(&if_true))),
|
||||
IsProjection(0, AllOf(CaptureEq(&add),
|
||||
IsInt32AddWithOverflow(value, value))),
|
||||
IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))),
|
||||
IsIfFalse(AllOf(CaptureEq(&branch),
|
||||
IsBranch(IsProjection(1, CaptureEq(&add)),
|
||||
graph()->start()))))));
|
||||
IsPhi(
|
||||
MachineRepresentation::kTagged,
|
||||
IsFinishRegion(
|
||||
AllOf(CaptureEq(&heap_number),
|
||||
IsAllocateHeapNumber(_, CaptureEq(&if_true))),
|
||||
IsStore(
|
||||
StoreRepresentation(MachineType::Float64(), kNoWriteBarrier),
|
||||
CaptureEq(&heap_number),
|
||||
IsIntPtrConstant(HeapNumber::kValueOffset - kHeapObjectTag),
|
||||
IsChangeInt32ToFloat64(value), CaptureEq(&heap_number),
|
||||
CaptureEq(&if_true))),
|
||||
IsProjection(
|
||||
0, AllOf(CaptureEq(&add), IsInt32AddWithOverflow(value, value))),
|
||||
IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))),
|
||||
IsIfFalse(AllOf(CaptureEq(&branch),
|
||||
IsBranch(IsProjection(1, CaptureEq(&add)),
|
||||
graph()->start()))))));
|
||||
}
|
||||
|
||||
|
||||
@ -385,7 +402,8 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToFloat64) {
|
||||
Capture<Node*> branch, if_true;
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsPhi(kMachFloat64, IsLoadHeapNumber(value, CaptureEq(&if_true)),
|
||||
IsPhi(MachineRepresentation::kFloat64,
|
||||
IsLoadHeapNumber(value, CaptureEq(&if_true)),
|
||||
IsChangeInt32ToFloat64(IsWord32Sar(
|
||||
value, IsInt32Constant(kSmiTagSize + kSmiShiftSize))),
|
||||
IsMerge(AllOf(CaptureEq(&if_true),
|
||||
@ -410,7 +428,7 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToInt32) {
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsPhi(
|
||||
kMachInt32,
|
||||
MachineRepresentation::kWord32,
|
||||
IsChangeFloat64ToInt32(IsLoadHeapNumber(value, CaptureEq(&if_true))),
|
||||
IsWord32Sar(value, IsInt32Constant(kSmiTagSize + kSmiShiftSize)),
|
||||
IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))),
|
||||
@ -433,7 +451,7 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToUint32) {
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsPhi(
|
||||
kMachUint32,
|
||||
MachineRepresentation::kWord32,
|
||||
IsChangeFloat64ToUint32(IsLoadHeapNumber(value, CaptureEq(&if_true))),
|
||||
IsWord32Sar(value, IsInt32Constant(kSmiTagSize + kSmiShiftSize)),
|
||||
IsMerge(AllOf(CaptureEq(&if_true), IsIfTrue(CaptureEq(&branch))),
|
||||
@ -456,13 +474,13 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeUint32ToTagged) {
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsPhi(
|
||||
kMachAnyTagged,
|
||||
MachineRepresentation::kTagged,
|
||||
IsWord32Shl(value, IsInt32Constant(kSmiTagSize + kSmiShiftSize)),
|
||||
IsFinishRegion(
|
||||
AllOf(CaptureEq(&heap_number),
|
||||
IsAllocateHeapNumber(_, CaptureEq(&if_false))),
|
||||
IsStore(
|
||||
StoreRepresentation(kMachFloat64, kNoWriteBarrier),
|
||||
StoreRepresentation(MachineType::Float64(), kNoWriteBarrier),
|
||||
CaptureEq(&heap_number),
|
||||
IsInt32Constant(HeapNumber::kValueOffset - kHeapObjectTag),
|
||||
IsChangeUint32ToFloat64(value), CaptureEq(&heap_number),
|
||||
@ -483,7 +501,9 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeUint32ToTagged) {
|
||||
class ChangeLowering64Test : public ChangeLoweringTest {
|
||||
public:
|
||||
~ChangeLowering64Test() override {}
|
||||
MachineType WordRepresentation() const final { return kRepWord64; }
|
||||
MachineRepresentation WordRepresentation() const final {
|
||||
return MachineRepresentation::kWord64;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -507,7 +527,8 @@ TARGET_TEST_F(ChangeLowering64Test, ChangeTaggedToFloat64) {
|
||||
Capture<Node*> branch, if_true;
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsPhi(kMachFloat64, IsLoadHeapNumber(value, CaptureEq(&if_true)),
|
||||
IsPhi(MachineRepresentation::kFloat64,
|
||||
IsLoadHeapNumber(value, CaptureEq(&if_true)),
|
||||
IsChangeInt32ToFloat64(IsTruncateInt64ToInt32(IsWord64Sar(
|
||||
value, IsInt64Constant(kSmiTagSize + kSmiShiftSize)))),
|
||||
IsMerge(AllOf(CaptureEq(&if_true),
|
||||
@ -532,7 +553,7 @@ TARGET_TEST_F(ChangeLowering64Test, ChangeTaggedToInt32) {
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsPhi(
|
||||
kMachInt32,
|
||||
MachineRepresentation::kWord32,
|
||||
IsChangeFloat64ToInt32(IsLoadHeapNumber(value, CaptureEq(&if_true))),
|
||||
IsTruncateInt64ToInt32(
|
||||
IsWord64Sar(value, IsInt64Constant(kSmiTagSize + kSmiShiftSize))),
|
||||
@ -556,7 +577,7 @@ TARGET_TEST_F(ChangeLowering64Test, ChangeTaggedToUint32) {
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsPhi(
|
||||
kMachUint32,
|
||||
MachineRepresentation::kWord32,
|
||||
IsChangeFloat64ToUint32(IsLoadHeapNumber(value, CaptureEq(&if_true))),
|
||||
IsTruncateInt64ToInt32(
|
||||
IsWord64Sar(value, IsInt64Constant(kSmiTagSize + kSmiShiftSize))),
|
||||
@ -580,14 +601,14 @@ TARGET_TEST_F(ChangeLowering64Test, ChangeUint32ToTagged) {
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsPhi(
|
||||
kMachAnyTagged,
|
||||
MachineRepresentation::kTagged,
|
||||
IsWord64Shl(IsChangeUint32ToUint64(value),
|
||||
IsInt64Constant(kSmiTagSize + kSmiShiftSize)),
|
||||
IsFinishRegion(
|
||||
AllOf(CaptureEq(&heap_number),
|
||||
IsAllocateHeapNumber(_, CaptureEq(&if_false))),
|
||||
IsStore(
|
||||
StoreRepresentation(kMachFloat64, kNoWriteBarrier),
|
||||
StoreRepresentation(MachineType::Float64(), kNoWriteBarrier),
|
||||
CaptureEq(&heap_number),
|
||||
IsInt64Constant(HeapNumber::kValueOffset - kHeapObjectTag),
|
||||
IsChangeUint32ToFloat64(value), CaptureEq(&heap_number),
|
||||
|
@ -28,7 +28,8 @@ class CommonOperatorReducerTest : public GraphTest {
|
||||
Reduction Reduce(
|
||||
AdvancedReducer::Editor* editor, Node* node,
|
||||
MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags) {
|
||||
MachineOperatorBuilder machine(zone(), kMachPtr, flags);
|
||||
MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(),
|
||||
flags);
|
||||
CommonOperatorReducer reducer(editor, graph(), common(), &machine);
|
||||
return reducer.Reduce(node);
|
||||
}
|
||||
@ -54,11 +55,11 @@ const BranchHint kBranchHints[] = {BranchHint::kNone, BranchHint::kFalse,
|
||||
BranchHint::kTrue};
|
||||
|
||||
|
||||
const MachineType kMachineTypes[] = {
|
||||
kMachFloat32, kMachFloat64, kMachInt8, kMachUint8, kMachInt16,
|
||||
kMachUint16, kMachInt32, kMachUint32, kMachInt64, kMachUint64,
|
||||
kMachPtr, kMachAnyTagged, kRepBit, kRepWord8, kRepWord16,
|
||||
kRepWord32, kRepWord64, kRepFloat32, kRepFloat64, kRepTagged};
|
||||
const MachineRepresentation kMachineRepresentations[] = {
|
||||
MachineRepresentation::kBit, MachineRepresentation::kWord8,
|
||||
MachineRepresentation::kWord16, MachineRepresentation::kWord32,
|
||||
MachineRepresentation::kWord64, MachineRepresentation::kFloat32,
|
||||
MachineRepresentation::kFloat64, MachineRepresentation::kTagged};
|
||||
|
||||
|
||||
const Operator kOp0(0, Operator::kNoProperties, "Op0", 0, 0, 0, 1, 1, 0);
|
||||
@ -279,7 +280,7 @@ TEST_F(CommonOperatorReducerTest, PhiWithMerge) {
|
||||
Node* const input = graph()->NewNode(&kOp0);
|
||||
TRACED_FORRANGE(int, input_count, 2, kMaxInputs - 1) {
|
||||
int const value_input_count = input_count - 1;
|
||||
TRACED_FOREACH(MachineType, type, kMachineTypes) {
|
||||
TRACED_FOREACH(MachineRepresentation, rep, kMachineRepresentations) {
|
||||
for (int i = 0; i < value_input_count; ++i) {
|
||||
inputs[i] = graph()->start();
|
||||
}
|
||||
@ -292,7 +293,7 @@ TEST_F(CommonOperatorReducerTest, PhiWithMerge) {
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
EXPECT_CALL(editor, Revisit(merge));
|
||||
Reduction r = Reduce(
|
||||
&editor, graph()->NewNode(common()->Phi(type, value_input_count),
|
||||
&editor, graph()->NewNode(common()->Phi(rep, value_input_count),
|
||||
input_count, inputs));
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_EQ(input, r.replacement());
|
||||
@ -306,8 +307,8 @@ TEST_F(CommonOperatorReducerTest, PhiWithLoop) {
|
||||
Node* const loop =
|
||||
graph()->NewNode(common()->Loop(2), graph()->start(), graph()->start());
|
||||
loop->ReplaceInput(1, loop);
|
||||
Node* const phi =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), p0, p0, loop);
|
||||
Node* const phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), p0, p0, loop);
|
||||
phi->ReplaceInput(1, phi);
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
EXPECT_CALL(editor, Revisit(loop));
|
||||
@ -327,8 +328,8 @@ TEST_F(CommonOperatorReducerTest, PhiToFloat32Abs) {
|
||||
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
|
||||
Node* vfalse = graph()->NewNode(machine()->Float32Sub(), c0, p0);
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi =
|
||||
graph()->NewNode(common()->Phi(kMachFloat32, 2), vtrue, vfalse, merge);
|
||||
Node* phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kFloat32, 2), vtrue, vfalse, merge);
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
EXPECT_CALL(editor, Revisit(merge));
|
||||
Reduction r = Reduce(&editor, phi);
|
||||
@ -347,8 +348,8 @@ TEST_F(CommonOperatorReducerTest, PhiToFloat64Abs) {
|
||||
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
|
||||
Node* vfalse = graph()->NewNode(machine()->Float64Sub(), c0, p0);
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi =
|
||||
graph()->NewNode(common()->Phi(kMachFloat64, 2), vtrue, vfalse, merge);
|
||||
Node* phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kFloat64, 2), vtrue, vfalse, merge);
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
EXPECT_CALL(editor, Revisit(merge));
|
||||
Reduction r = Reduce(&editor, phi);
|
||||
@ -365,7 +366,8 @@ TEST_F(CommonOperatorReducerTest, PhiToFloat32Max) {
|
||||
Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
|
||||
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachFloat32, 2), p1, p0, merge);
|
||||
Node* phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kFloat32, 2), p1, p0, merge);
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
EXPECT_CALL(editor, Revisit(merge));
|
||||
Reduction r = Reduce(&editor, phi, MachineOperatorBuilder::kFloat32Max);
|
||||
@ -382,7 +384,8 @@ TEST_F(CommonOperatorReducerTest, PhiToFloat64Max) {
|
||||
Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
|
||||
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachFloat64, 2), p1, p0, merge);
|
||||
Node* phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kFloat64, 2), p1, p0, merge);
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
EXPECT_CALL(editor, Revisit(merge));
|
||||
Reduction r = Reduce(&editor, phi, MachineOperatorBuilder::kFloat64Max);
|
||||
@ -399,7 +402,8 @@ TEST_F(CommonOperatorReducerTest, PhiToFloat32Min) {
|
||||
Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
|
||||
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachFloat32, 2), p0, p1, merge);
|
||||
Node* phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kFloat32, 2), p0, p1, merge);
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
EXPECT_CALL(editor, Revisit(merge));
|
||||
Reduction r = Reduce(&editor, phi, MachineOperatorBuilder::kFloat32Min);
|
||||
@ -416,7 +420,8 @@ TEST_F(CommonOperatorReducerTest, PhiToFloat64Min) {
|
||||
Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
|
||||
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachFloat64, 2), p0, p1, merge);
|
||||
Node* phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kFloat64, 2), p0, p1, merge);
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
EXPECT_CALL(editor, Revisit(merge));
|
||||
Reduction r = Reduce(&editor, phi, MachineOperatorBuilder::kFloat64Min);
|
||||
@ -440,8 +445,8 @@ TEST_F(CommonOperatorReducerTest, ReturnWithPhiAndEffectPhiAndMerge) {
|
||||
Node* vfalse = Parameter(1);
|
||||
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
|
||||
Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge);
|
||||
Node* phi =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), vtrue, vfalse, merge);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
vtrue, vfalse, merge);
|
||||
Node* ret = graph()->NewNode(common()->Return(), phi, ephi, merge);
|
||||
graph()->SetEnd(graph()->NewNode(common()->End(1), ret));
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
@ -461,9 +466,9 @@ TEST_F(CommonOperatorReducerTest, ReturnWithPhiAndEffectPhiAndMerge) {
|
||||
TEST_F(CommonOperatorReducerTest, SelectWithSameThenAndElse) {
|
||||
Node* const input = graph()->NewNode(&kOp0);
|
||||
TRACED_FOREACH(BranchHint, hint, kBranchHints) {
|
||||
TRACED_FOREACH(MachineType, type, kMachineTypes) {
|
||||
TRACED_FOREACH(MachineRepresentation, rep, kMachineRepresentations) {
|
||||
Reduction r = Reduce(
|
||||
graph()->NewNode(common()->Select(type, hint), input, input, input));
|
||||
graph()->NewNode(common()->Select(rep, hint), input, input, input));
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_EQ(input, r.replacement());
|
||||
}
|
||||
@ -474,8 +479,9 @@ TEST_F(CommonOperatorReducerTest, SelectWithSameThenAndElse) {
|
||||
TEST_F(CommonOperatorReducerTest, SelectWithInt32ZeroConstant) {
|
||||
Node* p0 = Parameter(0);
|
||||
Node* p1 = Parameter(1);
|
||||
Node* select = graph()->NewNode(common()->Select(kMachAnyTagged),
|
||||
Int32Constant(0), p0, p1);
|
||||
Node* select =
|
||||
graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
|
||||
Int32Constant(0), p0, p1);
|
||||
Reduction r = Reduce(select);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_EQ(p1, r.replacement());
|
||||
@ -485,8 +491,9 @@ TEST_F(CommonOperatorReducerTest, SelectWithInt32ZeroConstant) {
|
||||
TEST_F(CommonOperatorReducerTest, SelectWithInt32OneConstant) {
|
||||
Node* p0 = Parameter(0);
|
||||
Node* p1 = Parameter(1);
|
||||
Node* select = graph()->NewNode(common()->Select(kMachAnyTagged),
|
||||
Int32Constant(1), p0, p1);
|
||||
Node* select =
|
||||
graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
|
||||
Int32Constant(1), p0, p1);
|
||||
Reduction r = Reduce(select);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_EQ(p0, r.replacement());
|
||||
@ -496,8 +503,9 @@ TEST_F(CommonOperatorReducerTest, SelectWithInt32OneConstant) {
|
||||
TEST_F(CommonOperatorReducerTest, SelectWithInt64ZeroConstant) {
|
||||
Node* p0 = Parameter(0);
|
||||
Node* p1 = Parameter(1);
|
||||
Node* select = graph()->NewNode(common()->Select(kMachAnyTagged),
|
||||
Int64Constant(0), p0, p1);
|
||||
Node* select =
|
||||
graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
|
||||
Int64Constant(0), p0, p1);
|
||||
Reduction r = Reduce(select);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_EQ(p1, r.replacement());
|
||||
@ -507,8 +515,9 @@ TEST_F(CommonOperatorReducerTest, SelectWithInt64ZeroConstant) {
|
||||
TEST_F(CommonOperatorReducerTest, SelectWithInt64OneConstant) {
|
||||
Node* p0 = Parameter(0);
|
||||
Node* p1 = Parameter(1);
|
||||
Node* select = graph()->NewNode(common()->Select(kMachAnyTagged),
|
||||
Int64Constant(1), p0, p1);
|
||||
Node* select =
|
||||
graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
|
||||
Int64Constant(1), p0, p1);
|
||||
Reduction r = Reduce(select);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_EQ(p0, r.replacement());
|
||||
@ -518,8 +527,9 @@ TEST_F(CommonOperatorReducerTest, SelectWithInt64OneConstant) {
|
||||
TEST_F(CommonOperatorReducerTest, SelectWithFalseConstant) {
|
||||
Node* p0 = Parameter(0);
|
||||
Node* p1 = Parameter(1);
|
||||
Node* select = graph()->NewNode(common()->Select(kMachAnyTagged),
|
||||
FalseConstant(), p0, p1);
|
||||
Node* select =
|
||||
graph()->NewNode(common()->Select(MachineRepresentation::kTagged),
|
||||
FalseConstant(), p0, p1);
|
||||
Reduction r = Reduce(select);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_EQ(p1, r.replacement());
|
||||
@ -529,8 +539,8 @@ TEST_F(CommonOperatorReducerTest, SelectWithFalseConstant) {
|
||||
TEST_F(CommonOperatorReducerTest, SelectWithTrueConstant) {
|
||||
Node* p0 = Parameter(0);
|
||||
Node* p1 = Parameter(1);
|
||||
Node* select = graph()->NewNode(common()->Select(kMachAnyTagged),
|
||||
TrueConstant(), p0, p1);
|
||||
Node* select = graph()->NewNode(
|
||||
common()->Select(MachineRepresentation::kTagged), TrueConstant(), p0, p1);
|
||||
Reduction r = Reduce(select);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_EQ(p0, r.replacement());
|
||||
@ -542,8 +552,8 @@ TEST_F(CommonOperatorReducerTest, SelectToFloat32Abs) {
|
||||
Node* c0 = Float32Constant(0.0);
|
||||
Node* check = graph()->NewNode(machine()->Float32LessThan(), c0, p0);
|
||||
Node* select =
|
||||
graph()->NewNode(common()->Select(kMachFloat32), check, p0,
|
||||
graph()->NewNode(machine()->Float32Sub(), c0, p0));
|
||||
graph()->NewNode(common()->Select(MachineRepresentation::kFloat32), check,
|
||||
p0, graph()->NewNode(machine()->Float32Sub(), c0, p0));
|
||||
Reduction r = Reduce(select);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsFloat32Abs(p0));
|
||||
@ -555,8 +565,8 @@ TEST_F(CommonOperatorReducerTest, SelectToFloat64Abs) {
|
||||
Node* c0 = Float64Constant(0.0);
|
||||
Node* check = graph()->NewNode(machine()->Float64LessThan(), c0, p0);
|
||||
Node* select =
|
||||
graph()->NewNode(common()->Select(kMachFloat64), check, p0,
|
||||
graph()->NewNode(machine()->Float64Sub(), c0, p0));
|
||||
graph()->NewNode(common()->Select(MachineRepresentation::kFloat64), check,
|
||||
p0, graph()->NewNode(machine()->Float64Sub(), c0, p0));
|
||||
Reduction r = Reduce(select);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsFloat64Abs(p0));
|
||||
@ -567,8 +577,8 @@ TEST_F(CommonOperatorReducerTest, SelectToFloat32Max) {
|
||||
Node* p0 = Parameter(0);
|
||||
Node* p1 = Parameter(1);
|
||||
Node* check = graph()->NewNode(machine()->Float32LessThan(), p0, p1);
|
||||
Node* select =
|
||||
graph()->NewNode(common()->Select(kMachFloat32), check, p1, p0);
|
||||
Node* select = graph()->NewNode(
|
||||
common()->Select(MachineRepresentation::kFloat32), check, p1, p0);
|
||||
Reduction r = Reduce(select, MachineOperatorBuilder::kFloat32Max);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsFloat32Max(p1, p0));
|
||||
@ -579,8 +589,8 @@ TEST_F(CommonOperatorReducerTest, SelectToFloat64Max) {
|
||||
Node* p0 = Parameter(0);
|
||||
Node* p1 = Parameter(1);
|
||||
Node* check = graph()->NewNode(machine()->Float64LessThan(), p0, p1);
|
||||
Node* select =
|
||||
graph()->NewNode(common()->Select(kMachFloat64), check, p1, p0);
|
||||
Node* select = graph()->NewNode(
|
||||
common()->Select(MachineRepresentation::kFloat64), check, p1, p0);
|
||||
Reduction r = Reduce(select, MachineOperatorBuilder::kFloat64Max);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsFloat64Max(p1, p0));
|
||||
@ -591,8 +601,8 @@ TEST_F(CommonOperatorReducerTest, SelectToFloat32Min) {
|
||||
Node* p0 = Parameter(0);
|
||||
Node* p1 = Parameter(1);
|
||||
Node* check = graph()->NewNode(machine()->Float32LessThan(), p0, p1);
|
||||
Node* select =
|
||||
graph()->NewNode(common()->Select(kMachFloat32), check, p0, p1);
|
||||
Node* select = graph()->NewNode(
|
||||
common()->Select(MachineRepresentation::kFloat32), check, p0, p1);
|
||||
Reduction r = Reduce(select, MachineOperatorBuilder::kFloat32Min);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsFloat32Min(p0, p1));
|
||||
@ -603,8 +613,8 @@ TEST_F(CommonOperatorReducerTest, SelectToFloat64Min) {
|
||||
Node* p0 = Parameter(0);
|
||||
Node* p1 = Parameter(1);
|
||||
Node* check = graph()->NewNode(machine()->Float64LessThan(), p0, p1);
|
||||
Node* select =
|
||||
graph()->NewNode(common()->Select(kMachFloat64), check, p0, p1);
|
||||
Node* select = graph()->NewNode(
|
||||
common()->Select(MachineRepresentation::kFloat64), check, p0, p1);
|
||||
Reduction r = Reduce(select, MachineOperatorBuilder::kFloat64Min);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsFloat64Min(p0, p1));
|
||||
|
@ -272,16 +272,19 @@ TEST_F(CommonOperatorTest, IfValue) {
|
||||
|
||||
|
||||
TEST_F(CommonOperatorTest, Select) {
|
||||
static const MachineType kTypes[] = {
|
||||
kMachInt8, kMachUint8, kMachInt16, kMachUint16,
|
||||
kMachInt32, kMachUint32, kMachInt64, kMachUint64,
|
||||
kMachFloat32, kMachFloat64, kMachAnyTagged};
|
||||
TRACED_FOREACH(MachineType, type, kTypes) {
|
||||
static const MachineRepresentation kMachineRepresentations[] = {
|
||||
MachineRepresentation::kBit, MachineRepresentation::kWord8,
|
||||
MachineRepresentation::kWord16, MachineRepresentation::kWord32,
|
||||
MachineRepresentation::kWord64, MachineRepresentation::kFloat32,
|
||||
MachineRepresentation::kFloat64, MachineRepresentation::kTagged};
|
||||
|
||||
|
||||
TRACED_FOREACH(MachineRepresentation, rep, kMachineRepresentations) {
|
||||
TRACED_FOREACH(BranchHint, hint, kBranchHints) {
|
||||
const Operator* const op = common()->Select(type, hint);
|
||||
const Operator* const op = common()->Select(rep, hint);
|
||||
EXPECT_EQ(IrOpcode::kSelect, op->opcode());
|
||||
EXPECT_EQ(Operator::kPure, op->properties());
|
||||
EXPECT_EQ(type, SelectParametersOf(op).type());
|
||||
EXPECT_EQ(rep, SelectParametersOf(op).representation());
|
||||
EXPECT_EQ(hint, SelectParametersOf(op).hint());
|
||||
EXPECT_EQ(3, op->ValueInputCount());
|
||||
EXPECT_EQ(0, op->EffectInputCount());
|
||||
|
@ -105,8 +105,8 @@ TEST_F(ControlFlowOptimizerTest, CloneBranch) {
|
||||
Node* control1 = graph()->NewNode(common()->IfTrue(), branch0);
|
||||
Node* control2 = graph()->NewNode(common()->IfFalse(), branch0);
|
||||
Node* merge0 = graph()->NewNode(common()->Merge(2), control1, control2);
|
||||
Node* phi0 =
|
||||
graph()->NewNode(common()->Phi(kRepBit, 2), cond1, cond2, merge0);
|
||||
Node* phi0 = graph()->NewNode(common()->Phi(MachineRepresentation::kBit, 2),
|
||||
cond1, cond2, merge0);
|
||||
Node* branch = graph()->NewNode(common()->Branch(), phi0, merge0);
|
||||
Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
|
||||
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
|
||||
|
@ -36,11 +36,11 @@ class DeadCodeEliminationTest : public GraphTest {
|
||||
|
||||
namespace {
|
||||
|
||||
const MachineType kMachineTypes[] = {
|
||||
kMachFloat32, kMachFloat64, kMachInt8, kMachUint8, kMachInt16,
|
||||
kMachUint16, kMachInt32, kMachUint32, kMachInt64, kMachUint64,
|
||||
kMachPtr, kMachAnyTagged, kRepBit, kRepWord8, kRepWord16,
|
||||
kRepWord32, kRepWord64, kRepFloat32, kRepFloat64, kRepTagged};
|
||||
const MachineRepresentation kMachineRepresentations[] = {
|
||||
MachineRepresentation::kBit, MachineRepresentation::kWord8,
|
||||
MachineRepresentation::kWord16, MachineRepresentation::kWord32,
|
||||
MachineRepresentation::kWord64, MachineRepresentation::kFloat32,
|
||||
MachineRepresentation::kFloat64, MachineRepresentation::kTagged};
|
||||
|
||||
|
||||
const int kMaxInputs = 16;
|
||||
@ -190,8 +190,8 @@ TEST_F(DeadCodeEliminationTest, MergeWithOneLiveAndOneDeadInput) {
|
||||
Node* const e0 = graph()->NewNode(&kOp0, v0, graph()->start(), c0);
|
||||
Node* const e1 = graph()->NewNode(&kOp0, v1, graph()->start(), c1);
|
||||
Node* const merge = graph()->NewNode(common()->Merge(2), c0, c1);
|
||||
Node* const phi =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), v0, v1, merge);
|
||||
Node* const phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), v0, v1, merge);
|
||||
Node* const ephi = graph()->NewNode(common()->EffectPhi(2), e0, e1, merge);
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
EXPECT_CALL(editor, Replace(phi, v0));
|
||||
@ -217,8 +217,8 @@ TEST_F(DeadCodeEliminationTest, MergeWithTwoLiveAndTwoDeadInputs) {
|
||||
Node* const e2 = graph()->NewNode(&kOp0, v2, e1, c0);
|
||||
Node* const e3 = graph()->NewNode(&kOp0, v3, graph()->start(), c3);
|
||||
Node* const merge = graph()->NewNode(common()->Merge(4), c0, c1, c2, c3);
|
||||
Node* const phi =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 4), v0, v1, v2, v3, merge);
|
||||
Node* const phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 4), v0, v1, v2, v3, merge);
|
||||
Node* const ephi =
|
||||
graph()->NewNode(common()->EffectPhi(4), e0, e1, e2, e3, merge);
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
@ -227,7 +227,8 @@ TEST_F(DeadCodeEliminationTest, MergeWithTwoLiveAndTwoDeadInputs) {
|
||||
Reduction const r = Reduce(&editor, merge);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsMerge(c0, c3));
|
||||
EXPECT_THAT(phi, IsPhi(kMachAnyTagged, v0, v3, r.replacement()));
|
||||
EXPECT_THAT(phi,
|
||||
IsPhi(MachineRepresentation::kTagged, v0, v3, r.replacement()));
|
||||
EXPECT_THAT(ephi, IsEffectPhi(e0, e3, r.replacement()));
|
||||
}
|
||||
|
||||
@ -274,8 +275,8 @@ TEST_F(DeadCodeEliminationTest, LoopWithOneLiveAndOneDeadInput) {
|
||||
Node* const e0 = graph()->NewNode(&kOp0, v0, graph()->start(), c0);
|
||||
Node* const e1 = graph()->NewNode(&kOp0, v1, graph()->start(), c1);
|
||||
Node* const loop = graph()->NewNode(common()->Loop(2), c0, c1);
|
||||
Node* const phi =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), v0, v1, loop);
|
||||
Node* const phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), v0, v1, loop);
|
||||
Node* const ephi = graph()->NewNode(common()->EffectPhi(2), e0, e1, loop);
|
||||
Node* const terminate = graph()->NewNode(common()->Terminate(), ephi, loop);
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
@ -303,8 +304,8 @@ TEST_F(DeadCodeEliminationTest, LoopWithTwoLiveAndTwoDeadInputs) {
|
||||
Node* const e2 = graph()->NewNode(&kOp0, v2, e1, c0);
|
||||
Node* const e3 = graph()->NewNode(&kOp0, v3, graph()->start(), c3);
|
||||
Node* const loop = graph()->NewNode(common()->Loop(4), c0, c1, c2, c3);
|
||||
Node* const phi =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 4), v0, v1, v2, v3, loop);
|
||||
Node* const phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 4), v0, v1, v2, v3, loop);
|
||||
Node* const ephi =
|
||||
graph()->NewNode(common()->EffectPhi(4), e0, e1, e2, e3, loop);
|
||||
StrictMock<MockAdvancedReducerEditor> editor;
|
||||
@ -313,7 +314,8 @@ TEST_F(DeadCodeEliminationTest, LoopWithTwoLiveAndTwoDeadInputs) {
|
||||
Reduction const r = Reduce(&editor, loop);
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsLoop(c0, c3));
|
||||
EXPECT_THAT(phi, IsPhi(kMachAnyTagged, v0, v3, r.replacement()));
|
||||
EXPECT_THAT(phi,
|
||||
IsPhi(MachineRepresentation::kTagged, v0, v3, r.replacement()));
|
||||
EXPECT_THAT(ephi, IsEffectPhi(e0, e3, r.replacement()));
|
||||
}
|
||||
|
||||
@ -324,14 +326,14 @@ TEST_F(DeadCodeEliminationTest, LoopWithTwoLiveAndTwoDeadInputs) {
|
||||
|
||||
TEST_F(DeadCodeEliminationTest, PhiWithDeadControlInput) {
|
||||
Node* inputs[kMaxInputs + 1];
|
||||
TRACED_FOREACH(MachineType, type, kMachineTypes) {
|
||||
TRACED_FOREACH(MachineRepresentation, rep, kMachineRepresentations) {
|
||||
TRACED_FORRANGE(int, input_count, 1, kMaxInputs) {
|
||||
for (int i = 0; i < input_count; ++i) {
|
||||
inputs[i] = Parameter(i);
|
||||
}
|
||||
inputs[input_count] = graph()->NewNode(common()->Dead());
|
||||
Reduction const r = Reduce(graph()->NewNode(
|
||||
common()->Phi(type, input_count), input_count + 1, inputs));
|
||||
common()->Phi(rep, input_count), input_count + 1, inputs));
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsDead());
|
||||
}
|
||||
|
@ -114,7 +114,8 @@ TEST_F(DiamondTest, DiamondPhis) {
|
||||
Node* p2 = Parameter(2);
|
||||
Diamond d(graph(), common(), p0);
|
||||
|
||||
MachineType types[] = {kMachAnyTagged, kMachUint32, kMachInt32};
|
||||
MachineRepresentation types[] = {MachineRepresentation::kTagged,
|
||||
MachineRepresentation::kWord32};
|
||||
|
||||
for (size_t i = 0; i < arraysize(types); i++) {
|
||||
Node* phi = d.Phi(types[i], p1, p2);
|
||||
|
@ -133,7 +133,7 @@ class EscapeAnalysisTest : public GraphTest {
|
||||
|
||||
FieldAccess AccessAtIndex(int offset) {
|
||||
FieldAccess access = {kTaggedBase, offset, MaybeHandle<Name>(), Type::Any(),
|
||||
kMachAnyTagged};
|
||||
MachineType::AnyTagged()};
|
||||
return access;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,8 @@ const int32_t kImmediates[] = {kMinInt, -42, -1, 0, 1, 2,
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Int32AddWithParameter) {
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32());
|
||||
m.Return(m.Int32Add(m.Parameter(0), m.Parameter(1)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -30,7 +31,7 @@ TEST_F(InstructionSelectorTest, Int32AddWithParameter) {
|
||||
TEST_F(InstructionSelectorTest, Int32AddWithImmediate) {
|
||||
TRACED_FOREACH(int32_t, imm, kImmediates) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Int32Add(m.Parameter(0), m.Int32Constant(imm)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -43,7 +44,7 @@ TEST_F(InstructionSelectorTest, Int32AddWithImmediate) {
|
||||
}
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Int32Add(m.Int32Constant(imm), m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -60,7 +61,8 @@ TEST_F(InstructionSelectorTest, Int32AddWithImmediate) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Int32SubWithParameter) {
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32());
|
||||
m.Return(m.Int32Sub(m.Parameter(0), m.Parameter(1)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -71,7 +73,7 @@ TEST_F(InstructionSelectorTest, Int32SubWithParameter) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Int32SubWithImmediate) {
|
||||
TRACED_FOREACH(int32_t, imm, kImmediates) {
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Int32Sub(m.Parameter(0), m.Int32Constant(imm)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -87,7 +89,7 @@ TEST_F(InstructionSelectorTest, Int32SubWithImmediate) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, ChangeFloat32ToFloat64WithParameter) {
|
||||
StreamBuilder m(this, kMachFloat32, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float32(), MachineType::Float64());
|
||||
m.Return(m.ChangeFloat32ToFloat64(m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -98,7 +100,7 @@ TEST_F(InstructionSelectorTest, ChangeFloat32ToFloat64WithParameter) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, TruncateFloat64ToFloat32WithParameter) {
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat32);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float32());
|
||||
m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -113,7 +115,8 @@ TEST_F(InstructionSelectorTest, TruncateFloat64ToFloat32WithParameter) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, BetterLeftOperandTestAddBinop) {
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32());
|
||||
Node* param1 = m.Parameter(0);
|
||||
Node* param2 = m.Parameter(1);
|
||||
Node* add = m.Int32Add(param1, param2);
|
||||
@ -131,7 +134,8 @@ TEST_F(InstructionSelectorTest, BetterLeftOperandTestAddBinop) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, BetterLeftOperandTestMulBinop) {
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32());
|
||||
Node* param1 = m.Parameter(0);
|
||||
Node* param2 = m.Parameter(1);
|
||||
Node* mul = m.Int32Mul(param1, param2);
|
||||
@ -151,7 +155,7 @@ TEST_F(InstructionSelectorTest, BetterLeftOperandTestMulBinop) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, ChangeUint32ToFloat64WithParameter) {
|
||||
StreamBuilder m(this, kMachFloat64, kMachUint32);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Uint32());
|
||||
m.Return(m.ChangeUint32ToFloat64(m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -178,14 +182,14 @@ std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) {
|
||||
|
||||
|
||||
static const MemoryAccess kMemoryAccesses[] = {
|
||||
{kMachInt8, kIA32Movsxbl, kIA32Movb},
|
||||
{kMachUint8, kIA32Movzxbl, kIA32Movb},
|
||||
{kMachInt16, kIA32Movsxwl, kIA32Movw},
|
||||
{kMachUint16, kIA32Movzxwl, kIA32Movw},
|
||||
{kMachInt32, kIA32Movl, kIA32Movl},
|
||||
{kMachUint32, kIA32Movl, kIA32Movl},
|
||||
{kMachFloat32, kIA32Movss, kIA32Movss},
|
||||
{kMachFloat64, kIA32Movsd, kIA32Movsd}};
|
||||
{MachineType::Int8(), kIA32Movsxbl, kIA32Movb},
|
||||
{MachineType::Uint8(), kIA32Movzxbl, kIA32Movb},
|
||||
{MachineType::Int16(), kIA32Movsxwl, kIA32Movw},
|
||||
{MachineType::Uint16(), kIA32Movzxwl, kIA32Movw},
|
||||
{MachineType::Int32(), kIA32Movl, kIA32Movl},
|
||||
{MachineType::Uint32(), kIA32Movl, kIA32Movl},
|
||||
{MachineType::Float32(), kIA32Movss, kIA32Movss},
|
||||
{MachineType::Float64(), kIA32Movsd, kIA32Movsd}};
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -196,7 +200,8 @@ typedef InstructionSelectorTestWithParam<MemoryAccess>
|
||||
|
||||
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) {
|
||||
const MemoryAccess memacc = GetParam();
|
||||
StreamBuilder m(this, memacc.type, kMachPtr, kMachInt32);
|
||||
StreamBuilder m(this, memacc.type, MachineType::Pointer(),
|
||||
MachineType::Int32());
|
||||
m.Return(m.Load(memacc.type, m.Parameter(0), m.Parameter(1)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -209,7 +214,7 @@ TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) {
|
||||
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateBase) {
|
||||
const MemoryAccess memacc = GetParam();
|
||||
TRACED_FOREACH(int32_t, base, kImmediates) {
|
||||
StreamBuilder m(this, memacc.type, kMachPtr);
|
||||
StreamBuilder m(this, memacc.type, MachineType::Pointer());
|
||||
m.Return(m.Load(memacc.type, m.Int32Constant(base), m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -229,7 +234,7 @@ TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateBase) {
|
||||
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateIndex) {
|
||||
const MemoryAccess memacc = GetParam();
|
||||
TRACED_FOREACH(int32_t, index, kImmediates) {
|
||||
StreamBuilder m(this, memacc.type, kMachPtr);
|
||||
StreamBuilder m(this, memacc.type, MachineType::Pointer());
|
||||
m.Return(m.Load(memacc.type, m.Parameter(0), m.Int32Constant(index)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -248,7 +253,8 @@ TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateIndex) {
|
||||
|
||||
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
|
||||
const MemoryAccess memacc = GetParam();
|
||||
StreamBuilder m(this, kMachInt32, kMachPtr, kMachInt32, memacc.type);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(),
|
||||
MachineType::Int32(), memacc.type);
|
||||
m.Store(memacc.type, m.Parameter(0), m.Parameter(1), m.Parameter(2),
|
||||
kNoWriteBarrier);
|
||||
m.Return(m.Int32Constant(0));
|
||||
@ -263,7 +269,8 @@ TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
|
||||
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateBase) {
|
||||
const MemoryAccess memacc = GetParam();
|
||||
TRACED_FOREACH(int32_t, base, kImmediates) {
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32, memacc.type);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
|
||||
memacc.type);
|
||||
m.Store(memacc.type, m.Int32Constant(base), m.Parameter(0), m.Parameter(1),
|
||||
kNoWriteBarrier);
|
||||
m.Return(m.Int32Constant(0));
|
||||
@ -285,7 +292,8 @@ TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateBase) {
|
||||
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateIndex) {
|
||||
const MemoryAccess memacc = GetParam();
|
||||
TRACED_FOREACH(int32_t, index, kImmediates) {
|
||||
StreamBuilder m(this, kMachInt32, kMachPtr, memacc.type);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(),
|
||||
memacc.type);
|
||||
m.Store(memacc.type, m.Parameter(0), m.Int32Constant(index), m.Parameter(1),
|
||||
kNoWriteBarrier);
|
||||
m.Return(m.Int32Constant(0));
|
||||
@ -320,8 +328,8 @@ class AddressingModeUnitTest : public InstructionSelectorTest {
|
||||
|
||||
void Run(Node* base, Node* load_index, Node* store_index,
|
||||
AddressingMode mode) {
|
||||
Node* load = m->Load(kMachInt32, base, load_index);
|
||||
m->Store(kMachInt32, base, store_index, load, kNoWriteBarrier);
|
||||
Node* load = m->Load(MachineType::Int32(), base, load_index);
|
||||
m->Store(MachineType::Int32(), base, store_index, load, kNoWriteBarrier);
|
||||
m->Return(m->Int32Constant(0));
|
||||
Stream s = m->Build();
|
||||
ASSERT_EQ(2U, s.size());
|
||||
@ -339,7 +347,8 @@ class AddressingModeUnitTest : public InstructionSelectorTest {
|
||||
|
||||
void Reset() {
|
||||
delete m;
|
||||
m = new StreamBuilder(this, kMachInt32, kMachInt32, kMachInt32);
|
||||
m = new StreamBuilder(this, MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32());
|
||||
zero = m->Int32Constant(0);
|
||||
null_ptr = m->Int32Constant(0);
|
||||
non_zero = m->Int32Constant(127);
|
||||
@ -565,7 +574,7 @@ static AddressingMode AddressingModeForAddMult(int32_t imm,
|
||||
|
||||
TEST_P(InstructionSelectorMultTest, Mult32) {
|
||||
const MultParam m_param = GetParam();
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
Node* param = m.Parameter(0);
|
||||
Node* mult = m.Int32Mul(param, m.Int32Constant(m_param.value));
|
||||
m.Return(mult);
|
||||
@ -586,7 +595,7 @@ TEST_P(InstructionSelectorMultTest, Mult32) {
|
||||
TEST_P(InstructionSelectorMultTest, MultAdd32) {
|
||||
TRACED_FOREACH(int32_t, imm, kImmediates) {
|
||||
const MultParam m_param = GetParam();
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
Node* param = m.Parameter(0);
|
||||
Node* mult = m.Int32Add(m.Int32Mul(param, m.Int32Constant(m_param.value)),
|
||||
m.Int32Constant(imm));
|
||||
@ -618,7 +627,8 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorMultTest,
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Int32MulHigh) {
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
|
||||
MachineType::Int32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const p1 = m.Parameter(1);
|
||||
Node* const n = m.Int32MulHigh(p0, p1);
|
||||
@ -643,7 +653,7 @@ TEST_F(InstructionSelectorTest, Int32MulHigh) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float32Abs) {
|
||||
{
|
||||
StreamBuilder m(this, kMachFloat32, kMachFloat32);
|
||||
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Float32Abs(p0);
|
||||
m.Return(n);
|
||||
@ -658,7 +668,7 @@ TEST_F(InstructionSelectorTest, Float32Abs) {
|
||||
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachFloat32, kMachFloat32);
|
||||
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Float32Abs(p0);
|
||||
m.Return(n);
|
||||
@ -676,7 +686,7 @@ TEST_F(InstructionSelectorTest, Float32Abs) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float64Abs) {
|
||||
{
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Float64Abs(p0);
|
||||
m.Return(n);
|
||||
@ -691,7 +701,7 @@ TEST_F(InstructionSelectorTest, Float64Abs) {
|
||||
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Float64Abs(p0);
|
||||
m.Return(n);
|
||||
@ -709,7 +719,8 @@ TEST_F(InstructionSelectorTest, Float64Abs) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float64BinopArithmetic) {
|
||||
{
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
|
||||
MachineType::Float64());
|
||||
Node* add = m.Float64Add(m.Parameter(0), m.Parameter(1));
|
||||
Node* mul = m.Float64Mul(add, m.Parameter(1));
|
||||
Node* sub = m.Float64Sub(mul, add);
|
||||
@ -723,7 +734,8 @@ TEST_F(InstructionSelectorTest, Float64BinopArithmetic) {
|
||||
EXPECT_EQ(kAVXFloat64Div, s[3]->arch_opcode());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
|
||||
MachineType::Float64());
|
||||
Node* add = m.Float64Add(m.Parameter(0), m.Parameter(1));
|
||||
Node* mul = m.Float64Mul(add, m.Parameter(1));
|
||||
Node* sub = m.Float64Sub(mul, add);
|
||||
@ -741,7 +753,7 @@ TEST_F(InstructionSelectorTest, Float64BinopArithmetic) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float32SubWithMinusZeroAndParameter) {
|
||||
{
|
||||
StreamBuilder m(this, kMachFloat32, kMachFloat32);
|
||||
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Float32Sub(m.Float32Constant(-0.0f), p0);
|
||||
m.Return(n);
|
||||
@ -755,7 +767,7 @@ TEST_F(InstructionSelectorTest, Float32SubWithMinusZeroAndParameter) {
|
||||
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachFloat32, kMachFloat32);
|
||||
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Float32Sub(m.Float32Constant(-0.0f), p0);
|
||||
m.Return(n);
|
||||
@ -773,7 +785,7 @@ TEST_F(InstructionSelectorTest, Float32SubWithMinusZeroAndParameter) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float64SubWithMinusZeroAndParameter) {
|
||||
{
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Float64Sub(m.Float64Constant(-0.0), p0);
|
||||
m.Return(n);
|
||||
@ -787,7 +799,7 @@ TEST_F(InstructionSelectorTest, Float64SubWithMinusZeroAndParameter) {
|
||||
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Float64Sub(m.Float64Constant(-0.0), p0);
|
||||
m.Return(n);
|
||||
@ -808,9 +820,9 @@ TEST_F(InstructionSelectorTest, Float64SubWithMinusZeroAndParameter) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Uint32LessThanWithLoadAndLoadStackPointer) {
|
||||
StreamBuilder m(this, kMachBool);
|
||||
StreamBuilder m(this, MachineType::Bool());
|
||||
Node* const sl = m.Load(
|
||||
kMachPtr,
|
||||
MachineType::Pointer(),
|
||||
m.ExternalConstant(ExternalReference::address_of_stack_limit(isolate())));
|
||||
Node* const sp = m.LoadStackPointer();
|
||||
Node* const n = m.Uint32LessThan(sl, sp);
|
||||
@ -827,7 +839,7 @@ TEST_F(InstructionSelectorTest, Uint32LessThanWithLoadAndLoadStackPointer) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word32Clz) {
|
||||
StreamBuilder m(this, kMachUint32, kMachUint32);
|
||||
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Word32Clz(p0);
|
||||
m.Return(n);
|
||||
|
@ -158,7 +158,7 @@ InstructionSelectorTest::StreamBuilder::GetFrameStateFunctionInfo(
|
||||
|
||||
TARGET_TEST_F(InstructionSelectorTest, ReturnFloat32Constant) {
|
||||
const float kValue = 4.2f;
|
||||
StreamBuilder m(this, kMachFloat32);
|
||||
StreamBuilder m(this, MachineType::Float32());
|
||||
m.Return(m.Float32Constant(kValue));
|
||||
Stream s = m.Build(kAllInstructions);
|
||||
ASSERT_EQ(3U, s.size());
|
||||
@ -171,7 +171,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReturnFloat32Constant) {
|
||||
|
||||
|
||||
TARGET_TEST_F(InstructionSelectorTest, ReturnParameter) {
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Parameter(0));
|
||||
Stream s = m.Build(kAllInstructions);
|
||||
ASSERT_EQ(3U, s.size());
|
||||
@ -183,7 +183,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReturnParameter) {
|
||||
|
||||
|
||||
TARGET_TEST_F(InstructionSelectorTest, ReturnZero) {
|
||||
StreamBuilder m(this, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32());
|
||||
m.Return(m.Int32Constant(0));
|
||||
Stream s = m.Build(kAllInstructions);
|
||||
ASSERT_EQ(3U, s.size());
|
||||
@ -201,7 +201,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReturnZero) {
|
||||
|
||||
|
||||
TARGET_TEST_F(InstructionSelectorTest, TruncateFloat64ToInt32WithParameter) {
|
||||
StreamBuilder m(this, kMachInt32, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Float64());
|
||||
m.Return(
|
||||
m.TruncateFloat64ToInt32(TruncationMode::kJavaScript, m.Parameter(0)));
|
||||
Stream s = m.Build(kAllInstructions);
|
||||
@ -219,7 +219,7 @@ TARGET_TEST_F(InstructionSelectorTest, TruncateFloat64ToInt32WithParameter) {
|
||||
|
||||
|
||||
TARGET_TEST_F(InstructionSelectorTest, DoubleParameter) {
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64());
|
||||
Node* param = m.Parameter(0);
|
||||
m.Return(param);
|
||||
Stream s = m.Build(kAllInstructions);
|
||||
@ -228,7 +228,7 @@ TARGET_TEST_F(InstructionSelectorTest, DoubleParameter) {
|
||||
|
||||
|
||||
TARGET_TEST_F(InstructionSelectorTest, ReferenceParameter) {
|
||||
StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged);
|
||||
StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged());
|
||||
Node* param = m.Parameter(0);
|
||||
m.Return(param);
|
||||
Stream s = m.Build(kAllInstructions);
|
||||
@ -241,7 +241,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReferenceParameter) {
|
||||
|
||||
|
||||
TARGET_TEST_F(InstructionSelectorTest, FinishRegion) {
|
||||
StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged);
|
||||
StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged());
|
||||
Node* param = m.Parameter(0);
|
||||
Node* finish =
|
||||
m.AddNode(m.common()->FinishRegion(), param, m.graph()->start());
|
||||
@ -284,7 +284,7 @@ TARGET_TEST_P(InstructionSelectorPhiTest, Doubleness) {
|
||||
m.Bind(&b);
|
||||
m.Goto(&c);
|
||||
m.Bind(&c);
|
||||
Node* phi = m.Phi(type, param0, param1);
|
||||
Node* phi = m.Phi(type.representation(), param0, param1);
|
||||
m.Return(phi);
|
||||
Stream s = m.Build(kAllInstructions);
|
||||
EXPECT_EQ(s.IsDouble(phi), s.IsDouble(param0));
|
||||
@ -304,7 +304,7 @@ TARGET_TEST_P(InstructionSelectorPhiTest, Referenceness) {
|
||||
m.Bind(&b);
|
||||
m.Goto(&c);
|
||||
m.Bind(&c);
|
||||
Node* phi = m.Phi(type, param0, param1);
|
||||
Node* phi = m.Phi(type.representation(), param0, param1);
|
||||
m.Return(phi);
|
||||
Stream s = m.Build(kAllInstructions);
|
||||
EXPECT_EQ(s.IsReference(phi), s.IsReference(param0));
|
||||
@ -312,11 +312,14 @@ TARGET_TEST_P(InstructionSelectorPhiTest, Referenceness) {
|
||||
}
|
||||
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorPhiTest,
|
||||
::testing::Values(kMachFloat64, kMachInt8, kMachUint8,
|
||||
kMachInt16, kMachUint16, kMachInt32,
|
||||
kMachUint32, kMachInt64, kMachUint64,
|
||||
kMachPtr, kMachAnyTagged));
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
InstructionSelectorTest, InstructionSelectorPhiTest,
|
||||
::testing::Values(MachineType::Float64(), MachineType::Int8(),
|
||||
MachineType::Uint8(), MachineType::Int16(),
|
||||
MachineType::Uint16(), MachineType::Int32(),
|
||||
MachineType::Uint32(), MachineType::Int64(),
|
||||
MachineType::Uint64(), MachineType::Pointer(),
|
||||
MachineType::AnyTagged()));
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -324,15 +327,15 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorPhiTest,
|
||||
|
||||
|
||||
TARGET_TEST_F(InstructionSelectorTest, ValueEffect) {
|
||||
StreamBuilder m1(this, kMachInt32, kMachPtr);
|
||||
StreamBuilder m1(this, MachineType::Int32(), MachineType::Pointer());
|
||||
Node* p1 = m1.Parameter(0);
|
||||
m1.Return(m1.Load(kMachInt32, p1, m1.Int32Constant(0)));
|
||||
m1.Return(m1.Load(MachineType::Int32(), p1, m1.Int32Constant(0)));
|
||||
Stream s1 = m1.Build(kAllInstructions);
|
||||
StreamBuilder m2(this, kMachInt32, kMachPtr);
|
||||
StreamBuilder m2(this, MachineType::Int32(), MachineType::Pointer());
|
||||
Node* p2 = m2.Parameter(0);
|
||||
m2.Return(
|
||||
m2.AddNode(m2.machine()->Load(kMachInt32), p2, m2.Int32Constant(0),
|
||||
m2.AddNode(m2.common()->BeginRegion(), m2.graph()->start())));
|
||||
m2.Return(m2.AddNode(
|
||||
m2.machine()->Load(MachineType::Int32()), p2, m2.Int32Constant(0),
|
||||
m2.AddNode(m2.common()->BeginRegion(), m2.graph()->start())));
|
||||
Stream s2 = m2.Build(kAllInstructions);
|
||||
EXPECT_LE(3U, s1.size());
|
||||
ASSERT_EQ(s1.size(), s2.size());
|
||||
@ -351,8 +354,8 @@ TARGET_TEST_F(InstructionSelectorTest, ValueEffect) {
|
||||
|
||||
|
||||
TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) {
|
||||
StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged,
|
||||
kMachAnyTagged);
|
||||
StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged(),
|
||||
MachineType::AnyTagged(), MachineType::AnyTagged());
|
||||
|
||||
BailoutId bailout_id(42);
|
||||
|
||||
@ -360,7 +363,7 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) {
|
||||
Node* receiver = m.Parameter(1);
|
||||
Node* context = m.Parameter(2);
|
||||
|
||||
ZoneVector<MachineType> int32_type(1, kMachInt32, zone());
|
||||
ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone());
|
||||
ZoneVector<MachineType> empty_types(zone());
|
||||
|
||||
CallDescriptor* descriptor = Linkage::GetJSCallDescriptor(
|
||||
@ -402,8 +405,8 @@ TARGET_TEST_F(InstructionSelectorTest, CallJSFunctionWithDeopt) {
|
||||
|
||||
|
||||
TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeopt) {
|
||||
StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged,
|
||||
kMachAnyTagged);
|
||||
StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged(),
|
||||
MachineType::AnyTagged(), MachineType::AnyTagged());
|
||||
|
||||
BailoutId bailout_id_before(42);
|
||||
|
||||
@ -412,9 +415,9 @@ TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeopt) {
|
||||
Node* receiver = m.Parameter(1);
|
||||
Node* context = m.Int32Constant(1); // Context is ignored.
|
||||
|
||||
ZoneVector<MachineType> int32_type(1, kMachInt32, zone());
|
||||
ZoneVector<MachineType> float64_type(1, kMachFloat64, zone());
|
||||
ZoneVector<MachineType> tagged_type(1, kMachAnyTagged, zone());
|
||||
ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone());
|
||||
ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone());
|
||||
ZoneVector<MachineType> tagged_type(1, MachineType::AnyTagged(), zone());
|
||||
|
||||
Callable callable = CodeFactory::ToObject(isolate());
|
||||
CallDescriptor* descriptor = Linkage::GetStubCallDescriptor(
|
||||
@ -480,13 +483,15 @@ TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeopt) {
|
||||
// We inserted 0 here.
|
||||
EXPECT_EQ(0.5, s.ToFloat64(call_instr->InputAt(5)));
|
||||
EXPECT_TRUE(s.ToHeapObject(call_instr->InputAt(6))->IsUndefined());
|
||||
EXPECT_EQ(kMachAnyTagged, desc_before->GetType(0)); // function is always
|
||||
// tagged/any.
|
||||
EXPECT_EQ(kMachInt32, desc_before->GetType(1));
|
||||
EXPECT_EQ(kMachAnyTagged, desc_before->GetType(2)); // context is always
|
||||
// tagged/any.
|
||||
EXPECT_EQ(kMachFloat64, desc_before->GetType(3));
|
||||
EXPECT_EQ(kMachAnyTagged, desc_before->GetType(4));
|
||||
EXPECT_EQ(MachineType::AnyTagged(),
|
||||
desc_before->GetType(0)); // function is always
|
||||
// tagged/any.
|
||||
EXPECT_EQ(MachineType::Int32(), desc_before->GetType(1));
|
||||
EXPECT_EQ(MachineType::AnyTagged(),
|
||||
desc_before->GetType(2)); // context is always
|
||||
// tagged/any.
|
||||
EXPECT_EQ(MachineType::Float64(), desc_before->GetType(3));
|
||||
EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(4));
|
||||
|
||||
// Function.
|
||||
EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(7)));
|
||||
@ -500,8 +505,8 @@ TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeopt) {
|
||||
|
||||
|
||||
TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeoptRecursiveFrameState) {
|
||||
StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged, kMachAnyTagged,
|
||||
kMachAnyTagged);
|
||||
StreamBuilder m(this, MachineType::AnyTagged(), MachineType::AnyTagged(),
|
||||
MachineType::AnyTagged(), MachineType::AnyTagged());
|
||||
|
||||
BailoutId bailout_id_before(42);
|
||||
BailoutId bailout_id_parent(62);
|
||||
@ -512,9 +517,9 @@ TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeoptRecursiveFrameState) {
|
||||
Node* context = m.Int32Constant(66);
|
||||
Node* context2 = m.Int32Constant(46);
|
||||
|
||||
ZoneVector<MachineType> int32_type(1, kMachInt32, zone());
|
||||
ZoneVector<MachineType> int32x2_type(2, kMachInt32, zone());
|
||||
ZoneVector<MachineType> float64_type(1, kMachFloat64, zone());
|
||||
ZoneVector<MachineType> int32_type(1, MachineType::Int32(), zone());
|
||||
ZoneVector<MachineType> int32x2_type(2, MachineType::Int32(), zone());
|
||||
ZoneVector<MachineType> float64_type(1, MachineType::Float64(), zone());
|
||||
|
||||
Callable callable = CodeFactory::ToObject(isolate());
|
||||
CallDescriptor* descriptor = Linkage::GetStubCallDescriptor(
|
||||
@ -586,31 +591,31 @@ TARGET_TEST_F(InstructionSelectorTest, CallStubWithDeoptRecursiveFrameState) {
|
||||
EXPECT_EQ(1u, desc_before_outer->locals_count());
|
||||
EXPECT_EQ(1u, desc_before_outer->stack_count());
|
||||
// Values from parent environment.
|
||||
EXPECT_EQ(kMachAnyTagged, desc_before->GetType(0));
|
||||
EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(0));
|
||||
EXPECT_EQ(63, s.ToInt32(call_instr->InputAt(3)));
|
||||
EXPECT_EQ(kMachInt32, desc_before_outer->GetType(1));
|
||||
EXPECT_EQ(MachineType::Int32(), desc_before_outer->GetType(1));
|
||||
// Context:
|
||||
EXPECT_EQ(66, s.ToInt32(call_instr->InputAt(4)));
|
||||
EXPECT_EQ(kMachAnyTagged, desc_before_outer->GetType(2));
|
||||
EXPECT_EQ(MachineType::AnyTagged(), desc_before_outer->GetType(2));
|
||||
EXPECT_EQ(64, s.ToInt32(call_instr->InputAt(5)));
|
||||
EXPECT_EQ(kMachInt32, desc_before_outer->GetType(3));
|
||||
EXPECT_EQ(MachineType::Int32(), desc_before_outer->GetType(3));
|
||||
EXPECT_EQ(65, s.ToInt32(call_instr->InputAt(6)));
|
||||
EXPECT_EQ(kMachInt32, desc_before_outer->GetType(4));
|
||||
EXPECT_EQ(MachineType::Int32(), desc_before_outer->GetType(4));
|
||||
// Values from the nested frame.
|
||||
EXPECT_EQ(1u, desc_before->parameters_count());
|
||||
EXPECT_EQ(1u, desc_before->locals_count());
|
||||
EXPECT_EQ(2u, desc_before->stack_count());
|
||||
EXPECT_EQ(kMachAnyTagged, desc_before->GetType(0));
|
||||
EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(0));
|
||||
EXPECT_EQ(43, s.ToInt32(call_instr->InputAt(8)));
|
||||
EXPECT_EQ(kMachInt32, desc_before->GetType(1));
|
||||
EXPECT_EQ(MachineType::Int32(), desc_before->GetType(1));
|
||||
EXPECT_EQ(46, s.ToInt32(call_instr->InputAt(9)));
|
||||
EXPECT_EQ(kMachAnyTagged, desc_before->GetType(2));
|
||||
EXPECT_EQ(MachineType::AnyTagged(), desc_before->GetType(2));
|
||||
EXPECT_EQ(0.25, s.ToFloat64(call_instr->InputAt(10)));
|
||||
EXPECT_EQ(kMachFloat64, desc_before->GetType(3));
|
||||
EXPECT_EQ(MachineType::Float64(), desc_before->GetType(3));
|
||||
EXPECT_EQ(44, s.ToInt32(call_instr->InputAt(11)));
|
||||
EXPECT_EQ(kMachInt32, desc_before->GetType(4));
|
||||
EXPECT_EQ(MachineType::Int32(), desc_before->GetType(4));
|
||||
EXPECT_EQ(45, s.ToInt32(call_instr->InputAt(12)));
|
||||
EXPECT_EQ(kMachInt32, desc_before->GetType(5));
|
||||
EXPECT_EQ(MachineType::Int32(), desc_before->GetType(5));
|
||||
|
||||
// Function.
|
||||
EXPECT_EQ(s.ToVreg(function_node), s.ToVreg(call_instr->InputAt(13)));
|
||||
|
@ -37,17 +37,19 @@ class InstructionSelectorTest : public TestWithContext,
|
||||
class StreamBuilder final : public RawMachineAssembler {
|
||||
public:
|
||||
StreamBuilder(InstructionSelectorTest* test, MachineType return_type)
|
||||
: RawMachineAssembler(
|
||||
test->isolate(), new (test->zone()) Graph(test->zone()),
|
||||
MakeCallDescriptor(test->zone(), return_type), kMachPtr,
|
||||
MachineOperatorBuilder::kAllOptionalOps),
|
||||
: RawMachineAssembler(test->isolate(),
|
||||
new (test->zone()) Graph(test->zone()),
|
||||
MakeCallDescriptor(test->zone(), return_type),
|
||||
MachineType::PointerRepresentation(),
|
||||
MachineOperatorBuilder::kAllOptionalOps),
|
||||
test_(test) {}
|
||||
StreamBuilder(InstructionSelectorTest* test, MachineType return_type,
|
||||
MachineType parameter0_type)
|
||||
: RawMachineAssembler(
|
||||
test->isolate(), new (test->zone()) Graph(test->zone()),
|
||||
MakeCallDescriptor(test->zone(), return_type, parameter0_type),
|
||||
kMachPtr, MachineOperatorBuilder::kAllOptionalOps),
|
||||
MachineType::PointerRepresentation(),
|
||||
MachineOperatorBuilder::kAllOptionalOps),
|
||||
test_(test) {}
|
||||
StreamBuilder(InstructionSelectorTest* test, MachineType return_type,
|
||||
MachineType parameter0_type, MachineType parameter1_type)
|
||||
@ -55,7 +57,8 @@ class InstructionSelectorTest : public TestWithContext,
|
||||
test->isolate(), new (test->zone()) Graph(test->zone()),
|
||||
MakeCallDescriptor(test->zone(), return_type, parameter0_type,
|
||||
parameter1_type),
|
||||
kMachPtr, MachineOperatorBuilder::kAllOptionalOps),
|
||||
MachineType::PointerRepresentation(),
|
||||
MachineOperatorBuilder::kAllOptionalOps),
|
||||
test_(test) {}
|
||||
StreamBuilder(InstructionSelectorTest* test, MachineType return_type,
|
||||
MachineType parameter0_type, MachineType parameter1_type,
|
||||
@ -64,7 +67,8 @@ class InstructionSelectorTest : public TestWithContext,
|
||||
test->isolate(), new (test->zone()) Graph(test->zone()),
|
||||
MakeCallDescriptor(test->zone(), return_type, parameter0_type,
|
||||
parameter1_type, parameter2_type),
|
||||
kMachPtr, MachineOperatorBuilder::kAllOptionalOps),
|
||||
MachineType::PointerRepresentation(),
|
||||
MachineOperatorBuilder::kAllOptionalOps),
|
||||
test_(test) {}
|
||||
|
||||
Stream Build(CpuFeature feature) {
|
||||
|
@ -96,7 +96,8 @@ Matcher<Node*>
|
||||
InterpreterAssemblerTest::InterpreterAssemblerForTest::IsBytecodeOperand(
|
||||
int offset) {
|
||||
return IsLoad(
|
||||
kMachUint8, IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
MachineType::Uint8(),
|
||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
|
||||
IsInt32Constant(offset)));
|
||||
}
|
||||
@ -105,7 +106,8 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsBytecodeOperand(
|
||||
Matcher<Node*> InterpreterAssemblerTest::InterpreterAssemblerForTest::
|
||||
IsBytecodeOperandSignExtended(int offset) {
|
||||
Matcher<Node*> load_matcher = IsLoad(
|
||||
kMachInt8, IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
MachineType::Int8(),
|
||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
|
||||
IsInt32Constant(offset)));
|
||||
if (kPointerSize == 8) {
|
||||
@ -120,16 +122,19 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsBytecodeOperandShort(
|
||||
int offset) {
|
||||
if (TargetSupportsUnalignedAccess()) {
|
||||
return IsLoad(
|
||||
kMachUint16, IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
MachineType::Uint16(),
|
||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
|
||||
IsInt32Constant(offset)));
|
||||
} else {
|
||||
Matcher<Node*> first_byte = IsLoad(
|
||||
kMachUint8, IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
MachineType::Uint8(),
|
||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
|
||||
IsInt32Constant(offset)));
|
||||
Matcher<Node*> second_byte = IsLoad(
|
||||
kMachUint8, IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
MachineType::Uint8(),
|
||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
|
||||
IsInt32Constant(offset + 1)));
|
||||
#if V8_TARGET_LITTLE_ENDIAN
|
||||
@ -158,13 +163,15 @@ TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) {
|
||||
Matcher<Node*> next_bytecode_offset_matcher =
|
||||
IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
|
||||
IsInt32Constant(interpreter::Bytecodes::Size(bytecode)));
|
||||
Matcher<Node*> target_bytecode_matcher = m.IsLoad(
|
||||
kMachUint8, IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
next_bytecode_offset_matcher);
|
||||
Matcher<Node*> code_target_matcher = m.IsLoad(
|
||||
kMachPtr, IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
||||
IsWord32Shl(target_bytecode_matcher,
|
||||
IsInt32Constant(kPointerSizeLog2)));
|
||||
Matcher<Node*> target_bytecode_matcher =
|
||||
m.IsLoad(MachineType::Uint8(),
|
||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
next_bytecode_offset_matcher);
|
||||
Matcher<Node*> code_target_matcher =
|
||||
m.IsLoad(MachineType::Pointer(),
|
||||
IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
||||
IsWord32Shl(target_bytecode_matcher,
|
||||
IsInt32Constant(kPointerSizeLog2)));
|
||||
|
||||
EXPECT_EQ(CallDescriptor::kCallCodeObject, m.call_descriptor()->kind());
|
||||
EXPECT_TRUE(m.call_descriptor()->flags() & CallDescriptor::kCanUseRoots);
|
||||
@ -196,13 +203,15 @@ TARGET_TEST_F(InterpreterAssemblerTest, Jump) {
|
||||
Matcher<Node*> next_bytecode_offset_matcher =
|
||||
IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
|
||||
IsInt32Constant(jump_offset));
|
||||
Matcher<Node*> target_bytecode_matcher = m.IsLoad(
|
||||
kMachUint8, IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
next_bytecode_offset_matcher);
|
||||
Matcher<Node*> code_target_matcher = m.IsLoad(
|
||||
kMachPtr, IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
||||
IsWord32Shl(target_bytecode_matcher,
|
||||
IsInt32Constant(kPointerSizeLog2)));
|
||||
Matcher<Node*> target_bytecode_matcher =
|
||||
m.IsLoad(MachineType::Uint8(),
|
||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
next_bytecode_offset_matcher);
|
||||
Matcher<Node*> code_target_matcher =
|
||||
m.IsLoad(MachineType::Pointer(),
|
||||
IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
||||
IsWord32Shl(target_bytecode_matcher,
|
||||
IsInt32Constant(kPointerSizeLog2)));
|
||||
|
||||
EXPECT_EQ(CallDescriptor::kCallCodeObject, m.call_descriptor()->kind());
|
||||
EXPECT_TRUE(m.call_descriptor()->flags() & CallDescriptor::kCanUseRoots);
|
||||
@ -241,13 +250,15 @@ TARGET_TEST_F(InterpreterAssemblerTest, JumpIfWordEqual) {
|
||||
Matcher<Node*> next_bytecode_offset_matcher =
|
||||
IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
|
||||
IsInt32Constant(jump_offsets[i]));
|
||||
Matcher<Node*> target_bytecode_matcher = m.IsLoad(
|
||||
kMachUint8, IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
next_bytecode_offset_matcher);
|
||||
Matcher<Node*> code_target_matcher = m.IsLoad(
|
||||
kMachPtr, IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
||||
IsWord32Shl(target_bytecode_matcher,
|
||||
IsInt32Constant(kPointerSizeLog2)));
|
||||
Matcher<Node*> target_bytecode_matcher =
|
||||
m.IsLoad(MachineType::Uint8(),
|
||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
next_bytecode_offset_matcher);
|
||||
Matcher<Node*> code_target_matcher =
|
||||
m.IsLoad(MachineType::Pointer(),
|
||||
IsParameter(Linkage::kInterpreterDispatchTableParameter),
|
||||
IsWord32Shl(target_bytecode_matcher,
|
||||
IsInt32Constant(kPointerSizeLog2)));
|
||||
EXPECT_THAT(
|
||||
end->InputAt(i),
|
||||
IsTailCall(m.call_descriptor(), code_target_matcher,
|
||||
@ -383,7 +394,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadRegister) {
|
||||
Node* load_reg_node = m.LoadRegister(reg_index_node);
|
||||
EXPECT_THAT(
|
||||
load_reg_node,
|
||||
m.IsLoad(kMachAnyTagged,
|
||||
m.IsLoad(MachineType::AnyTagged(),
|
||||
IsParameter(Linkage::kInterpreterRegisterFileParameter),
|
||||
IsWordShl(reg_index_node, IsInt32Constant(kPointerSizeLog2))));
|
||||
}
|
||||
@ -398,10 +409,11 @@ TARGET_TEST_F(InterpreterAssemblerTest, StoreRegister) {
|
||||
Node* store_reg_node = m.StoreRegister(store_value, reg_index_node);
|
||||
EXPECT_THAT(
|
||||
store_reg_node,
|
||||
m.IsStore(StoreRepresentation(kMachAnyTagged, kNoWriteBarrier),
|
||||
IsParameter(Linkage::kInterpreterRegisterFileParameter),
|
||||
IsWordShl(reg_index_node, IsInt32Constant(kPointerSizeLog2)),
|
||||
store_value));
|
||||
m.IsStore(
|
||||
StoreRepresentation(MachineType::AnyTagged(), kNoWriteBarrier),
|
||||
IsParameter(Linkage::kInterpreterRegisterFileParameter),
|
||||
IsWordShl(reg_index_node, IsInt32Constant(kPointerSizeLog2)),
|
||||
store_value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -456,12 +468,12 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadConstantPoolEntry) {
|
||||
Node* index = m.Int32Constant(2);
|
||||
Node* load_constant = m.LoadConstantPoolEntry(index);
|
||||
Matcher<Node*> constant_pool_matcher = m.IsLoad(
|
||||
kMachAnyTagged,
|
||||
MachineType::AnyTagged(),
|
||||
IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
|
||||
IsIntPtrConstant(BytecodeArray::kConstantPoolOffset - kHeapObjectTag));
|
||||
EXPECT_THAT(
|
||||
load_constant,
|
||||
m.IsLoad(kMachAnyTagged, constant_pool_matcher,
|
||||
m.IsLoad(MachineType::AnyTagged(), constant_pool_matcher,
|
||||
IsIntPtrAdd(
|
||||
IsIntPtrConstant(FixedArray::kHeaderSize - kHeapObjectTag),
|
||||
IsWordShl(index, IsInt32Constant(kPointerSizeLog2)))));
|
||||
@ -477,7 +489,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadFixedArrayElement) {
|
||||
Node* load_element = m.LoadFixedArrayElement(fixed_array, index);
|
||||
EXPECT_THAT(
|
||||
load_element,
|
||||
m.IsLoad(kMachAnyTagged, fixed_array,
|
||||
m.IsLoad(MachineType::AnyTagged(), fixed_array,
|
||||
IsIntPtrAdd(
|
||||
IsIntPtrConstant(FixedArray::kHeaderSize - kHeapObjectTag),
|
||||
IsWordShl(IsInt32Constant(index),
|
||||
@ -493,7 +505,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadObjectField) {
|
||||
int offset = 16;
|
||||
Node* load_field = m.LoadObjectField(object, offset);
|
||||
EXPECT_THAT(load_field,
|
||||
m.IsLoad(kMachAnyTagged, object,
|
||||
m.IsLoad(MachineType::AnyTagged(), object,
|
||||
IsIntPtrConstant(offset - kHeapObjectTag)));
|
||||
}
|
||||
}
|
||||
@ -509,7 +521,8 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadContextSlot) {
|
||||
Matcher<Node*> offset =
|
||||
IsIntPtrAdd(IsWordShl(slot_index, IsInt32Constant(kPointerSizeLog2)),
|
||||
IsInt32Constant(Context::kHeaderSize - kHeapObjectTag));
|
||||
EXPECT_THAT(load_context_slot, m.IsLoad(kMachAnyTagged, context, offset));
|
||||
EXPECT_THAT(load_context_slot,
|
||||
m.IsLoad(MachineType::AnyTagged(), context, offset));
|
||||
}
|
||||
}
|
||||
|
||||
@ -525,10 +538,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, StoreContextSlot) {
|
||||
Matcher<Node*> offset =
|
||||
IsIntPtrAdd(IsWordShl(slot_index, IsInt32Constant(kPointerSizeLog2)),
|
||||
IsInt32Constant(Context::kHeaderSize - kHeapObjectTag));
|
||||
EXPECT_THAT(
|
||||
store_context_slot,
|
||||
m.IsStore(StoreRepresentation(kMachAnyTagged, kFullWriteBarrier),
|
||||
context, offset, value));
|
||||
EXPECT_THAT(store_context_slot,
|
||||
m.IsStore(StoreRepresentation(MachineType::AnyTagged(),
|
||||
kFullWriteBarrier),
|
||||
context, offset, value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -561,7 +574,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, CallRuntime) {
|
||||
function_table,
|
||||
IsInt32Mul(function_id, IsInt32Constant(sizeof(Runtime::Function))));
|
||||
Matcher<Node*> function_entry =
|
||||
m.IsLoad(kMachPtr, function,
|
||||
m.IsLoad(MachineType::Pointer(), function,
|
||||
IsInt32Constant(offsetof(Runtime::Function, entry)));
|
||||
|
||||
Node* call_runtime = m.CallRuntime(function_id, first_arg, arg_count);
|
||||
@ -611,18 +624,19 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadTypeFeedbackVector) {
|
||||
InterpreterAssemblerForTest m(this, bytecode);
|
||||
Node* feedback_vector = m.LoadTypeFeedbackVector();
|
||||
|
||||
Matcher<Node*> load_function_matcher = m.IsLoad(
|
||||
kMachAnyTagged, IsParameter(Linkage::kInterpreterRegisterFileParameter),
|
||||
IsIntPtrConstant(
|
||||
InterpreterFrameConstants::kFunctionFromRegisterPointer));
|
||||
Matcher<Node*> load_function_matcher =
|
||||
m.IsLoad(MachineType::AnyTagged(),
|
||||
IsParameter(Linkage::kInterpreterRegisterFileParameter),
|
||||
IsIntPtrConstant(
|
||||
InterpreterFrameConstants::kFunctionFromRegisterPointer));
|
||||
Matcher<Node*> load_shared_function_info_matcher =
|
||||
m.IsLoad(kMachAnyTagged, load_function_matcher,
|
||||
m.IsLoad(MachineType::AnyTagged(), load_function_matcher,
|
||||
IsIntPtrConstant(JSFunction::kSharedFunctionInfoOffset -
|
||||
kHeapObjectTag));
|
||||
|
||||
EXPECT_THAT(
|
||||
feedback_vector,
|
||||
m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher,
|
||||
m.IsLoad(MachineType::AnyTagged(), load_shared_function_info_matcher,
|
||||
IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
|
||||
kHeapObjectTag)));
|
||||
}
|
||||
|
@ -26,7 +26,8 @@ class JSBuiltinReducerTest : public TypedGraphTest {
|
||||
protected:
|
||||
Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags =
|
||||
MachineOperatorBuilder::Flag::kNoFlags) {
|
||||
MachineOperatorBuilder machine(zone(), kMachPtr, flags);
|
||||
MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(),
|
||||
flags);
|
||||
SimplifiedOperatorBuilder simplified(zone());
|
||||
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified,
|
||||
&machine);
|
||||
@ -142,7 +143,8 @@ TEST_F(JSBuiltinReducerTest, MathMax2) {
|
||||
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(),
|
||||
IsSelect(kMachNone, IsNumberLessThan(p1, p0), p0, p1));
|
||||
IsSelect(MachineRepresentation::kNone,
|
||||
IsNumberLessThan(p1, p0), p0, p1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,8 @@ class JSContextRelaxationTest : public GraphTest {
|
||||
protected:
|
||||
Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags =
|
||||
MachineOperatorBuilder::kNoFlags) {
|
||||
MachineOperatorBuilder machine(zone(), kMachPtr, flags);
|
||||
MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(),
|
||||
flags);
|
||||
JSGraph jsgraph(isolate(), graph(), common(), javascript(), nullptr,
|
||||
&machine);
|
||||
// TODO(titzer): mock the GraphReducer here for better unit testing.
|
||||
|
@ -32,7 +32,8 @@ class JSIntrinsicLoweringTest : public TypedGraphTest {
|
||||
protected:
|
||||
Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags =
|
||||
MachineOperatorBuilder::kNoFlags) {
|
||||
MachineOperatorBuilder machine(zone(), kMachPtr, flags);
|
||||
MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(),
|
||||
flags);
|
||||
SimplifiedOperatorBuilder simplified(zone());
|
||||
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified,
|
||||
&machine);
|
||||
@ -148,7 +149,7 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsArray) {
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(
|
||||
static_cast<MachineType>(kTypeBool | kRepTagged), IsFalseConstant(),
|
||||
MachineRepresentation::kTagged, IsFalseConstant(),
|
||||
IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(),
|
||||
IsLoadField(AccessBuilder::ForMap(), input,
|
||||
effect, CaptureEq(&if_false)),
|
||||
@ -179,7 +180,7 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsDate) {
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(
|
||||
static_cast<MachineType>(kTypeBool | kRepTagged), IsFalseConstant(),
|
||||
MachineRepresentation::kTagged, IsFalseConstant(),
|
||||
IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(),
|
||||
IsLoadField(AccessBuilder::ForMap(), input,
|
||||
effect, CaptureEq(&if_false)),
|
||||
@ -210,7 +211,7 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsTypedArray) {
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(
|
||||
static_cast<MachineType>(kTypeBool | kRepTagged), IsFalseConstant(),
|
||||
MachineRepresentation::kTagged, IsFalseConstant(),
|
||||
IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(),
|
||||
IsLoadField(AccessBuilder::ForMap(), input,
|
||||
effect, CaptureEq(&if_false)),
|
||||
@ -241,7 +242,7 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsFunction) {
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(
|
||||
static_cast<MachineType>(kTypeBool | kRepTagged), IsFalseConstant(),
|
||||
MachineRepresentation::kTagged, IsFalseConstant(),
|
||||
IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(),
|
||||
IsLoadField(AccessBuilder::ForMap(), input,
|
||||
effect, CaptureEq(&if_false)),
|
||||
@ -272,7 +273,7 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsRegExp) {
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(
|
||||
static_cast<MachineType>(kTypeBool | kRepTagged), IsFalseConstant(),
|
||||
MachineRepresentation::kTagged, IsFalseConstant(),
|
||||
IsWord32Equal(IsLoadField(AccessBuilder::ForMapInstanceType(),
|
||||
IsLoadField(AccessBuilder::ForMap(), input,
|
||||
effect, CaptureEq(&if_false)),
|
||||
@ -303,7 +304,7 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsJSReceiverWithAny) {
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(
|
||||
kMachAnyTagged, IsFalseConstant(),
|
||||
MachineRepresentation::kTagged, IsFalseConstant(),
|
||||
IsUint32LessThanOrEqual(
|
||||
IsInt32Constant(FIRST_JS_RECEIVER_TYPE),
|
||||
IsLoadField(AccessBuilder::ForMapInstanceType(),
|
||||
@ -449,9 +450,10 @@ TEST_F(JSIntrinsicLoweringTest, InlineValueOf) {
|
||||
EXPECT_THAT(
|
||||
phi,
|
||||
IsPhi(
|
||||
kMachAnyTagged, input,
|
||||
IsPhi(kMachAnyTagged, IsLoadField(AccessBuilder::ForValue(), input,
|
||||
effect, CaptureEq(&if_true1)),
|
||||
MachineRepresentation::kTagged, input,
|
||||
IsPhi(MachineRepresentation::kTagged,
|
||||
IsLoadField(AccessBuilder::ForValue(), input, effect,
|
||||
CaptureEq(&if_true1)),
|
||||
input,
|
||||
IsMerge(
|
||||
AllOf(CaptureEq(&if_true1), IsIfTrue(CaptureEq(&branch1))),
|
||||
|
@ -357,7 +357,7 @@ TEST_F(JSTypedLoweringTest, JSToObjectWithAny) {
|
||||
Reduction r = Reduce(graph()->NewNode(javascript()->ToObject(), input,
|
||||
context, frame_state, effect, control));
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(r.replacement(), IsPhi(kMachAnyTagged, _, _, _));
|
||||
EXPECT_THAT(r.replacement(), IsPhi(MachineRepresentation::kTagged, _, _, _));
|
||||
}
|
||||
|
||||
|
||||
@ -387,10 +387,10 @@ TEST_F(JSTypedLoweringTest, JSToStringWithBoolean) {
|
||||
Reduction r = Reduce(graph()->NewNode(javascript()->ToString(), input,
|
||||
context, frame_state, effect, control));
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsSelect(kMachAnyTagged, input, IsHeapConstant(factory()->true_string()),
|
||||
IsHeapConstant(factory()->false_string())));
|
||||
EXPECT_THAT(r.replacement(),
|
||||
IsSelect(MachineRepresentation::kTagged, input,
|
||||
IsHeapConstant(factory()->true_string()),
|
||||
IsHeapConstant(factory()->false_string())));
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,9 +14,11 @@ namespace compiler {
|
||||
|
||||
namespace {
|
||||
|
||||
MachineType kMachineTypes[] = {kMachAnyTagged, kMachAnyTagged, kMachAnyTagged,
|
||||
kMachAnyTagged, kMachAnyTagged, kMachAnyTagged,
|
||||
kMachAnyTagged, kMachAnyTagged};
|
||||
MachineType kMachineTypes[] = {
|
||||
MachineType::AnyTagged(), MachineType::AnyTagged(),
|
||||
MachineType::AnyTagged(), MachineType::AnyTagged(),
|
||||
MachineType::AnyTagged(), MachineType::AnyTagged(),
|
||||
MachineType::AnyTagged(), MachineType::AnyTagged()};
|
||||
}
|
||||
|
||||
class LinkageTailCall : public TestWithZone {
|
||||
@ -26,17 +28,17 @@ class LinkageTailCall : public TestWithZone {
|
||||
locations->return_count() + locations->parameter_count());
|
||||
MachineSignature* types = new (zone()) MachineSignature(
|
||||
locations->return_count(), locations->parameter_count(), kMachineTypes);
|
||||
return new (zone())
|
||||
CallDescriptor(CallDescriptor::kCallCodeObject, kMachAnyTagged,
|
||||
LinkageLocation::ForAnyRegister(),
|
||||
types, // machine_sig
|
||||
locations, // location_sig
|
||||
0, // js_parameter_count
|
||||
Operator::kNoProperties, // properties
|
||||
0, // callee-saved
|
||||
0, // callee-saved fp
|
||||
CallDescriptor::kNoFlags, // flags,
|
||||
"");
|
||||
return new (zone()) CallDescriptor(CallDescriptor::kCallCodeObject,
|
||||
MachineType::AnyTagged(),
|
||||
LinkageLocation::ForAnyRegister(),
|
||||
types, // machine_sig
|
||||
locations, // location_sig
|
||||
0, // js_parameter_count
|
||||
Operator::kNoProperties, // properties
|
||||
0, // callee-saved
|
||||
0, // callee-saved fp
|
||||
CallDescriptor::kNoFlags, // flags,
|
||||
"");
|
||||
}
|
||||
|
||||
LinkageLocation StackLocation(int loc) {
|
||||
|
@ -40,7 +40,7 @@ class TestRangeBuilder {
|
||||
|
||||
TopLevelLiveRange* Build() {
|
||||
TopLevelLiveRange* range =
|
||||
new (zone_) TopLevelLiveRange(id_, MachineType::kRepTagged);
|
||||
new (zone_) TopLevelLiveRange(id_, MachineRepresentation::kTagged);
|
||||
// Traverse the provided interval specifications backwards, because that is
|
||||
// what LiveRange expects.
|
||||
for (int i = static_cast<int>(pairs_.size()) - 1; i >= 0; --i) {
|
||||
|
@ -33,8 +33,8 @@ class LiveRangeUnitTest : public TestWithZone {
|
||||
TopLevelLiveRange* Splinter(TopLevelLiveRange* top, int start, int end,
|
||||
int new_id = 0) {
|
||||
if (top->splinter() == nullptr) {
|
||||
TopLevelLiveRange* ret =
|
||||
new (zone()) TopLevelLiveRange(new_id, MachineType::kRepTagged);
|
||||
TopLevelLiveRange* ret = new (zone())
|
||||
TopLevelLiveRange(new_id, MachineRepresentation::kTagged);
|
||||
top->SetSplinter(ret);
|
||||
}
|
||||
top->Splinter(LifetimePosition::FromInt(start),
|
||||
@ -74,7 +74,7 @@ class LiveRangeUnitTest : public TestWithZone {
|
||||
TEST_F(LiveRangeUnitTest, InvalidConstruction) {
|
||||
// Build a range manually, because the builder guards against empty cases.
|
||||
TopLevelLiveRange* range =
|
||||
new (zone()) TopLevelLiveRange(1, MachineType::kRepTagged);
|
||||
new (zone()) TopLevelLiveRange(1, MachineRepresentation::kTagged);
|
||||
V8_ASSERT_DEBUG_DEATH(
|
||||
range->AddUseInterval(LifetimePosition::FromInt(0),
|
||||
LifetimePosition::FromInt(0), zone()),
|
||||
@ -437,7 +437,7 @@ TEST_F(LiveRangeUnitTest, IDGeneration) {
|
||||
EXPECT_EQ(0, vreg->relative_id());
|
||||
|
||||
TopLevelLiveRange* splinter =
|
||||
new (zone()) TopLevelLiveRange(101, MachineType::kRepTagged);
|
||||
new (zone()) TopLevelLiveRange(101, MachineRepresentation::kTagged);
|
||||
vreg->SetSplinter(splinter);
|
||||
vreg->Splinter(LifetimePosition::FromInt(4), LifetimePosition::FromInt(12),
|
||||
zone());
|
||||
|
@ -23,7 +23,7 @@ class LivenessAnalysisTest : public GraphTest {
|
||||
public:
|
||||
explicit LivenessAnalysisTest(int locals_count = 4)
|
||||
: locals_count_(locals_count),
|
||||
machine_(zone(), kRepWord32),
|
||||
machine_(zone(), MachineRepresentation::kWord32),
|
||||
javascript_(zone()),
|
||||
jsgraph_(isolate(), graph(), common(), &javascript_, nullptr,
|
||||
&machine_),
|
||||
|
@ -119,7 +119,8 @@ class LoopPeelingTest : public GraphTest {
|
||||
a->loop->ReplaceInput(0, b->if_true);
|
||||
}
|
||||
Node* NewPhi(While* w, Node* a, Node* b) {
|
||||
return graph()->NewNode(common()->Phi(kMachAnyTagged, 2), a, b, w->loop);
|
||||
return graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), a,
|
||||
b, w->loop);
|
||||
}
|
||||
|
||||
Branch NewBranch(Node* cond, Node* control = nullptr) {
|
||||
@ -133,8 +134,8 @@ class LoopPeelingTest : public GraphTest {
|
||||
Counter NewCounter(While* w, int32_t b, int32_t k) {
|
||||
Node* base = Int32Constant(b);
|
||||
Node* inc = Int32Constant(k);
|
||||
Node* phi =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), base, base, w->loop);
|
||||
Node* phi = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), base, base, w->loop);
|
||||
Node* add = graph()->NewNode(machine()->Int32Add(), phi, inc);
|
||||
phi->ReplaceInput(1, add);
|
||||
return {base, inc, phi, add};
|
||||
@ -183,7 +184,7 @@ TEST_F(LoopPeelingTest, SimpleLoopWithCounter) {
|
||||
|
||||
Capture<Node*> merge;
|
||||
EXPECT_THAT(
|
||||
r, IsReturn(IsPhi(kMachAnyTagged, c.phi, c.base,
|
||||
r, IsReturn(IsPhi(MachineRepresentation::kTagged, c.phi, c.base,
|
||||
AllOf(CaptureEq(&merge), IsMerge(w.exit, if_false1))),
|
||||
start(), CaptureEq(&merge)));
|
||||
}
|
||||
@ -222,7 +223,7 @@ TEST_F(LoopPeelingTest, SimpleNestedLoopWithCounter_peel_outer) {
|
||||
Capture<Node*> merge;
|
||||
EXPECT_THAT(
|
||||
r,
|
||||
IsReturn(IsPhi(kMachAnyTagged, c.phi, c.base,
|
||||
IsReturn(IsPhi(MachineRepresentation::kTagged, c.phi, c.base,
|
||||
AllOf(CaptureEq(&merge), IsMerge(outer.exit, if_falseo))),
|
||||
start(), CaptureEq(&merge)));
|
||||
}
|
||||
@ -298,11 +299,11 @@ TEST_F(LoopPeelingTest, SimpleInnerCounter_peel_inner) {
|
||||
EXPECT_THAT(peeled->map(c.add), IsInt32Add(c.base, c.inc));
|
||||
|
||||
Node* back = phi->InputAt(1);
|
||||
EXPECT_THAT(back, IsPhi(kMachAnyTagged, c.phi, c.base,
|
||||
EXPECT_THAT(back, IsPhi(MachineRepresentation::kTagged, c.phi, c.base,
|
||||
IsMerge(inner.exit, if_falsei)));
|
||||
|
||||
EXPECT_THAT(phi,
|
||||
IsPhi(kMachAnyTagged, IsInt32Constant(11), back, outer.loop));
|
||||
EXPECT_THAT(phi, IsPhi(MachineRepresentation::kTagged, IsInt32Constant(11),
|
||||
back, outer.loop));
|
||||
|
||||
EXPECT_THAT(r, IsReturn(phi, start(), outer.exit));
|
||||
}
|
||||
@ -347,9 +348,9 @@ TEST_F(LoopPeelingTest, TwoBackedgeLoopWithPhi) {
|
||||
Node* loop = graph()->NewNode(common()->Loop(3), start(), start(), start());
|
||||
Branch b1 = NewBranch(p0, loop);
|
||||
Branch b2 = NewBranch(p0, b1.if_true);
|
||||
Node* phi =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 3), Int32Constant(0),
|
||||
Int32Constant(1), Int32Constant(2), loop);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 3),
|
||||
Int32Constant(0), Int32Constant(1),
|
||||
Int32Constant(2), loop);
|
||||
|
||||
loop->ReplaceInput(1, b2.if_true);
|
||||
loop->ReplaceInput(2, b2.if_false);
|
||||
@ -376,14 +377,15 @@ TEST_F(LoopPeelingTest, TwoBackedgeLoopWithPhi) {
|
||||
|
||||
EXPECT_THAT(loop, IsLoop(IsMerge(b2t, b2f), b2.if_true, b2.if_false));
|
||||
|
||||
EXPECT_THAT(
|
||||
phi, IsPhi(kMachAnyTagged, IsPhi(kMachAnyTagged, IsInt32Constant(1),
|
||||
IsInt32Constant(2), IsMerge(b2t, b2f)),
|
||||
IsInt32Constant(1), IsInt32Constant(2), loop));
|
||||
EXPECT_THAT(phi,
|
||||
IsPhi(MachineRepresentation::kTagged,
|
||||
IsPhi(MachineRepresentation::kTagged, IsInt32Constant(1),
|
||||
IsInt32Constant(2), IsMerge(b2t, b2f)),
|
||||
IsInt32Constant(1), IsInt32Constant(2), loop));
|
||||
|
||||
Capture<Node*> merge;
|
||||
EXPECT_THAT(
|
||||
r, IsReturn(IsPhi(kMachAnyTagged, phi, IsInt32Constant(0),
|
||||
r, IsReturn(IsPhi(MachineRepresentation::kTagged, phi, IsInt32Constant(0),
|
||||
AllOf(CaptureEq(&merge), IsMerge(b1.if_false, b1f))),
|
||||
start(), CaptureEq(&merge)));
|
||||
}
|
||||
@ -394,9 +396,9 @@ TEST_F(LoopPeelingTest, TwoBackedgeLoopWithCounter) {
|
||||
Node* loop = graph()->NewNode(common()->Loop(3), start(), start(), start());
|
||||
Branch b1 = NewBranch(p0, loop);
|
||||
Branch b2 = NewBranch(p0, b1.if_true);
|
||||
Node* phi =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 3), Int32Constant(0),
|
||||
Int32Constant(1), Int32Constant(2), loop);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 3),
|
||||
Int32Constant(0), Int32Constant(1),
|
||||
Int32Constant(2), loop);
|
||||
|
||||
phi->ReplaceInput(
|
||||
1, graph()->NewNode(machine()->Int32Add(), phi, Int32Constant(1)));
|
||||
@ -432,18 +434,18 @@ TEST_F(LoopPeelingTest, TwoBackedgeLoopWithCounter) {
|
||||
|
||||
Node* eval = phi->InputAt(0);
|
||||
|
||||
EXPECT_THAT(eval, IsPhi(kMachAnyTagged,
|
||||
EXPECT_THAT(eval, IsPhi(MachineRepresentation::kTagged,
|
||||
IsInt32Add(IsInt32Constant(0), IsInt32Constant(1)),
|
||||
IsInt32Add(IsInt32Constant(0), IsInt32Constant(2)),
|
||||
CaptureEq(&entry)));
|
||||
|
||||
EXPECT_THAT(phi,
|
||||
IsPhi(kMachAnyTagged, eval, IsInt32Add(phi, IsInt32Constant(1)),
|
||||
IsInt32Add(phi, IsInt32Constant(2)), loop));
|
||||
EXPECT_THAT(phi, IsPhi(MachineRepresentation::kTagged, eval,
|
||||
IsInt32Add(phi, IsInt32Constant(1)),
|
||||
IsInt32Add(phi, IsInt32Constant(2)), loop));
|
||||
|
||||
Capture<Node*> merge;
|
||||
EXPECT_THAT(
|
||||
r, IsReturn(IsPhi(kMachAnyTagged, phi, IsInt32Constant(0),
|
||||
r, IsReturn(IsPhi(MachineRepresentation::kTagged, phi, IsInt32Constant(0),
|
||||
AllOf(CaptureEq(&merge), IsMerge(b1.if_false, b1f))),
|
||||
start(), CaptureEq(&merge)));
|
||||
}
|
||||
|
@ -447,11 +447,13 @@ TEST_F(MachineOperatorReducerTest, TruncateFloat64ToInt32WithPhi) {
|
||||
TRACED_FOREACH(TruncationMode, mode, kTruncationModes) {
|
||||
Reduction reduction = Reduce(graph()->NewNode(
|
||||
machine()->TruncateFloat64ToInt32(mode),
|
||||
graph()->NewNode(common()->Phi(kMachFloat64, 2), p0, p1, merge)));
|
||||
graph()->NewNode(common()->Phi(MachineRepresentation::kFloat64, 2), p0,
|
||||
p1, merge)));
|
||||
ASSERT_TRUE(reduction.Changed());
|
||||
EXPECT_THAT(reduction.replacement(),
|
||||
IsPhi(kMachInt32, IsTruncateFloat64ToInt32(p0),
|
||||
IsTruncateFloat64ToInt32(p1), merge));
|
||||
EXPECT_THAT(
|
||||
reduction.replacement(),
|
||||
IsPhi(MachineRepresentation::kWord32, IsTruncateFloat64ToInt32(p0),
|
||||
IsTruncateFloat64ToInt32(p1), merge));
|
||||
}
|
||||
}
|
||||
|
||||
@ -828,8 +830,8 @@ TEST_F(MachineOperatorReducerTest, Word32SarWithWord32ShlAndLoad) {
|
||||
Node* const p0 = Parameter(0);
|
||||
Node* const p1 = Parameter(1);
|
||||
{
|
||||
Node* const l = graph()->NewNode(machine()->Load(kMachInt8), p0, p1,
|
||||
graph()->start(), graph()->start());
|
||||
Node* const l = graph()->NewNode(machine()->Load(MachineType::Int8()), p0,
|
||||
p1, graph()->start(), graph()->start());
|
||||
Reduction const r = Reduce(graph()->NewNode(
|
||||
machine()->Word32Sar(),
|
||||
graph()->NewNode(machine()->Word32Shl(), l, Int32Constant(24)),
|
||||
@ -838,8 +840,8 @@ TEST_F(MachineOperatorReducerTest, Word32SarWithWord32ShlAndLoad) {
|
||||
EXPECT_EQ(l, r.replacement());
|
||||
}
|
||||
{
|
||||
Node* const l = graph()->NewNode(machine()->Load(kMachInt16), p0, p1,
|
||||
graph()->start(), graph()->start());
|
||||
Node* const l = graph()->NewNode(machine()->Load(MachineType::Int16()), p0,
|
||||
p1, graph()->start(), graph()->start());
|
||||
Reduction const r = Reduce(graph()->NewNode(
|
||||
machine()->Word32Sar(),
|
||||
graph()->NewNode(machine()->Word32Shl(), l, Int32Constant(16)),
|
||||
@ -1142,7 +1144,8 @@ TEST_F(MachineOperatorReducerTest, Int32ModWithConstant) {
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsSelect(kMachInt32, IsInt32LessThan(p0, IsInt32Constant(0)),
|
||||
IsSelect(MachineRepresentation::kWord32,
|
||||
IsInt32LessThan(p0, IsInt32Constant(0)),
|
||||
IsInt32Sub(IsInt32Constant(0),
|
||||
IsWord32And(IsInt32Sub(IsInt32Constant(0), p0),
|
||||
IsInt32Constant(mask))),
|
||||
@ -1157,7 +1160,8 @@ TEST_F(MachineOperatorReducerTest, Int32ModWithConstant) {
|
||||
ASSERT_TRUE(r.Changed());
|
||||
EXPECT_THAT(
|
||||
r.replacement(),
|
||||
IsSelect(kMachInt32, IsInt32LessThan(p0, IsInt32Constant(0)),
|
||||
IsSelect(MachineRepresentation::kWord32,
|
||||
IsInt32LessThan(p0, IsInt32Constant(0)),
|
||||
IsInt32Sub(IsInt32Constant(0),
|
||||
IsWord32And(IsInt32Sub(IsInt32Constant(0), p0),
|
||||
IsInt32Constant(mask))),
|
||||
@ -1556,7 +1560,7 @@ TEST_F(MachineOperatorReducerTest, Float64LessThanOrEqualWithFloat32Constant) {
|
||||
|
||||
|
||||
TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) {
|
||||
const StoreRepresentation rep(kMachUint8, kNoWriteBarrier);
|
||||
const StoreRepresentation rep(MachineType::Uint8(), kNoWriteBarrier);
|
||||
Node* const base = Parameter(0);
|
||||
Node* const index = Parameter(1);
|
||||
Node* const value = Parameter(2);
|
||||
@ -1578,7 +1582,7 @@ TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) {
|
||||
|
||||
|
||||
TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32SarAndWord32Shl) {
|
||||
const StoreRepresentation rep(kMachUint8, kNoWriteBarrier);
|
||||
const StoreRepresentation rep(MachineType::Uint8(), kNoWriteBarrier);
|
||||
Node* const base = Parameter(0);
|
||||
Node* const index = Parameter(1);
|
||||
Node* const value = Parameter(2);
|
||||
@ -1602,7 +1606,7 @@ TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32SarAndWord32Shl) {
|
||||
|
||||
|
||||
TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32And) {
|
||||
const StoreRepresentation rep(kMachUint16, kNoWriteBarrier);
|
||||
const StoreRepresentation rep(MachineType::Uint16(), kNoWriteBarrier);
|
||||
Node* const base = Parameter(0);
|
||||
Node* const index = Parameter(1);
|
||||
Node* const value = Parameter(2);
|
||||
@ -1624,7 +1628,7 @@ TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32And) {
|
||||
|
||||
|
||||
TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32SarAndWord32Shl) {
|
||||
const StoreRepresentation rep(kMachUint16, kNoWriteBarrier);
|
||||
const StoreRepresentation rep(MachineType::Uint16(), kNoWriteBarrier);
|
||||
Node* const base = Parameter(0);
|
||||
Node* const index = Parameter(1);
|
||||
Node* const value = Parameter(2);
|
||||
|
@ -17,25 +17,31 @@ namespace compiler {
|
||||
template <typename T>
|
||||
class MachineOperatorTestWithParam
|
||||
: public TestWithZone,
|
||||
public ::testing::WithParamInterface< ::testing::tuple<MachineType, T> > {
|
||||
public ::testing::WithParamInterface<
|
||||
::testing::tuple<MachineRepresentation, T> > {
|
||||
protected:
|
||||
MachineType type() const { return ::testing::get<0>(B::GetParam()); }
|
||||
MachineRepresentation representation() const {
|
||||
return ::testing::get<0>(B::GetParam());
|
||||
}
|
||||
const T& GetParam() const { return ::testing::get<1>(B::GetParam()); }
|
||||
|
||||
private:
|
||||
typedef ::testing::WithParamInterface< ::testing::tuple<MachineType, T> > B;
|
||||
typedef ::testing::WithParamInterface<
|
||||
::testing::tuple<MachineRepresentation, T> > B;
|
||||
};
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
const MachineType kMachineReps[] = {kRepWord32, kRepWord64};
|
||||
const MachineRepresentation kMachineReps[] = {MachineRepresentation::kWord32,
|
||||
MachineRepresentation::kWord64};
|
||||
|
||||
|
||||
const MachineType kMachineTypesForAccess[] = {
|
||||
kMachFloat32, kMachFloat64, kMachInt8, kMachUint8, kMachInt16,
|
||||
kMachUint16, kMachInt32, kMachUint32, kMachInt64, kMachUint64,
|
||||
kMachPtr, kMachAnyTagged, kMachPtr};
|
||||
MachineType::Float32(), MachineType::Float64(), MachineType::Int8(),
|
||||
MachineType::Uint8(), MachineType::Int16(), MachineType::Uint16(),
|
||||
MachineType::Int32(), MachineType::Uint32(), MachineType::Int64(),
|
||||
MachineType::Uint64(), MachineType::AnyTagged()};
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -49,14 +55,14 @@ typedef MachineOperatorTestWithParam<LoadRepresentation>
|
||||
|
||||
|
||||
TEST_P(MachineLoadOperatorTest, InstancesAreGloballyShared) {
|
||||
MachineOperatorBuilder machine1(zone(), type());
|
||||
MachineOperatorBuilder machine2(zone(), type());
|
||||
MachineOperatorBuilder machine1(zone(), representation());
|
||||
MachineOperatorBuilder machine2(zone(), representation());
|
||||
EXPECT_EQ(machine1.Load(GetParam()), machine2.Load(GetParam()));
|
||||
}
|
||||
|
||||
|
||||
TEST_P(MachineLoadOperatorTest, NumberOfInputsAndOutputs) {
|
||||
MachineOperatorBuilder machine(zone(), type());
|
||||
MachineOperatorBuilder machine(zone(), representation());
|
||||
const Operator* op = machine.Load(GetParam());
|
||||
|
||||
EXPECT_EQ(2, op->ValueInputCount());
|
||||
@ -71,13 +77,13 @@ TEST_P(MachineLoadOperatorTest, NumberOfInputsAndOutputs) {
|
||||
|
||||
|
||||
TEST_P(MachineLoadOperatorTest, OpcodeIsCorrect) {
|
||||
MachineOperatorBuilder machine(zone(), type());
|
||||
MachineOperatorBuilder machine(zone(), representation());
|
||||
EXPECT_EQ(IrOpcode::kLoad, machine.Load(GetParam())->opcode());
|
||||
}
|
||||
|
||||
|
||||
TEST_P(MachineLoadOperatorTest, ParameterIsCorrect) {
|
||||
MachineOperatorBuilder machine(zone(), type());
|
||||
MachineOperatorBuilder machine(zone(), representation());
|
||||
EXPECT_EQ(GetParam(),
|
||||
OpParameter<LoadRepresentation>(machine.Load(GetParam())));
|
||||
}
|
||||
@ -108,14 +114,14 @@ class MachineStoreOperatorTest
|
||||
|
||||
|
||||
TEST_P(MachineStoreOperatorTest, InstancesAreGloballyShared) {
|
||||
MachineOperatorBuilder machine1(zone(), type());
|
||||
MachineOperatorBuilder machine2(zone(), type());
|
||||
MachineOperatorBuilder machine1(zone(), representation());
|
||||
MachineOperatorBuilder machine2(zone(), representation());
|
||||
EXPECT_EQ(machine1.Store(GetParam()), machine2.Store(GetParam()));
|
||||
}
|
||||
|
||||
|
||||
TEST_P(MachineStoreOperatorTest, NumberOfInputsAndOutputs) {
|
||||
MachineOperatorBuilder machine(zone(), type());
|
||||
MachineOperatorBuilder machine(zone(), representation());
|
||||
const Operator* op = machine.Store(GetParam());
|
||||
|
||||
EXPECT_EQ(3, op->ValueInputCount());
|
||||
@ -130,13 +136,13 @@ TEST_P(MachineStoreOperatorTest, NumberOfInputsAndOutputs) {
|
||||
|
||||
|
||||
TEST_P(MachineStoreOperatorTest, OpcodeIsCorrect) {
|
||||
MachineOperatorBuilder machine(zone(), type());
|
||||
MachineOperatorBuilder machine(zone(), representation());
|
||||
EXPECT_EQ(IrOpcode::kStore, machine.Store(GetParam())->opcode());
|
||||
}
|
||||
|
||||
|
||||
TEST_P(MachineStoreOperatorTest, ParameterIsCorrect) {
|
||||
MachineOperatorBuilder machine(zone(), type());
|
||||
MachineOperatorBuilder machine(zone(), representation());
|
||||
EXPECT_EQ(GetParam(),
|
||||
OpParameter<StoreRepresentation>(machine.Store(GetParam())));
|
||||
}
|
||||
@ -256,14 +262,16 @@ const PureOperator kPureOperators[] = {
|
||||
|
||||
class MachinePureOperatorTest : public TestWithZone {
|
||||
protected:
|
||||
MachineType word_type() { return kMachPtr; }
|
||||
MachineRepresentation word_type() {
|
||||
return MachineType::PointerRepresentation();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
TEST_F(MachinePureOperatorTest, PureOperators) {
|
||||
TRACED_FOREACH(MachineType, machine_rep1, kMachineReps) {
|
||||
TRACED_FOREACH(MachineRepresentation, machine_rep1, kMachineReps) {
|
||||
MachineOperatorBuilder machine1(zone(), machine_rep1);
|
||||
TRACED_FOREACH(MachineType, machine_rep2, kMachineReps) {
|
||||
TRACED_FOREACH(MachineRepresentation, machine_rep2, kMachineReps) {
|
||||
MachineOperatorBuilder machine2(zone(), machine_rep2);
|
||||
TRACED_FOREACH(PureOperator, pop, kPureOperators) {
|
||||
const Operator* op1 = (machine1.*pop.constructor)();
|
||||
@ -317,15 +325,17 @@ const OptionalOperatorEntry kOptionalOperators[] = {
|
||||
|
||||
class MachineOptionalOperatorTest : public TestWithZone {
|
||||
protected:
|
||||
MachineType word_type() { return kMachPtr; }
|
||||
MachineRepresentation word_rep() {
|
||||
return MachineType::PointerRepresentation();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
TEST_F(MachineOptionalOperatorTest, OptionalOperators) {
|
||||
TRACED_FOREACH(OptionalOperatorEntry, pop, kOptionalOperators) {
|
||||
TRACED_FOREACH(MachineType, machine_rep1, kMachineReps) {
|
||||
TRACED_FOREACH(MachineRepresentation, machine_rep1, kMachineReps) {
|
||||
MachineOperatorBuilder machine1(zone(), machine_rep1, pop.enabling_flag);
|
||||
TRACED_FOREACH(MachineType, machine_rep2, kMachineReps) {
|
||||
TRACED_FOREACH(MachineRepresentation, machine_rep2, kMachineReps) {
|
||||
MachineOperatorBuilder machine2(zone(), machine_rep2,
|
||||
pop.enabling_flag);
|
||||
const Operator* op1 = (machine1.*pop.constructor)().op();
|
||||
@ -335,7 +345,7 @@ TEST_F(MachineOptionalOperatorTest, OptionalOperators) {
|
||||
EXPECT_EQ(pop.control_input_count, op1->ControlInputCount());
|
||||
EXPECT_EQ(pop.value_output_count, op1->ValueOutputCount());
|
||||
|
||||
MachineOperatorBuilder machine3(zone(), word_type());
|
||||
MachineOperatorBuilder machine3(zone(), word_rep());
|
||||
EXPECT_TRUE((machine1.*pop.constructor)().IsSupported());
|
||||
EXPECT_FALSE((machine3.*pop.constructor)().IsSupported());
|
||||
}
|
||||
@ -356,7 +366,7 @@ typedef TestWithZone MachineOperatorTest;
|
||||
|
||||
|
||||
TEST_F(MachineOperatorTest, PseudoOperatorsWhenWordSizeIs32Bit) {
|
||||
MachineOperatorBuilder machine(zone(), kRepWord32);
|
||||
MachineOperatorBuilder machine(zone(), MachineRepresentation::kWord32);
|
||||
EXPECT_EQ(machine.Word32And(), machine.WordAnd());
|
||||
EXPECT_EQ(machine.Word32Or(), machine.WordOr());
|
||||
EXPECT_EQ(machine.Word32Xor(), machine.WordXor());
|
||||
@ -378,7 +388,7 @@ TEST_F(MachineOperatorTest, PseudoOperatorsWhenWordSizeIs32Bit) {
|
||||
|
||||
|
||||
TEST_F(MachineOperatorTest, PseudoOperatorsWhenWordSizeIs64Bit) {
|
||||
MachineOperatorBuilder machine(zone(), kRepWord64);
|
||||
MachineOperatorBuilder machine(zone(), MachineRepresentation::kWord64);
|
||||
EXPECT_EQ(machine.Word64And(), machine.WordAnd());
|
||||
EXPECT_EQ(machine.Word64Or(), machine.WordOr());
|
||||
EXPECT_EQ(machine.Word64Xor(), machine.WordXor());
|
||||
|
@ -41,19 +41,19 @@ struct FPCmp {
|
||||
|
||||
const FPCmp kFPCmpInstructions[] = {
|
||||
{{&RawMachineAssembler::Float64Equal, "Float64Equal", kMipsCmpD,
|
||||
kMachFloat64},
|
||||
MachineType::Float64()},
|
||||
kEqual},
|
||||
{{&RawMachineAssembler::Float64LessThan, "Float64LessThan", kMipsCmpD,
|
||||
kMachFloat64},
|
||||
MachineType::Float64()},
|
||||
kUnsignedLessThan},
|
||||
{{&RawMachineAssembler::Float64LessThanOrEqual, "Float64LessThanOrEqual",
|
||||
kMipsCmpD, kMachFloat64},
|
||||
kMipsCmpD, MachineType::Float64()},
|
||||
kUnsignedLessThanOrEqual},
|
||||
{{&RawMachineAssembler::Float64GreaterThan, "Float64GreaterThan", kMipsCmpD,
|
||||
kMachFloat64},
|
||||
MachineType::Float64()},
|
||||
kUnsignedLessThan},
|
||||
{{&RawMachineAssembler::Float64GreaterThanOrEqual,
|
||||
"Float64GreaterThanOrEqual", kMipsCmpD, kMachFloat64},
|
||||
"Float64GreaterThanOrEqual", kMipsCmpD, MachineType::Float64()},
|
||||
kUnsignedLessThanOrEqual}};
|
||||
|
||||
struct Conversion {
|
||||
@ -69,12 +69,14 @@ struct Conversion {
|
||||
|
||||
|
||||
const MachInst2 kLogicalInstructions[] = {
|
||||
{&RawMachineAssembler::WordAnd, "WordAnd", kMipsAnd, kMachInt16},
|
||||
{&RawMachineAssembler::WordOr, "WordOr", kMipsOr, kMachInt16},
|
||||
{&RawMachineAssembler::WordXor, "WordXor", kMipsXor, kMachInt16},
|
||||
{&RawMachineAssembler::Word32And, "Word32And", kMipsAnd, kMachInt32},
|
||||
{&RawMachineAssembler::Word32Or, "Word32Or", kMipsOr, kMachInt32},
|
||||
{&RawMachineAssembler::Word32Xor, "Word32Xor", kMipsXor, kMachInt32}};
|
||||
{&RawMachineAssembler::WordAnd, "WordAnd", kMipsAnd, MachineType::Int16()},
|
||||
{&RawMachineAssembler::WordOr, "WordOr", kMipsOr, MachineType::Int16()},
|
||||
{&RawMachineAssembler::WordXor, "WordXor", kMipsXor, MachineType::Int16()},
|
||||
{&RawMachineAssembler::Word32And, "Word32And", kMipsAnd,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Word32Or, "Word32Or", kMipsOr, MachineType::Int32()},
|
||||
{&RawMachineAssembler::Word32Xor, "Word32Xor", kMipsXor,
|
||||
MachineType::Int32()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -83,14 +85,18 @@ const MachInst2 kLogicalInstructions[] = {
|
||||
|
||||
|
||||
const MachInst2 kShiftInstructions[] = {
|
||||
{&RawMachineAssembler::WordShl, "WordShl", kMipsShl, kMachInt16},
|
||||
{&RawMachineAssembler::WordShr, "WordShr", kMipsShr, kMachInt16},
|
||||
{&RawMachineAssembler::WordSar, "WordSar", kMipsSar, kMachInt16},
|
||||
{&RawMachineAssembler::WordRor, "WordRor", kMipsRor, kMachInt16},
|
||||
{&RawMachineAssembler::Word32Shl, "Word32Shl", kMipsShl, kMachInt32},
|
||||
{&RawMachineAssembler::Word32Shr, "Word32Shr", kMipsShr, kMachInt32},
|
||||
{&RawMachineAssembler::Word32Sar, "Word32Sar", kMipsSar, kMachInt32},
|
||||
{&RawMachineAssembler::Word32Ror, "Word32Ror", kMipsRor, kMachInt32}};
|
||||
{&RawMachineAssembler::WordShl, "WordShl", kMipsShl, MachineType::Int16()},
|
||||
{&RawMachineAssembler::WordShr, "WordShr", kMipsShr, MachineType::Int16()},
|
||||
{&RawMachineAssembler::WordSar, "WordSar", kMipsSar, MachineType::Int16()},
|
||||
{&RawMachineAssembler::WordRor, "WordRor", kMipsRor, MachineType::Int16()},
|
||||
{&RawMachineAssembler::Word32Shl, "Word32Shl", kMipsShl,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Word32Shr, "Word32Shr", kMipsShr,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Word32Sar, "Word32Sar", kMipsSar,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Word32Ror, "Word32Ror", kMipsRor,
|
||||
MachineType::Int32()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -99,11 +105,16 @@ const MachInst2 kShiftInstructions[] = {
|
||||
|
||||
|
||||
const MachInst2 kMulDivInstructions[] = {
|
||||
{&RawMachineAssembler::Int32Mul, "Int32Mul", kMipsMul, kMachInt32},
|
||||
{&RawMachineAssembler::Int32Div, "Int32Div", kMipsDiv, kMachInt32},
|
||||
{&RawMachineAssembler::Uint32Div, "Uint32Div", kMipsDivU, kMachUint32},
|
||||
{&RawMachineAssembler::Float64Mul, "Float64Mul", kMipsMulD, kMachFloat64},
|
||||
{&RawMachineAssembler::Float64Div, "Float64Div", kMipsDivD, kMachFloat64}};
|
||||
{&RawMachineAssembler::Int32Mul, "Int32Mul", kMipsMul,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Int32Div, "Int32Div", kMipsDiv,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Uint32Div, "Uint32Div", kMipsDivU,
|
||||
MachineType::Uint32()},
|
||||
{&RawMachineAssembler::Float64Mul, "Float64Mul", kMipsMulD,
|
||||
MachineType::Float64()},
|
||||
{&RawMachineAssembler::Float64Div, "Float64Div", kMipsDivD,
|
||||
MachineType::Float64()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -112,9 +123,12 @@ const MachInst2 kMulDivInstructions[] = {
|
||||
|
||||
|
||||
const MachInst2 kModInstructions[] = {
|
||||
{&RawMachineAssembler::Int32Mod, "Int32Mod", kMipsMod, kMachInt32},
|
||||
{&RawMachineAssembler::Uint32Mod, "Int32UMod", kMipsModU, kMachInt32},
|
||||
{&RawMachineAssembler::Float64Mod, "Float64Mod", kMipsModD, kMachFloat64}};
|
||||
{&RawMachineAssembler::Int32Mod, "Int32Mod", kMipsMod,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Uint32Mod, "Int32UMod", kMipsModU,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Float64Mod, "Float64Mod", kMipsModD,
|
||||
MachineType::Float64()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -123,8 +137,10 @@ const MachInst2 kModInstructions[] = {
|
||||
|
||||
|
||||
const MachInst2 kFPArithInstructions[] = {
|
||||
{&RawMachineAssembler::Float64Add, "Float64Add", kMipsAddD, kMachFloat64},
|
||||
{&RawMachineAssembler::Float64Sub, "Float64Sub", kMipsSubD, kMachFloat64}};
|
||||
{&RawMachineAssembler::Float64Add, "Float64Add", kMipsAddD,
|
||||
MachineType::Float64()},
|
||||
{&RawMachineAssembler::Float64Sub, "Float64Sub", kMipsSubD,
|
||||
MachineType::Float64()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -133,12 +149,14 @@ const MachInst2 kFPArithInstructions[] = {
|
||||
|
||||
|
||||
const MachInst2 kAddSubInstructions[] = {
|
||||
{&RawMachineAssembler::Int32Add, "Int32Add", kMipsAdd, kMachInt32},
|
||||
{&RawMachineAssembler::Int32Sub, "Int32Sub", kMipsSub, kMachInt32},
|
||||
{&RawMachineAssembler::Int32Add, "Int32Add", kMipsAdd,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Int32Sub, "Int32Sub", kMipsSub,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Int32AddWithOverflow, "Int32AddWithOverflow",
|
||||
kMipsAddOvf, kMachInt32},
|
||||
kMipsAddOvf, MachineType::Int32()},
|
||||
{&RawMachineAssembler::Int32SubWithOverflow, "Int32SubWithOverflow",
|
||||
kMipsSubOvf, kMachInt32}};
|
||||
kMipsSubOvf, MachineType::Int32()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -147,9 +165,11 @@ const MachInst2 kAddSubInstructions[] = {
|
||||
|
||||
|
||||
const MachInst1 kAddSubOneInstructions[] = {
|
||||
{&RawMachineAssembler::Int32Neg, "Int32Neg", kMipsSub, kMachInt32},
|
||||
{&RawMachineAssembler::Int32Neg, "Int32Neg", kMipsSub,
|
||||
MachineType::Int32()},
|
||||
// TODO(dusmil): check this ...
|
||||
// {&RawMachineAssembler::WordEqual , "WordEqual" , kMipsTst, kMachInt32}
|
||||
// {&RawMachineAssembler::WordEqual , "WordEqual" , kMipsTst,
|
||||
// MachineType::Int32()}
|
||||
};
|
||||
|
||||
|
||||
@ -159,31 +179,35 @@ const MachInst1 kAddSubOneInstructions[] = {
|
||||
|
||||
|
||||
const IntCmp kCmpInstructions[] = {
|
||||
{{&RawMachineAssembler::WordEqual, "WordEqual", kMipsCmp, kMachInt16}, 1U},
|
||||
{{&RawMachineAssembler::WordNotEqual, "WordNotEqual", kMipsCmp, kMachInt16},
|
||||
{{&RawMachineAssembler::WordEqual, "WordEqual", kMipsCmp,
|
||||
MachineType::Int16()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Word32Equal, "Word32Equal", kMipsCmp, kMachInt32},
|
||||
{{&RawMachineAssembler::WordNotEqual, "WordNotEqual", kMipsCmp,
|
||||
MachineType::Int16()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Word32Equal, "Word32Equal", kMipsCmp,
|
||||
MachineType::Int32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Word32NotEqual, "Word32NotEqual", kMipsCmp,
|
||||
kMachInt32},
|
||||
MachineType::Int32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kMipsCmp,
|
||||
kMachInt32},
|
||||
MachineType::Int32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual",
|
||||
kMipsCmp, kMachInt32},
|
||||
kMipsCmp, MachineType::Int32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Int32GreaterThan, "Int32GreaterThan", kMipsCmp,
|
||||
kMachInt32},
|
||||
MachineType::Int32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Int32GreaterThanOrEqual, "Int32GreaterThanOrEqual",
|
||||
kMipsCmp, kMachInt32},
|
||||
kMipsCmp, MachineType::Int32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Uint32LessThan, "Uint32LessThan", kMipsCmp,
|
||||
kMachUint32},
|
||||
MachineType::Uint32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Uint32LessThanOrEqual, "Uint32LessThanOrEqual",
|
||||
kMipsCmp, kMachUint32},
|
||||
kMipsCmp, MachineType::Uint32()},
|
||||
1U}};
|
||||
|
||||
|
||||
@ -200,37 +224,37 @@ const Conversion kConversionInstructions[] = {
|
||||
// integers.
|
||||
// mips instruction: cvt_d_w
|
||||
{{&RawMachineAssembler::ChangeInt32ToFloat64, "ChangeInt32ToFloat64",
|
||||
kMipsCvtDW, kMachFloat64},
|
||||
kMachInt32},
|
||||
kMipsCvtDW, MachineType::Float64()},
|
||||
MachineType::Int32()},
|
||||
|
||||
// mips instruction: cvt_d_uw
|
||||
{{&RawMachineAssembler::ChangeUint32ToFloat64, "ChangeUint32ToFloat64",
|
||||
kMipsCvtDUw, kMachFloat64},
|
||||
kMachInt32},
|
||||
kMipsCvtDUw, MachineType::Float64()},
|
||||
MachineType::Int32()},
|
||||
|
||||
// mips instruction: trunc_w_d
|
||||
{{&RawMachineAssembler::ChangeFloat64ToInt32, "ChangeFloat64ToInt32",
|
||||
kMipsTruncWD, kMachFloat64},
|
||||
kMachInt32},
|
||||
kMipsTruncWD, MachineType::Float64()},
|
||||
MachineType::Int32()},
|
||||
|
||||
// mips instruction: trunc_uw_d
|
||||
{{&RawMachineAssembler::ChangeFloat64ToUint32, "ChangeFloat64ToUint32",
|
||||
kMipsTruncUwD, kMachFloat64},
|
||||
kMachInt32}};
|
||||
kMipsTruncUwD, MachineType::Float64()},
|
||||
MachineType::Int32()}};
|
||||
|
||||
const Conversion kFloat64RoundInstructions[] = {
|
||||
{{&RawMachineAssembler::Float64RoundUp, "Float64RoundUp", kMipsCeilWD,
|
||||
kMachFloat64},
|
||||
kMachInt32},
|
||||
MachineType::Float64()},
|
||||
MachineType::Int32()},
|
||||
{{&RawMachineAssembler::Float64RoundDown, "Float64RoundDown", kMipsFloorWD,
|
||||
kMachFloat64},
|
||||
kMachInt32},
|
||||
MachineType::Float64()},
|
||||
MachineType::Int32()},
|
||||
{{&RawMachineAssembler::Float64RoundTiesEven, "Float64RoundTiesEven",
|
||||
kMipsRoundWD, kMachFloat64},
|
||||
kMachInt32},
|
||||
kMipsRoundWD, MachineType::Float64()},
|
||||
MachineType::Int32()},
|
||||
{{&RawMachineAssembler::Float64RoundTruncate, "Float64RoundTruncate",
|
||||
kMipsTruncWD, kMachFloat64},
|
||||
kMachInt32}};
|
||||
kMipsTruncWD, MachineType::Float64()},
|
||||
MachineType::Int32()}};
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -240,7 +264,8 @@ typedef InstructionSelectorTestWithParam<FPCmp> InstructionSelectorFPCmpTest;
|
||||
|
||||
TEST_P(InstructionSelectorFPCmpTest, Parameter) {
|
||||
const FPCmp cmp = GetParam();
|
||||
StreamBuilder m(this, kMachInt32, cmp.mi.machine_type, cmp.mi.machine_type);
|
||||
StreamBuilder m(this, MachineType::Int32(), cmp.mi.machine_type,
|
||||
cmp.mi.machine_type);
|
||||
m.Return((m.*cmp.mi.constructor)(m.Parameter(0), m.Parameter(1)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -292,7 +317,8 @@ typedef InstructionSelectorTestWithParam<MachInst2>
|
||||
TEST_P(InstructionSelectorShiftTest, Immediate) {
|
||||
const MachInst2 dpi = GetParam();
|
||||
const MachineType type = dpi.machine_type;
|
||||
TRACED_FORRANGE(int32_t, imm, 0, (ElementSizeOf(type) * 8) - 1) {
|
||||
TRACED_FORRANGE(int32_t, imm, 0,
|
||||
((1 << ElementSizeLog2Of(type.representation())) * 8) - 1) {
|
||||
StreamBuilder m(this, type, type);
|
||||
m.Return((m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm)));
|
||||
Stream s = m.Build();
|
||||
@ -319,7 +345,7 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) {
|
||||
uint32_t jnk = rng()->NextInt();
|
||||
jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0;
|
||||
uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk;
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Shr(m.Word32And(m.Parameter(0), m.Int32Constant(msk)),
|
||||
m.Int32Constant(shift)));
|
||||
Stream s = m.Build();
|
||||
@ -336,7 +362,7 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) {
|
||||
uint32_t jnk = rng()->NextInt();
|
||||
jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0;
|
||||
uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk;
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Shr(m.Word32And(m.Int32Constant(msk), m.Parameter(0)),
|
||||
m.Int32Constant(shift)));
|
||||
Stream s = m.Build();
|
||||
@ -352,7 +378,7 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word32ShlWithWord32And) {
|
||||
TRACED_FORRANGE(int32_t, shift, 0, 30) {
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const r =
|
||||
m.Word32Shl(m.Word32And(p0, m.Int32Constant((1 << (31 - shift)) - 1)),
|
||||
@ -397,7 +423,7 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorLogicalTest,
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word32XorMinusOneWithParameter) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Xor(m.Parameter(0), m.Int32Constant(-1)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -406,7 +432,7 @@ TEST_F(InstructionSelectorTest, Word32XorMinusOneWithParameter) {
|
||||
EXPECT_EQ(1U, s[0]->OutputCount());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Xor(m.Int32Constant(-1), m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -419,7 +445,7 @@ TEST_F(InstructionSelectorTest, Word32XorMinusOneWithParameter) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word32XorMinusOneWithWord32Or) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Xor(m.Word32Or(m.Parameter(0), m.Parameter(0)),
|
||||
m.Int32Constant(-1)));
|
||||
Stream s = m.Build();
|
||||
@ -429,7 +455,7 @@ TEST_F(InstructionSelectorTest, Word32XorMinusOneWithWord32Or) {
|
||||
EXPECT_EQ(1U, s[0]->OutputCount());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Xor(m.Int32Constant(-1),
|
||||
m.Word32Or(m.Parameter(0), m.Parameter(0))));
|
||||
Stream s = m.Build();
|
||||
@ -448,7 +474,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) {
|
||||
int32_t lsb = shift & 0x1f;
|
||||
TRACED_FORRANGE(int32_t, width, 1, 31) {
|
||||
uint32_t msk = (1 << width) - 1;
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32And(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)),
|
||||
m.Int32Constant(msk)));
|
||||
Stream s = m.Build();
|
||||
@ -464,7 +490,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) {
|
||||
int32_t lsb = shift & 0x1f;
|
||||
TRACED_FORRANGE(int32_t, width, 1, 31) {
|
||||
uint32_t msk = (1 << width) - 1;
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(
|
||||
m.Word32And(m.Int32Constant(msk),
|
||||
m.Word32Shr(m.Parameter(0), m.Int32Constant(shift))));
|
||||
@ -483,7 +509,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) {
|
||||
TEST_F(InstructionSelectorTest, Word32AndToClearBits) {
|
||||
TRACED_FORRANGE(int32_t, shift, 1, 31) {
|
||||
int32_t mask = ~((1 << shift) - 1);
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32And(m.Parameter(0), m.Int32Constant(mask)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -494,7 +520,7 @@ TEST_F(InstructionSelectorTest, Word32AndToClearBits) {
|
||||
}
|
||||
TRACED_FORRANGE(int32_t, shift, 1, 31) {
|
||||
int32_t mask = ~((1 << shift) - 1);
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32And(m.Int32Constant(mask), m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -698,13 +724,13 @@ struct MemoryAccess {
|
||||
|
||||
|
||||
static const MemoryAccess kMemoryAccesses[] = {
|
||||
{kMachInt8, kMipsLb, kMipsSb},
|
||||
{kMachUint8, kMipsLbu, kMipsSb},
|
||||
{kMachInt16, kMipsLh, kMipsSh},
|
||||
{kMachUint16, kMipsLhu, kMipsSh},
|
||||
{kMachInt32, kMipsLw, kMipsSw},
|
||||
{kMachFloat32, kMipsLwc1, kMipsSwc1},
|
||||
{kMachFloat64, kMipsLdc1, kMipsSdc1}};
|
||||
{MachineType::Int8(), kMipsLb, kMipsSb},
|
||||
{MachineType::Uint8(), kMipsLbu, kMipsSb},
|
||||
{MachineType::Int16(), kMipsLh, kMipsSh},
|
||||
{MachineType::Uint16(), kMipsLhu, kMipsSh},
|
||||
{MachineType::Int32(), kMipsLw, kMipsSw},
|
||||
{MachineType::Float32(), kMipsLwc1, kMipsSwc1},
|
||||
{MachineType::Float64(), kMipsLdc1, kMipsSdc1}};
|
||||
|
||||
|
||||
struct MemoryAccessImm {
|
||||
@ -743,49 +769,49 @@ std::ostream& operator<<(std::ostream& os, const MemoryAccessImm1& acc) {
|
||||
|
||||
|
||||
const MemoryAccessImm kMemoryAccessesImm[] = {
|
||||
{kMachInt8,
|
||||
{MachineType::Int8(),
|
||||
kMipsLb,
|
||||
kMipsSb,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachUint8,
|
||||
{MachineType::Uint8(),
|
||||
kMipsLbu,
|
||||
kMipsSb,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachInt16,
|
||||
{MachineType::Int16(),
|
||||
kMipsLh,
|
||||
kMipsSh,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachUint16,
|
||||
{MachineType::Uint16(),
|
||||
kMipsLhu,
|
||||
kMipsSh,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachInt32,
|
||||
{MachineType::Int32(),
|
||||
kMipsLw,
|
||||
kMipsSw,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachFloat32,
|
||||
{MachineType::Float32(),
|
||||
kMipsLwc1,
|
||||
kMipsSwc1,
|
||||
&InstructionSelectorTest::Stream::IsDouble,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachFloat64,
|
||||
{MachineType::Float64(),
|
||||
kMipsLdc1,
|
||||
kMipsSdc1,
|
||||
&InstructionSelectorTest::Stream::IsDouble,
|
||||
@ -795,37 +821,37 @@ const MemoryAccessImm kMemoryAccessesImm[] = {
|
||||
|
||||
|
||||
const MemoryAccessImm1 kMemoryAccessImmMoreThan16bit[] = {
|
||||
{kMachInt8,
|
||||
{MachineType::Int8(),
|
||||
kMipsLb,
|
||||
kMipsSb,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachInt8,
|
||||
{MachineType::Int8(),
|
||||
kMipsLbu,
|
||||
kMipsSb,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachInt16,
|
||||
{MachineType::Int16(),
|
||||
kMipsLh,
|
||||
kMipsSh,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachInt16,
|
||||
{MachineType::Int16(),
|
||||
kMipsLhu,
|
||||
kMipsSh,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachInt32,
|
||||
{MachineType::Int32(),
|
||||
kMipsLw,
|
||||
kMipsSw,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachFloat32,
|
||||
{MachineType::Float32(),
|
||||
kMipsLwc1,
|
||||
kMipsSwc1,
|
||||
&InstructionSelectorTest::Stream::IsDouble,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachFloat64,
|
||||
{MachineType::Float64(),
|
||||
kMipsLdc1,
|
||||
kMipsSdc1,
|
||||
&InstructionSelectorTest::Stream::IsDouble,
|
||||
@ -840,7 +866,8 @@ typedef InstructionSelectorTestWithParam<MemoryAccess>
|
||||
|
||||
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) {
|
||||
const MemoryAccess memacc = GetParam();
|
||||
StreamBuilder m(this, memacc.type, kMachPtr, kMachInt32);
|
||||
StreamBuilder m(this, memacc.type, MachineType::Pointer(),
|
||||
MachineType::Int32());
|
||||
m.Return(m.Load(memacc.type, m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -851,7 +878,8 @@ TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) {
|
||||
|
||||
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
|
||||
const MemoryAccess memacc = GetParam();
|
||||
StreamBuilder m(this, kMachInt32, kMachPtr, kMachInt32, memacc.type);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(),
|
||||
MachineType::Int32(), memacc.type);
|
||||
m.Store(memacc.type, m.Parameter(0), m.Parameter(1), kNoWriteBarrier);
|
||||
m.Return(m.Int32Constant(0));
|
||||
Stream s = m.Build();
|
||||
@ -878,7 +906,7 @@ typedef InstructionSelectorTestWithParam<MemoryAccessImm>
|
||||
TEST_P(InstructionSelectorMemoryAccessImmTest, LoadWithImmediateIndex) {
|
||||
const MemoryAccessImm memacc = GetParam();
|
||||
TRACED_FOREACH(int32_t, index, memacc.immediates) {
|
||||
StreamBuilder m(this, memacc.type, kMachPtr);
|
||||
StreamBuilder m(this, memacc.type, MachineType::Pointer());
|
||||
m.Return(m.Load(memacc.type, m.Parameter(0), m.Int32Constant(index)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -901,7 +929,8 @@ TEST_P(InstructionSelectorMemoryAccessImmTest, LoadWithImmediateIndex) {
|
||||
TEST_P(InstructionSelectorMemoryAccessImmTest, StoreWithImmediateIndex) {
|
||||
const MemoryAccessImm memacc = GetParam();
|
||||
TRACED_FOREACH(int32_t, index, memacc.immediates) {
|
||||
StreamBuilder m(this, kMachInt32, kMachPtr, memacc.type);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(),
|
||||
memacc.type);
|
||||
m.Store(memacc.type, m.Parameter(0), m.Int32Constant(index), m.Parameter(1),
|
||||
kNoWriteBarrier);
|
||||
m.Return(m.Int32Constant(0));
|
||||
@ -935,7 +964,7 @@ TEST_P(InstructionSelectorMemoryAccessImmMoreThan16bitTest,
|
||||
LoadWithImmediateIndex) {
|
||||
const MemoryAccessImm1 memacc = GetParam();
|
||||
TRACED_FOREACH(int32_t, index, memacc.immediates) {
|
||||
StreamBuilder m(this, memacc.type, kMachPtr);
|
||||
StreamBuilder m(this, memacc.type, MachineType::Pointer());
|
||||
m.Return(m.Load(memacc.type, m.Parameter(0), m.Int32Constant(index)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(2U, s.size());
|
||||
@ -953,7 +982,8 @@ TEST_P(InstructionSelectorMemoryAccessImmMoreThan16bitTest,
|
||||
StoreWithImmediateIndex) {
|
||||
const MemoryAccessImm1 memacc = GetParam();
|
||||
TRACED_FOREACH(int32_t, index, memacc.immediates) {
|
||||
StreamBuilder m(this, kMachInt32, kMachPtr, memacc.type);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(),
|
||||
memacc.type);
|
||||
m.Store(memacc.type, m.Parameter(0), m.Int32Constant(index), m.Parameter(1),
|
||||
kNoWriteBarrier);
|
||||
m.Return(m.Int32Constant(0));
|
||||
@ -981,7 +1011,7 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word32EqualWithZero) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Equal(m.Parameter(0), m.Int32Constant(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -993,7 +1023,7 @@ TEST_F(InstructionSelectorTest, Word32EqualWithZero) {
|
||||
EXPECT_EQ(kEqual, s[0]->flags_condition());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Equal(m.Int32Constant(0), m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -1008,7 +1038,7 @@ TEST_F(InstructionSelectorTest, Word32EqualWithZero) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word32Clz) {
|
||||
StreamBuilder m(this, kMachUint32, kMachUint32);
|
||||
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Word32Clz(p0);
|
||||
m.Return(n);
|
||||
@ -1023,7 +1053,7 @@ TEST_F(InstructionSelectorTest, Word32Clz) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float32Abs) {
|
||||
StreamBuilder m(this, kMachFloat32, kMachFloat32);
|
||||
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Float32Abs(p0);
|
||||
m.Return(n);
|
||||
@ -1038,7 +1068,7 @@ TEST_F(InstructionSelectorTest, Float32Abs) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float64Abs) {
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Float64Abs(p0);
|
||||
m.Return(n);
|
||||
@ -1053,7 +1083,8 @@ TEST_F(InstructionSelectorTest, Float64Abs) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float32Max) {
|
||||
StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32);
|
||||
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(),
|
||||
MachineType::Float32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const p1 = m.Parameter(1);
|
||||
Node* const n = m.Float32Max(p0, p1);
|
||||
@ -1069,7 +1100,8 @@ TEST_F(InstructionSelectorTest, Float32Max) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float32Min) {
|
||||
StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32);
|
||||
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(),
|
||||
MachineType::Float32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const p1 = m.Parameter(1);
|
||||
Node* const n = m.Float32Min(p0, p1);
|
||||
@ -1085,7 +1117,8 @@ TEST_F(InstructionSelectorTest, Float32Min) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float64Max) {
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
|
||||
MachineType::Float64());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const p1 = m.Parameter(1);
|
||||
Node* const n = m.Float64Max(p0, p1);
|
||||
@ -1101,7 +1134,8 @@ TEST_F(InstructionSelectorTest, Float64Max) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float64Min) {
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
|
||||
MachineType::Float64());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const p1 = m.Parameter(1);
|
||||
Node* const n = m.Float64Min(p0, p1);
|
||||
|
@ -41,19 +41,19 @@ struct FPCmp {
|
||||
|
||||
const FPCmp kFPCmpInstructions[] = {
|
||||
{{&RawMachineAssembler::Float64Equal, "Float64Equal", kMips64CmpD,
|
||||
kMachFloat64},
|
||||
MachineType::Float64()},
|
||||
kEqual},
|
||||
{{&RawMachineAssembler::Float64LessThan, "Float64LessThan", kMips64CmpD,
|
||||
kMachFloat64},
|
||||
MachineType::Float64()},
|
||||
kUnsignedLessThan},
|
||||
{{&RawMachineAssembler::Float64LessThanOrEqual, "Float64LessThanOrEqual",
|
||||
kMips64CmpD, kMachFloat64},
|
||||
kMips64CmpD, MachineType::Float64()},
|
||||
kUnsignedLessThanOrEqual},
|
||||
{{&RawMachineAssembler::Float64GreaterThan, "Float64GreaterThan",
|
||||
kMips64CmpD, kMachFloat64},
|
||||
kMips64CmpD, MachineType::Float64()},
|
||||
kUnsignedLessThan},
|
||||
{{&RawMachineAssembler::Float64GreaterThanOrEqual,
|
||||
"Float64GreaterThanOrEqual", kMips64CmpD, kMachFloat64},
|
||||
"Float64GreaterThanOrEqual", kMips64CmpD, MachineType::Float64()},
|
||||
kUnsignedLessThanOrEqual}};
|
||||
|
||||
struct Conversion {
|
||||
@ -69,12 +69,18 @@ struct Conversion {
|
||||
|
||||
|
||||
const MachInst2 kLogicalInstructions[] = {
|
||||
{&RawMachineAssembler::Word32And, "Word32And", kMips64And, kMachInt32},
|
||||
{&RawMachineAssembler::Word64And, "Word64And", kMips64And, kMachInt64},
|
||||
{&RawMachineAssembler::Word32Or, "Word32Or", kMips64Or, kMachInt32},
|
||||
{&RawMachineAssembler::Word64Or, "Word64Or", kMips64Or, kMachInt64},
|
||||
{&RawMachineAssembler::Word32Xor, "Word32Xor", kMips64Xor, kMachInt32},
|
||||
{&RawMachineAssembler::Word64Xor, "Word64Xor", kMips64Xor, kMachInt64}};
|
||||
{&RawMachineAssembler::Word32And, "Word32And", kMips64And,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Word64And, "Word64And", kMips64And,
|
||||
MachineType::Int64()},
|
||||
{&RawMachineAssembler::Word32Or, "Word32Or", kMips64Or,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Word64Or, "Word64Or", kMips64Or,
|
||||
MachineType::Int64()},
|
||||
{&RawMachineAssembler::Word32Xor, "Word32Xor", kMips64Xor,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Word64Xor, "Word64Xor", kMips64Xor,
|
||||
MachineType::Int64()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -83,14 +89,22 @@ const MachInst2 kLogicalInstructions[] = {
|
||||
|
||||
|
||||
const MachInst2 kShiftInstructions[] = {
|
||||
{&RawMachineAssembler::Word32Shl, "Word32Shl", kMips64Shl, kMachInt32},
|
||||
{&RawMachineAssembler::Word64Shl, "Word64Shl", kMips64Dshl, kMachInt64},
|
||||
{&RawMachineAssembler::Word32Shr, "Word32Shr", kMips64Shr, kMachInt32},
|
||||
{&RawMachineAssembler::Word64Shr, "Word64Shr", kMips64Dshr, kMachInt64},
|
||||
{&RawMachineAssembler::Word32Sar, "Word32Sar", kMips64Sar, kMachInt32},
|
||||
{&RawMachineAssembler::Word64Sar, "Word64Sar", kMips64Dsar, kMachInt64},
|
||||
{&RawMachineAssembler::Word32Ror, "Word32Ror", kMips64Ror, kMachInt32},
|
||||
{&RawMachineAssembler::Word64Ror, "Word64Ror", kMips64Dror, kMachInt64}};
|
||||
{&RawMachineAssembler::Word32Shl, "Word32Shl", kMips64Shl,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Word64Shl, "Word64Shl", kMips64Dshl,
|
||||
MachineType::Int64()},
|
||||
{&RawMachineAssembler::Word32Shr, "Word32Shr", kMips64Shr,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Word64Shr, "Word64Shr", kMips64Dshr,
|
||||
MachineType::Int64()},
|
||||
{&RawMachineAssembler::Word32Sar, "Word32Sar", kMips64Sar,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Word64Sar, "Word64Sar", kMips64Dsar,
|
||||
MachineType::Int64()},
|
||||
{&RawMachineAssembler::Word32Ror, "Word32Ror", kMips64Ror,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Word64Ror, "Word64Ror", kMips64Dror,
|
||||
MachineType::Int64()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -99,15 +113,22 @@ const MachInst2 kShiftInstructions[] = {
|
||||
|
||||
|
||||
const MachInst2 kMulDivInstructions[] = {
|
||||
{&RawMachineAssembler::Int32Mul, "Int32Mul", kMips64Mul, kMachInt32},
|
||||
{&RawMachineAssembler::Int32Div, "Int32Div", kMips64Div, kMachInt32},
|
||||
{&RawMachineAssembler::Uint32Div, "Uint32Div", kMips64DivU, kMachUint32},
|
||||
{&RawMachineAssembler::Int64Mul, "Int64Mul", kMips64Dmul, kMachInt64},
|
||||
{&RawMachineAssembler::Int64Div, "Int64Div", kMips64Ddiv, kMachInt64},
|
||||
{&RawMachineAssembler::Uint64Div, "Uint64Div", kMips64DdivU, kMachUint64},
|
||||
{&RawMachineAssembler::Float64Mul, "Float64Mul", kMips64MulD, kMachFloat64},
|
||||
{&RawMachineAssembler::Int32Mul, "Int32Mul", kMips64Mul,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Int32Div, "Int32Div", kMips64Div,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Uint32Div, "Uint32Div", kMips64DivU,
|
||||
MachineType::Uint32()},
|
||||
{&RawMachineAssembler::Int64Mul, "Int64Mul", kMips64Dmul,
|
||||
MachineType::Int64()},
|
||||
{&RawMachineAssembler::Int64Div, "Int64Div", kMips64Ddiv,
|
||||
MachineType::Int64()},
|
||||
{&RawMachineAssembler::Uint64Div, "Uint64Div", kMips64DdivU,
|
||||
MachineType::Uint64()},
|
||||
{&RawMachineAssembler::Float64Mul, "Float64Mul", kMips64MulD,
|
||||
MachineType::Float64()},
|
||||
{&RawMachineAssembler::Float64Div, "Float64Div", kMips64DivD,
|
||||
kMachFloat64}};
|
||||
MachineType::Float64()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -116,10 +137,12 @@ const MachInst2 kMulDivInstructions[] = {
|
||||
|
||||
|
||||
const MachInst2 kModInstructions[] = {
|
||||
{&RawMachineAssembler::Int32Mod, "Int32Mod", kMips64Mod, kMachInt32},
|
||||
{&RawMachineAssembler::Uint32Mod, "Uint32Mod", kMips64ModU, kMachInt32},
|
||||
{&RawMachineAssembler::Int32Mod, "Int32Mod", kMips64Mod,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Uint32Mod, "Uint32Mod", kMips64ModU,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Float64Mod, "Float64Mod", kMips64ModD,
|
||||
kMachFloat64}};
|
||||
MachineType::Float64()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -128,9 +151,10 @@ const MachInst2 kModInstructions[] = {
|
||||
|
||||
|
||||
const MachInst2 kFPArithInstructions[] = {
|
||||
{&RawMachineAssembler::Float64Add, "Float64Add", kMips64AddD, kMachFloat64},
|
||||
{&RawMachineAssembler::Float64Add, "Float64Add", kMips64AddD,
|
||||
MachineType::Float64()},
|
||||
{&RawMachineAssembler::Float64Sub, "Float64Sub", kMips64SubD,
|
||||
kMachFloat64}};
|
||||
MachineType::Float64()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -139,10 +163,14 @@ const MachInst2 kFPArithInstructions[] = {
|
||||
|
||||
|
||||
const MachInst2 kAddSubInstructions[] = {
|
||||
{&RawMachineAssembler::Int32Add, "Int32Add", kMips64Add, kMachInt32},
|
||||
{&RawMachineAssembler::Int64Add, "Int64Add", kMips64Dadd, kMachInt64},
|
||||
{&RawMachineAssembler::Int32Sub, "Int32Sub", kMips64Sub, kMachInt32},
|
||||
{&RawMachineAssembler::Int64Sub, "Int64Sub", kMips64Dsub, kMachInt64}};
|
||||
{&RawMachineAssembler::Int32Add, "Int32Add", kMips64Add,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Int64Add, "Int64Add", kMips64Dadd,
|
||||
MachineType::Int64()},
|
||||
{&RawMachineAssembler::Int32Sub, "Int32Sub", kMips64Sub,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Int64Sub, "Int64Sub", kMips64Dsub,
|
||||
MachineType::Int64()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -151,8 +179,10 @@ const MachInst2 kAddSubInstructions[] = {
|
||||
|
||||
|
||||
const MachInst1 kAddSubOneInstructions[] = {
|
||||
{&RawMachineAssembler::Int32Neg, "Int32Neg", kMips64Sub, kMachInt32},
|
||||
{&RawMachineAssembler::Int64Neg, "Int64Neg", kMips64Dsub, kMachInt64}};
|
||||
{&RawMachineAssembler::Int32Neg, "Int32Neg", kMips64Sub,
|
||||
MachineType::Int32()},
|
||||
{&RawMachineAssembler::Int64Neg, "Int64Neg", kMips64Dsub,
|
||||
MachineType::Int64()}};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -161,33 +191,35 @@ const MachInst1 kAddSubOneInstructions[] = {
|
||||
|
||||
|
||||
const IntCmp kCmpInstructions[] = {
|
||||
{{&RawMachineAssembler::WordEqual, "WordEqual", kMips64Cmp, kMachInt64},
|
||||
{{&RawMachineAssembler::WordEqual, "WordEqual", kMips64Cmp,
|
||||
MachineType::Int64()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::WordNotEqual, "WordNotEqual", kMips64Cmp,
|
||||
kMachInt64},
|
||||
MachineType::Int64()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Word32Equal, "Word32Equal", kMips64Cmp, kMachInt32},
|
||||
{{&RawMachineAssembler::Word32Equal, "Word32Equal", kMips64Cmp,
|
||||
MachineType::Int32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Word32NotEqual, "Word32NotEqual", kMips64Cmp,
|
||||
kMachInt32},
|
||||
MachineType::Int32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kMips64Cmp,
|
||||
kMachInt32},
|
||||
MachineType::Int32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual",
|
||||
kMips64Cmp, kMachInt32},
|
||||
kMips64Cmp, MachineType::Int32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Int32GreaterThan, "Int32GreaterThan", kMips64Cmp,
|
||||
kMachInt32},
|
||||
MachineType::Int32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Int32GreaterThanOrEqual, "Int32GreaterThanOrEqual",
|
||||
kMips64Cmp, kMachInt32},
|
||||
kMips64Cmp, MachineType::Int32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Uint32LessThan, "Uint32LessThan", kMips64Cmp,
|
||||
kMachUint32},
|
||||
MachineType::Uint32()},
|
||||
1U},
|
||||
{{&RawMachineAssembler::Uint32LessThanOrEqual, "Uint32LessThanOrEqual",
|
||||
kMips64Cmp, kMachUint32},
|
||||
kMips64Cmp, MachineType::Uint32()},
|
||||
1U}};
|
||||
|
||||
|
||||
@ -205,42 +237,42 @@ const Conversion kConversionInstructions[] = {
|
||||
// mips instructions:
|
||||
// mtc1, cvt.d.w
|
||||
{{&RawMachineAssembler::ChangeInt32ToFloat64, "ChangeInt32ToFloat64",
|
||||
kMips64CvtDW, kMachFloat64},
|
||||
kMachInt32},
|
||||
kMips64CvtDW, MachineType::Float64()},
|
||||
MachineType::Int32()},
|
||||
|
||||
// mips instructions:
|
||||
// cvt.d.uw
|
||||
{{&RawMachineAssembler::ChangeUint32ToFloat64, "ChangeUint32ToFloat64",
|
||||
kMips64CvtDUw, kMachFloat64},
|
||||
kMachInt32},
|
||||
kMips64CvtDUw, MachineType::Float64()},
|
||||
MachineType::Int32()},
|
||||
|
||||
// mips instructions:
|
||||
// mfc1, trunc double to word, for more details look at mips macro
|
||||
// asm and mips asm file
|
||||
{{&RawMachineAssembler::ChangeFloat64ToInt32, "ChangeFloat64ToInt32",
|
||||
kMips64TruncWD, kMachFloat64},
|
||||
kMachInt32},
|
||||
kMips64TruncWD, MachineType::Float64()},
|
||||
MachineType::Int32()},
|
||||
|
||||
// mips instructions:
|
||||
// trunc double to unsigned word, for more details look at mips macro
|
||||
// asm and mips asm file
|
||||
{{&RawMachineAssembler::ChangeFloat64ToUint32, "ChangeFloat64ToUint32",
|
||||
kMips64TruncUwD, kMachFloat64},
|
||||
kMachInt32}};
|
||||
kMips64TruncUwD, MachineType::Float64()},
|
||||
MachineType::Int32()}};
|
||||
|
||||
const Conversion kFloat64RoundInstructions[] = {
|
||||
{{&RawMachineAssembler::Float64RoundUp, "Float64RoundUp", kMips64CeilWD,
|
||||
kMachFloat64},
|
||||
kMachInt32},
|
||||
MachineType::Float64()},
|
||||
MachineType::Int32()},
|
||||
{{&RawMachineAssembler::Float64RoundDown, "Float64RoundDown",
|
||||
kMips64FloorWD, kMachFloat64},
|
||||
kMachInt32},
|
||||
kMips64FloorWD, MachineType::Float64()},
|
||||
MachineType::Int32()},
|
||||
{{&RawMachineAssembler::Float64RoundTiesEven, "Float64RoundTiesEven",
|
||||
kMips64RoundWD, kMachFloat64},
|
||||
kMachInt32},
|
||||
kMips64RoundWD, MachineType::Float64()},
|
||||
MachineType::Int32()},
|
||||
{{&RawMachineAssembler::Float64RoundTruncate, "Float64RoundTruncate",
|
||||
kMips64TruncWD, kMachFloat64},
|
||||
kMachInt32}};
|
||||
kMips64TruncWD, MachineType::Float64()},
|
||||
MachineType::Int32()}};
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -249,7 +281,8 @@ typedef InstructionSelectorTestWithParam<FPCmp> InstructionSelectorFPCmpTest;
|
||||
|
||||
TEST_P(InstructionSelectorFPCmpTest, Parameter) {
|
||||
const FPCmp cmp = GetParam();
|
||||
StreamBuilder m(this, kMachInt32, cmp.mi.machine_type, cmp.mi.machine_type);
|
||||
StreamBuilder m(this, MachineType::Int32(), cmp.mi.machine_type,
|
||||
cmp.mi.machine_type);
|
||||
m.Return((m.*cmp.mi.constructor)(m.Parameter(0), m.Parameter(1)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -293,7 +326,8 @@ typedef InstructionSelectorTestWithParam<MachInst2>
|
||||
TEST_P(InstructionSelectorShiftTest, Immediate) {
|
||||
const MachInst2 dpi = GetParam();
|
||||
const MachineType type = dpi.machine_type;
|
||||
TRACED_FORRANGE(int32_t, imm, 0, (ElementSizeOf(type) * 8) - 1) {
|
||||
TRACED_FORRANGE(int32_t, imm, 0,
|
||||
((1 << ElementSizeLog2Of(type.representation())) * 8) - 1) {
|
||||
StreamBuilder m(this, type, type);
|
||||
m.Return((m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm)));
|
||||
Stream s = m.Build();
|
||||
@ -318,7 +352,7 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) {
|
||||
uint32_t jnk = rng()->NextInt();
|
||||
jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0;
|
||||
uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk;
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Shr(m.Word32And(m.Parameter(0), m.Int32Constant(msk)),
|
||||
m.Int32Constant(shift)));
|
||||
Stream s = m.Build();
|
||||
@ -335,7 +369,7 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) {
|
||||
uint32_t jnk = rng()->NextInt();
|
||||
jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0;
|
||||
uint32_t msk = ((0xffffffffu >> (32 - width)) << lsb) | jnk;
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Shr(m.Word32And(m.Int32Constant(msk), m.Parameter(0)),
|
||||
m.Int32Constant(shift)));
|
||||
Stream s = m.Build();
|
||||
@ -359,7 +393,7 @@ TEST_F(InstructionSelectorTest, Word64ShrWithWord64AndWithImmediate) {
|
||||
jnk = (lsb > 0) ? (jnk >> (64 - lsb)) : 0;
|
||||
uint64_t msk =
|
||||
((V8_UINT64_C(0xffffffffffffffff) >> (64 - width)) << lsb) | jnk;
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(m.Word64Shr(m.Word64And(m.Parameter(0), m.Int64Constant(msk)),
|
||||
m.Int64Constant(shift)));
|
||||
Stream s = m.Build();
|
||||
@ -377,7 +411,7 @@ TEST_F(InstructionSelectorTest, Word64ShrWithWord64AndWithImmediate) {
|
||||
jnk = (lsb > 0) ? (jnk >> (64 - lsb)) : 0;
|
||||
uint64_t msk =
|
||||
((V8_UINT64_C(0xffffffffffffffff) >> (64 - width)) << lsb) | jnk;
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(m.Word64Shr(m.Word64And(m.Int64Constant(msk), m.Parameter(0)),
|
||||
m.Int64Constant(shift)));
|
||||
Stream s = m.Build();
|
||||
@ -394,7 +428,7 @@ TEST_F(InstructionSelectorTest, Word64ShrWithWord64AndWithImmediate) {
|
||||
TEST_F(InstructionSelectorTest, Word32AndToClearBits) {
|
||||
TRACED_FORRANGE(int32_t, shift, 1, 31) {
|
||||
int32_t mask = ~((1 << shift) - 1);
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32And(m.Parameter(0), m.Int32Constant(mask)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -405,7 +439,7 @@ TEST_F(InstructionSelectorTest, Word32AndToClearBits) {
|
||||
}
|
||||
TRACED_FORRANGE(int32_t, shift, 1, 31) {
|
||||
int32_t mask = ~((1 << shift) - 1);
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32And(m.Int32Constant(mask), m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -420,7 +454,7 @@ TEST_F(InstructionSelectorTest, Word32AndToClearBits) {
|
||||
TEST_F(InstructionSelectorTest, Word64AndToClearBits) {
|
||||
TRACED_FORRANGE(int32_t, shift, 1, 31) {
|
||||
int64_t mask = ~((1 << shift) - 1);
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(m.Word64And(m.Parameter(0), m.Int64Constant(mask)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -431,7 +465,7 @@ TEST_F(InstructionSelectorTest, Word64AndToClearBits) {
|
||||
}
|
||||
TRACED_FORRANGE(int32_t, shift, 1, 31) {
|
||||
int64_t mask = ~((1 << shift) - 1);
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(m.Word64And(m.Int64Constant(mask), m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -468,7 +502,7 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorLogicalTest,
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word64XorMinusOneWithParameter) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(m.Word64Xor(m.Parameter(0), m.Int64Constant(-1)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -477,7 +511,7 @@ TEST_F(InstructionSelectorTest, Word64XorMinusOneWithParameter) {
|
||||
EXPECT_EQ(1U, s[0]->OutputCount());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(m.Word64Xor(m.Int64Constant(-1), m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -490,7 +524,7 @@ TEST_F(InstructionSelectorTest, Word64XorMinusOneWithParameter) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word32XorMinusOneWithParameter) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Xor(m.Parameter(0), m.Int32Constant(-1)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -499,7 +533,7 @@ TEST_F(InstructionSelectorTest, Word32XorMinusOneWithParameter) {
|
||||
EXPECT_EQ(1U, s[0]->OutputCount());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Xor(m.Int32Constant(-1), m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -512,7 +546,7 @@ TEST_F(InstructionSelectorTest, Word32XorMinusOneWithParameter) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word64XorMinusOneWithWord64Or) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(m.Word64Xor(m.Word64Or(m.Parameter(0), m.Parameter(0)),
|
||||
m.Int64Constant(-1)));
|
||||
Stream s = m.Build();
|
||||
@ -522,7 +556,7 @@ TEST_F(InstructionSelectorTest, Word64XorMinusOneWithWord64Or) {
|
||||
EXPECT_EQ(1U, s[0]->OutputCount());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(m.Word64Xor(m.Int64Constant(-1),
|
||||
m.Word64Or(m.Parameter(0), m.Parameter(0))));
|
||||
Stream s = m.Build();
|
||||
@ -536,7 +570,7 @@ TEST_F(InstructionSelectorTest, Word64XorMinusOneWithWord64Or) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word32XorMinusOneWithWord32Or) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Xor(m.Word32Or(m.Parameter(0), m.Parameter(0)),
|
||||
m.Int32Constant(-1)));
|
||||
Stream s = m.Build();
|
||||
@ -546,7 +580,7 @@ TEST_F(InstructionSelectorTest, Word32XorMinusOneWithWord32Or) {
|
||||
EXPECT_EQ(1U, s[0]->OutputCount());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Xor(m.Int32Constant(-1),
|
||||
m.Word32Or(m.Parameter(0), m.Parameter(0))));
|
||||
Stream s = m.Build();
|
||||
@ -565,7 +599,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) {
|
||||
int32_t lsb = shift & 0x1f;
|
||||
TRACED_FORRANGE(int32_t, width, 1, 31) {
|
||||
uint32_t msk = (1 << width) - 1;
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32And(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)),
|
||||
m.Int32Constant(msk)));
|
||||
Stream s = m.Build();
|
||||
@ -581,7 +615,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) {
|
||||
int32_t lsb = shift & 0x1f;
|
||||
TRACED_FORRANGE(int32_t, width, 1, 31) {
|
||||
uint32_t msk = (1 << width) - 1;
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(
|
||||
m.Word32And(m.Int32Constant(msk),
|
||||
m.Word32Shr(m.Parameter(0), m.Int32Constant(shift))));
|
||||
@ -604,7 +638,7 @@ TEST_F(InstructionSelectorTest, Word64AndWithImmediateWithWord64Shr) {
|
||||
int64_t lsb = shift & 0x3f;
|
||||
TRACED_FORRANGE(int64_t, width, 1, 63) {
|
||||
uint64_t msk = (V8_UINT64_C(1) << width) - 1;
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(m.Word64And(m.Word64Shr(m.Parameter(0), m.Int64Constant(shift)),
|
||||
m.Int64Constant(msk)));
|
||||
Stream s = m.Build();
|
||||
@ -620,7 +654,7 @@ TEST_F(InstructionSelectorTest, Word64AndWithImmediateWithWord64Shr) {
|
||||
int64_t lsb = shift & 0x3f;
|
||||
TRACED_FORRANGE(int64_t, width, 1, 63) {
|
||||
uint64_t msk = (V8_UINT64_C(1) << width) - 1;
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(
|
||||
m.Word64And(m.Int64Constant(msk),
|
||||
m.Word64Shr(m.Parameter(0), m.Int64Constant(shift))));
|
||||
@ -638,7 +672,7 @@ TEST_F(InstructionSelectorTest, Word64AndWithImmediateWithWord64Shr) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word32ShlWithWord32And) {
|
||||
TRACED_FORRANGE(int32_t, shift, 0, 30) {
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const r =
|
||||
m.Word32Shl(m.Word32And(p0, m.Int32Constant((1 << (31 - shift)) - 1)),
|
||||
@ -657,7 +691,7 @@ TEST_F(InstructionSelectorTest, Word32ShlWithWord32And) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word64ShlWithWord64And) {
|
||||
TRACED_FORRANGE(int32_t, shift, 0, 62) {
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const r =
|
||||
m.Word64Shl(m.Word64And(p0, m.Int64Constant((1L << (63 - shift)) - 1)),
|
||||
@ -803,7 +837,7 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
|
||||
|
||||
TEST_F(InstructionSelectorTest, ChangesFromToSmi) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.TruncateInt64ToInt32(
|
||||
m.Word64Sar(m.Parameter(0), m.Int32Constant(32))));
|
||||
Stream s = m.Build();
|
||||
@ -814,7 +848,7 @@ TEST_F(InstructionSelectorTest, ChangesFromToSmi) {
|
||||
EXPECT_EQ(1U, s[0]->OutputCount());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(
|
||||
m.Word64Shl(m.ChangeInt32ToInt64(m.Parameter(0)), m.Int32Constant(32)));
|
||||
Stream s = m.Build();
|
||||
@ -850,7 +884,7 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
|
||||
|
||||
TEST_F(InstructionSelectorTest, CombineShiftsWithMul) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Int32Mul(m.Word64Sar(m.Parameter(0), m.Int32Constant(32)),
|
||||
m.Word64Sar(m.Parameter(0), m.Int32Constant(32))));
|
||||
Stream s = m.Build();
|
||||
@ -865,7 +899,7 @@ TEST_F(InstructionSelectorTest, CombineShiftsWithMul) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, CombineShiftsWithDivMod) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Int32Div(m.Word64Sar(m.Parameter(0), m.Int32Constant(32)),
|
||||
m.Word64Sar(m.Parameter(0), m.Int32Constant(32))));
|
||||
Stream s = m.Build();
|
||||
@ -876,7 +910,7 @@ TEST_F(InstructionSelectorTest, CombineShiftsWithDivMod) {
|
||||
EXPECT_EQ(1U, s[0]->OutputCount());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Int32Mod(m.Word64Sar(m.Parameter(0), m.Int32Constant(32)),
|
||||
m.Word64Sar(m.Parameter(0), m.Int32Constant(32))));
|
||||
Stream s = m.Build();
|
||||
@ -903,14 +937,14 @@ struct MemoryAccess {
|
||||
};
|
||||
|
||||
static const MemoryAccess kMemoryAccesses[] = {
|
||||
{kMachInt8, kMips64Lb, kMips64Sb},
|
||||
{kMachUint8, kMips64Lbu, kMips64Sb},
|
||||
{kMachInt16, kMips64Lh, kMips64Sh},
|
||||
{kMachUint16, kMips64Lhu, kMips64Sh},
|
||||
{kMachInt32, kMips64Lw, kMips64Sw},
|
||||
{kMachFloat32, kMips64Lwc1, kMips64Swc1},
|
||||
{kMachFloat64, kMips64Ldc1, kMips64Sdc1},
|
||||
{kMachInt64, kMips64Ld, kMips64Sd}};
|
||||
{MachineType::Int8(), kMips64Lb, kMips64Sb},
|
||||
{MachineType::Uint8(), kMips64Lbu, kMips64Sb},
|
||||
{MachineType::Int16(), kMips64Lh, kMips64Sh},
|
||||
{MachineType::Uint16(), kMips64Lhu, kMips64Sh},
|
||||
{MachineType::Int32(), kMips64Lw, kMips64Sw},
|
||||
{MachineType::Float32(), kMips64Lwc1, kMips64Swc1},
|
||||
{MachineType::Float64(), kMips64Ldc1, kMips64Sdc1},
|
||||
{MachineType::Int64(), kMips64Ld, kMips64Sd}};
|
||||
|
||||
|
||||
struct MemoryAccessImm {
|
||||
@ -949,56 +983,56 @@ std::ostream& operator<<(std::ostream& os, const MemoryAccessImm1& acc) {
|
||||
|
||||
|
||||
const MemoryAccessImm kMemoryAccessesImm[] = {
|
||||
{kMachInt8,
|
||||
{MachineType::Int8(),
|
||||
kMips64Lb,
|
||||
kMips64Sb,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachUint8,
|
||||
{MachineType::Uint8(),
|
||||
kMips64Lbu,
|
||||
kMips64Sb,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachInt16,
|
||||
{MachineType::Int16(),
|
||||
kMips64Lh,
|
||||
kMips64Sh,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachUint16,
|
||||
{MachineType::Uint16(),
|
||||
kMips64Lhu,
|
||||
kMips64Sh,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachInt32,
|
||||
{MachineType::Int32(),
|
||||
kMips64Lw,
|
||||
kMips64Sw,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachFloat32,
|
||||
{MachineType::Float32(),
|
||||
kMips64Lwc1,
|
||||
kMips64Swc1,
|
||||
&InstructionSelectorTest::Stream::IsDouble,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachFloat64,
|
||||
{MachineType::Float64(),
|
||||
kMips64Ldc1,
|
||||
kMips64Sdc1,
|
||||
&InstructionSelectorTest::Stream::IsDouble,
|
||||
{-4095, -3340, -3231, -3224, -3088, -1758, -1203, -123, -117, -91, -89,
|
||||
-87, -86, -82, -44, -23, -3, 0, 7, 10, 39, 52, 69, 71, 91, 92, 107, 109,
|
||||
115, 124, 286, 655, 1362, 1569, 2587, 3067, 3096, 3462, 3510, 4095}},
|
||||
{kMachInt64,
|
||||
{MachineType::Int64(),
|
||||
kMips64Ld,
|
||||
kMips64Sd,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
@ -1008,42 +1042,42 @@ const MemoryAccessImm kMemoryAccessesImm[] = {
|
||||
|
||||
|
||||
const MemoryAccessImm1 kMemoryAccessImmMoreThan16bit[] = {
|
||||
{kMachInt8,
|
||||
{MachineType::Int8(),
|
||||
kMips64Lb,
|
||||
kMips64Sb,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachInt8,
|
||||
{MachineType::Int8(),
|
||||
kMips64Lbu,
|
||||
kMips64Sb,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachInt16,
|
||||
{MachineType::Int16(),
|
||||
kMips64Lh,
|
||||
kMips64Sh,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachInt16,
|
||||
{MachineType::Int16(),
|
||||
kMips64Lhu,
|
||||
kMips64Sh,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachInt32,
|
||||
{MachineType::Int32(),
|
||||
kMips64Lw,
|
||||
kMips64Sw,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachFloat32,
|
||||
{MachineType::Float32(),
|
||||
kMips64Lwc1,
|
||||
kMips64Swc1,
|
||||
&InstructionSelectorTest::Stream::IsDouble,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachFloat64,
|
||||
{MachineType::Float64(),
|
||||
kMips64Ldc1,
|
||||
kMips64Sdc1,
|
||||
&InstructionSelectorTest::Stream::IsDouble,
|
||||
{-65000, -55000, 32777, 55000, 65000}},
|
||||
{kMachInt64,
|
||||
{MachineType::Int64(),
|
||||
kMips64Ld,
|
||||
kMips64Sd,
|
||||
&InstructionSelectorTest::Stream::IsInteger,
|
||||
@ -1057,7 +1091,8 @@ typedef InstructionSelectorTestWithParam<MemoryAccess>
|
||||
|
||||
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) {
|
||||
const MemoryAccess memacc = GetParam();
|
||||
StreamBuilder m(this, memacc.type, kMachPtr, kMachInt32);
|
||||
StreamBuilder m(this, memacc.type, MachineType::Pointer(),
|
||||
MachineType::Int32());
|
||||
m.Return(m.Load(memacc.type, m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -1068,7 +1103,8 @@ TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) {
|
||||
|
||||
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
|
||||
const MemoryAccess memacc = GetParam();
|
||||
StreamBuilder m(this, kMachInt32, kMachPtr, kMachInt32, memacc.type);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(),
|
||||
MachineType::Int32(), memacc.type);
|
||||
m.Store(memacc.type, m.Parameter(0), m.Parameter(1), kNoWriteBarrier);
|
||||
m.Return(m.Int32Constant(0));
|
||||
Stream s = m.Build();
|
||||
@ -1093,7 +1129,7 @@ typedef InstructionSelectorTestWithParam<MemoryAccessImm>
|
||||
TEST_P(InstructionSelectorMemoryAccessImmTest, LoadWithImmediateIndex) {
|
||||
const MemoryAccessImm memacc = GetParam();
|
||||
TRACED_FOREACH(int32_t, index, memacc.immediates) {
|
||||
StreamBuilder m(this, memacc.type, kMachPtr);
|
||||
StreamBuilder m(this, memacc.type, MachineType::Pointer());
|
||||
m.Return(m.Load(memacc.type, m.Parameter(0), m.Int32Constant(index)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -1116,7 +1152,8 @@ TEST_P(InstructionSelectorMemoryAccessImmTest, LoadWithImmediateIndex) {
|
||||
TEST_P(InstructionSelectorMemoryAccessImmTest, StoreWithImmediateIndex) {
|
||||
const MemoryAccessImm memacc = GetParam();
|
||||
TRACED_FOREACH(int32_t, index, memacc.immediates) {
|
||||
StreamBuilder m(this, kMachInt32, kMachPtr, memacc.type);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(),
|
||||
memacc.type);
|
||||
m.Store(memacc.type, m.Parameter(0), m.Int32Constant(index), m.Parameter(1),
|
||||
kNoWriteBarrier);
|
||||
m.Return(m.Int32Constant(0));
|
||||
@ -1148,7 +1185,7 @@ TEST_P(InstructionSelectorMemoryAccessImmMoreThan16bitTest,
|
||||
LoadWithImmediateIndex) {
|
||||
const MemoryAccessImm1 memacc = GetParam();
|
||||
TRACED_FOREACH(int32_t, index, memacc.immediates) {
|
||||
StreamBuilder m(this, memacc.type, kMachPtr);
|
||||
StreamBuilder m(this, memacc.type, MachineType::Pointer());
|
||||
m.Return(m.Load(memacc.type, m.Parameter(0), m.Int32Constant(index)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(2U, s.size());
|
||||
@ -1165,7 +1202,8 @@ TEST_P(InstructionSelectorMemoryAccessImmMoreThan16bitTest,
|
||||
StoreWithImmediateIndex) {
|
||||
const MemoryAccessImm1 memacc = GetParam();
|
||||
TRACED_FOREACH(int32_t, index, memacc.immediates) {
|
||||
StreamBuilder m(this, kMachInt32, kMachPtr, memacc.type);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(),
|
||||
memacc.type);
|
||||
m.Store(memacc.type, m.Parameter(0), m.Int32Constant(index), m.Parameter(1),
|
||||
kNoWriteBarrier);
|
||||
m.Return(m.Int32Constant(0));
|
||||
@ -1192,7 +1230,7 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word32EqualWithZero) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Equal(m.Parameter(0), m.Int32Constant(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -1204,7 +1242,7 @@ TEST_F(InstructionSelectorTest, Word32EqualWithZero) {
|
||||
EXPECT_EQ(kEqual, s[0]->flags_condition());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachInt32, kMachInt32);
|
||||
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
|
||||
m.Return(m.Word32Equal(m.Int32Constant(0), m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -1220,7 +1258,7 @@ TEST_F(InstructionSelectorTest, Word32EqualWithZero) {
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word64EqualWithZero) {
|
||||
{
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(m.Word64Equal(m.Parameter(0), m.Int64Constant(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -1232,7 +1270,7 @@ TEST_F(InstructionSelectorTest, Word64EqualWithZero) {
|
||||
EXPECT_EQ(kEqual, s[0]->flags_condition());
|
||||
}
|
||||
{
|
||||
StreamBuilder m(this, kMachInt64, kMachInt64);
|
||||
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
|
||||
m.Return(m.Word64Equal(m.Int32Constant(0), m.Parameter(0)));
|
||||
Stream s = m.Build();
|
||||
ASSERT_EQ(1U, s.size());
|
||||
@ -1247,7 +1285,7 @@ TEST_F(InstructionSelectorTest, Word64EqualWithZero) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word32Clz) {
|
||||
StreamBuilder m(this, kMachUint32, kMachUint32);
|
||||
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Word32Clz(p0);
|
||||
m.Return(n);
|
||||
@ -1262,7 +1300,7 @@ TEST_F(InstructionSelectorTest, Word32Clz) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Word64Clz) {
|
||||
StreamBuilder m(this, kMachUint64, kMachUint64);
|
||||
StreamBuilder m(this, MachineType::Uint64(), MachineType::Uint64());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Word64Clz(p0);
|
||||
m.Return(n);
|
||||
@ -1277,7 +1315,7 @@ TEST_F(InstructionSelectorTest, Word64Clz) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float32Abs) {
|
||||
StreamBuilder m(this, kMachFloat32, kMachFloat32);
|
||||
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Float32Abs(p0);
|
||||
m.Return(n);
|
||||
@ -1292,7 +1330,7 @@ TEST_F(InstructionSelectorTest, Float32Abs) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float64Abs) {
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const n = m.Float64Abs(p0);
|
||||
m.Return(n);
|
||||
@ -1307,7 +1345,8 @@ TEST_F(InstructionSelectorTest, Float64Abs) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float32Max) {
|
||||
StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32);
|
||||
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(),
|
||||
MachineType::Float32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const p1 = m.Parameter(1);
|
||||
Node* const n = m.Float32Max(p0, p1);
|
||||
@ -1323,7 +1362,8 @@ TEST_F(InstructionSelectorTest, Float32Max) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float32Min) {
|
||||
StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32);
|
||||
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(),
|
||||
MachineType::Float32());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const p1 = m.Parameter(1);
|
||||
Node* const n = m.Float32Min(p0, p1);
|
||||
@ -1339,7 +1379,8 @@ TEST_F(InstructionSelectorTest, Float32Min) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float64Max) {
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
|
||||
MachineType::Float64());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const p1 = m.Parameter(1);
|
||||
Node* const n = m.Float64Max(p0, p1);
|
||||
@ -1355,7 +1396,8 @@ TEST_F(InstructionSelectorTest, Float64Max) {
|
||||
|
||||
|
||||
TEST_F(InstructionSelectorTest, Float64Min) {
|
||||
StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
|
||||
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
|
||||
MachineType::Float64());
|
||||
Node* const p0 = m.Parameter(0);
|
||||
Node* const p1 = m.Parameter(1);
|
||||
Node* const n = m.Float64Min(p0, p1);
|
||||
|
@ -67,16 +67,16 @@ class MoveOptimizerTest : public InstructionSequenceTest {
|
||||
case kConstant:
|
||||
return ConstantOperand(op.value_);
|
||||
case kFixedSlot:
|
||||
return AllocatedOperand(LocationOperand::STACK_SLOT, kRepWord32,
|
||||
op.value_);
|
||||
return AllocatedOperand(LocationOperand::STACK_SLOT,
|
||||
MachineRepresentation::kWord32, op.value_);
|
||||
case kFixedRegister:
|
||||
CHECK(0 <= op.value_ && op.value_ < num_general_registers());
|
||||
return AllocatedOperand(LocationOperand::REGISTER, kRepWord32,
|
||||
op.value_);
|
||||
return AllocatedOperand(LocationOperand::REGISTER,
|
||||
MachineRepresentation::kWord32, op.value_);
|
||||
case kExplicit:
|
||||
CHECK(0 <= op.value_ && op.value_ < num_general_registers());
|
||||
return ExplicitOperand(LocationOperand::REGISTER, kRepWord32,
|
||||
op.value_);
|
||||
return ExplicitOperand(LocationOperand::REGISTER,
|
||||
MachineRepresentation::kWord32, op.value_);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ class IsConstantMatcher final : public NodeMatcher {
|
||||
|
||||
class IsSelectMatcher final : public NodeMatcher {
|
||||
public:
|
||||
IsSelectMatcher(const Matcher<MachineType>& type_matcher,
|
||||
IsSelectMatcher(const Matcher<MachineRepresentation>& type_matcher,
|
||||
const Matcher<Node*>& value0_matcher,
|
||||
const Matcher<Node*>& value1_matcher,
|
||||
const Matcher<Node*>& value2_matcher)
|
||||
@ -423,7 +423,7 @@ class IsSelectMatcher final : public NodeMatcher {
|
||||
|
||||
void DescribeTo(std::ostream* os) const final {
|
||||
NodeMatcher::DescribeTo(os);
|
||||
*os << " whose type (";
|
||||
*os << " whose representation (";
|
||||
type_matcher_.DescribeTo(os);
|
||||
*os << "), value0 (";
|
||||
value0_matcher_.DescribeTo(os);
|
||||
@ -435,19 +435,20 @@ class IsSelectMatcher final : public NodeMatcher {
|
||||
}
|
||||
|
||||
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
||||
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
||||
PrintMatchAndExplain(OpParameter<SelectParameters>(node).type(),
|
||||
"type", type_matcher_, listener) &&
|
||||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
||||
"value0", value0_matcher_, listener) &&
|
||||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
||||
"value1", value1_matcher_, listener) &&
|
||||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
|
||||
"value2", value2_matcher_, listener));
|
||||
return (
|
||||
NodeMatcher::MatchAndExplain(node, listener) &&
|
||||
PrintMatchAndExplain(SelectParametersOf(node->op()).representation(),
|
||||
"representation", type_matcher_, listener) &&
|
||||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "value0",
|
||||
value0_matcher_, listener) &&
|
||||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "value1",
|
||||
value1_matcher_, listener) &&
|
||||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), "value2",
|
||||
value2_matcher_, listener));
|
||||
}
|
||||
|
||||
private:
|
||||
const Matcher<MachineType> type_matcher_;
|
||||
const Matcher<MachineRepresentation> type_matcher_;
|
||||
const Matcher<Node*> value0_matcher_;
|
||||
const Matcher<Node*> value1_matcher_;
|
||||
const Matcher<Node*> value2_matcher_;
|
||||
@ -456,7 +457,7 @@ class IsSelectMatcher final : public NodeMatcher {
|
||||
|
||||
class IsPhiMatcher final : public NodeMatcher {
|
||||
public:
|
||||
IsPhiMatcher(const Matcher<MachineType>& type_matcher,
|
||||
IsPhiMatcher(const Matcher<MachineRepresentation>& type_matcher,
|
||||
const Matcher<Node*>& value0_matcher,
|
||||
const Matcher<Node*>& value1_matcher,
|
||||
const Matcher<Node*>& control_matcher)
|
||||
@ -468,7 +469,7 @@ class IsPhiMatcher final : public NodeMatcher {
|
||||
|
||||
void DescribeTo(std::ostream* os) const final {
|
||||
NodeMatcher::DescribeTo(os);
|
||||
*os << " whose type (";
|
||||
*os << " whose representation (";
|
||||
type_matcher_.DescribeTo(os);
|
||||
*os << "), value0 (";
|
||||
value0_matcher_.DescribeTo(os);
|
||||
@ -481,8 +482,8 @@ class IsPhiMatcher final : public NodeMatcher {
|
||||
|
||||
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
||||
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
||||
PrintMatchAndExplain(OpParameter<MachineType>(node), "type",
|
||||
type_matcher_, listener) &&
|
||||
PrintMatchAndExplain(PhiRepresentationOf(node->op()),
|
||||
"representation", type_matcher_, listener) &&
|
||||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
||||
"value0", value0_matcher_, listener) &&
|
||||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
||||
@ -492,7 +493,7 @@ class IsPhiMatcher final : public NodeMatcher {
|
||||
}
|
||||
|
||||
private:
|
||||
const Matcher<MachineType> type_matcher_;
|
||||
const Matcher<MachineRepresentation> type_matcher_;
|
||||
const Matcher<Node*> value0_matcher_;
|
||||
const Matcher<Node*> value1_matcher_;
|
||||
const Matcher<Node*> control_matcher_;
|
||||
@ -501,7 +502,7 @@ class IsPhiMatcher final : public NodeMatcher {
|
||||
|
||||
class IsPhi2Matcher final : public NodeMatcher {
|
||||
public:
|
||||
IsPhi2Matcher(const Matcher<MachineType>& type_matcher,
|
||||
IsPhi2Matcher(const Matcher<MachineRepresentation>& type_matcher,
|
||||
const Matcher<Node*>& value0_matcher,
|
||||
const Matcher<Node*>& value1_matcher,
|
||||
const Matcher<Node*>& value2_matcher,
|
||||
@ -515,7 +516,7 @@ class IsPhi2Matcher final : public NodeMatcher {
|
||||
|
||||
void DescribeTo(std::ostream* os) const final {
|
||||
NodeMatcher::DescribeTo(os);
|
||||
*os << " whose type (";
|
||||
*os << " whose representation (";
|
||||
type_matcher_.DescribeTo(os);
|
||||
*os << "), value0 (";
|
||||
value0_matcher_.DescribeTo(os);
|
||||
@ -530,8 +531,8 @@ class IsPhi2Matcher final : public NodeMatcher {
|
||||
|
||||
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
||||
return (NodeMatcher::MatchAndExplain(node, listener) &&
|
||||
PrintMatchAndExplain(OpParameter<MachineType>(node), "type",
|
||||
type_matcher_, listener) &&
|
||||
PrintMatchAndExplain(PhiRepresentationOf(node->op()),
|
||||
"representation", type_matcher_, listener) &&
|
||||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
||||
"value0", value0_matcher_, listener) &&
|
||||
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
||||
@ -543,7 +544,7 @@ class IsPhi2Matcher final : public NodeMatcher {
|
||||
}
|
||||
|
||||
private:
|
||||
const Matcher<MachineType> type_matcher_;
|
||||
const Matcher<MachineRepresentation> type_matcher_;
|
||||
const Matcher<Node*> value0_matcher_;
|
||||
const Matcher<Node*> value1_matcher_;
|
||||
const Matcher<Node*> value2_matcher_;
|
||||
@ -1594,7 +1595,7 @@ Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher) {
|
||||
}
|
||||
|
||||
|
||||
Matcher<Node*> IsSelect(const Matcher<MachineType>& type_matcher,
|
||||
Matcher<Node*> IsSelect(const Matcher<MachineRepresentation>& type_matcher,
|
||||
const Matcher<Node*>& value0_matcher,
|
||||
const Matcher<Node*>& value1_matcher,
|
||||
const Matcher<Node*>& value2_matcher) {
|
||||
@ -1603,7 +1604,7 @@ Matcher<Node*> IsSelect(const Matcher<MachineType>& type_matcher,
|
||||
}
|
||||
|
||||
|
||||
Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
|
||||
Matcher<Node*> IsPhi(const Matcher<MachineRepresentation>& type_matcher,
|
||||
const Matcher<Node*>& value0_matcher,
|
||||
const Matcher<Node*>& value1_matcher,
|
||||
const Matcher<Node*>& merge_matcher) {
|
||||
@ -1612,7 +1613,7 @@ Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
|
||||
}
|
||||
|
||||
|
||||
Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
|
||||
Matcher<Node*> IsPhi(const Matcher<MachineRepresentation>& type_matcher,
|
||||
const Matcher<Node*>& value0_matcher,
|
||||
const Matcher<Node*>& value1_matcher,
|
||||
const Matcher<Node*>& value2_matcher,
|
||||
|
@ -80,15 +80,15 @@ Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher);
|
||||
Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher);
|
||||
Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher);
|
||||
Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher);
|
||||
Matcher<Node*> IsSelect(const Matcher<MachineType>& type_matcher,
|
||||
Matcher<Node*> IsSelect(const Matcher<MachineRepresentation>& type_matcher,
|
||||
const Matcher<Node*>& value0_matcher,
|
||||
const Matcher<Node*>& value1_matcher,
|
||||
const Matcher<Node*>& value2_matcher);
|
||||
Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
|
||||
Matcher<Node*> IsPhi(const Matcher<MachineRepresentation>& type_matcher,
|
||||
const Matcher<Node*>& value0_matcher,
|
||||
const Matcher<Node*>& value1_matcher,
|
||||
const Matcher<Node*>& merge_matcher);
|
||||
Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
|
||||
Matcher<Node*> IsPhi(const Matcher<MachineRepresentation>& type_matcher,
|
||||
const Matcher<Node*>& value0_matcher,
|
||||
const Matcher<Node*>& value1_matcher,
|
||||
const Matcher<Node*>& value2_matcher,
|
||||
|
@ -658,7 +658,8 @@ Node* CreateDiamond(Graph* graph, CommonOperatorBuilder* common, Node* cond) {
|
||||
Node* t = graph->NewNode(common->IfTrue(), br);
|
||||
Node* f = graph->NewNode(common->IfFalse(), br);
|
||||
Node* m = graph->NewNode(common->Merge(2), t, f);
|
||||
Node* phi = graph->NewNode(common->Phi(kMachAnyTagged, 2), tv, fv, m);
|
||||
Node* phi =
|
||||
graph->NewNode(common->Phi(MachineRepresentation::kTagged, 2), tv, fv, m);
|
||||
return phi;
|
||||
}
|
||||
|
||||
@ -737,12 +738,13 @@ TARGET_TEST_F(SchedulerTest, NestedFloatingDiamonds) {
|
||||
Node* m1 = graph()->NewNode(common()->Merge(2), t1, f1);
|
||||
Node* ttrue = graph()->NewNode(common()->Int32Constant(1));
|
||||
Node* ffalse = graph()->NewNode(common()->Int32Constant(0));
|
||||
Node* phi1 =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), ttrue, ffalse, m1);
|
||||
Node* phi1 = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), ttrue, ffalse, m1);
|
||||
|
||||
|
||||
Node* m = graph()->NewNode(common()->Merge(2), t, f);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), fv, phi1, m);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
fv, phi1, m);
|
||||
Node* ephi1 = graph()->NewNode(common()->EffectPhi(2), start, map, m);
|
||||
|
||||
Node* ret = graph()->NewNode(common()->Return(), phi, ephi1, start);
|
||||
@ -766,27 +768,29 @@ TARGET_TEST_F(SchedulerTest, NestedFloatingDiamondWithChain) {
|
||||
Node* tA1 = graph()->NewNode(common()->IfTrue(), brA1);
|
||||
Node* fA1 = graph()->NewNode(common()->IfFalse(), brA1);
|
||||
Node* mA1 = graph()->NewNode(common()->Merge(2), tA1, fA1);
|
||||
Node* phiA1 = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), p0, p1, mA1);
|
||||
Node* phiA1 = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), p0, p1, mA1);
|
||||
|
||||
Node* brB1 = graph()->NewNode(common()->Branch(), p1, graph()->start());
|
||||
Node* tB1 = graph()->NewNode(common()->IfTrue(), brB1);
|
||||
Node* fB1 = graph()->NewNode(common()->IfFalse(), brB1);
|
||||
Node* mB1 = graph()->NewNode(common()->Merge(2), tB1, fB1);
|
||||
Node* phiB1 = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), p0, p1, mB1);
|
||||
Node* phiB1 = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), p0, p1, mB1);
|
||||
|
||||
Node* brA2 = graph()->NewNode(common()->Branch(), phiB1, mA1);
|
||||
Node* tA2 = graph()->NewNode(common()->IfTrue(), brA2);
|
||||
Node* fA2 = graph()->NewNode(common()->IfFalse(), brA2);
|
||||
Node* mA2 = graph()->NewNode(common()->Merge(2), tA2, fA2);
|
||||
Node* phiA2 =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), phiB1, c, mA2);
|
||||
Node* phiA2 = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), phiB1, c, mA2);
|
||||
|
||||
Node* brB2 = graph()->NewNode(common()->Branch(), phiA1, mB1);
|
||||
Node* tB2 = graph()->NewNode(common()->IfTrue(), brB2);
|
||||
Node* fB2 = graph()->NewNode(common()->IfFalse(), brB2);
|
||||
Node* mB2 = graph()->NewNode(common()->Merge(2), tB2, fB2);
|
||||
Node* phiB2 =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), phiA1, c, mB2);
|
||||
Node* phiB2 = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), phiA1, c, mB2);
|
||||
|
||||
Node* add = graph()->NewNode(&kIntAdd, phiA2, phiB2);
|
||||
Node* ret = graph()->NewNode(common()->Return(), add, start, start);
|
||||
@ -810,7 +814,8 @@ TARGET_TEST_F(SchedulerTest, NestedFloatingDiamondWithLoop) {
|
||||
Node* f = graph()->NewNode(common()->IfFalse(), br);
|
||||
|
||||
Node* loop = graph()->NewNode(common()->Loop(2), f, start);
|
||||
Node* ind = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), p0, p0, loop);
|
||||
Node* ind = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
p0, p0, loop);
|
||||
|
||||
Node* add = graph()->NewNode(&kIntAdd, ind, fv);
|
||||
Node* br1 = graph()->NewNode(common()->Branch(), add, loop);
|
||||
@ -821,7 +826,8 @@ TARGET_TEST_F(SchedulerTest, NestedFloatingDiamondWithLoop) {
|
||||
ind->ReplaceInput(1, ind); // close induction variable.
|
||||
|
||||
Node* m = graph()->NewNode(common()->Merge(2), t, f1);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), fv, ind, m);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
fv, ind, m);
|
||||
|
||||
Node* ret = graph()->NewNode(common()->Return(), phi, start, start);
|
||||
Node* end = graph()->NewNode(common()->End(1), ret);
|
||||
@ -840,7 +846,8 @@ TARGET_TEST_F(SchedulerTest, LoopedFloatingDiamond1) {
|
||||
|
||||
Node* c = graph()->NewNode(common()->Int32Constant(7));
|
||||
Node* loop = graph()->NewNode(common()->Loop(2), start, start);
|
||||
Node* ind = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), p0, p0, loop);
|
||||
Node* ind = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
p0, p0, loop);
|
||||
Node* add = graph()->NewNode(&kIntAdd, ind, c);
|
||||
|
||||
Node* br = graph()->NewNode(common()->Branch(), add, loop);
|
||||
@ -851,7 +858,8 @@ TARGET_TEST_F(SchedulerTest, LoopedFloatingDiamond1) {
|
||||
Node* t1 = graph()->NewNode(common()->IfTrue(), br1);
|
||||
Node* f1 = graph()->NewNode(common()->IfFalse(), br1);
|
||||
Node* m1 = graph()->NewNode(common()->Merge(2), t1, f1);
|
||||
Node* phi1 = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), add, p0, m1);
|
||||
Node* phi1 = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), add, p0, m1);
|
||||
|
||||
loop->ReplaceInput(1, t); // close loop.
|
||||
ind->ReplaceInput(1, phi1); // close induction variable.
|
||||
@ -873,13 +881,15 @@ TARGET_TEST_F(SchedulerTest, LoopedFloatingDiamond2) {
|
||||
|
||||
Node* c = graph()->NewNode(common()->Int32Constant(7));
|
||||
Node* loop = graph()->NewNode(common()->Loop(2), start, start);
|
||||
Node* ind = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), p0, p0, loop);
|
||||
Node* ind = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
p0, p0, loop);
|
||||
|
||||
Node* br1 = graph()->NewNode(common()->Branch(), p0, graph()->start());
|
||||
Node* t1 = graph()->NewNode(common()->IfTrue(), br1);
|
||||
Node* f1 = graph()->NewNode(common()->IfFalse(), br1);
|
||||
Node* m1 = graph()->NewNode(common()->Merge(2), t1, f1);
|
||||
Node* phi1 = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), c, ind, m1);
|
||||
Node* phi1 = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), c, ind, m1);
|
||||
|
||||
Node* add = graph()->NewNode(&kIntAdd, ind, phi1);
|
||||
|
||||
@ -907,14 +917,16 @@ TARGET_TEST_F(SchedulerTest, LoopedFloatingDiamond3) {
|
||||
|
||||
Node* c = graph()->NewNode(common()->Int32Constant(7));
|
||||
Node* loop = graph()->NewNode(common()->Loop(2), start, start);
|
||||
Node* ind = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), p0, p0, loop);
|
||||
Node* ind = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
p0, p0, loop);
|
||||
|
||||
Node* br1 = graph()->NewNode(common()->Branch(), p0, graph()->start());
|
||||
Node* t1 = graph()->NewNode(common()->IfTrue(), br1);
|
||||
Node* f1 = graph()->NewNode(common()->IfFalse(), br1);
|
||||
|
||||
Node* loop1 = graph()->NewNode(common()->Loop(2), t1, start);
|
||||
Node* ind1 = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), p0, p0, loop);
|
||||
Node* ind1 = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), p0, p0, loop);
|
||||
|
||||
Node* add1 = graph()->NewNode(&kIntAdd, ind1, c);
|
||||
Node* br2 = graph()->NewNode(common()->Branch(), add1, loop1);
|
||||
@ -925,7 +937,8 @@ TARGET_TEST_F(SchedulerTest, LoopedFloatingDiamond3) {
|
||||
ind1->ReplaceInput(1, ind1); // close inner induction variable.
|
||||
|
||||
Node* m1 = graph()->NewNode(common()->Merge(2), f1, f2);
|
||||
Node* phi1 = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), c, ind1, m1);
|
||||
Node* phi1 = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), c, ind1, m1);
|
||||
|
||||
Node* add = graph()->NewNode(&kIntAdd, ind, phi1);
|
||||
|
||||
@ -960,15 +973,17 @@ TARGET_TEST_F(SchedulerTest, PhisPushedDownToDifferentBranches) {
|
||||
Node* t = graph()->NewNode(common()->IfTrue(), br);
|
||||
Node* f = graph()->NewNode(common()->IfFalse(), br);
|
||||
Node* m = graph()->NewNode(common()->Merge(2), t, f);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), v1, v2, m);
|
||||
Node* phi2 = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), v3, v4, m);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
v1, v2, m);
|
||||
Node* phi2 = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), v3, v4, m);
|
||||
|
||||
Node* br2 = graph()->NewNode(common()->Branch(), p1, graph()->start());
|
||||
Node* t2 = graph()->NewNode(common()->IfTrue(), br2);
|
||||
Node* f2 = graph()->NewNode(common()->IfFalse(), br2);
|
||||
Node* m2 = graph()->NewNode(common()->Merge(2), t2, f2);
|
||||
Node* phi3 =
|
||||
graph()->NewNode(common()->Phi(kMachAnyTagged, 2), phi, phi2, m2);
|
||||
Node* phi3 = graph()->NewNode(
|
||||
common()->Phi(MachineRepresentation::kTagged, 2), phi, phi2, m2);
|
||||
|
||||
Node* ret = graph()->NewNode(common()->Return(), phi3, start, start);
|
||||
Node* end = graph()->NewNode(common()->End(1), ret);
|
||||
@ -990,7 +1005,8 @@ TARGET_TEST_F(SchedulerTest, BranchHintTrue) {
|
||||
Node* t = graph()->NewNode(common()->IfTrue(), br);
|
||||
Node* f = graph()->NewNode(common()->IfFalse(), br);
|
||||
Node* m = graph()->NewNode(common()->Merge(2), t, f);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), tv, fv, m);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
tv, fv, m);
|
||||
Node* ret = graph()->NewNode(common()->Return(), phi, start, start);
|
||||
Node* end = graph()->NewNode(common()->End(1), ret);
|
||||
|
||||
@ -1014,7 +1030,8 @@ TARGET_TEST_F(SchedulerTest, BranchHintFalse) {
|
||||
Node* t = graph()->NewNode(common()->IfTrue(), br);
|
||||
Node* f = graph()->NewNode(common()->IfFalse(), br);
|
||||
Node* m = graph()->NewNode(common()->Merge(2), t, f);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), tv, fv, m);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
tv, fv, m);
|
||||
Node* ret = graph()->NewNode(common()->Return(), phi, start, start);
|
||||
Node* end = graph()->NewNode(common()->End(1), ret);
|
||||
|
||||
@ -1042,7 +1059,8 @@ TARGET_TEST_F(SchedulerTest, CallException) {
|
||||
common()->IfException(IfExceptionHint::kLocallyUncaught), c2, c2);
|
||||
Node* hdl = graph()->NewNode(common()->Merge(2), ex1, ex2);
|
||||
Node* m = graph()->NewNode(common()->Merge(2), ok2, hdl);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), c2, p0, m);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
|
||||
c2, p0, m);
|
||||
Node* ret = graph()->NewNode(common()->Return(), phi, start, m);
|
||||
Node* end = graph()->NewNode(common()->End(1), ret);
|
||||
|
||||
@ -1084,7 +1102,8 @@ TARGET_TEST_F(SchedulerTest, Switch) {
|
||||
Node* d = graph()->NewNode(common()->IfDefault(), sw);
|
||||
Node* vd = graph()->NewNode(common()->Int32Constant(33));
|
||||
Node* m = graph()->NewNode(common()->Merge(3), c0, c1, d);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachInt32, 3), v0, v1, vd, m);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 3),
|
||||
v0, v1, vd, m);
|
||||
Node* ret = graph()->NewNode(common()->Return(), phi, start, m);
|
||||
Node* end = graph()->NewNode(common()->End(1), ret);
|
||||
|
||||
@ -1107,7 +1126,8 @@ TARGET_TEST_F(SchedulerTest, FloatingSwitch) {
|
||||
Node* d = graph()->NewNode(common()->IfDefault(), sw);
|
||||
Node* vd = graph()->NewNode(common()->Int32Constant(33));
|
||||
Node* m = graph()->NewNode(common()->Merge(3), c0, c1, d);
|
||||
Node* phi = graph()->NewNode(common()->Phi(kMachInt32, 3), v0, v1, vd, m);
|
||||
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 3),
|
||||
v0, v1, vd, m);
|
||||
Node* ret = graph()->NewNode(common()->Return(), phi, start, start);
|
||||
Node* end = graph()->NewNode(common()->End(1), ret);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user