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

Side by Side Diff: src/compiler/typer.cc

Issue 1193833002: [turbofan] Proper dead code elimination as regular reducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
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/base/flags.h" 5 #include "src/base/flags.h"
6 #include "src/bootstrapper.h" 6 #include "src/bootstrapper.h"
7 #include "src/compiler/graph-reducer.h" 7 #include "src/compiler/graph-reducer.h"
8 #include "src/compiler/js-operator.h" 8 #include "src/compiler/js-operator.h"
9 #include "src/compiler/node.h" 9 #include "src/compiler/node.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 DECLARE_CASE(Switch) 261 DECLARE_CASE(Switch)
262 DECLARE_CASE(IfValue) 262 DECLARE_CASE(IfValue)
263 DECLARE_CASE(IfDefault) 263 DECLARE_CASE(IfDefault)
264 DECLARE_CASE(Merge) 264 DECLARE_CASE(Merge)
265 DECLARE_CASE(Deoptimize) 265 DECLARE_CASE(Deoptimize)
266 DECLARE_CASE(Return) 266 DECLARE_CASE(Return)
267 DECLARE_CASE(TailCall) 267 DECLARE_CASE(TailCall)
268 DECLARE_CASE(Terminate) 268 DECLARE_CASE(Terminate)
269 DECLARE_CASE(OsrNormalEntry) 269 DECLARE_CASE(OsrNormalEntry)
270 DECLARE_CASE(OsrLoopEntry) 270 DECLARE_CASE(OsrLoopEntry)
271 DECLARE_CASE(DeadControl)
272 DECLARE_CASE(Throw) 271 DECLARE_CASE(Throw)
273 DECLARE_CASE(End) 272 DECLARE_CASE(End)
274 #undef DECLARE_CASE 273 #undef DECLARE_CASE
275 break; 274 break;
276 } 275 }
277 return NoChange(); 276 return NoChange();
278 } 277 }
279 278
280 Bounds TypeNode(Node* node) { 279 Bounds TypeNode(Node* node) {
281 switch (node->opcode()) { 280 switch (node->opcode()) {
(...skipping 24 matching lines...) Expand all
306 DECLARE_CASE(Switch) 305 DECLARE_CASE(Switch)
307 DECLARE_CASE(IfValue) 306 DECLARE_CASE(IfValue)
308 DECLARE_CASE(IfDefault) 307 DECLARE_CASE(IfDefault)
309 DECLARE_CASE(Merge) 308 DECLARE_CASE(Merge)
310 DECLARE_CASE(Deoptimize) 309 DECLARE_CASE(Deoptimize)
311 DECLARE_CASE(Return) 310 DECLARE_CASE(Return)
312 DECLARE_CASE(TailCall) 311 DECLARE_CASE(TailCall)
313 DECLARE_CASE(Terminate) 312 DECLARE_CASE(Terminate)
314 DECLARE_CASE(OsrNormalEntry) 313 DECLARE_CASE(OsrNormalEntry)
315 DECLARE_CASE(OsrLoopEntry) 314 DECLARE_CASE(OsrLoopEntry)
316 DECLARE_CASE(DeadControl)
317 DECLARE_CASE(Throw) 315 DECLARE_CASE(Throw)
318 DECLARE_CASE(End) 316 DECLARE_CASE(End)
319 #undef DECLARE_CASE 317 #undef DECLARE_CASE
320 break; 318 break;
321 } 319 }
322 UNREACHABLE(); 320 UNREACHABLE();
323 return Bounds(); 321 return Bounds();
324 } 322 }
325 323
326 Type* TypeConstant(Handle<Object> value); 324 Type* TypeConstant(Handle<Object> value);
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 UNREACHABLE(); 733 UNREACHABLE();
736 return Bounds(); 734 return Bounds();
737 } 735 }
738 736
739 737
740 Bounds Typer::Visitor::TypeFinish(Node* node) { 738 Bounds Typer::Visitor::TypeFinish(Node* node) {
741 return Operand(node, 0); 739 return Operand(node, 0);
742 } 740 }
743 741
744 742
745 Bounds Typer::Visitor::TypeDeadValue(Node* node) {
746 return Bounds(Type::None(zone()), Type::Any(zone()));
747 }
748
749
750 Bounds Typer::Visitor::TypeDeadEffect(Node* node) {
751 UNREACHABLE();
752 return Bounds();
753 }
754
755
756 Bounds Typer::Visitor::TypeFrameState(Node* node) { 743 Bounds Typer::Visitor::TypeFrameState(Node* node) {
757 // TODO(rossberg): Ideally FrameState wouldn't have a value output. 744 // TODO(rossberg): Ideally FrameState wouldn't have a value output.
758 return Bounds(Type::None(zone()), Type::Internal(zone())); 745 return Bounds(Type::None(zone()), Type::Internal(zone()));
759 } 746 }
760 747
761 748
762 Bounds Typer::Visitor::TypeStateValues(Node* node) { 749 Bounds Typer::Visitor::TypeStateValues(Node* node) {
763 return Bounds(Type::None(zone()), Type::Internal(zone())); 750 return Bounds(Type::None(zone()), Type::Internal(zone()));
764 } 751 }
765 752
766 753
767 Bounds Typer::Visitor::TypeTypedStateValues(Node* node) { 754 Bounds Typer::Visitor::TypeTypedStateValues(Node* node) {
768 return Bounds(Type::None(zone()), Type::Internal(zone())); 755 return Bounds(Type::None(zone()), Type::Internal(zone()));
769 } 756 }
770 757
771 758
772 Bounds Typer::Visitor::TypeCall(Node* node) { 759 Bounds Typer::Visitor::TypeCall(Node* node) {
773 return Bounds::Unbounded(zone()); 760 return Bounds::Unbounded(zone());
774 } 761 }
775 762
776 763
777 Bounds Typer::Visitor::TypeProjection(Node* node) { 764 Bounds Typer::Visitor::TypeProjection(Node* node) {
778 // TODO(titzer): use the output type of the input to determine the bounds. 765 // TODO(titzer): use the output type of the input to determine the bounds.
779 return Bounds::Unbounded(zone()); 766 return Bounds::Unbounded(zone());
780 } 767 }
781 768
782 769
770 Bounds Typer::Visitor::TypeDead(Node* node) {
771 return Bounds::Unbounded(zone());
772 }
773
774
783 // JS comparison operators. 775 // JS comparison operators.
784 776
785 777
786 Type* Typer::Visitor::JSEqualTyper(Type* lhs, Type* rhs, Typer* t) { 778 Type* Typer::Visitor::JSEqualTyper(Type* lhs, Type* rhs, Typer* t) {
787 if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return t->singleton_false; 779 if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return t->singleton_false;
788 if (lhs->Is(t->undefined_or_null) && rhs->Is(t->undefined_or_null)) { 780 if (lhs->Is(t->undefined_or_null) && rhs->Is(t->undefined_or_null)) {
789 return t->singleton_true; 781 return t->singleton_true;
790 } 782 }
791 if (lhs->Is(Type::Number()) && rhs->Is(Type::Number()) && 783 if (lhs->Is(Type::Number()) && rhs->Is(Type::Number()) &&
792 (lhs->Max() < rhs->Min() || lhs->Min() > rhs->Max())) { 784 (lhs->Max() < rhs->Min() || lhs->Min() > rhs->Max())) {
(...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 TYPED_ARRAYS(TYPED_ARRAY_CASE) 2421 TYPED_ARRAYS(TYPED_ARRAY_CASE)
2430 #undef TYPED_ARRAY_CASE 2422 #undef TYPED_ARRAY_CASE
2431 } 2423 }
2432 } 2424 }
2433 return Type::Constant(value, zone()); 2425 return Type::Constant(value, zone());
2434 } 2426 }
2435 2427
2436 } // namespace compiler 2428 } // namespace compiler
2437 } // namespace internal 2429 } // namespace internal
2438 } // namespace v8 2430 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698