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

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

Issue 591023003: WIP: Add first-class support for float32 representations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/machine-operator.cc ('k') | 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/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/compiler/generic-node-inl.h" 8 #include "src/compiler/generic-node-inl.h"
9 #include "src/compiler/graph.h" 9 #include "src/compiler/graph.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 return Replace(m.right().node()); 376 return Replace(m.right().node());
377 } 377 }
378 if (m.left().IsNaN()) { // NaN % x => NaN 378 if (m.left().IsNaN()) { // NaN % x => NaN
379 return Replace(m.left().node()); 379 return Replace(m.left().node());
380 } 380 }
381 if (m.IsFoldable()) { // K % K => K 381 if (m.IsFoldable()) { // K % K => K
382 return ReplaceFloat64(modulo(m.left().Value(), m.right().Value())); 382 return ReplaceFloat64(modulo(m.left().Value(), m.right().Value()));
383 } 383 }
384 break; 384 break;
385 } 385 }
386 // TODO(turbofan): Reduce float64/float32 changes and truncation.
386 case IrOpcode::kChangeFloat64ToInt32: { 387 case IrOpcode::kChangeFloat64ToInt32: {
387 Float64Matcher m(node->InputAt(0)); 388 Float64Matcher m(node->InputAt(0));
388 if (m.HasValue()) return ReplaceInt32(FastD2I(m.Value())); 389 if (m.HasValue()) return ReplaceInt32(FastD2I(m.Value()));
389 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); 390 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0));
390 break; 391 break;
391 } 392 }
392 case IrOpcode::kChangeFloat64ToUint32: { 393 case IrOpcode::kChangeFloat64ToUint32: {
393 Float64Matcher m(node->InputAt(0)); 394 Float64Matcher m(node->InputAt(0));
394 if (m.HasValue()) return ReplaceInt32(FastD2UI(m.Value())); 395 if (m.HasValue()) return ReplaceInt32(FastD2UI(m.Value()));
395 if (m.IsChangeUint32ToFloat64()) return Replace(m.node()->InputAt(0)); 396 if (m.IsChangeUint32ToFloat64()) return Replace(m.node()->InputAt(0));
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 MachineOperatorBuilder* MachineOperatorReducer::machine() const { 481 MachineOperatorBuilder* MachineOperatorReducer::machine() const {
481 return jsgraph()->machine(); 482 return jsgraph()->machine();
482 } 483 }
483 484
484 485
485 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } 486 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); }
486 487
487 } // namespace compiler 488 } // namespace compiler
488 } // namespace internal 489 } // namespace internal
489 } // namespace v8 490 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/machine-operator.cc ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698