OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 | 683 |
684 HConstant* HGraph::GetConstantMinus1() { | 684 HConstant* HGraph::GetConstantMinus1() { |
685 return GetConstant(&constant_minus1_, -1); | 685 return GetConstant(&constant_minus1_, -1); |
686 } | 686 } |
687 | 687 |
688 | 688 |
689 HConstant* HGraph::GetConstantBool(bool value) { | 689 HConstant* HGraph::GetConstantBool(bool value) { |
690 return value ? GetConstantTrue() : GetConstantFalse(); | 690 return value ? GetConstantTrue() : GetConstantFalse(); |
691 } | 691 } |
692 | 692 |
693 #define DEFINE_GET_CONSTANT(Name, name, type, htype, boolean_value, \ | 693 #define DEFINE_GET_CONSTANT(Name, name, constant, type, htype, boolean_value, \ |
694 undetectable) \ | 694 undetectable) \ |
695 HConstant* HGraph::GetConstant##Name() { \ | 695 HConstant* HGraph::GetConstant##Name() { \ |
696 if (!constant_##name##_.is_set()) { \ | 696 if (!constant_##name##_.is_set()) { \ |
697 HConstant* constant = new (zone()) HConstant( \ | 697 HConstant* constant = new (zone()) HConstant( \ |
698 Unique<Object>::CreateImmovable( \ | 698 Unique<Object>::CreateImmovable(isolate()->factory()->constant()), \ |
699 isolate()->factory()->name##_value()), \ | 699 Unique<Map>::CreateImmovable(isolate()->factory()->type##_map()), \ |
700 Unique<Map>::CreateImmovable(isolate()->factory()->type##_map()), \ | 700 false, Representation::Tagged(), htype, true, boolean_value, \ |
701 false, Representation::Tagged(), htype, true, boolean_value, \ | 701 undetectable, ODDBALL_TYPE); \ |
702 undetectable, ODDBALL_TYPE); \ | 702 constant->InsertAfter(entry_block()->first()); \ |
703 constant->InsertAfter(entry_block()->first()); \ | 703 constant_##name##_.set(constant); \ |
704 constant_##name##_.set(constant); \ | 704 } \ |
705 } \ | 705 return ReinsertConstantIfNecessary(constant_##name##_.get()); \ |
706 return ReinsertConstantIfNecessary(constant_##name##_.get()); \ | |
707 } | 706 } |
708 | 707 |
709 DEFINE_GET_CONSTANT(Undefined, undefined, undefined, HType::Undefined(), false, | 708 DEFINE_GET_CONSTANT(Undefined, undefined, undefined_value, undefined, |
710 true) | 709 HType::Undefined(), false, true) |
711 DEFINE_GET_CONSTANT(True, true, boolean, HType::Boolean(), true, false) | 710 DEFINE_GET_CONSTANT(True, true, true_value, boolean, HType::Boolean(), true, |
712 DEFINE_GET_CONSTANT(False, false, boolean, HType::Boolean(), false, false) | 711 false) |
713 DEFINE_GET_CONSTANT(Hole, the_hole, the_hole, HType::None(), false, false) | 712 DEFINE_GET_CONSTANT(False, false, false_value, boolean, HType::Boolean(), false, |
714 DEFINE_GET_CONSTANT(Null, null, null, HType::Null(), false, true) | 713 false) |
| 714 DEFINE_GET_CONSTANT(Hole, the_hole, the_hole_value, the_hole, HType::None(), |
| 715 false, false) |
| 716 DEFINE_GET_CONSTANT(Null, null, null_value, null, HType::Null(), false, true) |
| 717 DEFINE_GET_CONSTANT(OptimizedOut, optimized_out, optimized_out, optimized_out, |
| 718 HType::None(), false, false) |
715 | 719 |
716 #undef DEFINE_GET_CONSTANT | 720 #undef DEFINE_GET_CONSTANT |
717 | 721 |
718 #define DEFINE_IS_CONSTANT(Name, name) \ | 722 #define DEFINE_IS_CONSTANT(Name, name) \ |
719 bool HGraph::IsConstant##Name(HConstant* constant) { \ | 723 bool HGraph::IsConstant##Name(HConstant* constant) { \ |
720 return constant_##name##_.is_set() && constant == constant_##name##_.get(); \ | 724 return constant_##name##_.is_set() && constant == constant_##name##_.get(); \ |
721 } | 725 } |
722 DEFINE_IS_CONSTANT(Undefined, undefined) | 726 DEFINE_IS_CONSTANT(Undefined, undefined) |
723 DEFINE_IS_CONSTANT(0, 0) | 727 DEFINE_IS_CONSTANT(0, 0) |
724 DEFINE_IS_CONSTANT(1, 1) | 728 DEFINE_IS_CONSTANT(1, 1) |
(...skipping 12770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13495 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13499 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13496 } | 13500 } |
13497 | 13501 |
13498 #ifdef DEBUG | 13502 #ifdef DEBUG |
13499 graph_->Verify(false); // No full verify. | 13503 graph_->Verify(false); // No full verify. |
13500 #endif | 13504 #endif |
13501 } | 13505 } |
13502 | 13506 |
13503 } // namespace internal | 13507 } // namespace internal |
13504 } // namespace v8 | 13508 } // namespace v8 |
OLD | NEW |