Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 2703113003: [compiler] Cleanup: Move DCHECK into ChangeToPureOp. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698