| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/simplified-operator-reducer.h" | 5 #include "src/compiler/simplified-operator-reducer.h" |
| 6 | 6 |
| 7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
| 8 #include "src/compiler/machine-operator.h" | 8 #include "src/compiler/machine-operator.h" |
| 9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
| 10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 break; | 127 break; |
| 128 } | 128 } |
| 129 case IrOpcode::kCheckIf: { | 129 case IrOpcode::kCheckIf: { |
| 130 HeapObjectMatcher m(node->InputAt(0)); | 130 HeapObjectMatcher m(node->InputAt(0)); |
| 131 if (m.Is(factory()->true_value())) { | 131 if (m.Is(factory()->true_value())) { |
| 132 Node* const effect = NodeProperties::GetEffectInput(node); | 132 Node* const effect = NodeProperties::GetEffectInput(node); |
| 133 return Replace(effect); | 133 return Replace(effect); |
| 134 } | 134 } |
| 135 break; | 135 break; |
| 136 } | 136 } |
| 137 case IrOpcode::kCheckNumber: { |
| 138 NodeMatcher m(node->InputAt(0)); |
| 139 if (m.IsConvertTaggedHoleToUndefined()) { |
| 140 node->ReplaceInput(0, m.InputAt(0)); |
| 141 return Changed(node); |
| 142 } |
| 143 break; |
| 144 } |
| 137 case IrOpcode::kCheckTaggedPointer: { | 145 case IrOpcode::kCheckTaggedPointer: { |
| 138 Node* const input = node->InputAt(0); | 146 Node* const input = node->InputAt(0); |
| 139 if (DecideObjectIsSmi(input) == Decision::kFalse) { | 147 if (DecideObjectIsSmi(input) == Decision::kFalse) { |
| 140 ReplaceWithValue(node, input); | 148 ReplaceWithValue(node, input); |
| 141 return Replace(input); | 149 return Replace(input); |
| 142 } | 150 } |
| 143 break; | 151 break; |
| 144 } | 152 } |
| 145 case IrOpcode::kCheckTaggedSigned: { | 153 case IrOpcode::kCheckTaggedSigned: { |
| 146 Node* const input = node->InputAt(0); | 154 Node* const input = node->InputAt(0); |
| 147 if (DecideObjectIsSmi(input) == Decision::kTrue) { | 155 if (DecideObjectIsSmi(input) == Decision::kTrue) { |
| 148 ReplaceWithValue(node, input); | 156 ReplaceWithValue(node, input); |
| 149 return Replace(input); | 157 return Replace(input); |
| 150 } | 158 } |
| 159 NodeMatcher m(input); |
| 160 if (m.IsConvertTaggedHoleToUndefined()) { |
| 161 node->ReplaceInput(0, m.InputAt(0)); |
| 162 return Changed(node); |
| 163 } |
| 151 break; | 164 break; |
| 152 } | 165 } |
| 153 case IrOpcode::kObjectIsSmi: { | 166 case IrOpcode::kObjectIsSmi: { |
| 154 Node* const input = node->InputAt(0); | 167 Node* const input = node->InputAt(0); |
| 155 switch (DecideObjectIsSmi(input)) { | 168 switch (DecideObjectIsSmi(input)) { |
| 156 case Decision::kTrue: | 169 case Decision::kTrue: |
| 157 return ReplaceBoolean(true); | 170 return ReplaceBoolean(true); |
| 158 case Decision::kFalse: | 171 case Decision::kFalse: |
| 159 return ReplaceBoolean(false); | 172 return ReplaceBoolean(false); |
| 160 case Decision::kUnknown: | 173 case Decision::kUnknown: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 return jsgraph()->isolate(); | 233 return jsgraph()->isolate(); |
| 221 } | 234 } |
| 222 | 235 |
| 223 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { | 236 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { |
| 224 return jsgraph()->machine(); | 237 return jsgraph()->machine(); |
| 225 } | 238 } |
| 226 | 239 |
| 227 } // namespace compiler | 240 } // namespace compiler |
| 228 } // namespace internal | 241 } // namespace internal |
| 229 } // namespace v8 | 242 } // namespace v8 |
| OLD | NEW |