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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/simplified-operator.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/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 MachineType use_type = 348 MachineType use_type =
349 static_cast<MachineType>((use & kTypeMask) | propagate); 349 static_cast<MachineType>((use & kTypeMask) | propagate);
350 for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end(); 350 for (Node::Inputs::iterator iter(inputs.begin()); iter != inputs.end();
351 ++iter, --values) { 351 ++iter, --values) {
352 // TODO(titzer): it'd be nice to have distinguished edge kinds here. 352 // TODO(titzer): it'd be nice to have distinguished edge kinds here.
353 ProcessInput(node, iter.index(), values > 0 ? use_type : 0); 353 ProcessInput(node, iter.index(), values > 0 ? use_type : 0);
354 } 354 }
355 } 355 }
356 } 356 }
357 357
358 void VisitIsSmi(Node* node) {
359 ProcessInput(node, 0, kMachAnyTagged);
360 if (lower()) {
361 Node* is_tagged = jsgraph_->graph()->NewNode(
362 jsgraph_->machine()->WordAnd(), node->InputAt(0),
363 jsgraph_->Int32Constant(static_cast<int>(kSmiTagMask)));
364 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.
365 jsgraph_->machine()->WordEqual(), is_tagged,
366 jsgraph_->Int32Constant(kSmiTag));
367 DeferReplacement(node, is_smi);
368 }
369 SetOutput(node, kRepBit | kTypeBool);
370 }
371
372 void VisitIsNonNegativeSmi(Node* node) {
373 ProcessInput(node, 0, kMachAnyTagged);
374 if (lower()) {
375 Node* is_tagged = jsgraph_->graph()->NewNode(
376 jsgraph_->machine()->WordAnd(), node->InputAt(0),
377 jsgraph_->Int32Constant(static_cast<int>(kSmiTagMask)));
378 Node* is_smi = jsgraph_->graph()->NewNode(
379 jsgraph_->machine()->WordEqual(), is_tagged,
380 jsgraph_->Int32Constant(kSmiTag));
381 Node* is_non_neg = jsgraph_->graph()->NewNode(
382 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.
383 ? jsgraph_->machine()->Int32LessThanOrEqual()
384 : jsgraph_->machine()->Int64LessThanOrEqual(),
385 jsgraph_->Int32Constant(0), node->InputAt(0));
386 Node* is_non_neg_smi = jsgraph_->graph()->NewNode(
387 jsgraph_->machine()->Word32And(), is_smi, is_non_neg);
388 DeferReplacement(node, is_non_neg_smi);
389 }
390 SetOutput(node, kRepBit | kTypeBool);
391 }
392
358 const Operator* Int32Op(Node* node) { 393 const Operator* Int32Op(Node* node) {
359 return changer_->Int32OperatorFor(node->opcode()); 394 return changer_->Int32OperatorFor(node->opcode());
360 } 395 }
361 396
362 const Operator* Uint32Op(Node* node) { 397 const Operator* Uint32Op(Node* node) {
363 return changer_->Uint32OperatorFor(node->opcode()); 398 return changer_->Uint32OperatorFor(node->opcode());
364 } 399 }
365 400
366 const Operator* Float64Op(Node* node) { 401 const Operator* Float64Op(Node* node) {
367 return changer_->Float64OperatorFor(node->opcode()); 402 return changer_->Float64OperatorFor(node->opcode());
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 case IrOpcode::kFloat64LessThanOrEqual: 861 case IrOpcode::kFloat64LessThanOrEqual:
827 return VisitFloat64Cmp(node); 862 return VisitFloat64Cmp(node);
828 case IrOpcode::kLoadStackPointer: 863 case IrOpcode::kLoadStackPointer:
829 return VisitLeaf(node, kMachPtr); 864 return VisitLeaf(node, kMachPtr);
830 case IrOpcode::kStateValues: 865 case IrOpcode::kStateValues:
831 for (int i = 0; i < node->InputCount(); i++) { 866 for (int i = 0; i < node->InputCount(); i++) {
832 ProcessInput(node, i, kTypeAny); 867 ProcessInput(node, i, kTypeAny);
833 } 868 }
834 SetOutput(node, kMachAnyTagged); 869 SetOutput(node, kMachAnyTagged);
835 break; 870 break;
871 case IrOpcode::kIsSmi:
872 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.
873 case IrOpcode::kIsNonNegativeSmi:
874 return VisitIsNonNegativeSmi(node);
836 default: 875 default:
837 VisitInputs(node); 876 VisitInputs(node);
838 break; 877 break;
839 } 878 }
840 } 879 }
841 880
842 void DeferReplacement(Node* node, Node* replacement) { 881 void DeferReplacement(Node* node, Node* replacement) {
843 if (FLAG_trace_representation) { 882 if (FLAG_trace_representation) {
844 TRACE(("defer replacement #%d:%s with #%d:%s\n", node->id(), 883 TRACE(("defer replacement #%d:%s with #%d:%s\n", node->id(),
845 node->op()->mnemonic(), replacement->id(), 884 node->op()->mnemonic(), replacement->id(),
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { 1172 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) {
1134 node->set_op(machine()->IntLessThanOrEqual()); 1173 node->set_op(machine()->IntLessThanOrEqual());
1135 node->ReplaceInput(0, StringComparison(node, true)); 1174 node->ReplaceInput(0, StringComparison(node, true));
1136 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); 1175 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL));
1137 } 1176 }
1138 1177
1139 1178
1140 } // namespace compiler 1179 } // namespace compiler
1141 } // namespace internal 1180 } // namespace internal
1142 } // namespace v8 1181 } // namespace v8
OLDNEW
« 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