R=mstarzinger@chromium.org
BUG=
Review URL: https://codereview.chromium.org/
863513002
Cr-Commit-Position: refs/heads/master@{#26141}
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 if it's eliminable.
- if (NodeProperties::IsTyped(node) &&
- !IrOpcode::IsLeafOpcode(node->opcode()) &&
+ if (!IrOpcode::IsConstantOpcode(node->opcode()) &&
+ NodeProperties::IsTyped(node) &&
node->op()->HasProperty(Operator::kEliminatable)) {
Type* upper = NodeProperties::GetBounds(node).upper;
if (upper->IsConstant()) {
V(Start) \
V(End)
-// Opcodes for common operators.
-#define LEAF_OP_LIST(V) \
- V(Int32Constant) \
- V(Int64Constant) \
- V(Float32Constant) \
- V(Float64Constant) \
- V(ExternalConstant) \
- V(NumberConstant) \
+// Opcodes for constant operators.
+#define CONSTANT_OP_LIST(V) \
+ V(Int32Constant) \
+ V(Int64Constant) \
+ V(Float32Constant) \
+ V(Float64Constant) \
+ V(ExternalConstant) \
+ V(NumberConstant) \
V(HeapConstant)
#define INNER_OP_LIST(V) \
V(Projection)
#define COMMON_OP_LIST(V) \
- LEAF_OP_LIST(V) \
+ CONSTANT_OP_LIST(V) \
INNER_OP_LIST(V)
// Opcodes for JavaScript operators.
return kJSEqual <= value && value <= kJSDebugger;
}
- // Returns true if opcode for leaf operator.
- static bool IsLeafOpcode(Value value) {
+ // Returns true if opcode for constant operator.
+ static bool IsConstantOpcode(Value value) {
return kInt32Constant <= value && value <= kHeapConstant;
}
};
}
-bool IsLeafOpcode(IrOpcode::Value opcode) {
+bool IsConstantOpcode(IrOpcode::Value opcode) {
switch (opcode) {
#define OPCODE(Opcode) \
case IrOpcode::k##Opcode: \
return true;
- LEAF_OP_LIST(OPCODE)
+ CONSTANT_OP_LIST(OPCODE)
#undef OPCODE
default:
return false;
}
-TEST(IrOpcodeTest, IsLeafOpcode) {
- EXPECT_FALSE(IrOpcode::IsLeafOpcode(kInvalidOpcode));
-#define OPCODE(Opcode) \
- EXPECT_EQ(IsLeafOpcode(IrOpcode::k##Opcode), \
- IrOpcode::IsLeafOpcode(IrOpcode::k##Opcode));
+TEST(IrOpcodeTest, IsConstantOpcode) {
+ EXPECT_FALSE(IrOpcode::IsConstantOpcode(kInvalidOpcode));
+#define OPCODE(Opcode) \
+ EXPECT_EQ(IsConstantOpcode(IrOpcode::k##Opcode), \
+ IrOpcode::IsConstantOpcode(IrOpcode::k##Opcode));
ALL_OP_LIST(OPCODE)
#undef OPCODE
}