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

Side by Side Diff: src/compiler/js-generic-lowering.cc

Issue 702463002: [turbofan] Introduce separate SelectLowering reducer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix windows Created 6 years, 1 month 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 | « BUILD.gn ('k') | src/compiler/pipeline.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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/code-stubs.h" 6 #include "src/code-stubs.h"
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/js-generic-lowering.h" 9 #include "src/compiler/js-generic-lowering.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 58 }
59 59
60 60
61 Reduction JSGenericLowering::Reduce(Node* node) { 61 Reduction JSGenericLowering::Reduce(Node* node) {
62 switch (node->opcode()) { 62 switch (node->opcode()) {
63 #define DECLARE_CASE(x) \ 63 #define DECLARE_CASE(x) \
64 case IrOpcode::k##x: \ 64 case IrOpcode::k##x: \
65 Lower##x(node); \ 65 Lower##x(node); \
66 break; 66 break;
67 DECLARE_CASE(Branch) 67 DECLARE_CASE(Branch)
68 DECLARE_CASE(Select)
69 JS_OP_LIST(DECLARE_CASE) 68 JS_OP_LIST(DECLARE_CASE)
70 #undef DECLARE_CASE 69 #undef DECLARE_CASE
71 default: 70 default:
72 // Nothing to see. 71 // Nothing to see.
73 return NoChange(); 72 return NoChange();
74 } 73 }
75 return Changed(node); 74 return Changed(node);
76 } 75 }
77 76
78 77
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 // TODO(mstarzinger): If typing is enabled then simplified lowering will 235 // TODO(mstarzinger): If typing is enabled then simplified lowering will
237 // have inserted the correct ChangeBoolToBit, otherwise we need to perform 236 // have inserted the correct ChangeBoolToBit, otherwise we need to perform
238 // poor-man's representation inference here and insert manual change. 237 // poor-man's representation inference here and insert manual change.
239 Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0), 238 Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0),
240 jsgraph()->TrueConstant()); 239 jsgraph()->TrueConstant());
241 node->ReplaceInput(0, test); 240 node->ReplaceInput(0, test);
242 } 241 }
243 } 242 }
244 243
245 244
246 void JSGenericLowering::LowerSelect(Node* node) {
247 // TODO(bmeurer): This should probably be moved into a separate file.
248 SelectParameters const& p = SelectParametersOf(node->op());
249 Node* branch = graph()->NewNode(common()->Branch(p.hint()), node->InputAt(0),
250 graph()->start());
251 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
252 Node* vtrue = node->InputAt(1);
253 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
254 Node* vfalse = node->InputAt(2);
255 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
256 node->set_op(common()->Phi(p.type(), 2));
257 node->ReplaceInput(0, vtrue);
258 node->ReplaceInput(1, vfalse);
259 node->ReplaceInput(2, merge);
260 }
261
262
263 void JSGenericLowering::LowerJSUnaryNot(Node* node) { 245 void JSGenericLowering::LowerJSUnaryNot(Node* node) {
264 Callable callable = CodeFactory::ToBoolean( 246 Callable callable = CodeFactory::ToBoolean(
265 isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL); 247 isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL);
266 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 248 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
267 } 249 }
268 250
269 251
270 void JSGenericLowering::LowerJSToBoolean(Node* node) { 252 void JSGenericLowering::LowerJSToBoolean(Node* node) {
271 Callable callable = 253 Callable callable =
272 CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL); 254 CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 443
462 444
463 void JSGenericLowering::LowerJSCallRuntime(Node* node) { 445 void JSGenericLowering::LowerJSCallRuntime(Node* node) {
464 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); 446 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op());
465 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); 447 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity()));
466 } 448 }
467 449
468 } // namespace compiler 450 } // namespace compiler
469 } // namespace internal 451 } // namespace internal
470 } // namespace v8 452 } // namespace v8
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698