| 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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 } | 1048 } |
| 1049 UnuseAllInputs(); | 1049 UnuseAllInputs(); |
| 1050 for (ForwardInstructionIterator it(this); | 1050 for (ForwardInstructionIterator it(this); |
| 1051 !it.Done(); | 1051 !it.Done(); |
| 1052 it.Advance()) { | 1052 it.Advance()) { |
| 1053 it.Current()->UnuseAllInputs(); | 1053 it.Current()->UnuseAllInputs(); |
| 1054 } | 1054 } |
| 1055 } | 1055 } |
| 1056 | 1056 |
| 1057 | 1057 |
| 1058 void JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) { | 1058 PhiInstr* JoinEntryInstr::InsertPhi(intptr_t var_index, intptr_t var_count) { |
| 1059 // Lazily initialize the array of phis. | 1059 // Lazily initialize the array of phis. |
| 1060 // Currently, phis are stored in a sparse array that holds the phi | 1060 // Currently, phis are stored in a sparse array that holds the phi |
| 1061 // for variable with index i at position i. | 1061 // for variable with index i at position i. |
| 1062 // TODO(fschneider): Store phis in a more compact way. | 1062 // TODO(fschneider): Store phis in a more compact way. |
| 1063 if (phis_ == NULL) { | 1063 if (phis_ == NULL) { |
| 1064 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count); | 1064 phis_ = new ZoneGrowableArray<PhiInstr*>(var_count); |
| 1065 for (intptr_t i = 0; i < var_count; i++) { | 1065 for (intptr_t i = 0; i < var_count; i++) { |
| 1066 phis_->Add(NULL); | 1066 phis_->Add(NULL); |
| 1067 } | 1067 } |
| 1068 } | 1068 } |
| 1069 ASSERT((*phis_)[var_index] == NULL); | 1069 ASSERT((*phis_)[var_index] == NULL); |
| 1070 (*phis_)[var_index] = new PhiInstr(this, PredecessorCount()); | 1070 return (*phis_)[var_index] = new PhiInstr(this, PredecessorCount()); |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 | 1073 |
| 1074 void JoinEntryInstr::InsertPhi(PhiInstr* phi) { | 1074 void JoinEntryInstr::InsertPhi(PhiInstr* phi) { |
| 1075 // Lazily initialize the array of phis. | 1075 // Lazily initialize the array of phis. |
| 1076 if (phis_ == NULL) { | 1076 if (phis_ == NULL) { |
| 1077 phis_ = new ZoneGrowableArray<PhiInstr*>(1); | 1077 phis_ = new ZoneGrowableArray<PhiInstr*>(1); |
| 1078 } | 1078 } |
| 1079 phis_->Add(phi); | 1079 phis_->Add(phi); |
| 1080 } | 1080 } |
| (...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2638 InputAt(i)->definition()->IsMaterializeObject()) { | 2638 InputAt(i)->definition()->IsMaterializeObject()) { |
| 2639 InputAt(i)->definition()->AsMaterializeObject()->RemapRegisters( | 2639 InputAt(i)->definition()->AsMaterializeObject()->RemapRegisters( |
| 2640 fpu_reg_slots, cpu_reg_slots); | 2640 fpu_reg_slots, cpu_reg_slots); |
| 2641 } | 2641 } |
| 2642 } | 2642 } |
| 2643 } | 2643 } |
| 2644 | 2644 |
| 2645 | 2645 |
| 2646 LocationSummary* CurrentContextInstr::MakeLocationSummary(Isolate* isolate, | 2646 LocationSummary* CurrentContextInstr::MakeLocationSummary(Isolate* isolate, |
| 2647 bool opt) const { | 2647 bool opt) const { |
| 2648 return LocationSummary::Make(isolate, | 2648 // Only appears in initial definitions, never in normal code. |
| 2649 0, | 2649 UNREACHABLE(); |
| 2650 Location::RegisterLocation(CTX), | 2650 return NULL; |
| 2651 LocationSummary::kNoCall); | |
| 2652 } | 2651 } |
| 2653 | 2652 |
| 2654 | 2653 |
| 2655 void CurrentContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2654 void CurrentContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2656 // No code to emit. Just assert the correct result register. | 2655 // Only appears in initial definitions, never in normal code. |
| 2657 ASSERT(locs()->out(0).reg() == CTX); | 2656 UNREACHABLE(); |
| 2658 } | |
| 2659 | |
| 2660 | |
| 2661 LocationSummary* StoreContextInstr::MakeLocationSummary(Isolate* isolate, | |
| 2662 bool optimizing) const { | |
| 2663 const intptr_t kNumInputs = 1; | |
| 2664 const intptr_t kNumTemps = 0; | |
| 2665 LocationSummary* summary = new(isolate) LocationSummary( | |
| 2666 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | |
| 2667 summary->set_in(0, Location::RegisterLocation(CTX)); | |
| 2668 return summary; | |
| 2669 } | |
| 2670 | |
| 2671 | |
| 2672 void StoreContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 2673 // Nothing to do. Context register was loaded by the register allocator. | |
| 2674 ASSERT(locs()->in(0).reg() == CTX); | |
| 2675 } | 2657 } |
| 2676 | 2658 |
| 2677 | 2659 |
| 2678 LocationSummary* PushTempInstr::MakeLocationSummary(Isolate* isolate, | 2660 LocationSummary* PushTempInstr::MakeLocationSummary(Isolate* isolate, |
| 2679 bool optimizing) const { | 2661 bool optimizing) const { |
| 2680 return LocationSummary::Make(isolate, | 2662 return LocationSummary::Make(isolate, |
| 2681 1, | 2663 1, |
| 2682 Location::NoLocation(), | 2664 Location::NoLocation(), |
| 2683 LocationSummary::kNoCall); | 2665 LocationSummary::kNoCall); |
| 2684 } | 2666 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2722 left, | 2704 left, |
| 2723 right, | 2705 right, |
| 2724 Isolate::Current()->GetNextDeoptId()), | 2706 Isolate::Current()->GetNextDeoptId()), |
| 2725 needs_number_check_(needs_number_check) { | 2707 needs_number_check_(needs_number_check) { |
| 2726 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); | 2708 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); |
| 2727 } | 2709 } |
| 2728 | 2710 |
| 2729 | 2711 |
| 2730 LocationSummary* InstanceCallInstr::MakeLocationSummary(Isolate* isolate, | 2712 LocationSummary* InstanceCallInstr::MakeLocationSummary(Isolate* isolate, |
| 2731 bool optimizing) const { | 2713 bool optimizing) const { |
| 2732 return MakeCallSummary(); | 2714 return MakeCallSummary(isolate); |
| 2733 } | 2715 } |
| 2734 | 2716 |
| 2735 | 2717 |
| 2736 static uword TwoArgsSmiOpInlineCacheEntry(Token::Kind kind) { | 2718 static uword TwoArgsSmiOpInlineCacheEntry(Token::Kind kind) { |
| 2737 if (!FLAG_two_args_smi_icd) { | 2719 if (!FLAG_two_args_smi_icd) { |
| 2738 return 0; | 2720 return 0; |
| 2739 } | 2721 } |
| 2740 StubCode* stub_code = Isolate::Current()->stub_code(); | 2722 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 2741 switch (kind) { | 2723 switch (kind) { |
| 2742 case Token::kADD: return stub_code->SmiAddInlineCacheEntryPoint(); | 2724 case Token::kADD: return stub_code->SmiAddInlineCacheEntryPoint(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2840 !target.IsInvokeFieldDispatcher()) { | 2822 !target.IsInvokeFieldDispatcher()) { |
| 2841 return false; | 2823 return false; |
| 2842 } | 2824 } |
| 2843 } | 2825 } |
| 2844 return true; | 2826 return true; |
| 2845 } | 2827 } |
| 2846 | 2828 |
| 2847 | 2829 |
| 2848 LocationSummary* StaticCallInstr::MakeLocationSummary(Isolate* isolate, | 2830 LocationSummary* StaticCallInstr::MakeLocationSummary(Isolate* isolate, |
| 2849 bool optimizing) const { | 2831 bool optimizing) const { |
| 2850 return MakeCallSummary(); | 2832 return MakeCallSummary(isolate); |
| 2851 } | 2833 } |
| 2852 | 2834 |
| 2853 | 2835 |
| 2854 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2836 void StaticCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2855 const ICData* call_ic_data = NULL; | 2837 const ICData* call_ic_data = NULL; |
| 2856 if (!FLAG_propagate_ic_data || !compiler->is_optimizing()) { | 2838 if (!FLAG_propagate_ic_data || !compiler->is_optimizing()) { |
| 2857 const Array& arguments_descriptor = | 2839 const Array& arguments_descriptor = |
| 2858 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(), | 2840 Array::Handle(ArgumentsDescriptor::New(ArgumentCount(), |
| 2859 argument_names())); | 2841 argument_names())); |
| 2860 MethodRecognizer::Kind recognized_kind = | 2842 MethodRecognizer::Kind recognized_kind = |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3358 case Token::kTRUNCDIV: return 0; | 3340 case Token::kTRUNCDIV: return 0; |
| 3359 case Token::kMOD: return 1; | 3341 case Token::kMOD: return 1; |
| 3360 default: UNIMPLEMENTED(); return -1; | 3342 default: UNIMPLEMENTED(); return -1; |
| 3361 } | 3343 } |
| 3362 } | 3344 } |
| 3363 | 3345 |
| 3364 | 3346 |
| 3365 #undef __ | 3347 #undef __ |
| 3366 | 3348 |
| 3367 } // namespace dart | 3349 } // namespace dart |
| OLD | NEW |