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

Unified Diff: src/compiler/representation-change.h

Issue 1461963002: [turbofan] Simplify NumberTo(U)Int32 handling in representation inference. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/representation-change.h
diff --git a/src/compiler/representation-change.h b/src/compiler/representation-change.h
index b89d9363de8f3e5f2c9b56f8df9182308c436c5c..2eff131f26550bda84c4a81caa2709d897e198d5 100644
--- a/src/compiler/representation-change.h
+++ b/src/compiler/representation-change.h
@@ -211,16 +211,8 @@ class RepresentationChanger {
return jsgraph()->graph()->NewNode(op, node);
}
- Node* MakeInt32Constant(double value) {
- if (value < 0) {
- DCHECK(IsInt32Double(value));
- int32_t iv = static_cast<int32_t>(value);
- return jsgraph()->Int32Constant(iv);
- } else {
- DCHECK(IsUint32Double(value));
- int32_t iv = static_cast<int32_t>(static_cast<uint32_t>(value));
- return jsgraph()->Int32Constant(iv);
- }
+ Node* MakeTruncatedInt32Constant(double value) {
+ return jsgraph()->Int32Constant(DoubleToInt32(value));
}
Node* GetTruncatedWord32For(Node* node, MachineTypeUnion output_type) {
@@ -260,10 +252,10 @@ class RepresentationChanger {
case IrOpcode::kInt32Constant:
return node; // No change necessary.
case IrOpcode::kFloat32Constant:
- return MakeInt32Constant(OpParameter<float>(node));
+ return MakeTruncatedInt32Constant(OpParameter<float>(node));
case IrOpcode::kNumberConstant:
case IrOpcode::kFloat64Constant:
- return MakeInt32Constant(OpParameter<double>(node));
+ return MakeTruncatedInt32Constant(OpParameter<double>(node));
default:
break;
}
« no previous file with comments | « no previous file | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698