Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: runtime/vm/intermediate_language_ia32.cc

Issue 12221139: Revert "Remove SminessPropagator and FlowGraphTypePropagator and all associated infrastructure and … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // We should never return here. 205 // We should never return here.
206 __ int3(); 206 __ int3();
207 __ Bind(&done); 207 __ Bind(&done);
208 } 208 }
209 209
210 210
211 void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 211 void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
212 Register obj = locs()->in(0).reg(); 212 Register obj = locs()->in(0).reg();
213 Register result = locs()->out().reg(); 213 Register result = locs()->out().reg();
214 214
215 EmitAssertBoolean(obj, token_pos(), deopt_id(), locs(), compiler); 215 if (!is_eliminated()) {
216 EmitAssertBoolean(obj, token_pos(), deopt_id(), locs(), compiler);
217 }
216 ASSERT(obj == result); 218 ASSERT(obj == result);
217 } 219 }
218 220
219 221
220 LocationSummary* ArgumentDefinitionTestInstr::MakeLocationSummary() const { 222 LocationSummary* ArgumentDefinitionTestInstr::MakeLocationSummary() const {
221 const intptr_t kNumInputs = 1; 223 const intptr_t kNumInputs = 1;
222 const intptr_t kNumTemps = 0; 224 const intptr_t kNumTemps = 0;
223 LocationSummary* locs = 225 LocationSummary* locs =
224 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 226 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
225 locs->set_in(0, Location::RegisterLocation(EAX)); 227 locs->set_in(0, Location::RegisterLocation(EAX));
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 Register result = locs()->out().reg(); 1090 Register result = locs()->out().reg();
1089 __ movl(result, 1091 __ movl(result,
1090 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress()))); 1092 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress())));
1091 __ movl(result, Address(result, 1093 __ movl(result, Address(result,
1092 char_code, 1094 char_code,
1093 TIMES_HALF_WORD_SIZE, // Char code is a smi. 1095 TIMES_HALF_WORD_SIZE, // Char code is a smi.
1094 Symbols::kNullCharCodeSymbolOffset * kWordSize)); 1096 Symbols::kNullCharCodeSymbolOffset * kWordSize));
1095 } 1097 }
1096 1098
1097 1099
1098 CompileType* LoadIndexedInstr::ComputeInitialType() const { 1100 intptr_t LoadIndexedInstr::ResultCid() const {
1099 switch (class_id_) { 1101 switch (class_id_) {
1100 case kArrayCid: 1102 case kArrayCid:
1101 case kImmutableArrayCid: 1103 case kImmutableArrayCid:
1102 return CompileType::Dynamic(); 1104 return kDynamicCid;
1103
1104 case kFloat32ArrayCid : 1105 case kFloat32ArrayCid :
1105 case kFloat64ArrayCid : 1106 case kFloat64ArrayCid :
1106 return CompileType::FromCid(kDoubleCid); 1107 return kDoubleCid;
1107
1108 case kInt8ArrayCid: 1108 case kInt8ArrayCid:
1109 case kUint8ArrayCid: 1109 case kUint8ArrayCid:
1110 case kUint8ClampedArrayCid: 1110 case kUint8ClampedArrayCid:
1111 case kExternalUint8ArrayCid: 1111 case kExternalUint8ArrayCid:
1112 case kExternalUint8ClampedArrayCid: 1112 case kExternalUint8ClampedArrayCid:
1113 case kInt16ArrayCid: 1113 case kInt16ArrayCid:
1114 case kUint16ArrayCid: 1114 case kUint16ArrayCid:
1115 case kOneByteStringCid: 1115 case kOneByteStringCid:
1116 case kTwoByteStringCid: 1116 case kTwoByteStringCid:
1117 return CompileType::FromCid(kSmiCid); 1117 return kSmiCid;
1118
1119 case kInt32ArrayCid: 1118 case kInt32ArrayCid:
1120 case kUint32ArrayCid: 1119 case kUint32ArrayCid:
1121 // Result can be Smi or Mint when boxed. 1120 // Result can be Smi or Mint when boxed.
1122 // Instruction can deoptimize if we optimistically assumed that the result 1121 // Instruction can deoptimize if we optimistically assumed that the result
1123 // fits into Smi. 1122 // fits into Smi.
1124 return CanDeoptimize() ? CompileType::FromCid(kSmiCid) 1123 return CanDeoptimize() ? kSmiCid : kDynamicCid;
1125 : CompileType::Int();
1126
1127 default: 1124 default:
1128 UNIMPLEMENTED(); 1125 UNIMPLEMENTED();
1129 return CompileType::Dynamic(); 1126 return kDynamicCid;
1130 } 1127 }
1131 } 1128 }
1132 1129
1133 1130
1134 Representation LoadIndexedInstr::representation() const { 1131 Representation LoadIndexedInstr::representation() const {
1135 switch (class_id_) { 1132 switch (class_id_) {
1136 case kArrayCid: 1133 case kArrayCid:
1137 case kImmutableArrayCid: 1134 case kImmutableArrayCid:
1138 case kInt8ArrayCid: 1135 case kInt8ArrayCid:
1139 case kUint8ArrayCid: 1136 case kUint8ArrayCid:
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2263 break; 2260 break;
2264 } 2261 }
2265 default: 2262 default:
2266 UNREACHABLE(); 2263 UNREACHABLE();
2267 break; 2264 break;
2268 } 2265 }
2269 } 2266 }
2270 2267
2271 2268
2272 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary() const { 2269 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary() const {
2273 ASSERT((left()->Type()->ToCid() != kDoubleCid) && 2270 ASSERT((left()->ResultCid() != kDoubleCid) &&
2274 (right()->Type()->ToCid() != kDoubleCid)); 2271 (right()->ResultCid() != kDoubleCid));
2275 const intptr_t kNumInputs = 2; 2272 const intptr_t kNumInputs = 2;
2276 const intptr_t kNumTemps = 1; 2273 const intptr_t kNumTemps = 1;
2277 LocationSummary* summary = 2274 LocationSummary* summary =
2278 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2275 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2279 summary->set_in(0, Location::RequiresRegister()); 2276 summary->set_in(0, Location::RequiresRegister());
2280 summary->set_in(1, Location::RequiresRegister()); 2277 summary->set_in(1, Location::RequiresRegister());
2281 summary->set_temp(0, Location::RequiresRegister()); 2278 summary->set_temp(0, Location::RequiresRegister());
2282 return summary; 2279 return summary;
2283 } 2280 }
2284 2281
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2361 LocationSummary* summary = 2358 LocationSummary* summary =
2362 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2359 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2363 summary->set_in(0, Location::RequiresRegister()); 2360 summary->set_in(0, Location::RequiresRegister());
2364 if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister()); 2361 if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister());
2365 summary->set_out(Location::RequiresFpuRegister()); 2362 summary->set_out(Location::RequiresFpuRegister());
2366 return summary; 2363 return summary;
2367 } 2364 }
2368 2365
2369 2366
2370 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2367 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2371 const intptr_t value_cid = value()->Type()->ToCid(); 2368 const intptr_t value_cid = value()->ResultCid();
2372 const Register value = locs()->in(0).reg(); 2369 const Register value = locs()->in(0).reg();
2373 const XmmRegister result = locs()->out().fpu_reg(); 2370 const XmmRegister result = locs()->out().fpu_reg();
2374 2371
2375 if (value_cid == kDoubleCid) { 2372 if (value_cid == kDoubleCid) {
2376 __ movsd(result, FieldAddress(value, Double::value_offset())); 2373 __ movsd(result, FieldAddress(value, Double::value_offset()));
2377 } else if (value_cid == kSmiCid) { 2374 } else if (value_cid == kSmiCid) {
2378 __ SmiUntag(value); // Untag input before conversion. 2375 __ SmiUntag(value); // Untag input before conversion.
2379 __ cvtsi2sd(result, value); 2376 __ cvtsi2sd(result, value);
2380 __ SmiTag(value); // Restore input register. 2377 __ SmiTag(value); // Restore input register.
2381 } else { 2378 } else {
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
2749 const intptr_t kNumInputs = 1; 2746 const intptr_t kNumInputs = 1;
2750 const intptr_t kNumTemps = 0; 2747 const intptr_t kNumTemps = 0;
2751 LocationSummary* summary = 2748 LocationSummary* summary =
2752 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2749 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2753 summary->set_in(0, Location::RequiresRegister()); 2750 summary->set_in(0, Location::RequiresRegister());
2754 return summary; 2751 return summary;
2755 } 2752 }
2756 2753
2757 2754
2758 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2755 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2756 // TODO(srdjan): Check if we can remove this by reordering CSE and LICM.
2757 if (value()->ResultCid() == kSmiCid) return;
2759 Register value = locs()->in(0).reg(); 2758 Register value = locs()->in(0).reg();
2760 Label* deopt = compiler->AddDeoptStub(deopt_id(), 2759 Label* deopt = compiler->AddDeoptStub(deopt_id(),
2761 kDeoptCheckSmi); 2760 kDeoptCheckSmi);
2762 __ testl(value, Immediate(kSmiTagMask)); 2761 __ testl(value, Immediate(kSmiTagMask));
2763 __ j(NOT_ZERO, deopt); 2762 __ j(NOT_ZERO, deopt);
2764 } 2763 }
2765 2764
2766 2765
2767 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary() const { 2766 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary() const {
2768 const intptr_t kNumInputs = 2; 2767 const intptr_t kNumInputs = 2;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2814 LocationSummary* summary = 2813 LocationSummary* summary =
2815 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2814 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2816 summary->set_in(0, Location::RequiresRegister()); 2815 summary->set_in(0, Location::RequiresRegister());
2817 if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister()); 2816 if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister());
2818 summary->set_out(Location::RequiresFpuRegister()); 2817 summary->set_out(Location::RequiresFpuRegister());
2819 return summary; 2818 return summary;
2820 } 2819 }
2821 2820
2822 2821
2823 void UnboxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2822 void UnboxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2824 const intptr_t value_cid = value()->Type()->ToCid(); 2823 const intptr_t value_cid = value()->ResultCid();
2825 const Register value = locs()->in(0).reg(); 2824 const Register value = locs()->in(0).reg();
2826 const XmmRegister result = locs()->out().fpu_reg(); 2825 const XmmRegister result = locs()->out().fpu_reg();
2827 2826
2828 if (value_cid == kMintCid) { 2827 if (value_cid == kMintCid) {
2829 __ movsd(result, FieldAddress(value, Mint::value_offset())); 2828 __ movsd(result, FieldAddress(value, Mint::value_offset()));
2830 } else if (value_cid == kSmiCid) { 2829 } else if (value_cid == kSmiCid) {
2831 __ SmiUntag(value); // Untag input before conversion. 2830 __ SmiUntag(value); // Untag input before conversion.
2832 __ movd(result, value); 2831 __ movd(result, value);
2833 __ pmovsxdq(result, result); 2832 __ pmovsxdq(result, result);
2834 __ SmiTag(value); // Restore input register. 2833 __ SmiTag(value); // Restore input register.
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
3418 PcDescriptors::kOther, 3417 PcDescriptors::kOther,
3419 locs()); 3418 locs());
3420 __ Drop(2); // Discard type arguments and receiver. 3419 __ Drop(2); // Discard type arguments and receiver.
3421 } 3420 }
3422 3421
3423 } // namespace dart 3422 } // namespace dart
3424 3423
3425 #undef __ 3424 #undef __
3426 3425
3427 #endif // defined TARGET_ARCH_IA32 3426 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698