Commit 9803a724 authored by titzer@chromium.org's avatar titzer@chromium.org

Unify MachineType and RepType.

MachineType now tracks both the representation and the value type of machine quantities and is used uniformly throughout TurboFan.

These types can now express uint8, int8, uint16, and int16, i.e. signed and unsigned smallish integers. Note that currently only uint8 and uint16 are implemented in the TF backends.

R=bmeurer@chromium.org, mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/470593002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23122 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ae7d781d
......@@ -285,28 +285,30 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
void InstructionSelector::VisitLoad(Node* node) {
MachineType rep = OpParameter<MachineType>(node);
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
ArmOperandGenerator g(this);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
InstructionOperand* result = rep == kMachineFloat64
InstructionOperand* result = rep == kRepFloat64
? g.DefineAsDoubleRegister(node)
: g.DefineAsRegister(node);
ArchOpcode opcode;
// TODO(titzer): signed/unsigned small loads
switch (rep) {
case kMachineFloat64:
case kRepFloat64:
opcode = kArmFloat64Load;
break;
case kMachineWord8:
case kRepBit: // Fall through.
case kRepWord8:
opcode = kArmLoadWord8;
break;
case kMachineWord16:
case kRepWord16:
opcode = kArmLoadWord16;
break;
case kMachineTagged: // Fall through.
case kMachineWord32:
case kRepTagged: // Fall through.
case kRepWord32:
opcode = kArmLoadWord32;
break;
default:
......@@ -334,9 +336,9 @@ void InstructionSelector::VisitStore(Node* node) {
Node* value = node->InputAt(2);
StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node);
MachineType rep = store_rep.rep;
MachineType rep = RepresentationOf(store_rep.machine_type);
if (store_rep.write_barrier_kind == kFullWriteBarrier) {
DCHECK(rep == kMachineTagged);
DCHECK(rep == kRepTagged);
// TODO(dcarney): refactor RecordWrite function to take temp registers
// and pass them here instead of using fixed regs
// TODO(dcarney): handle immediate indices.
......@@ -347,22 +349,23 @@ void InstructionSelector::VisitStore(Node* node) {
return;
}
DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind);
InstructionOperand* val = rep == kMachineFloat64 ? g.UseDoubleRegister(value)
: g.UseRegister(value);
InstructionOperand* val =
rep == kRepFloat64 ? g.UseDoubleRegister(value) : g.UseRegister(value);
ArchOpcode opcode;
switch (rep) {
case kMachineFloat64:
case kRepFloat64:
opcode = kArmFloat64Store;
break;
case kMachineWord8:
case kRepBit: // Fall through.
case kRepWord8:
opcode = kArmStoreWord8;
break;
case kMachineWord16:
case kRepWord16:
opcode = kArmStoreWord16;
break;
case kMachineTagged: // Fall through.
case kMachineWord32:
case kRepTagged: // Fall through.
case kRepWord32:
opcode = kArmStoreWord32;
break;
default:
......
......@@ -150,31 +150,33 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
void InstructionSelector::VisitLoad(Node* node) {
MachineType rep = OpParameter<MachineType>(node);
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
Arm64OperandGenerator g(this);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
InstructionOperand* result = rep == kMachineFloat64
InstructionOperand* result = rep == kRepFloat64
? g.DefineAsDoubleRegister(node)
: g.DefineAsRegister(node);
ArchOpcode opcode;
// TODO(titzer): signed/unsigned small loads
switch (rep) {
case kMachineFloat64:
case kRepFloat64:
opcode = kArm64Float64Load;
break;
case kMachineWord8:
case kRepBit: // Fall through.
case kRepWord8:
opcode = kArm64LoadWord8;
break;
case kMachineWord16:
case kRepWord16:
opcode = kArm64LoadWord16;
break;
case kMachineWord32:
case kRepWord32:
opcode = kArm64LoadWord32;
break;
case kMachineTagged: // Fall through.
case kMachineWord64:
case kRepTagged: // Fall through.
case kRepWord64:
opcode = kArm64LoadWord64;
break;
default:
......@@ -201,9 +203,9 @@ void InstructionSelector::VisitStore(Node* node) {
Node* value = node->InputAt(2);
StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node);
MachineType rep = store_rep.rep;
MachineType rep = RepresentationOf(store_rep.machine_type);
if (store_rep.write_barrier_kind == kFullWriteBarrier) {
DCHECK(rep == kMachineTagged);
DCHECK(rep == kRepTagged);
// TODO(dcarney): refactor RecordWrite function to take temp registers
// and pass them here instead of using fixed regs
// TODO(dcarney): handle immediate indices.
......@@ -215,27 +217,28 @@ void InstructionSelector::VisitStore(Node* node) {
}
DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind);
InstructionOperand* val;
if (rep == kMachineFloat64) {
if (rep == kRepFloat64) {
val = g.UseDoubleRegister(value);
} else {
val = g.UseRegister(value);
}
ArchOpcode opcode;
switch (rep) {
case kMachineFloat64:
case kRepFloat64:
opcode = kArm64Float64Store;
break;
case kMachineWord8:
case kRepBit: // Fall through.
case kRepWord8:
opcode = kArm64StoreWord8;
break;
case kMachineWord16:
case kRepWord16:
opcode = kArm64StoreWord16;
break;
case kMachineWord32:
case kRepWord32:
opcode = kArm64StoreWord32;
break;
case kMachineTagged: // Fall through.
case kMachineWord64:
case kRepTagged: // Fall through.
case kRepWord64:
opcode = kArm64StoreWord64;
break;
default:
......
......@@ -173,7 +173,7 @@ Reduction ChangeLowering<4>::ChangeInt32ToTagged(Node* val, Node* effect,
Int32Constant(0), context, effect, if_true);
Node* store = graph()->NewNode(
machine()->Store(kMachineFloat64, kNoWriteBarrier), heap_number,
machine()->Store(kMachFloat64, kNoWriteBarrier), heap_number,
Int32Constant(HeapNumber::kValueOffset - kHeapObjectTag), number, effect,
heap_number);
......@@ -206,7 +206,7 @@ Reduction ChangeLowering<4>::ChangeTaggedToFloat64(Node* val, Node* effect,
Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
Node* load = graph()->NewNode(
machine()->Load(kMachineFloat64), val,
machine()->Load(kMachFloat64), val,
Int32Constant(HeapNumber::kValueOffset - kHeapObjectTag), if_true);
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
......@@ -233,7 +233,7 @@ Reduction ChangeLowering<8>::ChangeTaggedToFloat64(Node* val, Node* effect,
Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
Node* load = graph()->NewNode(
machine()->Load(kMachineFloat64), val,
machine()->Load(kMachFloat64), val,
Int32Constant(HeapNumber::kValueOffset - kHeapObjectTag), if_true);
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
......
......@@ -41,27 +41,29 @@ class IA32OperandGenerator V8_FINAL : public OperandGenerator {
void InstructionSelector::VisitLoad(Node* node) {
MachineType rep = OpParameter<MachineType>(node);
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
IA32OperandGenerator g(this);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
InstructionOperand* output = rep == kMachineFloat64
InstructionOperand* output = rep == kRepFloat64
? g.DefineAsDoubleRegister(node)
: g.DefineAsRegister(node);
ArchOpcode opcode;
// TODO(titzer): signed/unsigned small loads
switch (rep) {
case kMachineFloat64:
case kRepFloat64:
opcode = kSSELoad;
break;
case kMachineWord8:
case kRepBit: // Fall through.
case kRepWord8:
opcode = kIA32LoadWord8;
break;
case kMachineWord16:
case kRepWord16:
opcode = kIA32LoadWord16;
break;
case kMachineTagged: // Fall through.
case kMachineWord32:
case kRepTagged: // Fall through.
case kRepWord32:
opcode = kIA32LoadWord32;
break;
default:
......@@ -94,9 +96,9 @@ void InstructionSelector::VisitStore(Node* node) {
Node* value = node->InputAt(2);
StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node);
MachineType rep = store_rep.rep;
MachineType rep = RepresentationOf(store_rep.machine_type);
if (store_rep.write_barrier_kind == kFullWriteBarrier) {
DCHECK_EQ(kMachineTagged, rep);
DCHECK_EQ(kRepTagged, rep);
// TODO(dcarney): refactor RecordWrite function to take temp registers
// and pass them here instead of using fixed regs
// TODO(dcarney): handle immediate indices.
......@@ -109,13 +111,13 @@ void InstructionSelector::VisitStore(Node* node) {
DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind);
bool is_immediate = false;
InstructionOperand* val;
if (rep == kMachineFloat64) {
if (rep == kRepFloat64) {
val = g.UseDoubleRegister(value);
} else {
is_immediate = g.CanBeImmediate(value);
if (is_immediate) {
val = g.UseImmediate(value);
} else if (rep == kMachineWord8) {
} else if (rep == kRepWord8 || rep == kRepBit) {
val = g.UseByteRegister(value);
} else {
val = g.UseRegister(value);
......@@ -123,17 +125,18 @@ void InstructionSelector::VisitStore(Node* node) {
}
ArchOpcode opcode;
switch (rep) {
case kMachineFloat64:
case kRepFloat64:
opcode = kSSEStore;
break;
case kMachineWord8:
case kRepBit: // Fall through.
case kRepWord8:
opcode = is_immediate ? kIA32StoreWord8I : kIA32StoreWord8;
break;
case kMachineWord16:
case kRepWord16:
opcode = is_immediate ? kIA32StoreWord16I : kIA32StoreWord16;
break;
case kMachineTagged: // Fall through.
case kMachineWord32:
case kRepTagged: // Fall through.
case kRepWord32:
opcode = is_immediate ? kIA32StoreWord32I : kIA32StoreWord32;
break;
default:
......
......@@ -201,7 +201,7 @@ class OperandGenerator {
return new (zone()) UnallocatedOperand(UnallocatedOperand::FIXED_SLOT,
location.location_);
}
if (location.rep_ == kMachineFloat64) {
if (RepresentationOf(location.rep_) == kRepFloat64) {
return new (zone()) UnallocatedOperand(
UnallocatedOperand::FIXED_DOUBLE_REGISTER, location.location_);
}
......
......@@ -232,8 +232,8 @@ void InstructionSelector::MarkAsReference(Node* node) {
void InstructionSelector::MarkAsRepresentation(MachineType rep, Node* node) {
DCHECK_NOT_NULL(node);
if (rep == kMachineFloat64) MarkAsDouble(node);
if (rep == kMachineTagged) MarkAsReference(node);
if (RepresentationOf(rep) == kRepFloat64) MarkAsDouble(node);
if (RepresentationOf(rep) == kRepTagged) MarkAsReference(node);
}
......
......@@ -479,13 +479,13 @@ Node* JSGenericLowering::LowerJSLoadContext(Node* node) {
for (int i = 0; i < access.depth(); ++i) {
node->ReplaceInput(
0, graph()->NewNode(
machine()->Load(kMachineTagged),
machine()->Load(kMachAnyTagged),
NodeProperties::GetValueInput(node, 0),
Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
NodeProperties::GetEffectInput(node)));
}
node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index())));
PatchOperator(node, machine()->Load(kMachineTagged));
PatchOperator(node, machine()->Load(kMachAnyTagged));
return node;
}
......@@ -497,14 +497,14 @@ Node* JSGenericLowering::LowerJSStoreContext(Node* node) {
for (int i = 0; i < access.depth(); ++i) {
node->ReplaceInput(
0, graph()->NewNode(
machine()->Load(kMachineTagged),
machine()->Load(kMachAnyTagged),
NodeProperties::GetValueInput(node, 0),
Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
NodeProperties::GetEffectInput(node)));
}
node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1));
node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index())));
PatchOperator(node, machine()->Store(kMachineTagged, kFullWriteBarrier));
PatchOperator(node, machine()->Store(kMachAnyTagged, kFullWriteBarrier));
return node;
}
......
......@@ -13,11 +13,11 @@ class LinkageHelper {
public:
static LinkageLocation TaggedStackSlot(int index) {
DCHECK(index < 0);
return LinkageLocation(kMachineTagged, index);
return LinkageLocation(kMachAnyTagged, index);
}
static LinkageLocation TaggedRegisterLocation(Register reg) {
return LinkageLocation(kMachineTagged, Register::ToAllocationIndex(reg));
return LinkageLocation(kMachAnyTagged, Register::ToAllocationIndex(reg));
}
static inline LinkageLocation WordRegisterLocation(Register reg) {
......@@ -98,7 +98,7 @@ class LinkageHelper {
DCHECK_LE(return_count, 2);
locations[index++] = UnconstrainedRegister(kMachineTagged); // CEntryStub
locations[index++] = UnconstrainedRegister(kMachAnyTagged); // CEntryStub
for (int i = 0; i < parameter_count; i++) {
// All parameters to runtime calls go on the stack.
......@@ -143,7 +143,7 @@ class LinkageHelper {
int index = 0;
locations[index++] =
TaggedRegisterLocation(LinkageTraits::ReturnValueReg());
locations[index++] = UnconstrainedRegister(kMachineTagged); // code
locations[index++] = UnconstrainedRegister(kMachAnyTagged); // code
for (int i = 0; i < parameter_count; i++) {
if (i < register_parameter_count) {
// The first parameters to code stub calls go in registers.
......
......@@ -21,7 +21,7 @@ enum WriteBarrierKind { kNoWriteBarrier, kFullWriteBarrier };
// A Store needs a MachineType and a WriteBarrierKind
// in order to emit the correct write barrier.
struct StoreRepresentation {
MachineType rep;
MachineType machine_type;
WriteBarrierKind write_barrier_kind;
};
......@@ -33,7 +33,7 @@ class MachineOperatorBuilder {
public:
explicit MachineOperatorBuilder(Zone* zone, MachineType word = pointer_rep())
: zone_(zone), word_(word) {
CHECK(word == kMachineWord32 || word == kMachineWord64);
CHECK(word == kRepWord32 || word == kRepWord64);
}
#define SIMPLE(name, properties, inputs, outputs) \
......@@ -146,12 +146,12 @@ class MachineOperatorBuilder {
Operator* Float64LessThan() { BINOP(Float64LessThan); }
Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); }
inline bool is32() const { return word_ == kMachineWord32; }
inline bool is64() const { return word_ == kMachineWord64; }
inline bool is32() const { return word_ == kRepWord32; }
inline bool is64() const { return word_ == kRepWord64; }
inline MachineType word() const { return word_; }
static inline MachineType pointer_rep() {
return kPointerSize == 8 ? kMachineWord64 : kMachineWord32;
return kPointerSize == 8 ? kRepWord64 : kRepWord32;
}
#undef WORD_SIZE
......
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/compiler/machine-type.h"
#include "src/ostreams.h"
namespace v8 {
namespace internal {
namespace compiler {
#define PRINT(bit) \
if (type & bit) { \
if (before) os << "|"; \
os << #bit; \
before = true; \
}
OStream& operator<<(OStream& os, const MachineType& type) {
bool before = false;
PRINT(kRepBit);
PRINT(kRepWord8);
PRINT(kRepWord16);
PRINT(kRepWord32);
PRINT(kRepWord64);
PRINT(kRepFloat64);
PRINT(kRepTagged);
PRINT(kTypeBool);
PRINT(kTypeInt32);
PRINT(kTypeUint32);
PRINT(kTypeInt64);
PRINT(kTypeUint64);
PRINT(kTypeNumber);
PRINT(kTypeAny);
return os;
}
}
}
} // namespace v8::internal::compiler
......@@ -5,30 +5,98 @@
#ifndef V8_COMPILER_MACHINE_TYPE_H_
#define V8_COMPILER_MACHINE_TYPE_H_
#include "src/globals.h"
namespace v8 {
namespace internal {
class OStream;
namespace compiler {
// An enumeration of the storage representations at the machine level.
// - Words are uninterpreted bits of a given fixed size that can be used
// to store integers and pointers. They are normally allocated to general
// purpose registers by the backend and are not tracked for GC.
// - Floats are bits of a given fixed size that are used to store floating
// point numbers. They are normally allocated to the floating point
// registers of the machine and are not tracked for the GC.
// - Tagged values are the size of a reference into the heap and can store
// small words or references into the heap using a language and potentially
// machine-dependent tagging scheme. These values are tracked by the code
// generator for precise GC.
// Machine-level types and representations.
// TODO(titzer): Use the real type system instead of MachineType.
enum MachineType {
kMachineWord8,
kMachineWord16,
kMachineWord32,
kMachineWord64,
kMachineFloat64,
kMachineTagged,
kMachineLast
// Representations.
kRepBit = 1 << 0,
kRepWord8 = 1 << 1,
kRepWord16 = 1 << 2,
kRepWord32 = 1 << 3,
kRepWord64 = 1 << 4,
kRepFloat64 = 1 << 5,
kRepTagged = 1 << 6,
// Types.
kTypeBool = 1 << 7,
kTypeInt32 = 1 << 8,
kTypeUint32 = 1 << 9,
kTypeInt64 = 1 << 10,
kTypeUint64 = 1 << 11,
kTypeNumber = 1 << 12,
kTypeAny = 1 << 13
};
OStream& operator<<(OStream& os, const MachineType& type);
typedef uint16_t MachineTypeUnion;
// Globally useful machine types and constants.
const MachineTypeUnion kRepMask = kRepBit | kRepWord8 | kRepWord16 |
kRepWord32 | kRepWord64 | kRepFloat64 |
kRepTagged;
const MachineTypeUnion kTypeMask = kTypeBool | kTypeInt32 | kTypeUint32 |
kTypeInt64 | kTypeUint64 | kTypeNumber |
kTypeAny;
const MachineType kMachNone = static_cast<MachineType>(0);
const MachineType kMachFloat64 =
static_cast<MachineType>(kRepFloat64 | kTypeNumber);
const MachineType kMachInt8 = static_cast<MachineType>(kRepWord8 | kTypeInt32);
const MachineType kMachUint8 =
static_cast<MachineType>(kRepWord8 | kTypeUint32);
const MachineType kMachInt16 =
static_cast<MachineType>(kRepWord16 | kTypeInt32);
const MachineType kMachUint16 =
static_cast<MachineType>(kRepWord16 | kTypeUint32);
const MachineType kMachInt32 =
static_cast<MachineType>(kRepWord32 | kTypeInt32);
const MachineType kMachUint32 =
static_cast<MachineType>(kRepWord32 | kTypeUint32);
const MachineType kMachInt64 =
static_cast<MachineType>(kRepWord64 | kTypeInt64);
const MachineType kMachUint64 =
static_cast<MachineType>(kRepWord64 | kTypeUint64);
const MachineType kMachPtr = kPointerSize == 4 ? kRepWord32 : kRepWord64;
const MachineType kMachAnyTagged =
static_cast<MachineType>(kRepTagged | kTypeAny);
// Gets only the representation of the given type.
inline MachineType RepresentationOf(MachineType machine_type) {
int result = machine_type & kRepMask;
CHECK(IsPowerOf2(result));
return static_cast<MachineType>(result);
}
// Gets the element size in bytes of the machine type.
inline int ElementSizeOf(MachineType machine_type) {
switch (RepresentationOf(machine_type)) {
case kRepBit:
case kRepWord8:
return 1;
case kRepWord16:
return 2;
case kRepWord32:
return 4;
case kRepWord64:
case kRepFloat64:
return 8;
case kRepTagged:
return kPointerSize;
default:
UNREACHABLE();
return kPointerSize;
}
}
}
}
} // namespace v8::internal::compiler
......
This diff is collapsed.
This diff is collapsed.
......@@ -23,7 +23,7 @@ struct FieldAccess {
int offset; // offset of the field, without tag.
Handle<Name> name; // debugging only.
Type* type; // type of the field.
MachineType representation; // machine representation of field.
MachineType machine_type; // machine type of the field.
int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
};
......@@ -37,7 +37,7 @@ struct ElementAccess {
BaseTaggedness base_is_tagged; // specifies if the base pointer is tagged.
int header_size; // size of the header, without tag.
Type* type; // type of the element.
MachineType representation; // machine representation of element.
MachineType machine_type; // machine type of the element.
int tag() const { return base_is_tagged == kTaggedBase ? kHeapObjectTag : 0; }
};
......@@ -54,11 +54,11 @@ struct StaticParameterTraits<const FieldAccess> {
return os << val.offset;
}
static int HashCode(const FieldAccess& val) {
return (val.offset < 16) | (val.representation & 0xffff);
return (val.offset < 16) | (val.machine_type & 0xffff);
}
static bool Equals(const FieldAccess& a, const FieldAccess& b) {
return a.base_is_tagged == b.base_is_tagged && a.offset == b.offset &&
a.representation == b.representation && a.type->Is(b.type);
a.machine_type == b.machine_type && a.type->Is(b.type);
}
};
......@@ -70,12 +70,12 @@ struct StaticParameterTraits<const ElementAccess> {
return os << val.header_size;
}
static int HashCode(const ElementAccess& val) {
return (val.header_size < 16) | (val.representation & 0xffff);
return (val.header_size < 16) | (val.machine_type & 0xffff);
}
static bool Equals(const ElementAccess& a, const ElementAccess& b) {
return a.base_is_tagged == b.base_is_tagged &&
a.header_size == b.header_size &&
a.representation == b.representation && a.type->Is(b.type);
a.header_size == b.header_size && a.machine_type == b.machine_type &&
a.type->Is(b.type);
}
};
......
......@@ -56,30 +56,32 @@ class X64OperandGenerator V8_FINAL : public OperandGenerator {
void InstructionSelector::VisitLoad(Node* node) {
MachineType rep = OpParameter<MachineType>(node);
MachineType rep = RepresentationOf(OpParameter<MachineType>(node));
X64OperandGenerator g(this);
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
InstructionOperand* output = rep == kMachineFloat64
InstructionOperand* output = rep == kRepFloat64
? g.DefineAsDoubleRegister(node)
: g.DefineAsRegister(node);
ArchOpcode opcode;
// TODO(titzer): signed/unsigned small loads
switch (rep) {
case kMachineFloat64:
case kRepFloat64:
opcode = kSSELoad;
break;
case kMachineWord8:
case kRepBit: // Fall through.
case kRepWord8:
opcode = kX64LoadWord8;
break;
case kMachineWord16:
case kRepWord16:
opcode = kX64LoadWord16;
break;
case kMachineWord32:
case kRepWord32:
opcode = kX64LoadWord32;
break;
case kMachineTagged: // Fall through.
case kMachineWord64:
case kRepTagged: // Fall through.
case kRepWord64:
opcode = kX64LoadWord64;
break;
default:
......@@ -108,9 +110,9 @@ void InstructionSelector::VisitStore(Node* node) {
Node* value = node->InputAt(2);
StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node);
MachineType rep = store_rep.rep;
MachineType rep = RepresentationOf(store_rep.machine_type);
if (store_rep.write_barrier_kind == kFullWriteBarrier) {
DCHECK(rep == kMachineTagged);
DCHECK(rep == kRepTagged);
// TODO(dcarney): refactor RecordWrite function to take temp registers
// and pass them here instead of using fixed regs
// TODO(dcarney): handle immediate indices.
......@@ -123,13 +125,13 @@ void InstructionSelector::VisitStore(Node* node) {
DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind);
bool is_immediate = false;
InstructionOperand* val;
if (rep == kMachineFloat64) {
if (rep == kRepFloat64) {
val = g.UseDoubleRegister(value);
} else {
is_immediate = g.CanBeImmediate(value);
if (is_immediate) {
val = g.UseImmediate(value);
} else if (rep == kMachineWord8) {
} else if (rep == kRepWord8 || rep == kRepBit) {
val = g.UseByteRegister(value);
} else {
val = g.UseRegister(value);
......@@ -137,20 +139,21 @@ void InstructionSelector::VisitStore(Node* node) {
}
ArchOpcode opcode;
switch (rep) {
case kMachineFloat64:
case kRepFloat64:
opcode = kSSEStore;
break;
case kMachineWord8:
case kRepBit: // Fall through.
case kRepWord8:
opcode = is_immediate ? kX64StoreWord8I : kX64StoreWord8;
break;
case kMachineWord16:
case kRepWord16:
opcode = is_immediate ? kX64StoreWord16I : kX64StoreWord16;
break;
case kMachineWord32:
case kRepWord32:
opcode = is_immediate ? kX64StoreWord32I : kX64StoreWord32;
break;
case kMachineTagged: // Fall through.
case kMachineWord64:
case kRepTagged: // Fall through.
case kRepWord64:
opcode = is_immediate ? kX64StoreWord64I : kX64StoreWord64;
break;
default:
......
......@@ -23,6 +23,7 @@ namespace v8 {
namespace internal {
namespace compiler {
// TODO(titzer): move MachineType selection for C types into machine-type.h
template <typename R>
struct ReturnValueTraits {
static R Cast(uintptr_t r) { return reinterpret_cast<R>(r); }
......@@ -32,72 +33,62 @@ struct ReturnValueTraits {
while (false) {
*(static_cast<Object* volatile*>(0)) = static_cast<R>(0);
}
return kMachineTagged;
return kMachAnyTagged;
}
};
template <>
struct ReturnValueTraits<int32_t*> {
static int32_t* Cast(uintptr_t r) { return reinterpret_cast<int32_t*>(r); }
static MachineType Representation() {
return MachineOperatorBuilder::pointer_rep();
}
static MachineType Representation() { return kMachPtr; }
};
template <>
struct ReturnValueTraits<void> {
static void Cast(uintptr_t r) {}
static MachineType Representation() {
return MachineOperatorBuilder::pointer_rep();
}
static MachineType Representation() { return kMachPtr; }
};
template <>
struct ReturnValueTraits<bool> {
static bool Cast(uintptr_t r) { return static_cast<bool>(r); }
static MachineType Representation() {
return MachineOperatorBuilder::pointer_rep();
}
static MachineType Representation() { return kRepBit; }
};
template <>
struct ReturnValueTraits<int32_t> {
static int32_t Cast(uintptr_t r) { return static_cast<int32_t>(r); }
static MachineType Representation() { return kMachineWord32; }
static MachineType Representation() { return kMachInt32; }
};
template <>
struct ReturnValueTraits<uint32_t> {
static uint32_t Cast(uintptr_t r) { return static_cast<uint32_t>(r); }
static MachineType Representation() { return kMachineWord32; }
static MachineType Representation() { return kMachUint32; }
};
template <>
struct ReturnValueTraits<int64_t> {
static int64_t Cast(uintptr_t r) { return static_cast<int64_t>(r); }
static MachineType Representation() { return kMachineWord64; }
static MachineType Representation() { return kMachInt64; }
};
template <>
struct ReturnValueTraits<uint64_t> {
static uint64_t Cast(uintptr_t r) { return static_cast<uint64_t>(r); }
static MachineType Representation() { return kMachineWord64; }
static MachineType Representation() { return kMachUint64; }
};
template <>
struct ReturnValueTraits<int16_t> {
static int16_t Cast(uintptr_t r) { return static_cast<int16_t>(r); }
static MachineType Representation() {
return MachineOperatorBuilder::pointer_rep();
}
static MachineType Representation() { return kMachInt16; }
};
template <>
struct ReturnValueTraits<int8_t> {
static int8_t Cast(uintptr_t r) { return static_cast<int8_t>(r); }
static MachineType Representation() {
return MachineOperatorBuilder::pointer_rep();
}
static MachineType Representation() { return kMachInt8; }
};
template <>
......@@ -106,7 +97,7 @@ struct ReturnValueTraits<double> {
UNREACHABLE();
return 0.0;
}
static MachineType Representation() { return kMachineFloat64; }
static MachineType Representation() { return kMachFloat64; }
};
......@@ -131,9 +122,9 @@ class CallHelper {
virtual ~CallHelper() {}
static MachineCallDescriptorBuilder* ToCallDescriptorBuilder(
Zone* zone, MachineType return_type, MachineType p0 = kMachineLast,
MachineType p1 = kMachineLast, MachineType p2 = kMachineLast,
MachineType p3 = kMachineLast, MachineType p4 = kMachineLast) {
Zone* zone, MachineType return_type, MachineType p0 = kMachNone,
MachineType p1 = kMachNone, MachineType p2 = kMachNone,
MachineType p3 = kMachNone, MachineType p4 = kMachNone) {
const int kSize = 5;
MachineType* params = zone->NewArray<MachineType>(kSize);
params[0] = p0;
......@@ -143,7 +134,7 @@ class CallHelper {
params[4] = p4;
int parameter_count = 0;
for (int i = 0; i < kSize; ++i) {
if (params[i] == kMachineLast) {
if (params[i] == kMachNone) {
break;
}
parameter_count++;
......
......@@ -293,7 +293,7 @@ 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(kMachineWord32, kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
Node* p0 = m.Parameter(0);
Node* p1 = m.Parameter(1);
Node* n0;
......@@ -303,7 +303,7 @@ void Int32BinopInputShapeTester::TestAllInputShapes() {
if (i == -2) {
n0 = p0;
} else if (i == -1) {
n0 = m.LoadFromPointer(&input_a, kMachineWord32);
n0 = m.LoadFromPointer(&input_a, kMachInt32);
} else {
n0 = m.Int32Constant(inputs[i]);
}
......@@ -312,7 +312,7 @@ void Int32BinopInputShapeTester::TestAllInputShapes() {
if (j == -2) {
n1 = p1;
} else if (j == -1) {
n1 = m.LoadFromPointer(&input_b, kMachineWord32);
n1 = m.LoadFromPointer(&input_b, kMachInt32);
} else {
n1 = m.Int32Constant(inputs[j]);
}
......@@ -370,7 +370,7 @@ void Int32BinopInputShapeTester::RunRight(
TEST(ParametersEqual) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
Node* p1 = m.Parameter(1);
CHECK_NE(NULL, p1);
Node* p0 = m.Parameter(0);
......@@ -486,7 +486,7 @@ TEST(RunHeapNumberConstant) {
TEST(RunParam1) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32);
m.Return(m.Parameter(0));
FOR_INT32_INPUTS(i) {
......@@ -497,7 +497,7 @@ TEST(RunParam1) {
TEST(RunParam2_1) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
Node* p0 = m.Parameter(0);
Node* p1 = m.Parameter(1);
m.Return(p0);
......@@ -511,7 +511,7 @@ TEST(RunParam2_1) {
TEST(RunParam2_2) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
Node* p0 = m.Parameter(0);
Node* p1 = m.Parameter(1);
m.Return(p1);
......@@ -526,8 +526,7 @@ TEST(RunParam2_2) {
TEST(RunParam3) {
for (int i = 0; i < 3; i++) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32,
kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32, kMachInt32);
Node* nodes[] = {m.Parameter(0), m.Parameter(1), m.Parameter(2)};
m.Return(nodes[i]);
......
......@@ -91,11 +91,11 @@ class RawMachineAssemblerTester
: public MachineAssemblerTester<RawMachineAssembler>,
public CallHelper2<ReturnType, RawMachineAssemblerTester<ReturnType> > {
public:
RawMachineAssemblerTester(MachineType p0 = kMachineLast,
MachineType p1 = kMachineLast,
MachineType p2 = kMachineLast,
MachineType p3 = kMachineLast,
MachineType p4 = kMachineLast)
RawMachineAssemblerTester(MachineType p0 = kMachNone,
MachineType p1 = kMachNone,
MachineType p2 = kMachNone,
MachineType p3 = kMachNone,
MachineType p4 = kMachNone)
: MachineAssemblerTester<RawMachineAssembler>(
ReturnValueTraits<ReturnType>::Representation(), p0, p1, p2, p3,
p4) {}
......@@ -127,11 +127,11 @@ class StructuredMachineAssemblerTester
public CallHelper2<ReturnType,
StructuredMachineAssemblerTester<ReturnType> > {
public:
StructuredMachineAssemblerTester(MachineType p0 = kMachineLast,
MachineType p1 = kMachineLast,
MachineType p2 = kMachineLast,
MachineType p3 = kMachineLast,
MachineType p4 = kMachineLast)
StructuredMachineAssemblerTester(MachineType p0 = kMachNone,
MachineType p1 = kMachNone,
MachineType p2 = kMachNone,
MachineType p3 = kMachNone,
MachineType p4 = kMachNone)
: MachineAssemblerTester<StructuredMachineAssembler>(
ReturnValueTraits<ReturnType>::Representation(), p0, p1, p2, p3,
p4) {}
......@@ -201,15 +201,25 @@ 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, kMachineWord32, USE_RETURN_REGISTER> {
: public BinopTester<int32_t, kMachInt32, USE_RETURN_REGISTER> {
public:
explicit Int32BinopTester(RawMachineAssemblerTester<int32_t>* tester)
: BinopTester<int32_t, kMachineWord32, USE_RETURN_REGISTER>(tester) {}
: BinopTester<int32_t, kMachInt32, USE_RETURN_REGISTER>(tester) {}
};
// 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> {
public:
explicit Uint32BinopTester(RawMachineAssemblerTester<int32_t>* tester)
: BinopTester<uint32_t, kMachUint32, USE_RETURN_REGISTER>(tester) {}
int32_t call(uint32_t a0, uint32_t a1) {
p0 = static_cast<int32_t>(a0);
p1 = static_cast<int32_t>(a1);
return T->Call();
uint32_t call(uint32_t a0, uint32_t a1) {
p0 = a0;
p1 = a1;
return static_cast<uint32_t>(T->Call());
}
};
......@@ -218,10 +228,10 @@ class Int32BinopTester
// return a double value.
// TODO(titzer): figure out how to return doubles correctly on ia32.
class Float64BinopTester
: public BinopTester<double, kMachineFloat64, USE_RESULT_BUFFER> {
: public BinopTester<double, kMachFloat64, USE_RESULT_BUFFER> {
public:
explicit Float64BinopTester(RawMachineAssemblerTester<int32_t>* tester)
: BinopTester<double, kMachineFloat64, USE_RESULT_BUFFER>(tester) {}
: BinopTester<double, kMachFloat64, USE_RESULT_BUFFER>(tester) {}
};
......@@ -230,10 +240,10 @@ class Float64BinopTester
// TODO(titzer): pick word size of pointers based on V8_TARGET.
template <typename Type>
class PointerBinopTester
: public BinopTester<Type*, kMachineWord32, USE_RETURN_REGISTER> {
: public BinopTester<Type*, kMachPtr, USE_RETURN_REGISTER> {
public:
explicit PointerBinopTester(RawMachineAssemblerTester<int32_t>* tester)
: BinopTester<Type*, kMachineWord32, USE_RETURN_REGISTER>(tester) {}
: BinopTester<Type*, kMachPtr, USE_RETURN_REGISTER>(tester) {}
};
......@@ -241,10 +251,10 @@ class PointerBinopTester
// return a tagged value.
template <typename Type>
class TaggedBinopTester
: public BinopTester<Type*, kMachineTagged, USE_RETURN_REGISTER> {
: public BinopTester<Type*, kMachAnyTagged, USE_RETURN_REGISTER> {
public:
explicit TaggedBinopTester(RawMachineAssemblerTester<int32_t>* tester)
: BinopTester<Type*, kMachineTagged, USE_RETURN_REGISTER>(tester) {}
: BinopTester<Type*, kMachAnyTagged, USE_RETURN_REGISTER>(tester) {}
};
// A helper class for testing compares. Wraps a machine opcode and provides
......
......@@ -87,11 +87,11 @@ class GraphBuilderTester
public SimplifiedGraphBuilder,
public CallHelper2<ReturnType, GraphBuilderTester<ReturnType> > {
public:
explicit GraphBuilderTester(MachineType p0 = kMachineLast,
MachineType p1 = kMachineLast,
MachineType p2 = kMachineLast,
MachineType p3 = kMachineLast,
MachineType p4 = kMachineLast)
explicit GraphBuilderTester(MachineType p0 = kMachNone,
MachineType p1 = kMachNone,
MachineType p2 = kMachNone,
MachineType p3 = kMachNone,
MachineType p4 = kMachNone)
: GraphAndBuilders(main_zone()),
MachineCallHelper(
main_zone(),
......
......@@ -30,16 +30,16 @@ class InstructionSelectorTester : public HandleAndZoneScope,
static MachineType* BuildParameterArray(Zone* zone) {
MachineType* array = zone->NewArray<MachineType>(kParameterCount);
for (int i = 0; i < kParameterCount; ++i) {
array[i] = kMachineWord32;
array[i] = kMachInt32;
}
return array;
}
InstructionSelectorTester()
: RawMachineAssembler(
new (main_zone()) Graph(main_zone()), new (main_zone())
MachineCallDescriptorBuilder(kMachineWord32, kParameterCount,
BuildParameterArray(main_zone())),
new (main_zone()) Graph(main_zone()),
new (main_zone()) MachineCallDescriptorBuilder(
kMachInt32, kParameterCount, BuildParameterArray(main_zone())),
MachineOperatorBuilder::pointer_rep()) {}
void SelectInstructions(CpuFeature feature) {
......
......@@ -23,7 +23,7 @@ static IrOpcode::Value int32cmp_opcodes[] = {
TEST(BranchCombineWord32EqualZero_1) {
// Test combining a branch with x == 0
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32);
int32_t eq_constant = -1033;
int32_t ne_constant = 825118;
Node* p0 = m.Parameter(0);
......@@ -49,7 +49,7 @@ TEST(BranchCombineWord32EqualZero_chain) {
int32_t ne_constant = 815118;
for (int k = 0; k < 6; k++) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32);
Node* p0 = m.Parameter(0);
MLabel blocka, blockb;
Node* cond = p0;
......@@ -74,7 +74,7 @@ TEST(BranchCombineWord32EqualZero_chain) {
TEST(BranchCombineInt32LessThanZero_1) {
// Test combining a branch with x < 0
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32);
int32_t eq_constant = -1433;
int32_t ne_constant = 845118;
Node* p0 = m.Parameter(0);
......@@ -96,7 +96,7 @@ TEST(BranchCombineInt32LessThanZero_1) {
TEST(BranchCombineUint32LessThan100_1) {
// Test combining a branch with x < 100
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachUint32);
int32_t eq_constant = 1471;
int32_t ne_constant = 88845718;
Node* p0 = m.Parameter(0);
......@@ -118,7 +118,7 @@ TEST(BranchCombineUint32LessThan100_1) {
TEST(BranchCombineUint32LessThanOrEqual100_1) {
// Test combining a branch with x <= 100
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachUint32);
int32_t eq_constant = 1479;
int32_t ne_constant = 77845719;
Node* p0 = m.Parameter(0);
......@@ -140,7 +140,7 @@ TEST(BranchCombineUint32LessThanOrEqual100_1) {
TEST(BranchCombineZeroLessThanInt32_1) {
// Test combining a branch with 0 < x
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32);
int32_t eq_constant = -2033;
int32_t ne_constant = 225118;
Node* p0 = m.Parameter(0);
......@@ -162,7 +162,7 @@ TEST(BranchCombineZeroLessThanInt32_1) {
TEST(BranchCombineInt32GreaterThanZero_1) {
// Test combining a branch with x > 0
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32);
int32_t eq_constant = -1073;
int32_t ne_constant = 825178;
Node* p0 = m.Parameter(0);
......@@ -184,7 +184,7 @@ TEST(BranchCombineInt32GreaterThanZero_1) {
TEST(BranchCombineWord32EqualP) {
// Test combining a branch with an Word32Equal.
RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
int32_t eq_constant = -1035;
int32_t ne_constant = 825018;
Node* p0 = m.Parameter(0);
......@@ -214,7 +214,7 @@ TEST(BranchCombineWord32EqualI) {
for (int left = 0; left < 2; left++) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32);
int32_t a = *i;
Node* p0 = m.Int32Constant(a);
......@@ -243,7 +243,7 @@ TEST(BranchCombineInt32CmpP) {
int32_t ne_constant = 725018;
for (int op = 0; op < 2; op++) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32, kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
Node* p0 = m.Parameter(0);
Node* p1 = m.Parameter(1);
......@@ -275,7 +275,7 @@ TEST(BranchCombineInt32CmpI) {
for (int op = 0; op < 2; op++) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(kMachineWord32);
RawMachineAssemblerTester<int32_t> m(kMachInt32);
int32_t a = *i;
Node* p0 = m.Int32Constant(a);
Node* p1 = m.Parameter(0);
......@@ -432,8 +432,8 @@ TEST(BranchCombineFloat64Compares) {
CompareWrapper cmp = cmps[c];
for (int invert = 0; invert < 2; invert++) {
RawMachineAssemblerTester<int32_t> m;
Node* a = m.LoadFromPointer(&input_a, kMachineFloat64);
Node* b = m.LoadFromPointer(&input_b, kMachineFloat64);
Node* a = m.LoadFromPointer(&input_a, kMachFloat64);
Node* b = m.LoadFromPointer(&input_b, kMachFloat64);
MLabel blocka, blockb;
Node* cond = cmp.MakeNode(&m, a, b);
......
......@@ -27,7 +27,7 @@ using namespace v8::internal::compiler;
template <typename ReturnType>
class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
public:
explicit ChangesLoweringTester(MachineType p0 = kMachineLast)
explicit ChangesLoweringTester(MachineType p0 = kMachNone)
: GraphBuilderTester<ReturnType>(p0),
typer(this->zone()),
source_positions(this->graph()),
......@@ -77,22 +77,22 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
void StoreFloat64(Node* node, double* ptr) {
Node* ptr_node = this->PointerConstant(ptr);
this->Store(kMachineFloat64, ptr_node, node);
this->Store(kMachFloat64, ptr_node, node);
}
Node* LoadInt32(int32_t* ptr) {
Node* ptr_node = this->PointerConstant(ptr);
return this->Load(kMachineWord32, ptr_node);
return this->Load(kMachInt32, ptr_node);
}
Node* LoadUint32(uint32_t* ptr) {
Node* ptr_node = this->PointerConstant(ptr);
return this->Load(kMachineWord32, ptr_node);
return this->Load(kMachUint32, ptr_node);
}
Node* LoadFloat64(double* ptr) {
Node* ptr_node = this->PointerConstant(ptr);
return this->Load(kMachineFloat64, ptr_node);
return this->Load(kMachFloat64, ptr_node);
}
void CheckNumber(double expected, Object* number) {
......@@ -150,7 +150,7 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
TEST(RunChangeTaggedToInt32) {
// Build and lower a graph by hand.
ChangesLoweringTester<int32_t> t(kMachineTagged);
ChangesLoweringTester<int32_t> t(kMachAnyTagged);
t.BuildAndLower(t.simplified()->ChangeTaggedToInt32());
if (Pipeline::SupportedTarget()) {
......@@ -180,7 +180,7 @@ TEST(RunChangeTaggedToInt32) {
TEST(RunChangeTaggedToUint32) {
// Build and lower a graph by hand.
ChangesLoweringTester<uint32_t> t(kMachineTagged);
ChangesLoweringTester<uint32_t> t(kMachAnyTagged);
t.BuildAndLower(t.simplified()->ChangeTaggedToUint32());
if (Pipeline::SupportedTarget()) {
......@@ -209,11 +209,11 @@ TEST(RunChangeTaggedToUint32) {
TEST(RunChangeTaggedToFloat64) {
ChangesLoweringTester<int32_t> t(kMachineTagged);
ChangesLoweringTester<int32_t> t(kMachAnyTagged);
double result;
t.BuildStoreAndLower(t.simplified()->ChangeTaggedToFloat64(),
t.machine()->Store(kMachineFloat64, kNoWriteBarrier),
t.machine()->Store(kMachFloat64, kNoWriteBarrier),
&result);
if (Pipeline::SupportedTarget()) {
......@@ -259,7 +259,7 @@ TEST(RunChangeTaggedToFloat64) {
TEST(RunChangeBoolToBit) {
ChangesLoweringTester<int32_t> t(kMachineTagged);
ChangesLoweringTester<int32_t> t(kMachAnyTagged);
t.BuildAndLower(t.simplified()->ChangeBoolToBit());
if (Pipeline::SupportedTarget()) {
......@@ -277,7 +277,7 @@ TEST(RunChangeBoolToBit) {
TEST(RunChangeBitToBool) {
ChangesLoweringTester<Object*> t(kMachineWord32);
ChangesLoweringTester<Object*> t(kMachInt32);
t.BuildAndLower(t.simplified()->ChangeBitToBool());
if (Pipeline::SupportedTarget()) {
......@@ -312,7 +312,7 @@ TEST(RunChangeInt32ToTagged) {
ChangesLoweringTester<Object*> t;
int32_t input;
t.BuildLoadAndLower(t.simplified()->ChangeInt32ToTagged(),
t.machine()->Load(kMachineWord32), &input);
t.machine()->Load(kMachInt32), &input);
if (Pipeline::SupportedTarget()) {
FOR_INT32_INPUTS(i) {
......@@ -341,7 +341,7 @@ TEST(RunChangeUint32ToTagged) {
ChangesLoweringTester<Object*> t;
uint32_t input;
t.BuildLoadAndLower(t.simplified()->ChangeUint32ToTagged(),
t.machine()->Load(kMachineWord32), &input);
t.machine()->Load(kMachUint32), &input);
if (Pipeline::SupportedTarget()) {
FOR_UINT32_INPUTS(i) {
......@@ -375,7 +375,7 @@ TEST(RunChangeFloat64ToTagged) {
ChangesLoweringTester<Object*> t;
double input;
t.BuildLoadAndLower(t.simplified()->ChangeFloat64ToTagged(),
t.machine()->Load(kMachineFloat64), &input);
t.machine()->Load(kMachFloat64), &input);
// TODO(titzer): need inline allocation to change float to tagged.
if (TODO_FLOAT64_TO_TAGGED && Pipeline::SupportedTarget()) {
......
......@@ -120,8 +120,8 @@ class TrivialDeoptCodegenTester : public DeoptCodegenTester {
// deopt();
// }
MachineType parameter_reps[] = {kMachineTagged};
MachineCallDescriptorBuilder descriptor_builder(kMachineTagged, 1,
MachineType parameter_reps[] = {kMachAnyTagged};
MachineCallDescriptorBuilder descriptor_builder(kMachAnyTagged, 1,
parameter_reps);
RawMachineAssembler m(graph, &descriptor_builder);
......@@ -256,8 +256,8 @@ class TrivialRuntimeDeoptCodegenTester : public DeoptCodegenTester {
// %DeoptimizeFunction(foo);
// }
MachineType parameter_reps[] = {kMachineTagged};
MachineCallDescriptorBuilder descriptor_builder(kMachineTagged, 2,
MachineType parameter_reps[] = {kMachAnyTagged};
MachineCallDescriptorBuilder descriptor_builder(kMachAnyTagged, 2,
parameter_reps);
RawMachineAssembler m(graph, &descriptor_builder);
......
......@@ -32,7 +32,7 @@ class InstructionTester : public HandleAndZoneScope {
info(static_cast<HydrogenCodeStub*>(NULL), main_isolate()),
linkage(&info),
common(zone()),
machine(zone(), kMachineWord32),
machine(zone()),
code(NULL) {}
~InstructionTester() { delete code; }
......
......@@ -630,7 +630,7 @@ TEST(ReduceLoadStore) {
Node* base = R.Constant<int32_t>(11);
Node* index = R.Constant<int32_t>(4);
Node* load = R.graph.NewNode(R.machine.Load(kMachineWord32), base, index);
Node* load = R.graph.NewNode(R.machine.Load(kMachInt32), base, index);
{
MachineOperatorReducer reducer(&R.graph);
......@@ -639,8 +639,8 @@ TEST(ReduceLoadStore) {
}
{
Node* store = R.graph.NewNode(
R.machine.Store(kMachineWord32, kNoWriteBarrier), base, index, load);
Node* store = R.graph.NewNode(R.machine.Store(kMachInt32, kNoWriteBarrier),
base, index, load);
MachineOperatorReducer reducer(&R.graph);
Reduction reduction = reducer.Reduce(store);
CHECK(!reduction.Changed()); // stores should not be reduced.
......
This diff is collapsed.
......@@ -145,7 +145,7 @@ TEST(BuildMulNodeGraph) {
Schedule schedule(scope.main_zone());
Graph graph(scope.main_zone());
CommonOperatorBuilder common(scope.main_zone());
MachineOperatorBuilder machine(scope.main_zone(), kMachineWord32);
MachineOperatorBuilder machine(scope.main_zone());
Node* start = graph.NewNode(common.Start(0));
graph.SetStart(start);
......
......@@ -1536,7 +1536,7 @@ TEST(BuildScheduleSimpleLoopWithCodeMotion) {
Graph graph(scope.main_zone());
CommonOperatorBuilder common_builder(scope.main_zone());
JSOperatorBuilder js_builder(scope.main_zone());
MachineOperatorBuilder machine_builder(scope.main_zone(), kMachineWord32);
MachineOperatorBuilder machine_builder(scope.main_zone());
Operator* op;
Handle<Object> object =
......
......@@ -424,9 +424,9 @@ class IfBuilderGenerator : public StructuredMachineAssemblerTester<int32_t> {
m_.IfNode();
{
Node* offset = Int32Constant(offset_ * 4);
Store(kMachineWord32, Parameter(1), offset, var_.Get());
Store(kMachInt32, Parameter(1), offset, var_.Get());
var_.Set(Int32Add(var_.Get(), Int32Constant(kIfInc)));
c_.If(Load(kMachineWord32, Parameter(0), offset));
c_.If(Load(kMachInt32, Parameter(0), offset));
offset_++;
}
break;
......
......@@ -128,7 +128,6 @@ class ValueHelper {
#define FOR_UINT32_SHIFTS(var) for (uint32_t var = 0; var < 32; var++)
} // namespace compiler
} // namespace internal
} // namespace v8
......
......@@ -77,7 +77,7 @@ static const DPI kMulDivInstructions[] = {
// TODO(all): Use TEST_P, see instruction-selector-arm-unittest.cc.
TEST_F(InstructionSelectorTest, LogicalWithParameter) {
TRACED_FOREACH(DPI, dpi, kLogicalInstructions) {
StreamBuilder m(this, kMachineWord32, kMachineWord32, kMachineWord32);
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
......@@ -89,7 +89,7 @@ TEST_F(InstructionSelectorTest, LogicalWithParameter) {
// TODO(all): Use TEST_P, see instruction-selector-arm-unittest.cc.
TEST_F(InstructionSelectorTest, AddSubWithParameter) {
TRACED_FOREACH(DPI, dpi, kAddSubInstructions) {
StreamBuilder m(this, kMachineWord32, kMachineWord32, kMachineWord32);
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
......@@ -106,7 +106,7 @@ TEST_F(InstructionSelectorTest, AddSubWithImmediate) {
j != immediates.end(); ++j) {
int32_t imm = *j;
SCOPED_TRACE(::testing::Message() << "imm = " << imm);
StreamBuilder m(this, kMachineWord32, kMachineWord32);
StreamBuilder m(this, kMachInt32, kMachInt32);
m.Return((m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
......@@ -120,7 +120,7 @@ TEST_F(InstructionSelectorTest, AddSubWithImmediate) {
// TODO(all): Use TEST_P, see instruction-selector-arm-unittest.cc.
TEST_F(InstructionSelectorTest, MulDivWithParameter) {
TRACED_FOREACH(DPI, dpi, kMulDivInstructions) {
StreamBuilder m(this, kMachineWord32, kMachineWord32, kMachineWord32);
StreamBuilder m(this, kMachInt32, kMachInt32, kMachInt32);
m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
......
......@@ -136,7 +136,7 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeInt32ToTagged) {
const int32_t kValueOffset = HeapNumber::kValueOffset - kHeapObjectTag;
EXPECT_THAT(NodeProperties::GetControlInput(merge, 0),
IsStore(kMachineFloat64, kNoWriteBarrier, heap_number,
IsStore(kMachFloat64, kNoWriteBarrier, heap_number,
IsInt32Constant(kValueOffset),
IsChangeInt32ToFloat64(val), _, heap_number));
......@@ -164,11 +164,11 @@ TARGET_TEST_F(ChangeLowering32Test, ChangeTaggedToFloat64) {
kSmiTagSize + SmiTagging<kPointerSize>::kSmiShiftSize;
const int32_t kValueOffset = HeapNumber::kValueOffset - kHeapObjectTag;
Node* phi = reduction.replacement();
ASSERT_THAT(
phi, IsPhi(IsLoad(kMachineFloat64, val, IsInt32Constant(kValueOffset), _),
IsChangeInt32ToFloat64(
IsWord32Sar(val, IsInt32Constant(kShiftAmount))),
_));
ASSERT_THAT(phi,
IsPhi(IsLoad(kMachFloat64, val, IsInt32Constant(kValueOffset), _),
IsChangeInt32ToFloat64(
IsWord32Sar(val, IsInt32Constant(kShiftAmount))),
_));
Node* merge = NodeProperties::GetControlInput(phi);
ASSERT_EQ(IrOpcode::kMerge, merge->opcode());
......@@ -228,11 +228,11 @@ TARGET_TEST_F(ChangeLowering64Test, ChangeTaggedToFloat64) {
kSmiTagSize + SmiTagging<kPointerSize>::kSmiShiftSize;
const int32_t kValueOffset = HeapNumber::kValueOffset - kHeapObjectTag;
Node* phi = reduction.replacement();
ASSERT_THAT(
phi, IsPhi(IsLoad(kMachineFloat64, val, IsInt32Constant(kValueOffset), _),
IsChangeInt32ToFloat64(IsConvertInt64ToInt32(
IsWord64Sar(val, IsInt32Constant(kShiftAmount)))),
_));
ASSERT_THAT(phi,
IsPhi(IsLoad(kMachFloat64, val, IsInt32Constant(kValueOffset), _),
IsChangeInt32ToFloat64(IsConvertInt64ToInt32(
IsWord64Sar(val, IsInt32Constant(kShiftAmount)))),
_));
Node* merge = NodeProperties::GetControlInput(phi);
ASSERT_EQ(IrOpcode::kMerge, merge->opcode());
......
......@@ -72,7 +72,7 @@ InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build(
TARGET_TEST_F(InstructionSelectorTest, ReturnParameter) {
StreamBuilder m(this, kMachineWord32, kMachineWord32);
StreamBuilder m(this, kMachInt32, kMachInt32);
m.Return(m.Parameter(0));
Stream s = m.Build(kAllInstructions);
ASSERT_EQ(2U, s.size());
......@@ -84,7 +84,7 @@ TARGET_TEST_F(InstructionSelectorTest, ReturnParameter) {
TARGET_TEST_F(InstructionSelectorTest, ReturnZero) {
StreamBuilder m(this, kMachineWord32);
StreamBuilder m(this, kMachInt32);
m.Return(m.Int32Constant(0));
Stream s = m.Build(kAllInstructions);
ASSERT_EQ(2U, s.size());
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment