Reduction JSTypedLowering::Reduce(Node* node) {
+ // Check if the output type is a singleton. In that case we already know the
+ // result value and can simply replace the node unless there are effects.
+ if (node->bounds().upper->IsConstant() &&
+ !IrOpcode::IsLeafOpcode(node->opcode()) &&
+ !OperatorProperties::HasEffectOutput(node->op())) {
+ return ReplaceEagerly(node, jsgraph()->Constant(
+ node->bounds().upper->AsConstant()->Value()));
+ // TODO(neis): Extend this to Range(x,x), NaN, MinusZero, ...?
+ }
switch (node->opcode()) {
case IrOpcode::kJSEqual:
return ReduceJSEqual(node, false);
}
}
+ static bool IsLeafOpcode(Value val) {
+ switch (val) {
+#define RETURN_NAME(x) \
+ case k##x: \
+ return true;
+ LEAF_OP_LIST(RETURN_NAME)
+#undef RETURN_NAME
+ default:
+ return false;
+ }
+ }
+
static bool IsCommonOpcode(Value val) {
switch (val) {
#define RETURN_NAME(x) \