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-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/address-map.h" | 9 #include "src/address-map.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } else if (NodeProperties::IsEffectEdge(edge)) { | 163 } else if (NodeProperties::IsEffectEdge(edge)) { |
164 edge.UpdateTo(effect); | 164 edge.UpdateTo(effect); |
165 } else { | 165 } else { |
166 DCHECK(NodeProperties::IsValueEdge(edge) || | 166 DCHECK(NodeProperties::IsValueEdge(edge) || |
167 NodeProperties::IsContextEdge(edge)); | 167 NodeProperties::IsContextEdge(edge)); |
168 } | 168 } |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 void ChangeToPureOp(Node* node, const Operator* new_op) { | 172 void ChangeToPureOp(Node* node, const Operator* new_op) { |
| 173 DCHECK(new_op->HasProperty(Operator::kPure)); |
173 if (node->op()->EffectInputCount() > 0) { | 174 if (node->op()->EffectInputCount() > 0) { |
174 DCHECK_LT(0, node->op()->ControlInputCount()); | 175 DCHECK_LT(0, node->op()->ControlInputCount()); |
175 // Disconnect the node from effect and control chains. | 176 // Disconnect the node from effect and control chains. |
176 Node* control = NodeProperties::GetControlInput(node); | 177 Node* control = NodeProperties::GetControlInput(node); |
177 Node* effect = NodeProperties::GetEffectInput(node); | 178 Node* effect = NodeProperties::GetEffectInput(node); |
178 ReplaceEffectControlUses(node, effect, control); | 179 ReplaceEffectControlUses(node, effect, control); |
179 node->TrimInputCount(new_op->ValueInputCount()); | 180 node->TrimInputCount(new_op->ValueInputCount()); |
180 } else { | 181 } else { |
181 DCHECK_EQ(0, node->op()->ControlInputCount()); | 182 DCHECK_EQ(0, node->op()->ControlInputCount()); |
182 } | 183 } |
(...skipping 3192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3375 Node* const rhs = node->InputAt(1); | 3376 Node* const rhs = node->InputAt(1); |
3376 | 3377 |
3377 node->InsertInput(graph()->zone(), 0, graph()->NewNode(op, lhs, rhs)); | 3378 node->InsertInput(graph()->zone(), 0, graph()->NewNode(op, lhs, rhs)); |
3378 DCHECK_EQ(lhs, node->InputAt(1)); | 3379 DCHECK_EQ(lhs, node->InputAt(1)); |
3379 DCHECK_EQ(rhs, node->InputAt(2)); | 3380 DCHECK_EQ(rhs, node->InputAt(2)); |
3380 NodeProperties::ChangeOp(node, common()->Select(rep)); | 3381 NodeProperties::ChangeOp(node, common()->Select(rep)); |
3381 } | 3382 } |
3382 | 3383 |
3383 void SimplifiedLowering::DoShift(Node* node, Operator const* op, | 3384 void SimplifiedLowering::DoShift(Node* node, Operator const* op, |
3384 Type* rhs_type) { | 3385 Type* rhs_type) { |
3385 Node* const rhs = NodeProperties::GetValueInput(node, 1); | |
3386 if (!rhs_type->Is(type_cache_.kZeroToThirtyOne)) { | 3386 if (!rhs_type->Is(type_cache_.kZeroToThirtyOne)) { |
| 3387 Node* const rhs = NodeProperties::GetValueInput(node, 1); |
3387 node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs, | 3388 node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs, |
3388 jsgraph()->Int32Constant(0x1f))); | 3389 jsgraph()->Int32Constant(0x1f))); |
3389 } | 3390 } |
3390 DCHECK(op->HasProperty(Operator::kPure)); | |
3391 ChangeToPureOp(node, op); | 3391 ChangeToPureOp(node, op); |
3392 } | 3392 } |
3393 | 3393 |
3394 void SimplifiedLowering::DoStringToNumber(Node* node) { | 3394 void SimplifiedLowering::DoStringToNumber(Node* node) { |
3395 Operator::Properties properties = Operator::kEliminatable; | 3395 Operator::Properties properties = Operator::kEliminatable; |
3396 Callable callable = CodeFactory::StringToNumber(isolate()); | 3396 Callable callable = CodeFactory::StringToNumber(isolate()); |
3397 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; | 3397 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; |
3398 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 3398 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
3399 isolate(), graph()->zone(), callable.descriptor(), 0, flags, properties); | 3399 isolate(), graph()->zone(), callable.descriptor(), 0, flags, properties); |
3400 node->InsertInput(graph()->zone(), 0, | 3400 node->InsertInput(graph()->zone(), 0, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3513 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3513 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3514 Operator::kNoProperties); | 3514 Operator::kNoProperties); |
3515 to_number_operator_.set(common()->Call(desc)); | 3515 to_number_operator_.set(common()->Call(desc)); |
3516 } | 3516 } |
3517 return to_number_operator_.get(); | 3517 return to_number_operator_.get(); |
3518 } | 3518 } |
3519 | 3519 |
3520 } // namespace compiler | 3520 } // namespace compiler |
3521 } // namespace internal | 3521 } // namespace internal |
3522 } // namespace v8 | 3522 } // namespace v8 |
OLD | NEW |