| Index: src/compiler/machine-graph-verifier.cc
|
| diff --git a/src/compiler/machine-graph-verifier.cc b/src/compiler/machine-graph-verifier.cc
|
| index 9ab361475cbd1048024bd474458407e8a5a4898e..025c5dc86572cd2714eef5a8f1883f3d56a60f41 100644
|
| --- a/src/compiler/machine-graph-verifier.cc
|
| +++ b/src/compiler/machine-graph-verifier.cc
|
| @@ -306,8 +306,12 @@ class MachineRepresentationChecker {
|
| case IrOpcode::kInt64LessThanOrEqual:
|
| case IrOpcode::kUint64LessThan:
|
| case IrOpcode::kUint64LessThanOrEqual:
|
| - CheckValueInputForInt64Op(node, 0);
|
| - CheckValueInputForInt64Op(node, 1);
|
| + // Allows Smi operands in stubs.
|
| + CheckValueInputForInt64Op(node, 0, is_stub_);
|
| + CheckValueInputForInt64Op(node, 1, is_stub_);
|
| + if (is_stub_) {
|
| + CheckCompatibleValueInputRepresentations(node, 0, 1);
|
| + }
|
| break;
|
| case IrOpcode::kInt32x4ExtractLane:
|
| CheckValueInputRepresentationIs(node, 0,
|
| @@ -342,11 +346,35 @@ class MachineRepresentationChecker {
|
| case IrOpcode::kInt32LessThanOrEqual:
|
| case IrOpcode::kUint32LessThan:
|
| case IrOpcode::kUint32LessThanOrEqual:
|
| - MACHINE_BINOP_32_LIST(LABEL) {
|
| - CheckValueInputForInt32Op(node, 0);
|
| - CheckValueInputForInt32Op(node, 1);
|
| + case IrOpcode::kInt32Add:
|
| + case IrOpcode::kInt32Sub:
|
| + // Allows Smi operands in stubs.
|
| + CheckValueInputForInt32Op(node, 0, is_stub_);
|
| + CheckValueInputForInt32Op(node, 1, is_stub_);
|
| + if (is_stub_) {
|
| + CheckCompatibleValueInputRepresentations(node, 0, 1);
|
| }
|
| break;
|
| + case IrOpcode::kWord32And:
|
| + case IrOpcode::kWord32Or:
|
| + case IrOpcode::kWord32Xor:
|
| + case IrOpcode::kWord32Shl:
|
| + case IrOpcode::kWord32Shr:
|
| + case IrOpcode::kWord32Sar:
|
| + case IrOpcode::kWord32Ror:
|
| + case IrOpcode::kInt32Mul:
|
| + case IrOpcode::kInt32AddWithOverflow:
|
| + case IrOpcode::kInt32SubWithOverflow:
|
| + case IrOpcode::kInt32MulWithOverflow:
|
| + case IrOpcode::kInt32MulHigh:
|
| + case IrOpcode::kInt32Div:
|
| + case IrOpcode::kInt32Mod:
|
| + case IrOpcode::kUint32Div:
|
| + case IrOpcode::kUint32Mod:
|
| + case IrOpcode::kUint32MulHigh:
|
| + CheckValueInputForInt32Op(node, 0);
|
| + CheckValueInputForInt32Op(node, 1);
|
| + break;
|
| MACHINE_BINOP_64_LIST(LABEL) {
|
| CheckValueInputForInt64Op(node, 0);
|
| CheckValueInputForInt64Op(node, 1);
|
| @@ -488,6 +516,42 @@ class MachineRepresentationChecker {
|
| }
|
| }
|
|
|
| + MachineRepresentation Promote(MachineRepresentation rep) {
|
| + switch (rep) {
|
| + case MachineRepresentation::kBit:
|
| + case MachineRepresentation::kWord8:
|
| + case MachineRepresentation::kWord16:
|
| + case MachineRepresentation::kWord32:
|
| + return MachineRepresentation::kWord32;
|
| + case MachineRepresentation::kTagged:
|
| + case MachineRepresentation::kTaggedSigned:
|
| + case MachineRepresentation::kTaggedPointer:
|
| + return MachineRepresentation::kTagged;
|
| + default:
|
| + break;
|
| + }
|
| + return rep;
|
| + }
|
| +
|
| + void CheckCompatibleValueInputRepresentations(Node const* node, int index1,
|
| + int index2) {
|
| + Node const* input1 = node->InputAt(index1);
|
| + MachineRepresentation input_representation1 =
|
| + inferrer_->GetRepresentation(input1);
|
| + Node const* input2 = node->InputAt(index2);
|
| + MachineRepresentation input_representation2 =
|
| + inferrer_->GetRepresentation(input2);
|
| + if (Promote(input_representation1) != Promote(input_representation2)) {
|
| + std::stringstream str;
|
| + str << "TypeError: node #" << node->id() << ":" << *node->op()
|
| + << " uses operands with incompatible representations: node #"
|
| + << input1->id() << ":" << *input1->op() << ":"
|
| + << input_representation1 << " and #" << input2->id() << ":"
|
| + << *input2->op() << ":" << input_representation2 << ".";
|
| + FATAL(str.str().c_str());
|
| + }
|
| + }
|
| +
|
| void CheckValueInputIsTagged(Node const* node, int index) {
|
| Node const* input = node->InputAt(index);
|
| switch (inferrer_->GetRepresentation(input)) {
|
| @@ -538,7 +602,8 @@ class MachineRepresentationChecker {
|
| }
|
| }
|
|
|
| - void CheckValueInputForInt32Op(Node const* node, int index) {
|
| + void CheckValueInputForInt32Op(Node const* node, int index,
|
| + bool allow_tagged = false) {
|
| Node const* input = node->InputAt(index);
|
| switch (inferrer_->GetRepresentation(input)) {
|
| case MachineRepresentation::kBit:
|
| @@ -546,6 +611,13 @@ class MachineRepresentationChecker {
|
| case MachineRepresentation::kWord16:
|
| case MachineRepresentation::kWord32:
|
| return;
|
| + case MachineRepresentation::kTagged:
|
| + case MachineRepresentation::kTaggedSigned:
|
| + case MachineRepresentation::kTaggedPointer:
|
| + if (Is32() && allow_tagged) {
|
| + return;
|
| + }
|
| + break;
|
| case MachineRepresentation::kNone: {
|
| std::ostringstream str;
|
| str << "TypeError: node #" << input->id() << ":" << *input->op()
|
| @@ -563,13 +635,21 @@ class MachineRepresentationChecker {
|
| FATAL(str.str().c_str());
|
| }
|
|
|
| - void CheckValueInputForInt64Op(Node const* node, int index) {
|
| + void CheckValueInputForInt64Op(Node const* node, int index,
|
| + bool allow_tagged = false) {
|
| Node const* input = node->InputAt(index);
|
| MachineRepresentation input_representation =
|
| inferrer_->GetRepresentation(input);
|
| switch (input_representation) {
|
| case MachineRepresentation::kWord64:
|
| return;
|
| + case MachineRepresentation::kTagged:
|
| + case MachineRepresentation::kTaggedSigned:
|
| + case MachineRepresentation::kTaggedPointer:
|
| + if (Is64() && allow_tagged) {
|
| + return;
|
| + }
|
| + break;
|
| case MachineRepresentation::kNone: {
|
| std::ostringstream str;
|
| str << "TypeError: node #" << input->id() << ":" << *input->op()
|
|
|