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

Side by Side Diff: src/compiler/machine-operator-reducer.cc

Issue 2116753002: [builtins] Unify most of the remaining Math builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2102223005
Patch Set: 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 unified diff | Download patch
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/machine-operator-reducer.h" 5 #include "src/compiler/machine-operator-reducer.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/base/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 return Replace(m.right().node()); 360 return Replace(m.right().node());
361 } 361 }
362 if (m.left().IsNaN()) { // NaN % x => NaN 362 if (m.left().IsNaN()) { // NaN % x => NaN
363 return Replace(m.left().node()); 363 return Replace(m.left().node());
364 } 364 }
365 if (m.IsFoldable()) { // K % K => K 365 if (m.IsFoldable()) { // K % K => K
366 return ReplaceFloat64(modulo(m.left().Value(), m.right().Value())); 366 return ReplaceFloat64(modulo(m.left().Value(), m.right().Value()));
367 } 367 }
368 break; 368 break;
369 } 369 }
370 case IrOpcode::kFloat64Acos: {
371 Float64Matcher m(node->InputAt(0));
372 if (m.HasValue()) return ReplaceFloat64(base::ieee754::acos(m.Value()));
373 break;
374 }
375 case IrOpcode::kFloat64Acosh: {
376 Float64Matcher m(node->InputAt(0));
377 if (m.HasValue()) return ReplaceFloat64(base::ieee754::acosh(m.Value()));
378 break;
379 }
380 case IrOpcode::kFloat64Asin: {
381 Float64Matcher m(node->InputAt(0));
382 if (m.HasValue()) return ReplaceFloat64(base::ieee754::asin(m.Value()));
383 break;
384 }
385 case IrOpcode::kFloat64Asinh: {
386 Float64Matcher m(node->InputAt(0));
387 if (m.HasValue()) return ReplaceFloat64(base::ieee754::asinh(m.Value()));
388 break;
389 }
370 case IrOpcode::kFloat64Atan: { 390 case IrOpcode::kFloat64Atan: {
371 Float64Matcher m(node->InputAt(0)); 391 Float64Matcher m(node->InputAt(0));
372 if (m.HasValue()) return ReplaceFloat64(base::ieee754::atan(m.Value())); 392 if (m.HasValue()) return ReplaceFloat64(base::ieee754::atan(m.Value()));
373 break; 393 break;
374 } 394 }
395 case IrOpcode::kFloat64Atanh: {
396 Float64Matcher m(node->InputAt(0));
397 if (m.HasValue()) return ReplaceFloat64(base::ieee754::atanh(m.Value()));
398 break;
399 }
375 case IrOpcode::kFloat64Atan2: { 400 case IrOpcode::kFloat64Atan2: {
376 Float64BinopMatcher m(node); 401 Float64BinopMatcher m(node);
377 if (m.right().IsNaN()) { 402 if (m.right().IsNaN()) {
378 return Replace(m.right().node()); 403 return Replace(m.right().node());
379 } 404 }
380 if (m.left().IsNaN()) { 405 if (m.left().IsNaN()) {
381 return Replace(m.left().node()); 406 return Replace(m.left().node());
382 } 407 }
383 if (m.IsFoldable()) { 408 if (m.IsFoldable()) {
384 return ReplaceFloat64( 409 return ReplaceFloat64(
385 base::ieee754::atan2(m.left().Value(), m.right().Value())); 410 base::ieee754::atan2(m.left().Value(), m.right().Value()));
386 } 411 }
387 break; 412 break;
388 } 413 }
389 case IrOpcode::kFloat64Atanh: {
390 Float64Matcher m(node->InputAt(0));
391 if (m.HasValue()) return ReplaceFloat64(base::ieee754::atanh(m.Value()));
392 break;
393 }
394 case IrOpcode::kFloat64Cbrt: { 414 case IrOpcode::kFloat64Cbrt: {
395 Float64Matcher m(node->InputAt(0)); 415 Float64Matcher m(node->InputAt(0));
396 if (m.HasValue()) return ReplaceFloat64(base::ieee754::cbrt(m.Value())); 416 if (m.HasValue()) return ReplaceFloat64(base::ieee754::cbrt(m.Value()));
397 break; 417 break;
398 } 418 }
399 case IrOpcode::kFloat64Cos: { 419 case IrOpcode::kFloat64Cos: {
400 Float64Matcher m(node->InputAt(0)); 420 Float64Matcher m(node->InputAt(0));
401 if (m.HasValue()) return ReplaceFloat64(base::ieee754::cos(m.Value())); 421 if (m.HasValue()) return ReplaceFloat64(base::ieee754::cos(m.Value()));
402 break; 422 break;
403 } 423 }
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 MachineOperatorBuilder* MachineOperatorReducer::machine() const { 1210 MachineOperatorBuilder* MachineOperatorReducer::machine() const {
1191 return jsgraph()->machine(); 1211 return jsgraph()->machine();
1192 } 1212 }
1193 1213
1194 1214
1195 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } 1215 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); }
1196 1216
1197 } // namespace compiler 1217 } // namespace compiler
1198 } // namespace internal 1218 } // namespace internal
1199 } // namespace v8 1219 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698