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

Unified Diff: src/compiler/js-builtin-reducer.cc

Issue 2170343002: [turbofan] Change Float64Max/Float64Min to JavaScript semantics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mips/mips64 ports. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-builtin-reducer.cc
diff --git a/src/compiler/js-builtin-reducer.cc b/src/compiler/js-builtin-reducer.cc
index 21f51c1661a88153b80eaf93a8b97b71044aa046..c8fe93d099138a94d4878d3fb2b8c727ce078d42 100644
--- a/src/compiler/js-builtin-reducer.cc
+++ b/src/compiler/js-builtin-reducer.cc
@@ -353,20 +353,12 @@ Reduction JSBuiltinReducer::ReduceMathMax(Node* node) {
// Math.max() -> -Infinity
return Replace(jsgraph()->Constant(-V8_INFINITY));
}
- if (r.InputsMatchOne(Type::PlainPrimitive())) {
- // Math.max(a:plain-primitive) -> ToNumber(a)
+ if (r.InputsMatchAll(Type::PlainPrimitive())) {
+ // Math.max(a:plain-primitive, b:plain-primitive, ...)
Node* value = ToNumber(r.GetJSCallInput(0));
- return Replace(value);
- }
- if (r.InputsMatchAll(Type::Integral32())) {
- // Math.max(a:int32, b:int32, ...)
- Node* value = r.GetJSCallInput(0);
for (int i = 1; i < r.GetJSCallArity(); i++) {
- Node* const input = r.GetJSCallInput(i);
- value = graph()->NewNode(
- common()->Select(MachineRepresentation::kNone),
- graph()->NewNode(simplified()->NumberLessThan(), input, value), value,
- input);
+ Node* input = ToNumber(r.GetJSCallInput(i));
+ value = graph()->NewNode(simplified()->NumberMax(), value, input);
}
return Replace(value);
}
@@ -380,20 +372,12 @@ Reduction JSBuiltinReducer::ReduceMathMin(Node* node) {
// Math.min() -> Infinity
return Replace(jsgraph()->Constant(V8_INFINITY));
}
- if (r.InputsMatchOne(Type::PlainPrimitive())) {
- // Math.min(a:plain-primitive) -> ToNumber(a)
+ if (r.InputsMatchAll(Type::PlainPrimitive())) {
+ // Math.min(a:plain-primitive, b:plain-primitive, ...)
Node* value = ToNumber(r.GetJSCallInput(0));
- return Replace(value);
- }
- if (r.InputsMatchAll(Type::Integral32())) {
- // Math.min(a:int32, b:int32, ...)
- Node* value = r.GetJSCallInput(0);
for (int i = 1; i < r.GetJSCallArity(); i++) {
- Node* const input = r.GetJSCallInput(i);
- value = graph()->NewNode(
- common()->Select(MachineRepresentation::kNone),
- graph()->NewNode(simplified()->NumberLessThan(), input, value), input,
- value);
+ Node* input = ToNumber(r.GetJSCallInput(i));
+ value = graph()->NewNode(simplified()->NumberMin(), value, input);
}
return Replace(value);
}
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698