| Index: src/compiler/simplified-lowering.cc
|
| diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
|
| index e32a51e136b2e5453a44a344766ff0d933c410b4..e10619d21315c9adbb9c47d60ae2564d3579cb60 100644
|
| --- a/src/compiler/simplified-lowering.cc
|
| +++ b/src/compiler/simplified-lowering.cc
|
| @@ -54,10 +54,10 @@ class RepresentationSelector {
|
| public:
|
| // Information for each node tracked during the fixpoint.
|
| struct NodeInfo {
|
| - RepTypeUnion use : 14; // Union of all usages for the node.
|
| + MachineTypeUnion use : 14; // Union of all usages for the node.
|
| bool queued : 1; // Bookkeeping for the traversal.
|
| bool visited : 1; // Bookkeeping for the traversal.
|
| - RepTypeUnion output : 14; // Output type of the node.
|
| + MachineTypeUnion output : 14; // Output type of the node.
|
| };
|
|
|
| RepresentationSelector(JSGraph* jsgraph, Zone* zone,
|
| @@ -115,7 +115,7 @@ class RepresentationSelector {
|
|
|
| // Enqueue {node} if the {use} contains new information for that node.
|
| // Add {node} to {nodes_} if this is the first time it's been visited.
|
| - void Enqueue(Node* node, RepTypeUnion use = 0) {
|
| + void Enqueue(Node* node, MachineTypeUnion use = 0) {
|
| if (phase_ != PROPAGATE) return;
|
| NodeInfo* info = GetInfo(node);
|
| if (!info->visited) {
|
| @@ -147,15 +147,15 @@ class RepresentationSelector {
|
|
|
| bool lower() { return phase_ == LOWER; }
|
|
|
| - void Enqueue(Node* node, RepType use) {
|
| - Enqueue(node, static_cast<RepTypeUnion>(use));
|
| + void Enqueue(Node* node, MachineType use) {
|
| + Enqueue(node, static_cast<MachineTypeUnion>(use));
|
| }
|
|
|
| - void SetOutput(Node* node, RepTypeUnion output) {
|
| + void SetOutput(Node* node, MachineTypeUnion 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 & rMask) == 0 || IsPowerOf2(output & rMask));
|
| + DCHECK((output & kRepMask) == 0 || IsPowerOf2(output & kRepMask));
|
| GetInfo(node)->output = output;
|
| }
|
|
|
| @@ -165,16 +165,16 @@ class RepresentationSelector {
|
| NodeProperties::GetBounds(node->InputAt(1)).upper->Is(type);
|
| }
|
|
|
| - void ProcessInput(Node* node, int index, RepTypeUnion use) {
|
| + void ProcessInput(Node* node, int index, MachineTypeUnion use) {
|
| Node* input = node->InputAt(index);
|
| if (phase_ == PROPAGATE) {
|
| // In the propagate phase, propagate the usage information backward.
|
| Enqueue(input, use);
|
| } else {
|
| // In the change phase, insert a change before the use if necessary.
|
| - if ((use & rMask) == 0) return; // No input requirement on the use.
|
| - RepTypeUnion output = GetInfo(input)->output;
|
| - if ((output & rMask & use) == 0) {
|
| + if ((use & kRepMask) == 0) return; // No input requirement on the use.
|
| + MachineTypeUnion output = GetInfo(input)->output;
|
| + if ((output & kRepMask & use) == 0) {
|
| // Output representation doesn't match usage.
|
| TRACE((" change: #%d:%s(@%d #%d:%s) ", node->id(),
|
| node->op()->mnemonic(), index, input->id(),
|
| @@ -190,25 +190,18 @@ class RepresentationSelector {
|
| }
|
| }
|
|
|
| - static const RepTypeUnion kFloat64 = rFloat64 | tNumber;
|
| - static const RepTypeUnion kInt32 = rWord32 | tInt32;
|
| - static const RepTypeUnion kUint32 = rWord32 | tUint32;
|
| - static const RepTypeUnion kInt64 = rWord64 | tInt64;
|
| - static const RepTypeUnion kUint64 = rWord64 | tUint64;
|
| - static const RepTypeUnion kAnyTagged = rTagged | tAny;
|
| -
|
| // The default, most general visitation case. For {node}, process all value,
|
| // context, effect, and control inputs, assuming that value inputs should have
|
| - // {rTagged} representation and can observe all output values {tAny}.
|
| + // {kRepTagged} representation and can observe all output values {kTypeAny}.
|
| void VisitInputs(Node* node) {
|
| InputIter i = node->inputs().begin();
|
| for (int j = OperatorProperties::GetValueInputCount(node->op()); j > 0;
|
| ++i, j--) {
|
| - ProcessInput(node, i.index(), kAnyTagged); // Value inputs
|
| + ProcessInput(node, i.index(), kMachAnyTagged); // Value inputs
|
| }
|
| for (int j = OperatorProperties::GetContextInputCount(node->op()); j > 0;
|
| ++i, j--) {
|
| - ProcessInput(node, i.index(), kAnyTagged); // Context inputs
|
| + ProcessInput(node, i.index(), kMachAnyTagged); // Context inputs
|
| }
|
| for (int j = OperatorProperties::GetEffectInputCount(node->op()); j > 0;
|
| ++i, j--) {
|
| @@ -218,11 +211,12 @@ class RepresentationSelector {
|
| ++i, j--) {
|
| Enqueue(*i); // Control inputs: just visit
|
| }
|
| - SetOutput(node, kAnyTagged);
|
| + SetOutput(node, kMachAnyTagged);
|
| }
|
|
|
| // Helper for binops of the I x I -> O variety.
|
| - void VisitBinop(Node* node, RepTypeUnion input_use, RepTypeUnion output) {
|
| + void VisitBinop(Node* node, MachineTypeUnion input_use,
|
| + MachineTypeUnion output) {
|
| DCHECK_EQ(2, node->InputCount());
|
| ProcessInput(node, 0, input_use);
|
| ProcessInput(node, 1, input_use);
|
| @@ -230,32 +224,39 @@ class RepresentationSelector {
|
| }
|
|
|
| // Helper for unops of the I -> O variety.
|
| - void VisitUnop(Node* node, RepTypeUnion input_use, RepTypeUnion output) {
|
| + void VisitUnop(Node* node, MachineTypeUnion input_use,
|
| + MachineTypeUnion output) {
|
| DCHECK_EQ(1, node->InputCount());
|
| ProcessInput(node, 0, input_use);
|
| SetOutput(node, output);
|
| }
|
|
|
| // Helper for leaf nodes.
|
| - void VisitLeaf(Node* node, RepTypeUnion output) {
|
| + void VisitLeaf(Node* node, MachineTypeUnion output) {
|
| DCHECK_EQ(0, node->InputCount());
|
| SetOutput(node, output);
|
| }
|
|
|
| // Helpers for specific types of binops.
|
| - void VisitFloat64Binop(Node* node) { VisitBinop(node, kFloat64, kFloat64); }
|
| - void VisitInt32Binop(Node* node) { VisitBinop(node, kInt32, kInt32); }
|
| - void VisitUint32Binop(Node* node) { VisitBinop(node, kUint32, kUint32); }
|
| - void VisitInt64Binop(Node* node) { VisitBinop(node, kInt64, kInt64); }
|
| - void VisitUint64Binop(Node* node) { VisitBinop(node, kUint64, kUint64); }
|
| - void VisitFloat64Cmp(Node* node) { VisitBinop(node, kFloat64, rBit); }
|
| - void VisitInt32Cmp(Node* node) { VisitBinop(node, kInt32, rBit); }
|
| - void VisitUint32Cmp(Node* node) { VisitBinop(node, kUint32, rBit); }
|
| - void VisitInt64Cmp(Node* node) { VisitBinop(node, kInt64, rBit); }
|
| - void VisitUint64Cmp(Node* node) { VisitBinop(node, kUint64, rBit); }
|
| + void VisitFloat64Binop(Node* node) {
|
| + VisitBinop(node, kMachFloat64, kMachFloat64);
|
| + }
|
| + void VisitInt32Binop(Node* node) { VisitBinop(node, kMachInt32, kMachInt32); }
|
| + void VisitUint32Binop(Node* node) {
|
| + VisitBinop(node, kMachUint32, kMachUint32);
|
| + }
|
| + void VisitInt64Binop(Node* node) { VisitBinop(node, kMachInt64, kMachInt64); }
|
| + void VisitUint64Binop(Node* node) {
|
| + VisitBinop(node, kMachUint64, kMachUint64);
|
| + }
|
| + void VisitFloat64Cmp(Node* node) { VisitBinop(node, kMachFloat64, kRepBit); }
|
| + void VisitInt32Cmp(Node* node) { VisitBinop(node, kMachInt32, kRepBit); }
|
| + void VisitUint32Cmp(Node* node) { VisitBinop(node, kMachUint32, kRepBit); }
|
| + void VisitInt64Cmp(Node* node) { VisitBinop(node, kMachInt64, kRepBit); }
|
| + void VisitUint64Cmp(Node* node) { VisitBinop(node, kMachUint64, kRepBit); }
|
|
|
| // Helper for handling phis.
|
| - void VisitPhi(Node* node, RepTypeUnion use) {
|
| + void VisitPhi(Node* node, MachineTypeUnion use) {
|
| // First, propagate the usage information to inputs of the phi.
|
| int values = OperatorProperties::GetValueInputCount(node->op());
|
| Node::Inputs inputs = node->inputs();
|
| @@ -267,32 +268,32 @@ class RepresentationSelector {
|
| }
|
| // Phis adapt to whatever output representation their uses demand,
|
| // pushing representation changes to their inputs.
|
| - RepTypeUnion use_rep = GetUseInfo(node) & rMask;
|
| - RepTypeUnion use_type = GetUseInfo(node) & tMask;
|
| - RepTypeUnion rep = 0;
|
| - if (use_rep & rTagged) {
|
| - rep = rTagged; // Tagged overrides everything.
|
| - } else if (use_rep & rFloat64) {
|
| - rep = rFloat64;
|
| - } else if (use_rep & rWord64) {
|
| - rep = rWord64;
|
| - } else if (use_rep & rWord32) {
|
| - rep = rWord32;
|
| - } else if (use_rep & rBit) {
|
| - rep = rBit;
|
| + MachineTypeUnion use_rep = GetUseInfo(node) & kRepMask;
|
| + MachineTypeUnion use_type = GetUseInfo(node) & kTypeMask;
|
| + MachineTypeUnion rep = 0;
|
| + if (use_rep & kRepTagged) {
|
| + rep = kRepTagged; // Tagged overrides everything.
|
| + } else if (use_rep & kRepFloat64) {
|
| + rep = kRepFloat64;
|
| + } else if (use_rep & kRepWord64) {
|
| + rep = kRepWord64;
|
| + } else if (use_rep & kRepWord32) {
|
| + rep = kRepWord32;
|
| + } else if (use_rep & kRepBit) {
|
| + rep = kRepBit;
|
| } else {
|
| // There was no representation associated with any of the uses.
|
| // TODO(titzer): Select the best rep using phi's type, not the usage type?
|
| - if (use_type & tAny) {
|
| - rep = rTagged;
|
| - } else if (use_type & tNumber) {
|
| - rep = rFloat64;
|
| - } else if (use_type & tInt64 || use_type & tUint64) {
|
| - rep = rWord64;
|
| - } else if (use_type & tInt32 || use_type & tUint32) {
|
| - rep = rWord32;
|
| - } else if (use_type & tBool) {
|
| - rep = rBit;
|
| + if (use_type & kTypeAny) {
|
| + rep = kRepTagged;
|
| + } else if (use_type & kTypeNumber) {
|
| + rep = kRepFloat64;
|
| + } else if (use_type & kTypeInt64 || use_type & kTypeUint64) {
|
| + rep = kRepWord64;
|
| + } else if (use_type & kTypeInt32 || use_type & kTypeUint32) {
|
| + rep = kRepWord32;
|
| + } else if (use_type & kTypeBool) {
|
| + rep = kRepBit;
|
| } else {
|
| UNREACHABLE(); // should have at least a usage type!
|
| }
|
| @@ -316,7 +317,8 @@ class RepresentationSelector {
|
|
|
| // Dispatching routine for visiting the node {node} with the usage {use}.
|
| // Depending on the operator, propagate new usage info to the inputs.
|
| - void VisitNode(Node* node, RepTypeUnion use, SimplifiedLowering* lowering) {
|
| + void VisitNode(Node* node, MachineTypeUnion use,
|
| + SimplifiedLowering* lowering) {
|
| switch (node->opcode()) {
|
| //------------------------------------------------------------------
|
| // Common operators.
|
| @@ -328,21 +330,21 @@ class RepresentationSelector {
|
| // TODO(titzer): use representation from linkage.
|
| Type* upper = NodeProperties::GetBounds(node).upper;
|
| ProcessInput(node, 0, 0);
|
| - SetOutput(node, rTagged | changer_->TypeFromUpperBound(upper));
|
| + SetOutput(node, kRepTagged | changer_->TypeFromUpperBound(upper));
|
| return;
|
| }
|
| case IrOpcode::kInt32Constant:
|
| - return VisitLeaf(node, rWord32);
|
| + return VisitLeaf(node, kRepWord32);
|
| case IrOpcode::kInt64Constant:
|
| - return VisitLeaf(node, rWord64);
|
| + return VisitLeaf(node, kRepWord64);
|
| case IrOpcode::kFloat64Constant:
|
| - return VisitLeaf(node, rFloat64);
|
| + return VisitLeaf(node, kRepFloat64);
|
| case IrOpcode::kExternalConstant:
|
| - return VisitLeaf(node, rPtr);
|
| + return VisitLeaf(node, kMachPtr);
|
| case IrOpcode::kNumberConstant:
|
| - return VisitLeaf(node, rTagged);
|
| + return VisitLeaf(node, kRepTagged);
|
| case IrOpcode::kHeapConstant:
|
| - return VisitLeaf(node, rTagged);
|
| + return VisitLeaf(node, kRepTagged);
|
|
|
| case IrOpcode::kEnd:
|
| case IrOpcode::kIfTrue:
|
| @@ -353,7 +355,7 @@ class RepresentationSelector {
|
| return VisitInputs(node); // default visit for all node inputs.
|
|
|
| case IrOpcode::kBranch:
|
| - ProcessInput(node, 0, rBit);
|
| + ProcessInput(node, 0, kRepBit);
|
| Enqueue(NodeProperties::GetControlInput(node, 0));
|
| break;
|
| case IrOpcode::kPhi:
|
| @@ -372,27 +374,27 @@ class RepresentationSelector {
|
| #undef DEFINE_JS_CASE
|
| contains_js_nodes_ = true;
|
| VisitInputs(node);
|
| - return SetOutput(node, rTagged);
|
| + return SetOutput(node, kRepTagged);
|
|
|
| //------------------------------------------------------------------
|
| // Simplified operators.
|
| //------------------------------------------------------------------
|
| case IrOpcode::kBooleanNot: {
|
| if (lower()) {
|
| - RepTypeUnion input = GetInfo(node->InputAt(0))->output;
|
| - if (input & rBit) {
|
| - // BooleanNot(x: rBit) => WordEqual(x, #0)
|
| + MachineTypeUnion input = GetInfo(node->InputAt(0))->output;
|
| + if (input & kRepBit) {
|
| + // BooleanNot(x: kRepBit) => WordEqual(x, #0)
|
| node->set_op(lowering->machine()->WordEqual());
|
| node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0));
|
| } else {
|
| - // BooleanNot(x: rTagged) => WordEqual(x, #false)
|
| + // BooleanNot(x: kRepTagged) => WordEqual(x, #false)
|
| node->set_op(lowering->machine()->WordEqual());
|
| node->AppendInput(jsgraph_->zone(), jsgraph_->FalseConstant());
|
| }
|
| } else {
|
| // No input representation requirement; adapt during lowering.
|
| - ProcessInput(node, 0, tBool);
|
| - SetOutput(node, rBit);
|
| + ProcessInput(node, 0, kTypeBool);
|
| + SetOutput(node, kRepBit);
|
| }
|
| break;
|
| }
|
| @@ -420,12 +422,12 @@ class RepresentationSelector {
|
| // Add and subtract reduce to Int32Add/Sub if the inputs
|
| // are already integers and all uses are truncating.
|
| if (BothInputsAre(node, Type::Signed32()) &&
|
| - (use & (tUint32 | tNumber | tAny)) == 0) {
|
| + (use & (kTypeUint32 | kTypeNumber | kTypeAny)) == 0) {
|
| // => signed Int32Add/Sub
|
| VisitInt32Binop(node);
|
| if (lower()) node->set_op(Int32Op(node));
|
| } else if (BothInputsAre(node, Type::Unsigned32()) &&
|
| - (use & (tInt32 | tNumber | tAny)) == 0) {
|
| + (use & (kTypeInt32 | kTypeNumber | kTypeAny)) == 0) {
|
| // => unsigned Int32Add/Sub
|
| VisitUint32Binop(node);
|
| if (lower()) node->set_op(Uint32Op(node));
|
| @@ -445,84 +447,86 @@ class RepresentationSelector {
|
| break;
|
| }
|
| case IrOpcode::kNumberToInt32: {
|
| - RepTypeUnion use_rep = use & rMask;
|
| + MachineTypeUnion use_rep = use & kRepMask;
|
| if (lower()) {
|
| - RepTypeUnion in = GetInfo(node->InputAt(0))->output;
|
| - if ((in & tMask) == tInt32 || (in & rMask) == rWord32) {
|
| + MachineTypeUnion in = GetInfo(node->InputAt(0))->output;
|
| + if ((in & kTypeMask) == kTypeInt32 || (in & kRepMask) == kRepWord32) {
|
| // If the input has type int32, or is already a word32, just change
|
| // representation if necessary.
|
| - VisitUnop(node, tInt32 | use_rep, tInt32 | use_rep);
|
| + VisitUnop(node, kTypeInt32 | use_rep, kTypeInt32 | use_rep);
|
| DeferReplacement(node, node->InputAt(0));
|
| } else {
|
| // Require the input in float64 format and perform truncation.
|
| // TODO(turbofan): could also avoid the truncation with a tag check.
|
| - VisitUnop(node, tInt32 | rFloat64, tInt32 | rWord32);
|
| + VisitUnop(node, kTypeInt32 | kRepFloat64, kTypeInt32 | kRepWord32);
|
| // TODO(titzer): should be a truncation.
|
| node->set_op(lowering->machine()->ChangeFloat64ToInt32());
|
| }
|
| } else {
|
| // Propagate a type to the input, but pass through representation.
|
| - VisitUnop(node, tInt32, tInt32 | use_rep);
|
| + VisitUnop(node, kTypeInt32, kTypeInt32 | use_rep);
|
| }
|
| break;
|
| }
|
| case IrOpcode::kNumberToUint32: {
|
| - RepTypeUnion use_rep = use & rMask;
|
| + MachineTypeUnion use_rep = use & kRepMask;
|
| if (lower()) {
|
| - RepTypeUnion in = GetInfo(node->InputAt(0))->output;
|
| - if ((in & tMask) == tUint32 || (in & rMask) == rWord32) {
|
| + MachineTypeUnion in = GetInfo(node->InputAt(0))->output;
|
| + if ((in & kTypeMask) == kTypeUint32 ||
|
| + (in & kRepMask) == kRepWord32) {
|
| // The input has type int32, just change representation.
|
| - VisitUnop(node, tUint32 | use_rep, tUint32 | use_rep);
|
| + VisitUnop(node, kTypeUint32 | use_rep, kTypeUint32 | use_rep);
|
| DeferReplacement(node, node->InputAt(0));
|
| } else {
|
| // Require the input in float64 format to perform truncation.
|
| // TODO(turbofan): could also avoid the truncation with a tag check.
|
| - VisitUnop(node, tUint32 | rFloat64, tUint32 | rWord32);
|
| + VisitUnop(node, kTypeUint32 | kRepFloat64,
|
| + kTypeUint32 | kRepWord32);
|
| // TODO(titzer): should be a truncation.
|
| node->set_op(lowering->machine()->ChangeFloat64ToUint32());
|
| }
|
| } else {
|
| // Propagate a type to the input, but pass through representation.
|
| - VisitUnop(node, tUint32, tUint32 | use_rep);
|
| + VisitUnop(node, kTypeUint32, kTypeUint32 | use_rep);
|
| }
|
| break;
|
| }
|
| case IrOpcode::kReferenceEqual: {
|
| - VisitBinop(node, kAnyTagged, rBit);
|
| + VisitBinop(node, kMachAnyTagged, kRepBit);
|
| if (lower()) node->set_op(lowering->machine()->WordEqual());
|
| break;
|
| }
|
| case IrOpcode::kStringEqual: {
|
| - VisitBinop(node, kAnyTagged, rBit);
|
| + VisitBinop(node, kMachAnyTagged, kRepBit);
|
| // TODO(titzer): lower StringEqual to stub/runtime call.
|
| break;
|
| }
|
| case IrOpcode::kStringLessThan: {
|
| - VisitBinop(node, kAnyTagged, rBit);
|
| + VisitBinop(node, kMachAnyTagged, kRepBit);
|
| // TODO(titzer): lower StringLessThan to stub/runtime call.
|
| break;
|
| }
|
| case IrOpcode::kStringLessThanOrEqual: {
|
| - VisitBinop(node, kAnyTagged, rBit);
|
| + VisitBinop(node, kMachAnyTagged, kRepBit);
|
| // TODO(titzer): lower StringLessThanOrEqual to stub/runtime call.
|
| break;
|
| }
|
| case IrOpcode::kStringAdd: {
|
| - VisitBinop(node, kAnyTagged, kAnyTagged);
|
| + VisitBinop(node, kMachAnyTagged, kMachAnyTagged);
|
| // TODO(titzer): lower StringAdd to stub/runtime call.
|
| break;
|
| }
|
| case IrOpcode::kLoadField: {
|
| FieldAccess access = FieldAccessOf(node->op());
|
| ProcessInput(node, 0, changer_->TypeForBasePointer(access));
|
| - SetOutput(node, changer_->TypeForField(access));
|
| + SetOutput(node, access.machine_type);
|
| if (lower()) lowering->DoLoadField(node);
|
| break;
|
| }
|
| case IrOpcode::kStoreField: {
|
| FieldAccess access = FieldAccessOf(node->op());
|
| ProcessInput(node, 0, changer_->TypeForBasePointer(access));
|
| - ProcessInput(node, 1, changer_->TypeForField(access));
|
| + ProcessInput(node, 1, access.machine_type);
|
| SetOutput(node, 0);
|
| if (lower()) lowering->DoStoreField(node);
|
| break;
|
| @@ -530,16 +534,16 @@ class RepresentationSelector {
|
| case IrOpcode::kLoadElement: {
|
| ElementAccess access = ElementAccessOf(node->op());
|
| ProcessInput(node, 0, changer_->TypeForBasePointer(access));
|
| - ProcessInput(node, 1, kInt32); // element index
|
| - SetOutput(node, changer_->TypeForElement(access));
|
| + ProcessInput(node, 1, kMachInt32); // element index
|
| + SetOutput(node, access.machine_type);
|
| if (lower()) lowering->DoLoadElement(node);
|
| break;
|
| }
|
| case IrOpcode::kStoreElement: {
|
| ElementAccess access = ElementAccessOf(node->op());
|
| ProcessInput(node, 0, changer_->TypeForBasePointer(access));
|
| - ProcessInput(node, 1, kInt32); // element index
|
| - ProcessInput(node, 2, changer_->TypeForElement(access));
|
| + ProcessInput(node, 1, kMachInt32); // element index
|
| + ProcessInput(node, 2, access.machine_type);
|
| SetOutput(node, 0);
|
| if (lower()) lowering->DoStoreElement(node);
|
| break;
|
| @@ -550,26 +554,26 @@ class RepresentationSelector {
|
| //------------------------------------------------------------------
|
| case IrOpcode::kLoad: {
|
| // TODO(titzer): machine loads/stores need to know BaseTaggedness!?
|
| - RepType tBase = rTagged;
|
| - MachineType rep = OpParameter<MachineType>(node);
|
| + MachineType tBase = kRepTagged;
|
| + MachineType machine_type = OpParameter<MachineType>(node);
|
| ProcessInput(node, 0, tBase); // pointer or object
|
| - ProcessInput(node, 1, kInt32); // index
|
| - SetOutput(node, changer_->TypeForMachineType(rep));
|
| + ProcessInput(node, 1, kMachInt32); // index
|
| + SetOutput(node, machine_type);
|
| break;
|
| }
|
| case IrOpcode::kStore: {
|
| // TODO(titzer): machine loads/stores need to know BaseTaggedness!?
|
| - RepType tBase = rTagged;
|
| + MachineType tBase = kRepTagged;
|
| StoreRepresentation rep = OpParameter<StoreRepresentation>(node);
|
| ProcessInput(node, 0, tBase); // pointer or object
|
| - ProcessInput(node, 1, kInt32); // index
|
| - ProcessInput(node, 2, changer_->TypeForMachineType(rep.rep));
|
| + ProcessInput(node, 1, kMachInt32); // index
|
| + ProcessInput(node, 2, rep.machine_type);
|
| SetOutput(node, 0);
|
| break;
|
| }
|
| case IrOpcode::kWord32Shr:
|
| // We output unsigned int32 for shift right because JavaScript.
|
| - return VisitBinop(node, rWord32, rWord32 | tUint32);
|
| + return VisitBinop(node, kRepWord32, kRepWord32 | kTypeUint32);
|
| case IrOpcode::kWord32And:
|
| case IrOpcode::kWord32Or:
|
| case IrOpcode::kWord32Xor:
|
| @@ -578,9 +582,9 @@ class RepresentationSelector {
|
| // We use signed int32 as the output type for these word32 operations,
|
| // though the machine bits are the same for either signed or unsigned,
|
| // because JavaScript considers the result from these operations signed.
|
| - return VisitBinop(node, rWord32, rWord32 | tInt32);
|
| + return VisitBinop(node, kRepWord32, kRepWord32 | kTypeInt32);
|
| case IrOpcode::kWord32Equal:
|
| - return VisitBinop(node, rWord32, rBit);
|
| + return VisitBinop(node, kRepWord32, kRepBit);
|
|
|
| case IrOpcode::kInt32Add:
|
| case IrOpcode::kInt32Sub:
|
| @@ -619,23 +623,29 @@ class RepresentationSelector {
|
| case IrOpcode::kWord64Shl:
|
| case IrOpcode::kWord64Shr:
|
| case IrOpcode::kWord64Sar:
|
| - return VisitBinop(node, rWord64, rWord64);
|
| + return VisitBinop(node, kRepWord64, kRepWord64);
|
| case IrOpcode::kWord64Equal:
|
| - return VisitBinop(node, rWord64, rBit);
|
| + return VisitBinop(node, kRepWord64, kRepBit);
|
|
|
| case IrOpcode::kConvertInt32ToInt64:
|
| - return VisitUnop(node, tInt32 | rWord32, tInt32 | rWord64);
|
| + return VisitUnop(node, kTypeInt32 | kRepWord32,
|
| + kTypeInt32 | kRepWord64);
|
| case IrOpcode::kConvertInt64ToInt32:
|
| - return VisitUnop(node, tInt64 | rWord64, tInt32 | rWord32);
|
| + return VisitUnop(node, kTypeInt64 | kRepWord64,
|
| + kTypeInt32 | kRepWord32);
|
|
|
| case IrOpcode::kChangeInt32ToFloat64:
|
| - return VisitUnop(node, tInt32 | rWord32, tInt32 | rFloat64);
|
| + return VisitUnop(node, kTypeInt32 | kRepWord32,
|
| + kTypeInt32 | kRepFloat64);
|
| case IrOpcode::kChangeUint32ToFloat64:
|
| - return VisitUnop(node, tUint32 | rWord32, tUint32 | rFloat64);
|
| + return VisitUnop(node, kTypeUint32 | kRepWord32,
|
| + kTypeUint32 | kRepFloat64);
|
| case IrOpcode::kChangeFloat64ToInt32:
|
| - return VisitUnop(node, tInt32 | rFloat64, tInt32 | rWord32);
|
| + return VisitUnop(node, kTypeInt32 | kRepFloat64,
|
| + kTypeInt32 | kRepWord32);
|
| case IrOpcode::kChangeFloat64ToUint32:
|
| - return VisitUnop(node, tUint32 | rFloat64, tUint32 | rWord32);
|
| + return VisitUnop(node, kTypeUint32 | kRepFloat64,
|
| + kTypeUint32 | kRepWord32);
|
|
|
| case IrOpcode::kFloat64Add:
|
| case IrOpcode::kFloat64Sub:
|
| @@ -674,11 +684,10 @@ class RepresentationSelector {
|
| TRACE(("\n"));
|
| }
|
|
|
| - void PrintInfo(RepTypeUnion info) {
|
| + void PrintInfo(MachineTypeUnion info) {
|
| if (FLAG_trace_representation) {
|
| - char buf[REP_TYPE_STRLEN];
|
| - RenderRepTypeUnion(buf, info);
|
| - TRACE(("%s", buf));
|
| + OFStream os(stdout);
|
| + PrintMachineTypeUnionTo(os, info);
|
| }
|
| }
|
|
|
| @@ -700,7 +709,7 @@ class RepresentationSelector {
|
| return &info_[node->id()];
|
| }
|
|
|
| - RepTypeUnion GetUseInfo(Node* node) { return GetInfo(node)->use; }
|
| + MachineTypeUnion GetUseInfo(Node* node) { return GetInfo(node)->use; }
|
| };
|
|
|
|
|
| @@ -759,7 +768,7 @@ static void UpdateControlSuccessors(Node* before, Node* node) {
|
| void SimplifiedLowering::DoChangeTaggedToUI32(Node* node, Node* effect,
|
| Node* control, bool is_signed) {
|
| // if (IsTagged(val))
|
| - // ConvertFloat64To(Int32|Uint32)(Load[kMachineFloat64](input, #value_offset))
|
| + // ConvertFloat64To(Int32|Uint32)(Load[kMachFloat64](input, #value_offset))
|
| // else Untag(val)
|
| Node* val = node->InputAt(0);
|
| Node* branch = graph()->NewNode(common()->Branch(), IsTagged(val), control);
|
| @@ -767,7 +776,7 @@ void SimplifiedLowering::DoChangeTaggedToUI32(Node* node, Node* effect,
|
| // true branch.
|
| Node* tbranch = graph()->NewNode(common()->IfTrue(), branch);
|
| Node* loaded = graph()->NewNode(
|
| - machine()->Load(kMachineFloat64), val,
|
| + machine()->Load(kMachFloat64), val,
|
| OffsetMinusTagConstant(HeapNumber::kValueOffset), effect);
|
| Operator* op = is_signed ? machine()->ChangeFloat64ToInt32()
|
| : machine()->ChangeFloat64ToUint32();
|
| @@ -788,7 +797,7 @@ void SimplifiedLowering::DoChangeTaggedToUI32(Node* node, Node* effect,
|
|
|
| void SimplifiedLowering::DoChangeTaggedToFloat64(Node* node, Node* effect,
|
| Node* control) {
|
| - // if (IsTagged(input)) Load[kMachineFloat64](input, #value_offset)
|
| + // if (IsTagged(input)) Load[kMachFloat64](input, #value_offset)
|
| // else ConvertFloat64(Untag(input))
|
| Node* val = node->InputAt(0);
|
| Node* branch = graph()->NewNode(common()->Branch(), IsTagged(val), control);
|
| @@ -796,7 +805,7 @@ void SimplifiedLowering::DoChangeTaggedToFloat64(Node* node, Node* effect,
|
| // true branch.
|
| Node* tbranch = graph()->NewNode(common()->IfTrue(), branch);
|
| Node* loaded = graph()->NewNode(
|
| - machine()->Load(kMachineFloat64), val,
|
| + machine()->Load(kMachFloat64), val,
|
| OffsetMinusTagConstant(HeapNumber::kValueOffset), effect);
|
|
|
| // false branch.
|
| @@ -897,7 +906,8 @@ static WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged,
|
| MachineType representation,
|
| Type* type) {
|
| // TODO(turbofan): skip write barriers for Smis, etc.
|
| - if (base_is_tagged == kTaggedBase && representation == kMachineTagged) {
|
| + if (base_is_tagged == kTaggedBase &&
|
| + RepresentationOf(representation) == kRepTagged) {
|
| // Write barriers are only for writes into heap objects (i.e. tagged base).
|
| return kFullWriteBarrier;
|
| }
|
| @@ -907,7 +917,7 @@ static WriteBarrierKind ComputeWriteBarrierKind(BaseTaggedness base_is_tagged,
|
|
|
| void SimplifiedLowering::DoLoadField(Node* node) {
|
| const FieldAccess& access = FieldAccessOf(node->op());
|
| - node->set_op(machine_.Load(access.representation));
|
| + node->set_op(machine_.Load(access.machine_type));
|
| Node* offset = jsgraph()->Int32Constant(access.offset - access.tag());
|
| node->InsertInput(zone(), 1, offset);
|
| }
|
| @@ -916,8 +926,8 @@ void SimplifiedLowering::DoLoadField(Node* node) {
|
| void SimplifiedLowering::DoStoreField(Node* node) {
|
| const FieldAccess& access = FieldAccessOf(node->op());
|
| WriteBarrierKind kind = ComputeWriteBarrierKind(
|
| - access.base_is_tagged, access.representation, access.type);
|
| - node->set_op(machine_.Store(access.representation, kind));
|
| + access.base_is_tagged, access.machine_type, access.type);
|
| + node->set_op(machine_.Store(access.machine_type, kind));
|
| Node* offset = jsgraph()->Int32Constant(access.offset - access.tag());
|
| node->InsertInput(zone(), 1, offset);
|
| }
|
| @@ -925,28 +935,7 @@ void SimplifiedLowering::DoStoreField(Node* node) {
|
|
|
| Node* SimplifiedLowering::ComputeIndex(const ElementAccess& access,
|
| Node* index) {
|
| - int element_size = 0;
|
| - switch (access.representation) {
|
| - case kMachineTagged:
|
| - element_size = kPointerSize;
|
| - break;
|
| - case kMachineWord8:
|
| - element_size = 1;
|
| - break;
|
| - case kMachineWord16:
|
| - element_size = 2;
|
| - break;
|
| - case kMachineWord32:
|
| - element_size = 4;
|
| - break;
|
| - case kMachineWord64:
|
| - case kMachineFloat64:
|
| - element_size = 8;
|
| - break;
|
| - case kMachineLast:
|
| - UNREACHABLE();
|
| - break;
|
| - }
|
| + int element_size = ElementSizeOf(access.machine_type);
|
| if (element_size != 1) {
|
| index = graph()->NewNode(machine()->Int32Mul(),
|
| jsgraph()->Int32Constant(element_size), index);
|
| @@ -960,7 +949,7 @@ Node* SimplifiedLowering::ComputeIndex(const ElementAccess& access,
|
|
|
| void SimplifiedLowering::DoLoadElement(Node* node) {
|
| const ElementAccess& access = ElementAccessOf(node->op());
|
| - node->set_op(machine_.Load(access.representation));
|
| + node->set_op(machine_.Load(access.machine_type));
|
| node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
|
| }
|
|
|
| @@ -968,8 +957,8 @@ void SimplifiedLowering::DoLoadElement(Node* node) {
|
| void SimplifiedLowering::DoStoreElement(Node* node) {
|
| const ElementAccess& access = ElementAccessOf(node->op());
|
| WriteBarrierKind kind = ComputeWriteBarrierKind(
|
| - access.base_is_tagged, access.representation, access.type);
|
| - node->set_op(machine_.Store(access.representation, kind));
|
| + access.base_is_tagged, access.machine_type, access.type);
|
| + node->set_op(machine_.Store(access.machine_type, kind));
|
| node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
|
| }
|
|
|
|
|