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

Side by Side Diff: src/compiler/js-builtin-reducer.cc

Issue 1843533003: [turbofan] Introduce NumberFloor simplified operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 | src/compiler/opcodes.h » ('j') | 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/js-builtin-reducer.h" 5 #include "src/compiler/js-builtin-reducer.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 #include "src/compiler/simplified-operator.h" 9 #include "src/compiler/simplified-operator.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // Math.imul(a:int32, b:int32) -> Int32Mul(a, b) 125 // Math.imul(a:int32, b:int32) -> Int32Mul(a, b)
126 Node* value = graph()->NewNode(machine()->Int32Mul(), r.left(), r.right()); 126 Node* value = graph()->NewNode(machine()->Int32Mul(), r.left(), r.right());
127 return Replace(value); 127 return Replace(value);
128 } 128 }
129 return NoChange(); 129 return NoChange();
130 } 130 }
131 131
132 // ES6 draft 08-24-14, section 20.2.2.16. 132 // ES6 draft 08-24-14, section 20.2.2.16.
133 Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) { 133 Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) {
134 JSCallReduction r(node); 134 JSCallReduction r(node);
135 if (r.InputsMatchOne(Type::Number()) && 135 if (r.InputsMatchOne(Type::Number())) {
136 machine()->Float64RoundDown().IsSupported()) { 136 // Math.floor(a:number) -> NumberFloor(a)
137 // Math.floor(a:number) -> Float64RoundDown(a) 137 Node* value = graph()->NewNode(simplified()->NumberFloor(), r.left());
138 Node* value =
139 graph()->NewNode(machine()->Float64RoundDown().op(), r.left());
140 return Replace(value); 138 return Replace(value);
141 } 139 }
142 return NoChange(); 140 return NoChange();
143 } 141 }
144 142
145 // ES6 draft 08-24-14, section 20.2.2.17. 143 // ES6 draft 08-24-14, section 20.2.2.17.
146 Reduction JSBuiltinReducer::ReduceMathFround(Node* node) { 144 Reduction JSBuiltinReducer::ReduceMathFround(Node* node) {
147 JSCallReduction r(node); 145 JSCallReduction r(node);
148 if (r.InputsMatchOne(Type::Number())) { 146 if (r.InputsMatchOne(Type::Number())) {
149 // Math.fround(a:number) -> TruncateFloat64ToFloat32(a) 147 // Math.fround(a:number) -> TruncateFloat64ToFloat32(a)
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 242 }
245 243
246 244
247 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const { 245 SimplifiedOperatorBuilder* JSBuiltinReducer::simplified() const {
248 return jsgraph()->simplified(); 246 return jsgraph()->simplified();
249 } 247 }
250 248
251 } // namespace compiler 249 } // namespace compiler
252 } // namespace internal 250 } // namespace internal
253 } // namespace v8 251 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698