OLD | NEW |
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/compilation-dependencies.h" | 6 #include "src/compilation-dependencies.h" |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 // - relax effects from generic but not-side-effecting operations | 420 // - relax effects from generic but not-side-effecting operations |
421 | 421 |
422 | 422 |
423 JSTypedLowering::JSTypedLowering(Editor* editor, | 423 JSTypedLowering::JSTypedLowering(Editor* editor, |
424 CompilationDependencies* dependencies, | 424 CompilationDependencies* dependencies, |
425 Flags flags, JSGraph* jsgraph, Zone* zone) | 425 Flags flags, JSGraph* jsgraph, Zone* zone) |
426 : AdvancedReducer(editor), | 426 : AdvancedReducer(editor), |
427 dependencies_(dependencies), | 427 dependencies_(dependencies), |
428 flags_(flags), | 428 flags_(flags), |
429 jsgraph_(jsgraph), | 429 jsgraph_(jsgraph), |
| 430 the_hole_type_( |
| 431 Type::Constant(factory()->the_hole_value(), graph()->zone())), |
430 type_cache_(TypeCache::Get()) { | 432 type_cache_(TypeCache::Get()) { |
431 for (size_t k = 0; k < arraysize(shifted_int32_ranges_); ++k) { | 433 for (size_t k = 0; k < arraysize(shifted_int32_ranges_); ++k) { |
432 double min = kMinInt / (1 << k); | 434 double min = kMinInt / (1 << k); |
433 double max = kMaxInt / (1 << k); | 435 double max = kMaxInt / (1 << k); |
434 shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone()); | 436 shifted_int32_ranges_[k] = Type::Range(min, max, graph()->zone()); |
435 } | 437 } |
436 } | 438 } |
437 | 439 |
438 | 440 |
439 Reduction JSTypedLowering::ReduceJSAdd(Node* node) { | 441 Reduction JSTypedLowering::ReduceJSAdd(Node* node) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 } | 652 } |
651 if (r.OneInputCannotBe(Type::NumberOrString())) { | 653 if (r.OneInputCannotBe(Type::NumberOrString())) { |
652 // For values with canonical representation (i.e. not string nor number) an | 654 // For values with canonical representation (i.e. not string nor number) an |
653 // empty type intersection means the values cannot be strictly equal. | 655 // empty type intersection means the values cannot be strictly equal. |
654 if (!r.left_type()->Maybe(r.right_type())) { | 656 if (!r.left_type()->Maybe(r.right_type())) { |
655 Node* replacement = jsgraph()->BooleanConstant(invert); | 657 Node* replacement = jsgraph()->BooleanConstant(invert); |
656 ReplaceWithValue(node, replacement); | 658 ReplaceWithValue(node, replacement); |
657 return Replace(replacement); | 659 return Replace(replacement); |
658 } | 660 } |
659 } | 661 } |
| 662 if (r.OneInputIs(the_hole_type_)) { |
| 663 return r.ChangeToPureOperator(simplified()->ReferenceEqual(the_hole_type_), |
| 664 invert); |
| 665 } |
660 if (r.OneInputIs(Type::Undefined())) { | 666 if (r.OneInputIs(Type::Undefined())) { |
661 return r.ChangeToPureOperator( | 667 return r.ChangeToPureOperator( |
662 simplified()->ReferenceEqual(Type::Undefined()), invert); | 668 simplified()->ReferenceEqual(Type::Undefined()), invert); |
663 } | 669 } |
664 if (r.OneInputIs(Type::Null())) { | 670 if (r.OneInputIs(Type::Null())) { |
665 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Null()), | 671 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Null()), |
666 invert); | 672 invert); |
667 } | 673 } |
668 if (r.OneInputIs(Type::Boolean())) { | 674 if (r.OneInputIs(Type::Boolean())) { |
669 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Boolean()), | 675 return r.ChangeToPureOperator(simplified()->ReferenceEqual(Type::Boolean()), |
(...skipping 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2605 } | 2611 } |
2606 | 2612 |
2607 | 2613 |
2608 CompilationDependencies* JSTypedLowering::dependencies() const { | 2614 CompilationDependencies* JSTypedLowering::dependencies() const { |
2609 return dependencies_; | 2615 return dependencies_; |
2610 } | 2616 } |
2611 | 2617 |
2612 } // namespace compiler | 2618 } // namespace compiler |
2613 } // namespace internal | 2619 } // namespace internal |
2614 } // namespace v8 | 2620 } // namespace v8 |
OLD | NEW |