OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/flow_graph_allocator.h" | 10 #include "vm/flow_graph_allocator.h" |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 } | 1059 } |
1060 UnuseAllInputs(); | 1060 UnuseAllInputs(); |
1061 for (ForwardInstructionIterator it(this); | 1061 for (ForwardInstructionIterator it(this); |
1062 !it.Done(); | 1062 !it.Done(); |
1063 it.Advance()) { | 1063 it.Advance()) { |
1064 it.Current()->UnuseAllInputs(); | 1064 it.Current()->UnuseAllInputs(); |
1065 } | 1065 } |
1066 } | 1066 } |
1067 | 1067 |
1068 | 1068 |
1069 void JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) { | 1069 void JoinEntryInstr::InsertPhi(intptr_t var_index, |
| 1070 intptr_t var_count, |
| 1071 bool always_alive) { |
1070 // Lazily initialize the array of phis. | 1072 // Lazily initialize the array of phis. |
1071 // Currently, phis are stored in a sparse array that holds the phi | 1073 // Currently, phis are stored in a sparse array that holds the phi |
1072 // for variable with index i at position i. | 1074 // for variable with index i at position i. |
1073 // TODO(fschneider): Store phis in a more compact way. | 1075 // TODO(fschneider): Store phis in a more compact way. |
1074 if (phis_ == NULL) { | 1076 if (phis_ == NULL) { |
1075 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count); | 1077 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count); |
1076 for (intptr_t i = 0; i < var_count; i++) { | 1078 for (intptr_t i = 0; i < var_count; i++) { |
1077 phis_->Add(NULL); | 1079 phis_->Add(NULL); |
1078 } | 1080 } |
1079 } | 1081 } |
1080 ASSERT((*phis_)[var_index] == NULL); | 1082 ASSERT((*phis_)[var_index] == NULL); |
1081 (*phis_)[var_index] = new PhiInstr(this, PredecessorCount()); | 1083 (*phis_)[var_index] = new PhiInstr(this, PredecessorCount()); |
| 1084 if (always_alive) (*phis_)[var_index]->mark_alive(); |
1082 } | 1085 } |
1083 | 1086 |
1084 | 1087 |
1085 void JoinEntryInstr::InsertPhi(PhiInstr* phi) { | 1088 void JoinEntryInstr::InsertPhi(PhiInstr* phi) { |
1086 // Lazily initialize the array of phis. | 1089 // Lazily initialize the array of phis. |
1087 if (phis_ == NULL) { | 1090 if (phis_ == NULL) { |
1088 phis_ = new ZoneGrowableArray<PhiInstr*>(1); | 1091 phis_ = new ZoneGrowableArray<PhiInstr*>(1); |
1089 } | 1092 } |
1090 phis_->Add(phi); | 1093 phis_->Add(phi); |
1091 } | 1094 } |
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 left, | 2736 left, |
2734 right, | 2737 right, |
2735 Isolate::Current()->GetNextDeoptId()), | 2738 Isolate::Current()->GetNextDeoptId()), |
2736 needs_number_check_(needs_number_check) { | 2739 needs_number_check_(needs_number_check) { |
2737 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); | 2740 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); |
2738 } | 2741 } |
2739 | 2742 |
2740 | 2743 |
2741 LocationSummary* InstanceCallInstr::MakeLocationSummary(Isolate* isolate, | 2744 LocationSummary* InstanceCallInstr::MakeLocationSummary(Isolate* isolate, |
2742 bool optimizing) const { | 2745 bool optimizing) const { |
2743 return MakeCallSummary(); | 2746 return MakeCallSummary(isolate); |
2744 } | 2747 } |
2745 | 2748 |
2746 | 2749 |
2747 static uword TwoArgsSmiOpInlineCacheEntry(Token::Kind kind) { | 2750 static uword TwoArgsSmiOpInlineCacheEntry(Token::Kind kind) { |
2748 if (!FLAG_two_args_smi_icd) { | 2751 if (!FLAG_two_args_smi_icd) { |
2749 return 0; | 2752 return 0; |
2750 } | 2753 } |
2751 StubCode* stub_code = Isolate::Current()->stub_code(); | 2754 StubCode* stub_code = Isolate::Current()->stub_code(); |
2752 switch (kind) { | 2755 switch (kind) { |
2753 case Token::kADD: return stub_code->SmiAddInlineCacheEntryPoint(); | 2756 case Token::kADD: return stub_code->SmiAddInlineCacheEntryPoint(); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2851 !target.IsInvokeFieldDispatcher()) { | 2854 !target.IsInvokeFieldDispatcher()) { |
2852 return false; | 2855 return false; |
2853 } | 2856 } |
2854 } | 2857 } |
2855 return true; | 2858 return true; |
2856 } | 2859 } |
2857 | 2860 |
2858 | 2861 |
2859 LocationSummary* StaticCallInstr::MakeLocationSummary(Isolate* isolate, | 2862 LocationSummary* StaticCallInstr::MakeLocationSummary(Isolate* isolate, |
2860 bool optimizing) const { | 2863 bool optimizing) const { |
2861 return MakeCallSummary(); | 2864 return MakeCallSummary(isolate); |
2862 } | 2865 } |
2863 | 2866 |
2864 | 2867 |
2865 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2868 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2866 const ICData* call_ic_data = NULL; | 2869 const ICData* call_ic_data = NULL; |
2867 if (!FLAG_propagate_ic_data || !compiler->is_optimizing()) { | 2870 if (!FLAG_propagate_ic_data || !compiler->is_optimizing()) { |
2868 const Array& arguments_descriptor = | 2871 const Array& arguments_descriptor = |
2869 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(), | 2872 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(), |
2870 argument_names())); | 2873 argument_names())); |
2871 MethodRecognizer::Kind recognized_kind = | 2874 MethodRecognizer::Kind recognized_kind = |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3370 case Token::kTRUNCDIV: return 0; | 3373 case Token::kTRUNCDIV: return 0; |
3371 case Token::kMOD: return 1; | 3374 case Token::kMOD: return 1; |
3372 default: UNIMPLEMENTED(); return -1; | 3375 default: UNIMPLEMENTED(); return -1; |
3373 } | 3376 } |
3374 } | 3377 } |
3375 | 3378 |
3376 | 3379 |
3377 #undef __ | 3380 #undef __ |
3378 | 3381 |
3379 } // namespace dart | 3382 } // namespace dart |
OLD | NEW |