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

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

Issue 12260008: Reapply r18377 it was reverted due to the unrelated bug it surfaced. (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
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 if (!is_eliminated()) { 215 EmitAssertBoolean(obj, token_pos(), deopt_id(), locs(), compiler);
216 EmitAssertBoolean(obj, token_pos(), deopt_id(), locs(), compiler);
217 }
218 ASSERT(obj == result); 216 ASSERT(obj == result);
219 } 217 }
220 218
221 219
222 LocationSummary* ArgumentDefinitionTestInstr::MakeLocationSummary() const { 220 LocationSummary* ArgumentDefinitionTestInstr::MakeLocationSummary() const {
223 const intptr_t kNumInputs = 1; 221 const intptr_t kNumInputs = 1;
224 const intptr_t kNumTemps = 0; 222 const intptr_t kNumTemps = 0;
225 LocationSummary* locs = 223 LocationSummary* locs =
226 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); 224 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall);
227 locs->set_in(0, Location::RegisterLocation(EAX)); 225 locs->set_in(0, Location::RegisterLocation(EAX));
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 Register result = locs()->out().reg(); 1088 Register result = locs()->out().reg();
1091 __ movl(result, 1089 __ movl(result,
1092 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress()))); 1090 Immediate(reinterpret_cast<uword>(Symbols::PredefinedAddress())));
1093 __ movl(result, Address(result, 1091 __ movl(result, Address(result,
1094 char_code, 1092 char_code,
1095 TIMES_HALF_WORD_SIZE, // Char code is a smi. 1093 TIMES_HALF_WORD_SIZE, // Char code is a smi.
1096 Symbols::kNullCharCodeSymbolOffset * kWordSize)); 1094 Symbols::kNullCharCodeSymbolOffset * kWordSize));
1097 } 1095 }
1098 1096
1099 1097
1100 intptr_t LoadIndexedInstr::ResultCid() const { 1098 CompileType* LoadIndexedInstr::ComputeInitialType() const {
1101 switch (class_id_) { 1099 switch (class_id_) {
1102 case kArrayCid: 1100 case kArrayCid:
1103 case kImmutableArrayCid: 1101 case kImmutableArrayCid:
1104 return kDynamicCid; 1102 return CompileType::Dynamic();
1103
1105 case kFloat32ArrayCid : 1104 case kFloat32ArrayCid :
1106 case kFloat64ArrayCid : 1105 case kFloat64ArrayCid :
1107 return kDoubleCid; 1106 return CompileType::FromCid(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 kSmiCid; 1117 return CompileType::FromCid(kSmiCid);
1118
1118 case kInt32ArrayCid: 1119 case kInt32ArrayCid:
1119 case kUint32ArrayCid: 1120 case kUint32ArrayCid:
1120 // Result can be Smi or Mint when boxed. 1121 // Result can be Smi or Mint when boxed.
1121 // Instruction can deoptimize if we optimistically assumed that the result 1122 // Instruction can deoptimize if we optimistically assumed that the result
1122 // fits into Smi. 1123 // fits into Smi.
1123 return CanDeoptimize() ? kSmiCid : kDynamicCid; 1124 return CanDeoptimize() ? CompileType::FromCid(kSmiCid)
1125 : CompileType::Int();
1126
1124 default: 1127 default:
1125 UNIMPLEMENTED(); 1128 UNIMPLEMENTED();
1126 return kDynamicCid; 1129 return CompileType::Dynamic();
1127 } 1130 }
1128 } 1131 }
1129 1132
1130 1133
1131 Representation LoadIndexedInstr::representation() const { 1134 Representation LoadIndexedInstr::representation() const {
1132 switch (class_id_) { 1135 switch (class_id_) {
1133 case kArrayCid: 1136 case kArrayCid:
1134 case kImmutableArrayCid: 1137 case kImmutableArrayCid:
1135 case kInt8ArrayCid: 1138 case kInt8ArrayCid:
1136 case kUint8ArrayCid: 1139 case kUint8ArrayCid:
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2260 break; 2263 break;
2261 } 2264 }
2262 default: 2265 default:
2263 UNREACHABLE(); 2266 UNREACHABLE();
2264 break; 2267 break;
2265 } 2268 }
2266 } 2269 }
2267 2270
2268 2271
2269 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary() const { 2272 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary() const {
2270 ASSERT((left()->ResultCid() != kDoubleCid) && 2273 ASSERT((left()->Type()->ToCid() != kDoubleCid) &&
2271 (right()->ResultCid() != kDoubleCid)); 2274 (right()->Type()->ToCid() != kDoubleCid));
2272 const intptr_t kNumInputs = 2; 2275 const intptr_t kNumInputs = 2;
2273 const intptr_t kNumTemps = 1; 2276 const intptr_t kNumTemps = 1;
2274 LocationSummary* summary = 2277 LocationSummary* summary =
2275 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2278 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2276 summary->set_in(0, Location::RequiresRegister()); 2279 summary->set_in(0, Location::RequiresRegister());
2277 summary->set_in(1, Location::RequiresRegister()); 2280 summary->set_in(1, Location::RequiresRegister());
2278 summary->set_temp(0, Location::RequiresRegister()); 2281 summary->set_temp(0, Location::RequiresRegister());
2279 return summary; 2282 return summary;
2280 } 2283 }
2281 2284
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2358 LocationSummary* summary = 2361 LocationSummary* summary =
2359 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2362 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2360 summary->set_in(0, Location::RequiresRegister()); 2363 summary->set_in(0, Location::RequiresRegister());
2361 if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister()); 2364 if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister());
2362 summary->set_out(Location::RequiresFpuRegister()); 2365 summary->set_out(Location::RequiresFpuRegister());
2363 return summary; 2366 return summary;
2364 } 2367 }
2365 2368
2366 2369
2367 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2370 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2368 const intptr_t value_cid = value()->ResultCid(); 2371 const intptr_t value_cid = value()->Type()->ToCid();
2369 const Register value = locs()->in(0).reg(); 2372 const Register value = locs()->in(0).reg();
2370 const XmmRegister result = locs()->out().fpu_reg(); 2373 const XmmRegister result = locs()->out().fpu_reg();
2371 2374
2372 if (value_cid == kDoubleCid) { 2375 if (value_cid == kDoubleCid) {
2373 __ movsd(result, FieldAddress(value, Double::value_offset())); 2376 __ movsd(result, FieldAddress(value, Double::value_offset()));
2374 } else if (value_cid == kSmiCid) { 2377 } else if (value_cid == kSmiCid) {
2375 __ SmiUntag(value); // Untag input before conversion. 2378 __ SmiUntag(value); // Untag input before conversion.
2376 __ cvtsi2sd(result, value); 2379 __ cvtsi2sd(result, value);
2377 __ SmiTag(value); // Restore input register. 2380 __ SmiTag(value); // Restore input register.
2378 } else { 2381 } else {
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
2746 const intptr_t kNumInputs = 1; 2749 const intptr_t kNumInputs = 1;
2747 const intptr_t kNumTemps = 0; 2750 const intptr_t kNumTemps = 0;
2748 LocationSummary* summary = 2751 LocationSummary* summary =
2749 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2752 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2750 summary->set_in(0, Location::RequiresRegister()); 2753 summary->set_in(0, Location::RequiresRegister());
2751 return summary; 2754 return summary;
2752 } 2755 }
2753 2756
2754 2757
2755 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2758 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;
2758 Register value = locs()->in(0).reg(); 2759 Register value = locs()->in(0).reg();
2759 Label* deopt = compiler->AddDeoptStub(deopt_id(), 2760 Label* deopt = compiler->AddDeoptStub(deopt_id(),
2760 kDeoptCheckSmi); 2761 kDeoptCheckSmi);
2761 __ testl(value, Immediate(kSmiTagMask)); 2762 __ testl(value, Immediate(kSmiTagMask));
2762 __ j(NOT_ZERO, deopt); 2763 __ j(NOT_ZERO, deopt);
2763 } 2764 }
2764 2765
2765 2766
2766 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary() const { 2767 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary() const {
2767 const intptr_t kNumInputs = 2; 2768 const intptr_t kNumInputs = 2;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2813 LocationSummary* summary = 2814 LocationSummary* summary =
2814 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 2815 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
2815 summary->set_in(0, Location::RequiresRegister()); 2816 summary->set_in(0, Location::RequiresRegister());
2816 if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister()); 2817 if (CanDeoptimize()) summary->set_temp(0, Location::RequiresRegister());
2817 summary->set_out(Location::RequiresFpuRegister()); 2818 summary->set_out(Location::RequiresFpuRegister());
2818 return summary; 2819 return summary;
2819 } 2820 }
2820 2821
2821 2822
2822 void UnboxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2823 void UnboxIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2823 const intptr_t value_cid = value()->ResultCid(); 2824 const intptr_t value_cid = value()->Type()->ToCid();
2824 const Register value = locs()->in(0).reg(); 2825 const Register value = locs()->in(0).reg();
2825 const XmmRegister result = locs()->out().fpu_reg(); 2826 const XmmRegister result = locs()->out().fpu_reg();
2826 2827
2827 if (value_cid == kMintCid) { 2828 if (value_cid == kMintCid) {
2828 __ movsd(result, FieldAddress(value, Mint::value_offset())); 2829 __ movsd(result, FieldAddress(value, Mint::value_offset()));
2829 } else if (value_cid == kSmiCid) { 2830 } else if (value_cid == kSmiCid) {
2830 __ SmiUntag(value); // Untag input before conversion. 2831 __ SmiUntag(value); // Untag input before conversion.
2831 __ movd(result, value); 2832 __ movd(result, value);
2832 __ pmovsxdq(result, result); 2833 __ pmovsxdq(result, result);
2833 __ SmiTag(value); // Restore input register. 2834 __ SmiTag(value); // Restore input register.
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
3417 PcDescriptors::kOther, 3418 PcDescriptors::kOther,
3418 locs()); 3419 locs());
3419 __ Drop(2); // Discard type arguments and receiver. 3420 __ Drop(2); // Discard type arguments and receiver.
3420 } 3421 }
3421 3422
3422 } // namespace dart 3423 } // namespace dart
3423 3424
3424 #undef __ 3425 #undef __
3425 3426
3426 #endif // defined TARGET_ARCH_IA32 3427 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698