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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 509653003: Use TruncateFloat64ToInt32 instead of ChangeFloat64ToInt32 in lowering of simplified operators Numb… (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 | « no previous file | test/cctest/compiler/test-simplified-lowering.cc » ('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/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/graph-inl.h" 8 #include "src/compiler/graph-inl.h"
9 #include "src/compiler/node-properties-inl.h" 9 #include "src/compiler/node-properties-inl.h"
10 #include "src/compiler/representation-change.h" 10 #include "src/compiler/representation-change.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 MachineTypeUnion use_rep = use & kRepMask; 446 MachineTypeUnion use_rep = use & kRepMask;
447 if (lower()) { 447 if (lower()) {
448 MachineTypeUnion in = GetInfo(node->InputAt(0))->output; 448 MachineTypeUnion in = GetInfo(node->InputAt(0))->output;
449 if ((in & kTypeMask) == kTypeInt32 || (in & kRepMask) == kRepWord32) { 449 if ((in & kTypeMask) == kTypeInt32 || (in & kRepMask) == kRepWord32) {
450 // If the input has type int32, or is already a word32, just change 450 // If the input has type int32, or is already a word32, just change
451 // representation if necessary. 451 // representation if necessary.
452 VisitUnop(node, kTypeInt32 | use_rep, kTypeInt32 | use_rep); 452 VisitUnop(node, kTypeInt32 | use_rep, kTypeInt32 | use_rep);
453 DeferReplacement(node, node->InputAt(0)); 453 DeferReplacement(node, node->InputAt(0));
454 } else { 454 } else {
455 // Require the input in float64 format and perform truncation. 455 // Require the input in float64 format and perform truncation.
456 // TODO(turbofan): could also avoid the truncation with a tag check. 456 // TODO(turbofan): avoid a truncation with a smi check.
457 VisitUnop(node, kTypeInt32 | kRepFloat64, kTypeInt32 | kRepWord32); 457 VisitUnop(node, kTypeInt32 | kRepFloat64, kTypeInt32 | kRepWord32);
458 // TODO(titzer): should be a truncation. 458 node->set_op(lowering->machine()->TruncateFloat64ToInt32());
459 node->set_op(lowering->machine()->ChangeFloat64ToInt32());
460 } 459 }
461 } else { 460 } else {
462 // Propagate a type to the input, but pass through representation. 461 // Propagate a type to the input, but pass through representation.
463 VisitUnop(node, kTypeInt32, kTypeInt32 | use_rep); 462 VisitUnop(node, kTypeInt32, kTypeInt32 | use_rep);
464 } 463 }
465 break; 464 break;
466 } 465 }
467 case IrOpcode::kNumberToUint32: { 466 case IrOpcode::kNumberToUint32: {
468 MachineTypeUnion use_rep = use & kRepMask; 467 MachineTypeUnion use_rep = use & kRepMask;
469 if (lower()) { 468 if (lower()) {
470 MachineTypeUnion in = GetInfo(node->InputAt(0))->output; 469 MachineTypeUnion in = GetInfo(node->InputAt(0))->output;
471 if ((in & kTypeMask) == kTypeUint32 || 470 if ((in & kTypeMask) == kTypeUint32 ||
472 (in & kRepMask) == kRepWord32) { 471 (in & kRepMask) == kRepWord32) {
473 // The input has type int32, just change representation. 472 // The input has type int32, just change representation.
474 VisitUnop(node, kTypeUint32 | use_rep, kTypeUint32 | use_rep); 473 VisitUnop(node, kTypeUint32 | use_rep, kTypeUint32 | use_rep);
475 DeferReplacement(node, node->InputAt(0)); 474 DeferReplacement(node, node->InputAt(0));
476 } else { 475 } else {
477 // Require the input in float64 format to perform truncation. 476 // Require the input in float64 format to perform truncation.
478 // TODO(turbofan): could also avoid the truncation with a tag check. 477 // TODO(turbofan): avoid the truncation with a smi check.
479 VisitUnop(node, kTypeUint32 | kRepFloat64, 478 VisitUnop(node, kTypeUint32 | kRepFloat64,
480 kTypeUint32 | kRepWord32); 479 kTypeUint32 | kRepWord32);
481 // TODO(titzer): should be a truncation. 480 node->set_op(lowering->machine()->TruncateFloat64ToInt32());
482 node->set_op(lowering->machine()->ChangeFloat64ToUint32());
483 } 481 }
484 } else { 482 } else {
485 // Propagate a type to the input, but pass through representation. 483 // Propagate a type to the input, but pass through representation.
486 VisitUnop(node, kTypeUint32, kTypeUint32 | use_rep); 484 VisitUnop(node, kTypeUint32, kTypeUint32 | use_rep);
487 } 485 }
488 break; 486 break;
489 } 487 }
490 case IrOpcode::kReferenceEqual: { 488 case IrOpcode::kReferenceEqual: {
491 VisitBinop(node, kMachAnyTagged, kRepBit); 489 VisitBinop(node, kMachAnyTagged, kRepBit);
492 if (lower()) node->set_op(lowering->machine()->WordEqual()); 490 if (lower()) node->set_op(lowering->machine()->WordEqual());
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 WriteBarrierKind kind = ComputeWriteBarrierKind( 803 WriteBarrierKind kind = ComputeWriteBarrierKind(
806 access.base_is_tagged, access.machine_type, access.type); 804 access.base_is_tagged, access.machine_type, access.type);
807 node->set_op(machine_.Store(access.machine_type, kind)); 805 node->set_op(machine_.Store(access.machine_type, kind));
808 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1))); 806 node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
809 } 807 }
810 808
811 809
812 } // namespace compiler 810 } // namespace compiler
813 } // namespace internal 811 } // namespace internal
814 } // namespace v8 812 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/compiler/test-simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698