| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // instructions from the graph so we just leave fused comparison in it | 39 // instructions from the graph so we just leave fused comparison in it |
| 40 // but change its result location to be NoLocation. | 40 // but change its result location to be NoLocation. |
| 41 compiler->frame_register_allocator()->Push(locs()->out().reg(), this); | 41 compiler->frame_register_allocator()->Push(locs()->out().reg(), this); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 | 45 |
| 46 LocationSummary* ReturnInstr::MakeLocationSummary() const { | 46 LocationSummary* ReturnInstr::MakeLocationSummary() const { |
| 47 const intptr_t kNumInputs = 1; | 47 const intptr_t kNumInputs = 1; |
| 48 const intptr_t kNumTemps = 1; | 48 const intptr_t kNumTemps = 1; |
| 49 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); | 49 LocationSummary* locs = |
| 50 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 50 locs->set_in(0, Location::RegisterLocation(EAX)); | 51 locs->set_in(0, Location::RegisterLocation(EAX)); |
| 51 locs->set_temp(0, Location::RequiresRegister()); | 52 locs->set_temp(0, Location::RequiresRegister()); |
| 52 return locs; | 53 return locs; |
| 53 } | 54 } |
| 54 | 55 |
| 55 | 56 |
| 56 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 57 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 57 Register result = locs()->in(0).reg(); | 58 Register result = locs()->in(0).reg(); |
| 58 Register temp = locs()->temp(0).reg(); | 59 Register temp = locs()->temp(0).reg(); |
| 59 ASSERT(result == EAX); | 60 ASSERT(result == EAX); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 compiler->AddCurrentDescriptor(PcDescriptors::kReturn, | 104 compiler->AddCurrentDescriptor(PcDescriptors::kReturn, |
| 104 cid(), | 105 cid(), |
| 105 token_pos(), | 106 token_pos(), |
| 106 CatchClauseNode::kInvalidTryIndex); | 107 CatchClauseNode::kInvalidTryIndex); |
| 107 } | 108 } |
| 108 | 109 |
| 109 | 110 |
| 110 LocationSummary* ClosureCallComp::MakeLocationSummary() const { | 111 LocationSummary* ClosureCallComp::MakeLocationSummary() const { |
| 111 const intptr_t kNumInputs = 0; | 112 const intptr_t kNumInputs = 0; |
| 112 const intptr_t kNumTemps = 1; | 113 const intptr_t kNumTemps = 1; |
| 113 LocationSummary* result = new LocationSummary(kNumInputs, | 114 LocationSummary* result = |
| 114 kNumTemps, | 115 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 115 LocationSummary::kCall); | |
| 116 result->set_out(Location::RegisterLocation(EAX)); | 116 result->set_out(Location::RegisterLocation(EAX)); |
| 117 result->set_temp(0, Location::RegisterLocation(EDX)); // Arg. descriptor. | 117 result->set_temp(0, Location::RegisterLocation(EDX)); // Arg. descriptor. |
| 118 return result; | 118 return result; |
| 119 } | 119 } |
| 120 | 120 |
| 121 | 121 |
| 122 LocationSummary* LoadLocalComp::MakeLocationSummary() const { | 122 LocationSummary* LoadLocalComp::MakeLocationSummary() const { |
| 123 return LocationSummary::Make(0, Location::RequiresRegister()); | 123 return LocationSummary::Make(0, |
| 124 Location::RequiresRegister(), |
| 125 LocationSummary::kNoCall); |
| 124 } | 126 } |
| 125 | 127 |
| 126 | 128 |
| 127 void LoadLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 129 void LoadLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 128 Register result = locs()->out().reg(); | 130 Register result = locs()->out().reg(); |
| 129 __ movl(result, Address(EBP, local().index() * kWordSize)); | 131 __ movl(result, Address(EBP, local().index() * kWordSize)); |
| 130 } | 132 } |
| 131 | 133 |
| 132 | 134 |
| 133 LocationSummary* StoreLocalComp::MakeLocationSummary() const { | 135 LocationSummary* StoreLocalComp::MakeLocationSummary() const { |
| 134 return LocationSummary::Make(1, Location::SameAsFirstInput()); | 136 return LocationSummary::Make(1, |
| 137 Location::SameAsFirstInput(), |
| 138 LocationSummary::kNoCall); |
| 135 } | 139 } |
| 136 | 140 |
| 137 | 141 |
| 138 void StoreLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 142 void StoreLocalComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 139 Register value = locs()->in(0).reg(); | 143 Register value = locs()->in(0).reg(); |
| 140 Register result = locs()->out().reg(); | 144 Register result = locs()->out().reg(); |
| 141 ASSERT(result == value); // Assert that register assignment is correct. | 145 ASSERT(result == value); // Assert that register assignment is correct. |
| 142 __ movl(Address(EBP, local().index() * kWordSize), value); | 146 __ movl(Address(EBP, local().index() * kWordSize), value); |
| 143 } | 147 } |
| 144 | 148 |
| 145 | 149 |
| 146 LocationSummary* ConstantVal::MakeLocationSummary() const { | 150 LocationSummary* ConstantVal::MakeLocationSummary() const { |
| 147 return LocationSummary::Make(0, Location::RequiresRegister()); | 151 return LocationSummary::Make(0, |
| 152 Location::RequiresRegister(), |
| 153 LocationSummary::kNoCall); |
| 148 } | 154 } |
| 149 | 155 |
| 150 | 156 |
| 151 void ConstantVal::EmitNativeCode(FlowGraphCompiler* compiler) { | 157 void ConstantVal::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 152 Register result = locs()->out().reg(); | 158 Register result = locs()->out().reg(); |
| 153 __ LoadObject(result, value()); | 159 __ LoadObject(result, value()); |
| 154 } | 160 } |
| 155 | 161 |
| 156 | 162 |
| 157 LocationSummary* AssertAssignableComp::MakeLocationSummary() const { | 163 LocationSummary* AssertAssignableComp::MakeLocationSummary() const { |
| 158 const intptr_t kNumInputs = 3; | 164 const intptr_t kNumInputs = 3; |
| 159 const intptr_t kNumTemps = 0; | 165 const intptr_t kNumTemps = 0; |
| 160 LocationSummary* summary = new LocationSummary(kNumInputs, | 166 LocationSummary* summary = |
| 161 kNumTemps, | 167 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 162 LocationSummary::kCall); | |
| 163 summary->set_in(0, Location::RegisterLocation(EAX)); // Value. | 168 summary->set_in(0, Location::RegisterLocation(EAX)); // Value. |
| 164 summary->set_in(1, Location::RegisterLocation(ECX)); // Instantiator. | 169 summary->set_in(1, Location::RegisterLocation(ECX)); // Instantiator. |
| 165 summary->set_in(2, Location::RegisterLocation(EDX)); // Type arguments. | 170 summary->set_in(2, Location::RegisterLocation(EDX)); // Type arguments. |
| 166 summary->set_out(Location::RegisterLocation(EAX)); | 171 summary->set_out(Location::RegisterLocation(EAX)); |
| 167 return summary; | 172 return summary; |
| 168 } | 173 } |
| 169 | 174 |
| 170 | 175 |
| 171 LocationSummary* AssertBooleanComp::MakeLocationSummary() const { | 176 LocationSummary* AssertBooleanComp::MakeLocationSummary() const { |
| 172 const intptr_t kNumInputs = 1; | 177 const intptr_t kNumInputs = 1; |
| 173 const intptr_t kNumTemps = 0; | 178 const intptr_t kNumTemps = 0; |
| 174 LocationSummary* locs = new LocationSummary(kNumInputs, | 179 LocationSummary* locs = |
| 175 kNumTemps, | 180 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 176 LocationSummary::kCall); | |
| 177 locs->set_in(0, Location::RegisterLocation(EAX)); | 181 locs->set_in(0, Location::RegisterLocation(EAX)); |
| 178 locs->set_out(Location::RegisterLocation(EAX)); | 182 locs->set_out(Location::RegisterLocation(EAX)); |
| 179 return locs; | 183 return locs; |
| 180 } | 184 } |
| 181 | 185 |
| 182 | 186 |
| 183 void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 187 void AssertBooleanComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 184 Register obj = locs()->in(0).reg(); | 188 Register obj = locs()->in(0).reg(); |
| 185 Register result = locs()->out().reg(); | 189 Register result = locs()->out().reg(); |
| 186 | 190 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 return OVERFLOW; | 222 return OVERFLOW; |
| 219 } | 223 } |
| 220 } | 224 } |
| 221 | 225 |
| 222 | 226 |
| 223 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { | 227 LocationSummary* EqualityCompareComp::MakeLocationSummary() const { |
| 224 const intptr_t kNumInputs = 2; | 228 const intptr_t kNumInputs = 2; |
| 225 if (receiver_class_id() != kObject) { | 229 if (receiver_class_id() != kObject) { |
| 226 ASSERT((receiver_class_id() == kSmi) || (receiver_class_id() == kDouble)); | 230 ASSERT((receiver_class_id() == kSmi) || (receiver_class_id() == kDouble)); |
| 227 const intptr_t kNumTemps = 1; | 231 const intptr_t kNumTemps = 1; |
| 228 LocationSummary* locs = new LocationSummary(kNumInputs, | 232 LocationSummary* locs = |
| 229 kNumTemps, | 233 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 230 LocationSummary::kNoCall); | |
| 231 locs->set_in(0, Location::RequiresRegister()); | 234 locs->set_in(0, Location::RequiresRegister()); |
| 232 locs->set_in(1, Location::RequiresRegister()); | 235 locs->set_in(1, Location::RequiresRegister()); |
| 233 locs->set_temp(0, Location::RequiresRegister()); | 236 locs->set_temp(0, Location::RequiresRegister()); |
| 234 locs->set_out(Location::RequiresRegister()); | 237 locs->set_out(Location::RequiresRegister()); |
| 235 return locs; | 238 return locs; |
| 236 } | 239 } |
| 237 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { | 240 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { |
| 238 const intptr_t kNumTemps = 1; | 241 const intptr_t kNumTemps = 1; |
| 239 LocationSummary* locs = new LocationSummary(kNumInputs, | 242 LocationSummary* locs = |
| 240 kNumTemps, | 243 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 241 LocationSummary::kCall); | |
| 242 locs->set_in(0, Location::RegisterLocation(ECX)); | 244 locs->set_in(0, Location::RegisterLocation(ECX)); |
| 243 locs->set_in(1, Location::RegisterLocation(EDX)); | 245 locs->set_in(1, Location::RegisterLocation(EDX)); |
| 244 locs->set_temp(0, Location::RegisterLocation(EBX)); | 246 locs->set_temp(0, Location::RegisterLocation(EBX)); |
| 245 locs->set_out(Location::RegisterLocation(EAX)); | 247 locs->set_out(Location::RegisterLocation(EAX)); |
| 246 return locs; | 248 return locs; |
| 247 } | 249 } |
| 248 const intptr_t kNumTemps = 0; | 250 const intptr_t kNumTemps = 0; |
| 249 LocationSummary* locs = new LocationSummary(kNumInputs, | 251 LocationSummary* locs = |
| 250 kNumTemps, | 252 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 251 LocationSummary::kCall); | |
| 252 locs->set_in(0, Location::RegisterLocation(ECX)); | 253 locs->set_in(0, Location::RegisterLocation(ECX)); |
| 253 locs->set_in(1, Location::RegisterLocation(EDX)); | 254 locs->set_in(1, Location::RegisterLocation(EDX)); |
| 254 locs->set_out(Location::RegisterLocation(EAX)); | 255 locs->set_out(Location::RegisterLocation(EAX)); |
| 255 return locs; | 256 return locs; |
| 256 } | 257 } |
| 257 | 258 |
| 258 | 259 |
| 259 // Optional integer arguments can often be null. Null is not collected | 260 // Optional integer arguments can often be null. Null is not collected |
| 260 // by IC data. TODO(srdjan): Shall we collect null classes in ICData as well? | 261 // by IC data. TODO(srdjan): Shall we collect null classes in ICData as well? |
| 261 static void EmitSmiEqualityCompare(FlowGraphCompiler* compiler, | 262 static void EmitSmiEqualityCompare(FlowGraphCompiler* compiler, |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 __ pushl(right); | 498 __ pushl(right); |
| 498 EmitEqualityAsInstanceCall(compiler, this); | 499 EmitEqualityAsInstanceCall(compiler, this); |
| 499 } | 500 } |
| 500 } | 501 } |
| 501 | 502 |
| 502 | 503 |
| 503 LocationSummary* RelationalOpComp::MakeLocationSummary() const { | 504 LocationSummary* RelationalOpComp::MakeLocationSummary() const { |
| 504 if ((operands_class_id() == kSmi) || (operands_class_id() == kDouble)) { | 505 if ((operands_class_id() == kSmi) || (operands_class_id() == kDouble)) { |
| 505 const intptr_t kNumInputs = 2; | 506 const intptr_t kNumInputs = 2; |
| 506 const intptr_t kNumTemps = 1; | 507 const intptr_t kNumTemps = 1; |
| 507 LocationSummary* summary = new LocationSummary(kNumInputs, | 508 LocationSummary* summary = |
| 508 kNumTemps, | 509 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 509 LocationSummary::kNoCall); | |
| 510 summary->set_in(0, Location::RequiresRegister()); | 510 summary->set_in(0, Location::RequiresRegister()); |
| 511 summary->set_in(1, Location::RequiresRegister()); | 511 summary->set_in(1, Location::RequiresRegister()); |
| 512 summary->set_out(Location::RequiresRegister()); | 512 summary->set_out(Location::RequiresRegister()); |
| 513 summary->set_temp(0, Location::RequiresRegister()); | 513 summary->set_temp(0, Location::RequiresRegister()); |
| 514 return summary; | 514 return summary; |
| 515 } | 515 } |
| 516 ASSERT(operands_class_id() == kObject); | 516 ASSERT(operands_class_id() == kObject); |
| 517 return MakeCallSummary(); | 517 return MakeCallSummary(); |
| 518 } | 518 } |
| 519 | 519 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 kNumArguments, | 654 kNumArguments, |
| 655 Array::ZoneHandle(), // No optional arguments. | 655 Array::ZoneHandle(), // No optional arguments. |
| 656 kNumArgsChecked); | 656 kNumArgsChecked); |
| 657 ASSERT(locs()->out().reg() == EAX); | 657 ASSERT(locs()->out().reg() == EAX); |
| 658 } | 658 } |
| 659 | 659 |
| 660 | 660 |
| 661 LocationSummary* NativeCallComp::MakeLocationSummary() const { | 661 LocationSummary* NativeCallComp::MakeLocationSummary() const { |
| 662 const intptr_t kNumInputs = 0; | 662 const intptr_t kNumInputs = 0; |
| 663 const intptr_t kNumTemps = 3; | 663 const intptr_t kNumTemps = 3; |
| 664 LocationSummary* locs = new LocationSummary(kNumInputs, | 664 LocationSummary* locs = |
| 665 kNumTemps, | 665 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 666 LocationSummary::kCall); | |
| 667 locs->set_temp(0, Location::RegisterLocation(EAX)); | 666 locs->set_temp(0, Location::RegisterLocation(EAX)); |
| 668 locs->set_temp(1, Location::RegisterLocation(ECX)); | 667 locs->set_temp(1, Location::RegisterLocation(ECX)); |
| 669 locs->set_temp(2, Location::RegisterLocation(EDX)); | 668 locs->set_temp(2, Location::RegisterLocation(EDX)); |
| 670 locs->set_out(Location::RegisterLocation(EAX)); | 669 locs->set_out(Location::RegisterLocation(EAX)); |
| 671 return locs; | 670 return locs; |
| 672 } | 671 } |
| 673 | 672 |
| 674 | 673 |
| 675 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 674 void NativeCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 676 ASSERT(locs()->temp(0).reg() == EAX); | 675 ASSERT(locs()->temp(0).reg() == EAX); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 700 __ popl(result); | 699 __ popl(result); |
| 701 } | 700 } |
| 702 | 701 |
| 703 | 702 |
| 704 LocationSummary* LoadIndexedComp::MakeLocationSummary() const { | 703 LocationSummary* LoadIndexedComp::MakeLocationSummary() const { |
| 705 const intptr_t kNumInputs = 2; | 704 const intptr_t kNumInputs = 2; |
| 706 if ((receiver_type() == kGrowableObjectArray) || | 705 if ((receiver_type() == kGrowableObjectArray) || |
| 707 (receiver_type() == kArray) || | 706 (receiver_type() == kArray) || |
| 708 (receiver_type() == kImmutableArray)) { | 707 (receiver_type() == kImmutableArray)) { |
| 709 const intptr_t kNumTemps = 1; | 708 const intptr_t kNumTemps = 1; |
| 710 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); | 709 LocationSummary* locs = |
| 710 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 711 locs->set_in(0, Location::RequiresRegister()); | 711 locs->set_in(0, Location::RequiresRegister()); |
| 712 locs->set_in(1, Location::RequiresRegister()); | 712 locs->set_in(1, Location::RequiresRegister()); |
| 713 locs->set_temp(0, Location::RequiresRegister()); | 713 locs->set_temp(0, Location::RequiresRegister()); |
| 714 locs->set_out(Location::RequiresRegister()); | 714 locs->set_out(Location::RequiresRegister()); |
| 715 return locs; | 715 return locs; |
| 716 } else { | 716 } else { |
| 717 ASSERT(receiver_type() == kIllegalObjectKind); | 717 ASSERT(receiver_type() == kIllegalObjectKind); |
| 718 return MakeCallSummary(); | 718 return MakeCallSummary(); |
| 719 } | 719 } |
| 720 } | 720 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 break; | 812 break; |
| 813 } | 813 } |
| 814 } | 814 } |
| 815 | 815 |
| 816 | 816 |
| 817 LocationSummary* StoreIndexedComp::MakeLocationSummary() const { | 817 LocationSummary* StoreIndexedComp::MakeLocationSummary() const { |
| 818 const intptr_t kNumInputs = 3; | 818 const intptr_t kNumInputs = 3; |
| 819 if ((receiver_type() == kGrowableObjectArray) || | 819 if ((receiver_type() == kGrowableObjectArray) || |
| 820 (receiver_type() == kArray)) { | 820 (receiver_type() == kArray)) { |
| 821 const intptr_t kNumTemps = 1; | 821 const intptr_t kNumTemps = 1; |
| 822 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); | 822 LocationSummary* locs = |
| 823 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 823 locs->set_in(0, Location::RequiresRegister()); | 824 locs->set_in(0, Location::RequiresRegister()); |
| 824 locs->set_in(1, Location::RequiresRegister()); | 825 locs->set_in(1, Location::RequiresRegister()); |
| 825 locs->set_in(2, Location::RequiresRegister()); | 826 locs->set_in(2, Location::RequiresRegister()); |
| 826 locs->set_temp(0, Location::RequiresRegister()); | 827 locs->set_temp(0, Location::RequiresRegister()); |
| 827 locs->set_out(Location::NoLocation()); | 828 locs->set_out(Location::NoLocation()); |
| 828 return locs; | 829 return locs; |
| 829 } else { | 830 } else { |
| 830 ASSERT(receiver_type() == kIllegalObjectKind); | 831 ASSERT(receiver_type() == kIllegalObjectKind); |
| 831 return MakeCallSummary(); | 832 return MakeCallSummary(); |
| 832 } | 833 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 function_name, | 1001 function_name, |
| 1001 kArgumentCount, | 1002 kArgumentCount, |
| 1002 Array::ZoneHandle(), | 1003 Array::ZoneHandle(), |
| 1003 kCheckedArgumentCount); | 1004 kCheckedArgumentCount); |
| 1004 } | 1005 } |
| 1005 } | 1006 } |
| 1006 | 1007 |
| 1007 | 1008 |
| 1008 LocationSummary* StaticSetterComp::MakeLocationSummary() const { | 1009 LocationSummary* StaticSetterComp::MakeLocationSummary() const { |
| 1009 const intptr_t kNumInputs = 1; | 1010 const intptr_t kNumInputs = 1; |
| 1010 return LocationSummary::Make(kNumInputs, Location::RequiresRegister()); | 1011 return LocationSummary::Make(kNumInputs, |
| 1012 Location::RequiresRegister(), |
| 1013 LocationSummary::kNoCall); |
| 1011 } | 1014 } |
| 1012 | 1015 |
| 1013 | 1016 |
| 1014 void StaticSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1017 void StaticSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1015 Register value = locs()->in(0).reg(); | 1018 Register value = locs()->in(0).reg(); |
| 1016 Register result = locs()->out().reg(); | 1019 Register result = locs()->out().reg(); |
| 1017 | 1020 |
| 1018 // Preserve the argument as the result of the computation, | 1021 // Preserve the argument as the result of the computation, |
| 1019 // then call the setter. | 1022 // then call the setter. |
| 1020 | 1023 |
| 1021 // Duplicate the argument. | 1024 // Duplicate the argument. |
| 1022 // TODO(fschneider): Avoid preserving the value if the result is not used. | 1025 // TODO(fschneider): Avoid preserving the value if the result is not used. |
| 1023 __ pushl(value); | 1026 __ pushl(value); |
| 1024 __ pushl(value); | 1027 __ pushl(value); |
| 1025 compiler->GenerateStaticCall(cid(), | 1028 compiler->GenerateStaticCall(cid(), |
| 1026 token_pos(), | 1029 token_pos(), |
| 1027 try_index(), | 1030 try_index(), |
| 1028 setter_function(), | 1031 setter_function(), |
| 1029 1, | 1032 1, |
| 1030 Array::ZoneHandle()); | 1033 Array::ZoneHandle()); |
| 1031 __ popl(result); | 1034 __ popl(result); |
| 1032 } | 1035 } |
| 1033 | 1036 |
| 1034 | 1037 |
| 1035 LocationSummary* LoadInstanceFieldComp::MakeLocationSummary() const { | 1038 LocationSummary* LoadInstanceFieldComp::MakeLocationSummary() const { |
| 1036 // TODO(fschneider): For this instruction the input register may be | 1039 // TODO(fschneider): For this instruction the input register may be |
| 1037 // reused for the result (but is not required to) because the input | 1040 // reused for the result (but is not required to) because the input |
| 1038 // is not used after the result is defined. We should consider adding | 1041 // is not used after the result is defined. We should consider adding |
| 1039 // this information to the input policy. | 1042 // this information to the input policy. |
| 1040 return LocationSummary::Make(1, Location::RequiresRegister()); | 1043 return LocationSummary::Make(1, |
| 1044 Location::RequiresRegister(), |
| 1045 LocationSummary::kNoCall); |
| 1041 } | 1046 } |
| 1042 | 1047 |
| 1043 | 1048 |
| 1044 void LoadInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1049 void LoadInstanceFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1045 Register instance_reg = locs()->in(0).reg(); | 1050 Register instance_reg = locs()->in(0).reg(); |
| 1046 Register result_reg = locs()->out().reg(); | 1051 Register result_reg = locs()->out().reg(); |
| 1047 | 1052 |
| 1048 if (HasICData()) { | 1053 if (HasICData()) { |
| 1049 ASSERT(original() != NULL); | 1054 ASSERT(original() != NULL); |
| 1050 Label* deopt = compiler->AddDeoptStub(original()->cid(), | 1055 Label* deopt = compiler->AddDeoptStub(original()->cid(), |
| 1051 original()->token_pos(), | 1056 original()->token_pos(), |
| 1052 original()->try_index(), | 1057 original()->try_index(), |
| 1053 kDeoptInstanceGetterSameTarget, | 1058 kDeoptInstanceGetterSameTarget, |
| 1054 instance_reg); | 1059 instance_reg); |
| 1055 // Smis do not have instance fields (Smi class is always first). | 1060 // Smis do not have instance fields (Smi class is always first). |
| 1056 // Use 'result' as temporary register. | 1061 // Use 'result' as temporary register. |
| 1057 ASSERT(result_reg != instance_reg); | 1062 ASSERT(result_reg != instance_reg); |
| 1058 ASSERT(ic_data() != NULL); | 1063 ASSERT(ic_data() != NULL); |
| 1059 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, result_reg, deopt); | 1064 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, result_reg, deopt); |
| 1060 } | 1065 } |
| 1061 __ movl(result_reg, FieldAddress(instance_reg, field().Offset())); | 1066 __ movl(result_reg, FieldAddress(instance_reg, field().Offset())); |
| 1062 } | 1067 } |
| 1063 | 1068 |
| 1064 | 1069 |
| 1065 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const { | 1070 LocationSummary* LoadStaticFieldComp::MakeLocationSummary() const { |
| 1066 return LocationSummary::Make(0, Location::RequiresRegister()); | 1071 return LocationSummary::Make(0, |
| 1072 Location::RequiresRegister(), |
| 1073 LocationSummary::kNoCall); |
| 1067 } | 1074 } |
| 1068 | 1075 |
| 1069 | 1076 |
| 1070 void LoadStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1077 void LoadStaticFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1071 Register result = locs()->out().reg(); | 1078 Register result = locs()->out().reg(); |
| 1072 __ LoadObject(result, field()); | 1079 __ LoadObject(result, field()); |
| 1073 __ movl(result, FieldAddress(result, Field::value_offset())); | 1080 __ movl(result, FieldAddress(result, Field::value_offset())); |
| 1074 } | 1081 } |
| 1075 | 1082 |
| 1076 | 1083 |
| 1077 LocationSummary* InstanceOfComp::MakeLocationSummary() const { | 1084 LocationSummary* InstanceOfComp::MakeLocationSummary() const { |
| 1078 const intptr_t kNumInputs = 3; | 1085 const intptr_t kNumInputs = 3; |
| 1079 const intptr_t kNumTemps = 0; | 1086 const intptr_t kNumTemps = 0; |
| 1080 LocationSummary* summary = new LocationSummary(kNumInputs, | 1087 LocationSummary* summary = |
| 1081 kNumTemps, | 1088 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 1082 LocationSummary::kCall); | |
| 1083 summary->set_in(0, Location::RegisterLocation(EAX)); | 1089 summary->set_in(0, Location::RegisterLocation(EAX)); |
| 1084 summary->set_in(1, Location::RegisterLocation(ECX)); | 1090 summary->set_in(1, Location::RegisterLocation(ECX)); |
| 1085 summary->set_in(2, Location::RegisterLocation(EDX)); | 1091 summary->set_in(2, Location::RegisterLocation(EDX)); |
| 1086 summary->set_out(Location::RegisterLocation(EAX)); | 1092 summary->set_out(Location::RegisterLocation(EAX)); |
| 1087 return summary; | 1093 return summary; |
| 1088 } | 1094 } |
| 1089 | 1095 |
| 1090 | 1096 |
| 1091 void InstanceOfComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1097 void InstanceOfComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1092 ASSERT(locs()->in(0).reg() == EAX); // Value. | 1098 ASSERT(locs()->in(0).reg() == EAX); // Value. |
| 1093 ASSERT(locs()->in(1).reg() == ECX); // Instantiator. | 1099 ASSERT(locs()->in(1).reg() == ECX); // Instantiator. |
| 1094 ASSERT(locs()->in(2).reg() == EDX); // Instantiator type arguments. | 1100 ASSERT(locs()->in(2).reg() == EDX); // Instantiator type arguments. |
| 1095 | 1101 |
| 1096 compiler->GenerateInstanceOf(cid(), | 1102 compiler->GenerateInstanceOf(cid(), |
| 1097 token_pos(), | 1103 token_pos(), |
| 1098 try_index(), | 1104 try_index(), |
| 1099 type(), | 1105 type(), |
| 1100 negate_result()); | 1106 negate_result()); |
| 1101 ASSERT(locs()->out().reg() == EAX); | 1107 ASSERT(locs()->out().reg() == EAX); |
| 1102 } | 1108 } |
| 1103 | 1109 |
| 1104 | 1110 |
| 1105 LocationSummary* CreateArrayComp::MakeLocationSummary() const { | 1111 LocationSummary* CreateArrayComp::MakeLocationSummary() const { |
| 1106 // TODO(regis): The elements of the array could be considered as arguments to | 1112 // TODO(regis): The elements of the array could be considered as arguments to |
| 1107 // CreateArrayComp, thereby making CreateArrayComp a call. | 1113 // CreateArrayComp, thereby making CreateArrayComp a call. |
| 1108 // For VerifyCallComputation to work, CreateArrayComp would need an | 1114 // For VerifyCallComputation to work, CreateArrayComp would need an |
| 1109 // ArgumentCount getter and an ArgumentAt getter. | 1115 // ArgumentCount getter and an ArgumentAt getter. |
| 1110 const intptr_t kNumInputs = 1; | 1116 const intptr_t kNumInputs = 1; |
| 1111 const intptr_t kNumTemps = 1; | 1117 const intptr_t kNumTemps = 1; |
| 1112 LocationSummary* locs = new LocationSummary(kNumInputs, | 1118 LocationSummary* locs = |
| 1113 kNumTemps, | 1119 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 1114 LocationSummary::kCall); | |
| 1115 locs->set_in(0, Location::RegisterLocation(ECX)); | 1120 locs->set_in(0, Location::RegisterLocation(ECX)); |
| 1116 locs->set_temp(0, Location::RegisterLocation(EDX)); | 1121 locs->set_temp(0, Location::RegisterLocation(EDX)); |
| 1117 locs->set_out(Location::RegisterLocation(EAX)); | 1122 locs->set_out(Location::RegisterLocation(EAX)); |
| 1118 return locs; | 1123 return locs; |
| 1119 } | 1124 } |
| 1120 | 1125 |
| 1121 | 1126 |
| 1122 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1127 void CreateArrayComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1123 Register temp_reg = locs()->temp(0).reg(); | 1128 Register temp_reg = locs()->temp(0).reg(); |
| 1124 Register result_reg = locs()->out().reg(); | 1129 Register result_reg = locs()->out().reg(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1139 ASSERT(ElementAt(i)->IsUse()); | 1144 ASSERT(ElementAt(i)->IsUse()); |
| 1140 __ popl(Address(temp_reg, i * kWordSize)); | 1145 __ popl(Address(temp_reg, i * kWordSize)); |
| 1141 } | 1146 } |
| 1142 } | 1147 } |
| 1143 | 1148 |
| 1144 | 1149 |
| 1145 LocationSummary* | 1150 LocationSummary* |
| 1146 AllocateObjectWithBoundsCheckComp::MakeLocationSummary() const { | 1151 AllocateObjectWithBoundsCheckComp::MakeLocationSummary() const { |
| 1147 const intptr_t kNumInputs = 2; | 1152 const intptr_t kNumInputs = 2; |
| 1148 const intptr_t kNumTemps = 0; | 1153 const intptr_t kNumTemps = 0; |
| 1149 LocationSummary* locs = new LocationSummary(kNumInputs, | 1154 LocationSummary* locs = |
| 1150 kNumTemps, | 1155 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 1151 LocationSummary::kCall); | |
| 1152 locs->set_in(0, Location::RegisterLocation(EAX)); | 1156 locs->set_in(0, Location::RegisterLocation(EAX)); |
| 1153 locs->set_in(1, Location::RegisterLocation(ECX)); | 1157 locs->set_in(1, Location::RegisterLocation(ECX)); |
| 1154 locs->set_out(Location::RegisterLocation(EAX)); | 1158 locs->set_out(Location::RegisterLocation(EAX)); |
| 1155 return locs; | 1159 return locs; |
| 1156 } | 1160 } |
| 1157 | 1161 |
| 1158 | 1162 |
| 1159 void AllocateObjectWithBoundsCheckComp::EmitNativeCode( | 1163 void AllocateObjectWithBoundsCheckComp::EmitNativeCode( |
| 1160 FlowGraphCompiler* compiler) { | 1164 FlowGraphCompiler* compiler) { |
| 1161 const Class& cls = Class::ZoneHandle(constructor().owner()); | 1165 const Class& cls = Class::ZoneHandle(constructor().owner()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1173 try_index(), | 1177 try_index(), |
| 1174 kAllocateObjectWithBoundsCheckRuntimeEntry); | 1178 kAllocateObjectWithBoundsCheckRuntimeEntry); |
| 1175 // Pop instantiator type arguments, type arguments, and class. | 1179 // Pop instantiator type arguments, type arguments, and class. |
| 1176 // source location. | 1180 // source location. |
| 1177 __ Drop(3); | 1181 __ Drop(3); |
| 1178 __ popl(result); // Pop new instance. | 1182 __ popl(result); // Pop new instance. |
| 1179 } | 1183 } |
| 1180 | 1184 |
| 1181 | 1185 |
| 1182 LocationSummary* LoadVMFieldComp::MakeLocationSummary() const { | 1186 LocationSummary* LoadVMFieldComp::MakeLocationSummary() const { |
| 1183 return LocationSummary::Make(1, Location::RequiresRegister()); | 1187 return LocationSummary::Make(1, |
| 1188 Location::RequiresRegister(), |
| 1189 LocationSummary::kNoCall); |
| 1184 } | 1190 } |
| 1185 | 1191 |
| 1186 | 1192 |
| 1187 void LoadVMFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1193 void LoadVMFieldComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1188 Register instance_reg = locs()->in(0).reg(); | 1194 Register instance_reg = locs()->in(0).reg(); |
| 1189 Register result_reg = locs()->out().reg(); | 1195 Register result_reg = locs()->out().reg(); |
| 1190 if (HasICData()) { | 1196 if (HasICData()) { |
| 1191 ASSERT(original() != NULL); | 1197 ASSERT(original() != NULL); |
| 1192 Label* deopt = compiler->AddDeoptStub(original()->cid(), | 1198 Label* deopt = compiler->AddDeoptStub(original()->cid(), |
| 1193 original()->token_pos(), | 1199 original()->token_pos(), |
| 1194 original()->try_index(), | 1200 original()->try_index(), |
| 1195 kDeoptInstanceGetterSameTarget, | 1201 kDeoptInstanceGetterSameTarget, |
| 1196 instance_reg); | 1202 instance_reg); |
| 1197 // Smis do not have instance fields (Smi class is always first). | 1203 // Smis do not have instance fields (Smi class is always first). |
| 1198 // Use 'result' as temporary register. | 1204 // Use 'result' as temporary register. |
| 1199 ASSERT(result_reg != instance_reg); | 1205 ASSERT(result_reg != instance_reg); |
| 1200 ASSERT(ic_data() != NULL); | 1206 ASSERT(ic_data() != NULL); |
| 1201 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, result_reg, deopt); | 1207 compiler->EmitClassChecksNoSmi(*ic_data(), instance_reg, result_reg, deopt); |
| 1202 } | 1208 } |
| 1203 | 1209 |
| 1204 __ movl(result_reg, FieldAddress(instance_reg, offset_in_bytes())); | 1210 __ movl(result_reg, FieldAddress(instance_reg, offset_in_bytes())); |
| 1205 } | 1211 } |
| 1206 | 1212 |
| 1207 | 1213 |
| 1208 LocationSummary* InstantiateTypeArgumentsComp::MakeLocationSummary() const { | 1214 LocationSummary* InstantiateTypeArgumentsComp::MakeLocationSummary() const { |
| 1209 const intptr_t kNumInputs = 1; | 1215 const intptr_t kNumInputs = 1; |
| 1210 const intptr_t kNumTemps = 1; | 1216 const intptr_t kNumTemps = 1; |
| 1211 LocationSummary* locs = new LocationSummary(kNumInputs, | 1217 LocationSummary* locs = |
| 1212 kNumTemps, | 1218 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 1213 LocationSummary::kCall); | |
| 1214 locs->set_in(0, Location::RegisterLocation(EAX)); | 1219 locs->set_in(0, Location::RegisterLocation(EAX)); |
| 1215 locs->set_temp(0, Location::RegisterLocation(ECX)); | 1220 locs->set_temp(0, Location::RegisterLocation(ECX)); |
| 1216 locs->set_out(Location::RegisterLocation(EAX)); | 1221 locs->set_out(Location::RegisterLocation(EAX)); |
| 1217 return locs; | 1222 return locs; |
| 1218 } | 1223 } |
| 1219 | 1224 |
| 1220 | 1225 |
| 1221 void InstantiateTypeArgumentsComp::EmitNativeCode( | 1226 void InstantiateTypeArgumentsComp::EmitNativeCode( |
| 1222 FlowGraphCompiler* compiler) { | 1227 FlowGraphCompiler* compiler) { |
| 1223 Register instantiator_reg = locs()->in(0).reg(); | 1228 Register instantiator_reg = locs()->in(0).reg(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 __ Bind(&type_arguments_instantiated); | 1270 __ Bind(&type_arguments_instantiated); |
| 1266 ASSERT(instantiator_reg == result_reg); | 1271 ASSERT(instantiator_reg == result_reg); |
| 1267 // 'result_reg': Instantiated type arguments. | 1272 // 'result_reg': Instantiated type arguments. |
| 1268 } | 1273 } |
| 1269 | 1274 |
| 1270 | 1275 |
| 1271 LocationSummary* | 1276 LocationSummary* |
| 1272 ExtractConstructorTypeArgumentsComp::MakeLocationSummary() const { | 1277 ExtractConstructorTypeArgumentsComp::MakeLocationSummary() const { |
| 1273 const intptr_t kNumInputs = 1; | 1278 const intptr_t kNumInputs = 1; |
| 1274 const intptr_t kNumTemps = 1; | 1279 const intptr_t kNumTemps = 1; |
| 1275 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); | 1280 LocationSummary* locs = |
| 1281 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1276 locs->set_in(0, Location::RequiresRegister()); | 1282 locs->set_in(0, Location::RequiresRegister()); |
| 1277 locs->set_out(Location::SameAsFirstInput()); | 1283 locs->set_out(Location::SameAsFirstInput()); |
| 1278 locs->set_temp(0, Location::RequiresRegister()); | 1284 locs->set_temp(0, Location::RequiresRegister()); |
| 1279 return locs; | 1285 return locs; |
| 1280 } | 1286 } |
| 1281 | 1287 |
| 1282 | 1288 |
| 1283 void ExtractConstructorTypeArgumentsComp::EmitNativeCode( | 1289 void ExtractConstructorTypeArgumentsComp::EmitNativeCode( |
| 1284 FlowGraphCompiler* compiler) { | 1290 FlowGraphCompiler* compiler) { |
| 1285 Register instantiator_reg = locs()->in(0).reg(); | 1291 Register instantiator_reg = locs()->in(0).reg(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 // result_reg: uninstantiated type arguments. | 1328 // result_reg: uninstantiated type arguments. |
| 1323 __ Bind(&type_arguments_instantiated); | 1329 __ Bind(&type_arguments_instantiated); |
| 1324 // result_reg: uninstantiated or instantiated type arguments. | 1330 // result_reg: uninstantiated or instantiated type arguments. |
| 1325 } | 1331 } |
| 1326 | 1332 |
| 1327 | 1333 |
| 1328 LocationSummary* | 1334 LocationSummary* |
| 1329 ExtractConstructorInstantiatorComp::MakeLocationSummary() const { | 1335 ExtractConstructorInstantiatorComp::MakeLocationSummary() const { |
| 1330 const intptr_t kNumInputs = 1; | 1336 const intptr_t kNumInputs = 1; |
| 1331 const intptr_t kNumTemps = 1; | 1337 const intptr_t kNumTemps = 1; |
| 1332 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); | 1338 LocationSummary* locs = |
| 1339 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1333 locs->set_in(0, Location::RequiresRegister()); | 1340 locs->set_in(0, Location::RequiresRegister()); |
| 1334 locs->set_out(Location::SameAsFirstInput()); | 1341 locs->set_out(Location::SameAsFirstInput()); |
| 1335 locs->set_temp(0, Location::RequiresRegister()); | 1342 locs->set_temp(0, Location::RequiresRegister()); |
| 1336 return locs; | 1343 return locs; |
| 1337 } | 1344 } |
| 1338 | 1345 |
| 1339 | 1346 |
| 1340 void ExtractConstructorInstantiatorComp::EmitNativeCode( | 1347 void ExtractConstructorInstantiatorComp::EmitNativeCode( |
| 1341 FlowGraphCompiler* compiler) { | 1348 FlowGraphCompiler* compiler) { |
| 1342 ASSERT(instantiator()->IsUse()); | 1349 ASSERT(instantiator()->IsUse()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 Immediate(Smi::RawValue(StubCode::kNoInstantiator))); | 1395 Immediate(Smi::RawValue(StubCode::kNoInstantiator))); |
| 1389 } | 1396 } |
| 1390 __ Bind(&done); | 1397 __ Bind(&done); |
| 1391 // instantiator_reg: instantiator or kNoInstantiator. | 1398 // instantiator_reg: instantiator or kNoInstantiator. |
| 1392 } | 1399 } |
| 1393 | 1400 |
| 1394 | 1401 |
| 1395 LocationSummary* AllocateContextComp::MakeLocationSummary() const { | 1402 LocationSummary* AllocateContextComp::MakeLocationSummary() const { |
| 1396 const intptr_t kNumInputs = 0; | 1403 const intptr_t kNumInputs = 0; |
| 1397 const intptr_t kNumTemps = 1; | 1404 const intptr_t kNumTemps = 1; |
| 1398 LocationSummary* locs = new LocationSummary(kNumInputs, | 1405 LocationSummary* locs = |
| 1399 kNumTemps, | 1406 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 1400 LocationSummary::kCall); | |
| 1401 locs->set_temp(0, Location::RegisterLocation(EDX)); | 1407 locs->set_temp(0, Location::RegisterLocation(EDX)); |
| 1402 locs->set_out(Location::RegisterLocation(EAX)); | 1408 locs->set_out(Location::RegisterLocation(EAX)); |
| 1403 return locs; | 1409 return locs; |
| 1404 } | 1410 } |
| 1405 | 1411 |
| 1406 | 1412 |
| 1407 void AllocateContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1413 void AllocateContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1408 ASSERT(locs()->temp(0).reg() == EDX); | 1414 ASSERT(locs()->temp(0).reg() == EDX); |
| 1409 ASSERT(locs()->out().reg() == EAX); | 1415 ASSERT(locs()->out().reg() == EAX); |
| 1410 | 1416 |
| 1411 __ movl(EDX, Immediate(num_context_variables())); | 1417 __ movl(EDX, Immediate(num_context_variables())); |
| 1412 const ExternalLabel label("alloc_context", | 1418 const ExternalLabel label("alloc_context", |
| 1413 StubCode::AllocateContextEntryPoint()); | 1419 StubCode::AllocateContextEntryPoint()); |
| 1414 compiler->GenerateCall(token_pos(), | 1420 compiler->GenerateCall(token_pos(), |
| 1415 try_index(), | 1421 try_index(), |
| 1416 &label, | 1422 &label, |
| 1417 PcDescriptors::kOther); | 1423 PcDescriptors::kOther); |
| 1418 } | 1424 } |
| 1419 | 1425 |
| 1420 | 1426 |
| 1421 LocationSummary* CloneContextComp::MakeLocationSummary() const { | 1427 LocationSummary* CloneContextComp::MakeLocationSummary() const { |
| 1422 const intptr_t kNumInputs = 1; | 1428 const intptr_t kNumInputs = 1; |
| 1423 const intptr_t kNumTemps = 0; | 1429 const intptr_t kNumTemps = 0; |
| 1424 LocationSummary* locs = new LocationSummary(kNumInputs, | 1430 LocationSummary* locs = |
| 1425 kNumTemps, | 1431 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 1426 LocationSummary::kCall); | |
| 1427 locs->set_in(0, Location::RegisterLocation(EAX)); | 1432 locs->set_in(0, Location::RegisterLocation(EAX)); |
| 1428 locs->set_out(Location::RegisterLocation(EAX)); | 1433 locs->set_out(Location::RegisterLocation(EAX)); |
| 1429 return locs; | 1434 return locs; |
| 1430 } | 1435 } |
| 1431 | 1436 |
| 1432 | 1437 |
| 1433 void CloneContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1438 void CloneContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1434 Register context_value = locs()->in(0).reg(); | 1439 Register context_value = locs()->in(0).reg(); |
| 1435 Register result = locs()->out().reg(); | 1440 Register result = locs()->out().reg(); |
| 1436 | 1441 |
| 1437 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 1442 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 1438 __ pushl(context_value); | 1443 __ pushl(context_value); |
| 1439 compiler->GenerateCallRuntime(cid(), | 1444 compiler->GenerateCallRuntime(cid(), |
| 1440 token_pos(), | 1445 token_pos(), |
| 1441 try_index(), | 1446 try_index(), |
| 1442 kCloneContextRuntimeEntry); | 1447 kCloneContextRuntimeEntry); |
| 1443 __ popl(result); // Remove argument. | 1448 __ popl(result); // Remove argument. |
| 1444 __ popl(result); // Get result (cloned context). | 1449 __ popl(result); // Get result (cloned context). |
| 1445 } | 1450 } |
| 1446 | 1451 |
| 1447 | 1452 |
| 1448 LocationSummary* CatchEntryComp::MakeLocationSummary() const { | 1453 LocationSummary* CatchEntryComp::MakeLocationSummary() const { |
| 1449 return LocationSummary::Make(0, Location::NoLocation()); | 1454 return LocationSummary::Make(0, |
| 1455 Location::NoLocation(), |
| 1456 LocationSummary::kNoCall); |
| 1450 } | 1457 } |
| 1451 | 1458 |
| 1452 | 1459 |
| 1453 // Restore stack and initialize the two exception variables: | 1460 // Restore stack and initialize the two exception variables: |
| 1454 // exception and stack trace variables. | 1461 // exception and stack trace variables. |
| 1455 void CatchEntryComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1462 void CatchEntryComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1456 // Restore RSP from RBP as we are coming from a throw and the code for | 1463 // Restore RSP from RBP as we are coming from a throw and the code for |
| 1457 // popping arguments has not been run. | 1464 // popping arguments has not been run. |
| 1458 const intptr_t locals_space_size = compiler->StackSize() * kWordSize; | 1465 const intptr_t locals_space_size = compiler->StackSize() * kWordSize; |
| 1459 ASSERT(locals_space_size >= 0); | 1466 ASSERT(locals_space_size >= 0); |
| 1460 const intptr_t offset_size = | 1467 const intptr_t offset_size = |
| 1461 -locals_space_size + FlowGraphCompiler::kLocalsOffsetFromFP; | 1468 -locals_space_size + FlowGraphCompiler::kLocalsOffsetFromFP; |
| 1462 __ leal(ESP, Address(EBP, offset_size)); | 1469 __ leal(ESP, Address(EBP, offset_size)); |
| 1463 | 1470 |
| 1464 ASSERT(!exception_var().is_captured()); | 1471 ASSERT(!exception_var().is_captured()); |
| 1465 ASSERT(!stacktrace_var().is_captured()); | 1472 ASSERT(!stacktrace_var().is_captured()); |
| 1466 __ movl(Address(EBP, exception_var().index() * kWordSize), | 1473 __ movl(Address(EBP, exception_var().index() * kWordSize), |
| 1467 kExceptionObjectReg); | 1474 kExceptionObjectReg); |
| 1468 __ movl(Address(EBP, stacktrace_var().index() * kWordSize), | 1475 __ movl(Address(EBP, stacktrace_var().index() * kWordSize), |
| 1469 kStackTraceObjectReg); | 1476 kStackTraceObjectReg); |
| 1470 } | 1477 } |
| 1471 | 1478 |
| 1472 | 1479 |
| 1473 LocationSummary* CheckStackOverflowComp::MakeLocationSummary() const { | 1480 LocationSummary* CheckStackOverflowComp::MakeLocationSummary() const { |
| 1474 const intptr_t kNumInputs = 0; | 1481 const intptr_t kNumInputs = 0; |
| 1475 const intptr_t kNumTemps = 0; | 1482 const intptr_t kNumTemps = 0; |
| 1476 // TODO(vegorov): spilling is required only on an infrequently executed path. | 1483 // TODO(vegorov): spilling is required only on an infrequently executed path. |
| 1477 LocationSummary* summary = new LocationSummary(kNumInputs, | 1484 LocationSummary* summary = |
| 1478 kNumTemps, | 1485 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 1479 LocationSummary::kCall); | |
| 1480 return summary; | 1486 return summary; |
| 1481 } | 1487 } |
| 1482 | 1488 |
| 1483 | 1489 |
| 1484 void CheckStackOverflowComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1490 void CheckStackOverflowComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1485 __ cmpl(ESP, | 1491 __ cmpl(ESP, |
| 1486 Address::Absolute(Isolate::Current()->stack_limit_address())); | 1492 Address::Absolute(Isolate::Current()->stack_limit_address())); |
| 1487 Label no_stack_overflow; | 1493 Label no_stack_overflow; |
| 1488 __ j(ABOVE, &no_stack_overflow); | 1494 __ j(ABOVE, &no_stack_overflow); |
| 1489 compiler->GenerateCallRuntime(cid(), | 1495 compiler->GenerateCallRuntime(cid(), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1510 summary->set_in(1, Location::RegisterLocation(ECX)); | 1516 summary->set_in(1, Location::RegisterLocation(ECX)); |
| 1511 summary->set_temp(0, Location::RegisterLocation(EDX)); | 1517 summary->set_temp(0, Location::RegisterLocation(EDX)); |
| 1512 summary->set_out(Location::RegisterLocation(EAX)); | 1518 summary->set_out(Location::RegisterLocation(EAX)); |
| 1513 return summary; | 1519 return summary; |
| 1514 } | 1520 } |
| 1515 | 1521 |
| 1516 ASSERT(operands_type() == kSmiOperands); | 1522 ASSERT(operands_type() == kSmiOperands); |
| 1517 | 1523 |
| 1518 if (op_kind() == Token::kTRUNCDIV) { | 1524 if (op_kind() == Token::kTRUNCDIV) { |
| 1519 const intptr_t kNumTemps = 3; | 1525 const intptr_t kNumTemps = 3; |
| 1520 LocationSummary* summary = new LocationSummary(kNumInputs, kNumTemps); | 1526 LocationSummary* summary = |
| 1527 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1521 summary->set_in(0, Location::RegisterLocation(EAX)); | 1528 summary->set_in(0, Location::RegisterLocation(EAX)); |
| 1522 summary->set_in(1, Location::RegisterLocation(ECX)); | 1529 summary->set_in(1, Location::RegisterLocation(ECX)); |
| 1523 summary->set_out(Location::SameAsFirstInput()); | 1530 summary->set_out(Location::SameAsFirstInput()); |
| 1524 summary->set_temp(0, Location::RegisterLocation(EBX)); | 1531 summary->set_temp(0, Location::RegisterLocation(EBX)); |
| 1525 // Will be used for for sign extension. | 1532 // Will be used for for sign extension. |
| 1526 summary->set_temp(1, Location::RegisterLocation(EDX)); | 1533 summary->set_temp(1, Location::RegisterLocation(EDX)); |
| 1527 summary->set_temp(2, Location::RequiresRegister()); | 1534 summary->set_temp(2, Location::RequiresRegister()); |
| 1528 return summary; | 1535 return summary; |
| 1529 } else if (op_kind() == Token::kSHR) { | 1536 } else if (op_kind() == Token::kSHR) { |
| 1530 const intptr_t kNumTemps = 1; | 1537 const intptr_t kNumTemps = 1; |
| 1531 LocationSummary* summary = new LocationSummary(kNumInputs, kNumTemps); | 1538 LocationSummary* summary = |
| 1539 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1532 summary->set_in(0, Location::RequiresRegister()); | 1540 summary->set_in(0, Location::RequiresRegister()); |
| 1533 summary->set_in(1, Location::RegisterLocation(ECX)); | 1541 summary->set_in(1, Location::RegisterLocation(ECX)); |
| 1534 summary->set_out(Location::SameAsFirstInput()); | 1542 summary->set_out(Location::SameAsFirstInput()); |
| 1535 summary->set_temp(0, Location::RequiresRegister()); | 1543 summary->set_temp(0, Location::RequiresRegister()); |
| 1536 return summary; | 1544 return summary; |
| 1537 } else if (op_kind() == Token::kSHL) { | 1545 } else if (op_kind() == Token::kSHL) { |
| 1538 // Two Smi operands can easily overflow into Mint. | 1546 // Two Smi operands can easily overflow into Mint. |
| 1539 const intptr_t kNumTemps = 2; | 1547 const intptr_t kNumTemps = 2; |
| 1540 LocationSummary* summary = | 1548 LocationSummary* summary = |
| 1541 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 1549 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 1542 summary->set_in(0, Location::RegisterLocation(EAX)); | 1550 summary->set_in(0, Location::RegisterLocation(EAX)); |
| 1543 summary->set_in(1, Location::RegisterLocation(EDX)); | 1551 summary->set_in(1, Location::RegisterLocation(EDX)); |
| 1544 summary->set_temp(0, Location::RegisterLocation(EBX)); | 1552 summary->set_temp(0, Location::RegisterLocation(EBX)); |
| 1545 summary->set_temp(1, Location::RegisterLocation(ECX)); | 1553 summary->set_temp(1, Location::RegisterLocation(ECX)); |
| 1546 summary->set_out(Location::RegisterLocation(EAX)); | 1554 summary->set_out(Location::RegisterLocation(EAX)); |
| 1547 return summary; | 1555 return summary; |
| 1548 } else { | 1556 } else { |
| 1549 const intptr_t kNumTemps = 1; | 1557 const intptr_t kNumTemps = 1; |
| 1550 LocationSummary* summary = new LocationSummary(kNumInputs, kNumTemps); | 1558 LocationSummary* summary = |
| 1559 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1551 summary->set_in(0, Location::RequiresRegister()); | 1560 summary->set_in(0, Location::RequiresRegister()); |
| 1552 summary->set_in(1, Location::RequiresRegister()); | 1561 summary->set_in(1, Location::RequiresRegister()); |
| 1553 summary->set_out(Location::SameAsFirstInput()); | 1562 summary->set_out(Location::SameAsFirstInput()); |
| 1554 summary->set_temp(0, Location::RequiresRegister()); | 1563 summary->set_temp(0, Location::RequiresRegister()); |
| 1555 return summary; | 1564 return summary; |
| 1556 } | 1565 } |
| 1557 } | 1566 } |
| 1558 | 1567 |
| 1559 | 1568 |
| 1560 static void EmitSmiBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) { | 1569 static void EmitSmiBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) { |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1860 | 1869 |
| 1861 default: | 1870 default: |
| 1862 UNREACHABLE(); | 1871 UNREACHABLE(); |
| 1863 } | 1872 } |
| 1864 } | 1873 } |
| 1865 | 1874 |
| 1866 | 1875 |
| 1867 LocationSummary* UnarySmiOpComp::MakeLocationSummary() const { | 1876 LocationSummary* UnarySmiOpComp::MakeLocationSummary() const { |
| 1868 const intptr_t kNumInputs = 1; | 1877 const intptr_t kNumInputs = 1; |
| 1869 const intptr_t kNumTemps = 0; | 1878 const intptr_t kNumTemps = 0; |
| 1870 LocationSummary* summary = new LocationSummary(kNumInputs, kNumTemps); | 1879 LocationSummary* summary = |
| 1880 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1871 summary->set_in(0, Location::RequiresRegister()); | 1881 summary->set_in(0, Location::RequiresRegister()); |
| 1872 summary->set_out(Location::SameAsFirstInput()); | 1882 summary->set_out(Location::SameAsFirstInput()); |
| 1873 return summary; | 1883 return summary; |
| 1874 } | 1884 } |
| 1875 | 1885 |
| 1876 | 1886 |
| 1877 void UnarySmiOpComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1887 void UnarySmiOpComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1878 const ICData& ic_data = *instance_call()->ic_data(); | 1888 const ICData& ic_data = *instance_call()->ic_data(); |
| 1879 ASSERT(!ic_data.IsNull()); | 1889 ASSERT(!ic_data.IsNull()); |
| 1880 ASSERT(ic_data.num_args_tested() == 1); | 1890 ASSERT(ic_data.num_args_tested() == 1); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1909 } | 1919 } |
| 1910 } else { | 1920 } else { |
| 1911 UNREACHABLE(); | 1921 UNREACHABLE(); |
| 1912 } | 1922 } |
| 1913 } | 1923 } |
| 1914 | 1924 |
| 1915 | 1925 |
| 1916 LocationSummary* NumberNegateComp::MakeLocationSummary() const { | 1926 LocationSummary* NumberNegateComp::MakeLocationSummary() const { |
| 1917 const intptr_t kNumInputs = 1; | 1927 const intptr_t kNumInputs = 1; |
| 1918 const intptr_t kNumTemps = 1; // Needed for doubles. | 1928 const intptr_t kNumTemps = 1; // Needed for doubles. |
| 1919 LocationSummary* summary = new LocationSummary(kNumInputs, | 1929 LocationSummary* summary = |
| 1920 kNumTemps, | 1930 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 1921 LocationSummary::kCall); | |
| 1922 summary->set_in(0, Location::RegisterLocation(EAX)); | 1931 summary->set_in(0, Location::RegisterLocation(EAX)); |
| 1923 summary->set_temp(0, Location::RegisterLocation(ECX)); | 1932 summary->set_temp(0, Location::RegisterLocation(ECX)); |
| 1924 summary->set_out(Location::RegisterLocation(EAX)); | 1933 summary->set_out(Location::RegisterLocation(EAX)); |
| 1925 return summary; | 1934 return summary; |
| 1926 } | 1935 } |
| 1927 | 1936 |
| 1928 | 1937 |
| 1929 void NumberNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 1938 void NumberNegateComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1930 const ICData& ic_data = *instance_call()->ic_data(); | 1939 const ICData& ic_data = *instance_call()->ic_data(); |
| 1931 ASSERT(!ic_data.IsNull()); | 1940 ASSERT(!ic_data.IsNull()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 } else { | 1980 } else { |
| 1972 UNREACHABLE(); | 1981 UNREACHABLE(); |
| 1973 } | 1982 } |
| 1974 } | 1983 } |
| 1975 | 1984 |
| 1976 | 1985 |
| 1977 LocationSummary* ToDoubleComp::MakeLocationSummary() const { | 1986 LocationSummary* ToDoubleComp::MakeLocationSummary() const { |
| 1978 const intptr_t kNumInputs = 1; | 1987 const intptr_t kNumInputs = 1; |
| 1979 if (from() == kDouble) { | 1988 if (from() == kDouble) { |
| 1980 const intptr_t kNumTemps = 1; | 1989 const intptr_t kNumTemps = 1; |
| 1981 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps); | 1990 LocationSummary* locs = |
| 1991 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1982 locs->set_in(0, Location::RequiresRegister()); | 1992 locs->set_in(0, Location::RequiresRegister()); |
| 1983 locs->set_temp(0, Location::RequiresRegister()); | 1993 locs->set_temp(0, Location::RequiresRegister()); |
| 1984 locs->set_out(Location::SameAsFirstInput()); | 1994 locs->set_out(Location::SameAsFirstInput()); |
| 1985 locs->set_temp(0, Location::RequiresRegister()); | 1995 locs->set_temp(0, Location::RequiresRegister()); |
| 1986 return locs; | 1996 return locs; |
| 1987 } else { | 1997 } else { |
| 1988 ASSERT(from() == kSmi); | 1998 ASSERT(from() == kSmi); |
| 1989 return MakeCallSummary(); // Calls a stub to allocate result. | 1999 return MakeCallSummary(); // Calls a stub to allocate result. |
| 1990 } | 2000 } |
| 1991 } | 2001 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 GrowableArray<intptr_t> class_ids; | 2105 GrowableArray<intptr_t> class_ids; |
| 2096 ic_data.GetCheckAt(0, &class_ids, &target); | 2106 ic_data.GetCheckAt(0, &class_ids, &target); |
| 2097 return (class_ids[0] == class_id) && (class_ids[1] == class_id); | 2107 return (class_ids[0] == class_id) && (class_ids[1] == class_id); |
| 2098 } | 2108 } |
| 2099 | 2109 |
| 2100 | 2110 |
| 2101 LocationSummary* BranchInstr::MakeLocationSummary() const { | 2111 LocationSummary* BranchInstr::MakeLocationSummary() const { |
| 2102 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { | 2112 if ((kind() == Token::kEQ_STRICT) || (kind() == Token::kNE_STRICT)) { |
| 2103 const int kNumInputs = 2; | 2113 const int kNumInputs = 2; |
| 2104 const int kNumTemps = 0; | 2114 const int kNumTemps = 0; |
| 2105 LocationSummary* locs = new LocationSummary(kNumInputs, | 2115 LocationSummary* locs = |
| 2106 kNumTemps, | 2116 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2107 LocationSummary::kNoCall); | |
| 2108 locs->set_in(0, Location::RequiresRegister()); | 2117 locs->set_in(0, Location::RequiresRegister()); |
| 2109 locs->set_in(1, Location::RequiresRegister()); | 2118 locs->set_in(1, Location::RequiresRegister()); |
| 2110 return locs; | 2119 return locs; |
| 2111 } | 2120 } |
| 2112 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { | 2121 if (HasICData() && (ic_data()->NumberOfChecks() > 0)) { |
| 2113 if (ICDataWithBothClassIds(*ic_data(), kSmi) || | 2122 if (ICDataWithBothClassIds(*ic_data(), kSmi) || |
| 2114 ICDataWithBothClassIds(*ic_data(), kDouble)) { | 2123 ICDataWithBothClassIds(*ic_data(), kDouble)) { |
| 2115 const intptr_t kNumInputs = 2; | 2124 const intptr_t kNumInputs = 2; |
| 2116 const intptr_t kNumTemps = 1; | 2125 const intptr_t kNumTemps = 1; |
| 2117 LocationSummary* summary = new LocationSummary(kNumInputs, | 2126 LocationSummary* summary = |
| 2118 kNumTemps, | 2127 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2119 LocationSummary::kNoCall); | |
| 2120 summary->set_in(0, Location::RequiresRegister()); | 2128 summary->set_in(0, Location::RequiresRegister()); |
| 2121 summary->set_in(1, Location::RequiresRegister()); | 2129 summary->set_in(1, Location::RequiresRegister()); |
| 2122 summary->set_temp(0, Location::RequiresRegister()); | 2130 summary->set_temp(0, Location::RequiresRegister()); |
| 2123 return summary; | 2131 return summary; |
| 2124 } | 2132 } |
| 2125 if ((kind() == Token::kEQ) || (kind() == Token::kNE)) { | 2133 if ((kind() == Token::kEQ) || (kind() == Token::kNE)) { |
| 2126 const intptr_t kNumInputs = 2; | 2134 const intptr_t kNumInputs = 2; |
| 2127 const intptr_t kNumTemps = 1; | 2135 const intptr_t kNumTemps = 1; |
| 2128 LocationSummary* locs = new LocationSummary(kNumInputs, | 2136 LocationSummary* locs = |
| 2129 kNumTemps, | 2137 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 2130 LocationSummary::kCall); | |
| 2131 locs->set_in(0, Location::RegisterLocation(EAX)); | 2138 locs->set_in(0, Location::RegisterLocation(EAX)); |
| 2132 locs->set_in(1, Location::RegisterLocation(ECX)); | 2139 locs->set_in(1, Location::RegisterLocation(ECX)); |
| 2133 locs->set_temp(0, Location::RegisterLocation(EDX)); | 2140 locs->set_temp(0, Location::RegisterLocation(EDX)); |
| 2134 return locs; | 2141 return locs; |
| 2135 } | 2142 } |
| 2136 // Otherwise polymorphic dispatch. | 2143 // Otherwise polymorphic dispatch. |
| 2137 } | 2144 } |
| 2138 // Call. | 2145 // Call. |
| 2139 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); | 2146 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); |
| 2140 result->set_out(Location::RegisterLocation(EAX)); | 2147 result->set_out(Location::RegisterLocation(EAX)); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2192 ASSERT(locs()->out().reg() == EAX); | 2199 ASSERT(locs()->out().reg() == EAX); |
| 2193 __ CompareObject(locs()->out().reg(), compiler->bool_true()); | 2200 __ CompareObject(locs()->out().reg(), compiler->bool_true()); |
| 2194 EmitBranchOnCondition(compiler, branch_condition); | 2201 EmitBranchOnCondition(compiler, branch_condition); |
| 2195 } | 2202 } |
| 2196 | 2203 |
| 2197 } // namespace dart | 2204 } // namespace dart |
| 2198 | 2205 |
| 2199 #undef __ | 2206 #undef __ |
| 2200 | 2207 |
| 2201 #endif // defined TARGET_ARCH_X64 | 2208 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |