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

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

Issue 691513002: [turbofan] Introduce new Select operator to improve bounds checking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « src/compiler/control-reducer.cc ('k') | src/compiler/js-typed-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/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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 59
60 Reduction JSGenericLowering::Reduce(Node* node) { 60 Reduction JSGenericLowering::Reduce(Node* node) {
61 switch (node->opcode()) { 61 switch (node->opcode()) {
62 #define DECLARE_CASE(x) \ 62 #define DECLARE_CASE(x) \
63 case IrOpcode::k##x: \ 63 case IrOpcode::k##x: \
64 Lower##x(node); \ 64 Lower##x(node); \
65 break; 65 break;
66 DECLARE_CASE(Branch) 66 DECLARE_CASE(Branch)
67 DECLARE_CASE(Select)
67 JS_OP_LIST(DECLARE_CASE) 68 JS_OP_LIST(DECLARE_CASE)
68 #undef DECLARE_CASE 69 #undef DECLARE_CASE
69 default: 70 default:
70 // Nothing to see. 71 // Nothing to see.
71 return NoChange(); 72 return NoChange();
72 } 73 }
73 return Changed(node); 74 return Changed(node);
74 } 75 }
75 76
76 77
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // TODO(mstarzinger): If typing is enabled then simplified lowering will 235 // TODO(mstarzinger): If typing is enabled then simplified lowering will
235 // have inserted the correct ChangeBoolToBit, otherwise we need to perform 236 // have inserted the correct ChangeBoolToBit, otherwise we need to perform
236 // poor-man's representation inference here and insert manual change. 237 // poor-man's representation inference here and insert manual change.
237 Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0), 238 Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0),
238 jsgraph()->TrueConstant()); 239 jsgraph()->TrueConstant());
239 node->ReplaceInput(0, test); 240 node->ReplaceInput(0, test);
240 } 241 }
241 } 242 }
242 243
243 244
245 void JSGenericLowering::LowerSelect(Node* node) {
246 // TODO(bmeurer): This should probably be moved into a separate file.
247 SelectParameters const& p = SelectParametersOf(node->op());
248 Node* branch = graph()->NewNode(common()->Branch(p.hint()), node->InputAt(0),
249 graph()->start());
250 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
251 Node* vtrue = node->InputAt(1);
252 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
253 Node* vfalse = node->InputAt(2);
254 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
255 node->set_op(common()->Phi(p.type(), 2));
256 node->ReplaceInput(0, vtrue);
257 node->ReplaceInput(1, vfalse);
258 node->ReplaceInput(2, merge);
259 }
260
261
244 void JSGenericLowering::LowerJSUnaryNot(Node* node) { 262 void JSGenericLowering::LowerJSUnaryNot(Node* node) {
245 Callable callable = CodeFactory::ToBoolean( 263 Callable callable = CodeFactory::ToBoolean(
246 isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL); 264 isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL);
247 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 265 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
248 } 266 }
249 267
250 268
251 void JSGenericLowering::LowerJSToBoolean(Node* node) { 269 void JSGenericLowering::LowerJSToBoolean(Node* node) {
252 Callable callable = 270 Callable callable =
253 CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL); 271 CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 418
401 419
402 void JSGenericLowering::LowerJSCallRuntime(Node* node) { 420 void JSGenericLowering::LowerJSCallRuntime(Node* node) {
403 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); 421 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op());
404 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); 422 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity()));
405 } 423 }
406 424
407 } // namespace compiler 425 } // namespace compiler
408 } // namespace internal 426 } // namespace internal
409 } // namespace v8 427 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/control-reducer.cc ('k') | src/compiler/js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698