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

Unified Diff: src/compiler/simplified-lowering.cc

Issue 612043003: Add inlining for intrinsics. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index 7a0f32493239279bb25136f23e1fbd7c76a1c4b3..6892879f7cc0c6154fbb561c00e5822f44379bbc 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -355,6 +355,41 @@ class RepresentationSelector {
}
}
+ void VisitIsSmi(Node* node) {
+ ProcessInput(node, 0, kMachAnyTagged);
+ if (lower()) {
+ Node* is_tagged = jsgraph_->graph()->NewNode(
+ jsgraph_->machine()->WordAnd(), node->InputAt(0),
+ jsgraph_->Int32Constant(static_cast<int>(kSmiTagMask)));
+ Node* is_smi = jsgraph_->graph()->NewNode(
Michael Starzinger 2014/10/15 13:03:17 For posterity: There might be a more optimal lower
sigurds 2014/10/15 14:59:58 Acknowledged.
+ jsgraph_->machine()->WordEqual(), is_tagged,
+ jsgraph_->Int32Constant(kSmiTag));
+ DeferReplacement(node, is_smi);
+ }
+ SetOutput(node, kRepBit | kTypeBool);
+ }
+
+ void VisitIsNonNegativeSmi(Node* node) {
+ ProcessInput(node, 0, kMachAnyTagged);
+ if (lower()) {
+ Node* is_tagged = jsgraph_->graph()->NewNode(
+ jsgraph_->machine()->WordAnd(), node->InputAt(0),
+ jsgraph_->Int32Constant(static_cast<int>(kSmiTagMask)));
+ Node* is_smi = jsgraph_->graph()->NewNode(
+ jsgraph_->machine()->WordEqual(), is_tagged,
+ jsgraph_->Int32Constant(kSmiTag));
+ Node* is_non_neg = jsgraph_->graph()->NewNode(
+ jsgraph_->machine()->Is32()
Michael Starzinger 2014/10/15 13:03:17 nit: There already should be IntLessThanOrEqual()
sigurds 2014/10/15 14:59:58 Done.
+ ? jsgraph_->machine()->Int32LessThanOrEqual()
+ : jsgraph_->machine()->Int64LessThanOrEqual(),
+ jsgraph_->Int32Constant(0), node->InputAt(0));
+ Node* is_non_neg_smi = jsgraph_->graph()->NewNode(
+ jsgraph_->machine()->Word32And(), is_smi, is_non_neg);
+ DeferReplacement(node, is_non_neg_smi);
+ }
+ SetOutput(node, kRepBit | kTypeBool);
+ }
+
const Operator* Int32Op(Node* node) {
return changer_->Int32OperatorFor(node->opcode());
}
@@ -833,6 +868,10 @@ class RepresentationSelector {
}
SetOutput(node, kMachAnyTagged);
break;
+ case IrOpcode::kIsSmi:
+ return VisitIsSmi(node);
Michael Starzinger 2014/10/15 13:03:17 Please move this into the section for simplified o
sigurds 2014/10/15 14:59:58 Done. Did not create DoIsSmi/DoIsNonNegativeSmi.
+ case IrOpcode::kIsNonNegativeSmi:
+ return VisitIsNonNegativeSmi(node);
default:
VisitInputs(node);
break;
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698