diff options
Diffstat (limited to 'deps/v8/src/compiler/turboshaft/operation-matching.h')
-rw-r--r-- | deps/v8/src/compiler/turboshaft/operation-matching.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/deps/v8/src/compiler/turboshaft/operation-matching.h b/deps/v8/src/compiler/turboshaft/operation-matching.h index 7082b8293c..36bec7663e 100644 --- a/deps/v8/src/compiler/turboshaft/operation-matching.h +++ b/deps/v8/src/compiler/turboshaft/operation-matching.h @@ -6,6 +6,7 @@ #define V8_COMPILER_TURBOSHAFT_OPERATION_MATCHING_H_ #include "src/compiler/turboshaft/operations.h" +#include "src/compiler/turboshaft/representations.h" namespace v8 ::internal::compiler::turboshaft { @@ -93,7 +94,7 @@ class OperationMatching { int64_t* signed_constant = nullptr) { const ConstantOp* op = TryCast<ConstantOp>(matched); if (!op) return false; - switch (op->Representation()) { + switch (op->rep) { case RegisterRepresentation::Word32(): if (rep != WordRepresentation::Word32()) return false; break; @@ -106,8 +107,26 @@ class OperationMatching { default: return false; } - if (unsigned_constant) *unsigned_constant = op->integral(); - if (signed_constant) *signed_constant = op->signed_integral(); + if (unsigned_constant) { + switch (rep.value()) { + case WordRepresentation::Word32(): + *unsigned_constant = static_cast<uint32_t>(op->integral()); + break; + case WordRepresentation::Word64(): + *unsigned_constant = op->integral(); + break; + } + } + if (signed_constant) { + switch (rep.value()) { + case WordRepresentation::Word32(): + *signed_constant = static_cast<int32_t>(op->signed_integral()); + break; + case WordRepresentation::Word64(): + *signed_constant = op->signed_integral(); + break; + } + } return true; } |