Commit a40be67b authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Eliminate CheckHeapObject if the input cannot be in SignedSmall range.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2425613002
Cr-Commit-Position: refs/heads/master@{#40339}
parent 9126cb8d
...@@ -74,6 +74,8 @@ Reduction TypedOptimization::Reduce(Node* node) { ...@@ -74,6 +74,8 @@ Reduction TypedOptimization::Reduce(Node* node) {
} }
} }
switch (node->opcode()) { switch (node->opcode()) {
case IrOpcode::kCheckHeapObject:
return ReduceCheckHeapObject(node);
case IrOpcode::kCheckMaps: case IrOpcode::kCheckMaps:
return ReduceCheckMaps(node); return ReduceCheckMaps(node);
case IrOpcode::kCheckString: case IrOpcode::kCheckString:
...@@ -107,6 +109,16 @@ MaybeHandle<Map> GetStableMapFromObjectType(Type* object_type) { ...@@ -107,6 +109,16 @@ MaybeHandle<Map> GetStableMapFromObjectType(Type* object_type) {
} // namespace } // namespace
Reduction TypedOptimization::ReduceCheckHeapObject(Node* node) {
Node* const input = NodeProperties::GetValueInput(node, 0);
Type* const input_type = NodeProperties::GetType(input);
if (!input_type->Maybe(Type::SignedSmall())) {
ReplaceWithValue(node, input);
return Replace(input);
}
return NoChange();
}
Reduction TypedOptimization::ReduceCheckMaps(Node* node) { Reduction TypedOptimization::ReduceCheckMaps(Node* node) {
// The CheckMaps(o, ...map...) can be eliminated if map is stable, // The CheckMaps(o, ...map...) can be eliminated if map is stable,
// o has type Constant(object) and map == object->map, and either // o has type Constant(object) and map == object->map, and either
......
...@@ -39,6 +39,7 @@ class TypedOptimization final : public AdvancedReducer { ...@@ -39,6 +39,7 @@ class TypedOptimization final : public AdvancedReducer {
Reduction Reduce(Node* node) final; Reduction Reduce(Node* node) final;
private: private:
Reduction ReduceCheckHeapObject(Node* node);
Reduction ReduceCheckMaps(Node* node); Reduction ReduceCheckMaps(Node* node);
Reduction ReduceCheckString(Node* node); Reduction ReduceCheckString(Node* node);
Reduction ReduceLoadField(Node* node); Reduction ReduceLoadField(Node* node);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment