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

Side by Side Diff: src/compiler/effect-control-linearizer.cc

Issue 2715513007: [compiler] Tune lowering of CheckedUint32ToInt32. (Closed)
Patch Set: Created 3 years, 10 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/effect-control-linearizer.h" 5 #include "src/compiler/effect-control-linearizer.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/compiler-source-position-table.h" 9 #include "src/compiler/compiler-source-position-table.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 1475
1476 Node* add = __ Int32AddWithOverflow(value, value); 1476 Node* add = __ Int32AddWithOverflow(value, value);
1477 Node* check = __ Projection(1, add); 1477 Node* check = __ Projection(1, add);
1478 __ DeoptimizeIf(DeoptimizeReason::kOverflow, check, frame_state); 1478 __ DeoptimizeIf(DeoptimizeReason::kOverflow, check, frame_state);
1479 return __ Projection(0, add); 1479 return __ Projection(0, add);
1480 } 1480 }
1481 1481
1482 Node* EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node, 1482 Node* EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node,
1483 Node* frame_state) { 1483 Node* frame_state) {
1484 Node* value = node->InputAt(0); 1484 Node* value = node->InputAt(0);
1485 Node* max_int = __ Int32Constant(std::numeric_limits<int32_t>::max()); 1485 Node* unsafe = __ Int32LessThan(value, __ Int32Constant(0));
1486 Node* is_safe = __ Uint32LessThanOrEqual(value, max_int); 1486 __ DeoptimizeIf(DeoptimizeReason::kLostPrecision, unsafe, frame_state);
1487 __ DeoptimizeUnless(DeoptimizeReason::kLostPrecision, is_safe, frame_state);
1488 return value; 1487 return value;
1489 } 1488 }
1490 1489
1491 Node* EffectControlLinearizer::LowerCheckedUint32ToTaggedSigned( 1490 Node* EffectControlLinearizer::LowerCheckedUint32ToTaggedSigned(
1492 Node* node, Node* frame_state) { 1491 Node* node, Node* frame_state) {
1493 Node* value = node->InputAt(0); 1492 Node* value = node->InputAt(0);
1494 Node* check = __ Uint32LessThanOrEqual(value, SmiMaxValueConstant()); 1493 Node* check = __ Uint32LessThanOrEqual(value, SmiMaxValueConstant());
1495 __ DeoptimizeUnless(DeoptimizeReason::kLostPrecision, check, frame_state); 1494 __ DeoptimizeUnless(DeoptimizeReason::kLostPrecision, check, frame_state);
1496 return ChangeUint32ToSmi(value); 1495 return ChangeUint32ToSmi(value);
1497 } 1496 }
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2786 return isolate()->factory(); 2785 return isolate()->factory();
2787 } 2786 }
2788 2787
2789 Isolate* EffectControlLinearizer::isolate() const { 2788 Isolate* EffectControlLinearizer::isolate() const {
2790 return jsgraph()->isolate(); 2789 return jsgraph()->isolate();
2791 } 2790 }
2792 2791
2793 } // namespace compiler 2792 } // namespace compiler
2794 } // namespace internal 2793 } // namespace internal
2795 } // namespace v8 2794 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698