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

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

Issue 616873003: Use UnboxedInt32 and UnboxedUint32 representation for LoadIndexedInstr (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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_ia32.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 case kImmutableArrayCid: 986 case kImmutableArrayCid:
987 case kTypedDataInt8ArrayCid: 987 case kTypedDataInt8ArrayCid:
988 case kTypedDataUint8ArrayCid: 988 case kTypedDataUint8ArrayCid:
989 case kTypedDataUint8ClampedArrayCid: 989 case kTypedDataUint8ClampedArrayCid:
990 case kExternalTypedDataUint8ArrayCid: 990 case kExternalTypedDataUint8ArrayCid:
991 case kExternalTypedDataUint8ClampedArrayCid: 991 case kExternalTypedDataUint8ClampedArrayCid:
992 case kTypedDataInt16ArrayCid: 992 case kTypedDataInt16ArrayCid:
993 case kTypedDataUint16ArrayCid: 993 case kTypedDataUint16ArrayCid:
994 case kOneByteStringCid: 994 case kOneByteStringCid:
995 case kTwoByteStringCid: 995 case kTwoByteStringCid:
996 return kTagged;
996 case kTypedDataInt32ArrayCid: 997 case kTypedDataInt32ArrayCid:
998 return kUnboxedInt32;
997 case kTypedDataUint32ArrayCid: 999 case kTypedDataUint32ArrayCid:
998 return kTagged; 1000 return kUnboxedUint32;
999 case kTypedDataFloat32ArrayCid: 1001 case kTypedDataFloat32ArrayCid:
1000 case kTypedDataFloat64ArrayCid: 1002 case kTypedDataFloat64ArrayCid:
1001 return kUnboxedDouble; 1003 return kUnboxedDouble;
1002 case kTypedDataInt32x4ArrayCid: 1004 case kTypedDataInt32x4ArrayCid:
1003 return kUnboxedInt32x4; 1005 return kUnboxedInt32x4;
1004 case kTypedDataFloat32x4ArrayCid: 1006 case kTypedDataFloat32x4ArrayCid:
1005 return kUnboxedFloat32x4; 1007 return kUnboxedFloat32x4;
1006 case kTypedDataFloat64x2ArrayCid: 1008 case kTypedDataFloat64x2ArrayCid:
1007 return kUnboxedFloat64x2; 1009 return kUnboxedFloat64x2;
1008 default: 1010 default:
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 case kTypedDataInt32x4ArrayCid: 1088 case kTypedDataInt32x4ArrayCid:
1087 case kTypedDataFloat32x4ArrayCid: 1089 case kTypedDataFloat32x4ArrayCid:
1088 __ fldrq(result, element_address); 1090 __ fldrq(result, element_address);
1089 break; 1091 break;
1090 default: 1092 default:
1091 UNREACHABLE(); 1093 UNREACHABLE();
1092 } 1094 }
1093 return; 1095 return;
1094 } 1096 }
1095 1097
1098 if ((representation() == kUnboxedInt32) ||
1099 (representation() == kUnboxedUint32)) {
1100 const Register result = locs()->out(0).reg();
1101 switch (class_id()) {
1102 case kTypedDataInt32ArrayCid:
1103 ASSERT(representation() == kUnboxedInt32);
1104 __ ldr(result, element_address, kWord);
1105 break;
1106 case kTypedDataUint32ArrayCid:
1107 ASSERT(representation() == kUnboxedUint32);
1108 __ ldr(result, element_address, kUnsignedWord);
1109 break;
1110 default:
1111 UNREACHABLE();
1112 }
1113 return;
1114 }
1115
1116 ASSERT(representation() == kTagged);
1096 const Register result = locs()->out(0).reg(); 1117 const Register result = locs()->out(0).reg();
1097 switch (class_id()) { 1118 switch (class_id()) {
1098 case kTypedDataInt8ArrayCid: 1119 case kTypedDataInt8ArrayCid:
1099 ASSERT(index_scale() == 1); 1120 ASSERT(index_scale() == 1);
1100 __ ldr(result, element_address, kByte); 1121 __ ldr(result, element_address, kByte);
1101 __ SmiTag(result); 1122 __ SmiTag(result);
1102 break; 1123 break;
1103 case kTypedDataUint8ArrayCid: 1124 case kTypedDataUint8ArrayCid:
1104 case kTypedDataUint8ClampedArrayCid: 1125 case kTypedDataUint8ClampedArrayCid:
1105 case kExternalTypedDataUint8ArrayCid: 1126 case kExternalTypedDataUint8ArrayCid:
1106 case kExternalTypedDataUint8ClampedArrayCid: 1127 case kExternalTypedDataUint8ClampedArrayCid:
1107 case kOneByteStringCid: 1128 case kOneByteStringCid:
1108 ASSERT(index_scale() == 1); 1129 ASSERT(index_scale() == 1);
1109 __ ldr(result, element_address, kUnsignedByte); 1130 __ ldr(result, element_address, kUnsignedByte);
1110 __ SmiTag(result); 1131 __ SmiTag(result);
1111 break; 1132 break;
1112 case kTypedDataInt16ArrayCid: 1133 case kTypedDataInt16ArrayCid:
1113 __ ldr(result, element_address, kHalfword); 1134 __ ldr(result, element_address, kHalfword);
1114 __ SmiTag(result); 1135 __ SmiTag(result);
1115 break; 1136 break;
1116 case kTypedDataUint16ArrayCid: 1137 case kTypedDataUint16ArrayCid:
1117 case kTwoByteStringCid: 1138 case kTwoByteStringCid:
1118 __ ldr(result, element_address, kUnsignedHalfword); 1139 __ ldr(result, element_address, kUnsignedHalfword);
1119 __ SmiTag(result); 1140 __ SmiTag(result);
1120 break; 1141 break;
1121 case kTypedDataInt32ArrayCid:
1122 __ ldr(result, element_address, kWord);
1123 __ SmiTag(result);
1124 break;
1125 case kTypedDataUint32ArrayCid:
1126 __ ldr(result, element_address, kUnsignedWord);
1127 __ SmiTag(result);
1128 break;
1129 default: 1142 default:
1130 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); 1143 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
1131 __ ldr(result, element_address); 1144 __ ldr(result, element_address);
1132 break; 1145 break;
1133 } 1146 }
1134 } 1147 }
1135 1148
1136 1149
1137 Representation StoreIndexedInstr::RequiredInputRepresentation( 1150 Representation StoreIndexedInstr::RequiredInputRepresentation(
1138 intptr_t idx) const { 1151 intptr_t idx) const {
(...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after
3083 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3096 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3084 CompileType* value_type = value()->Type(); 3097 CompileType* value_type = value()->Type();
3085 const intptr_t value_cid = value_type->ToCid(); 3098 const intptr_t value_cid = value_type->ToCid();
3086 const Register value = locs()->in(0).reg(); 3099 const Register value = locs()->in(0).reg();
3087 const VRegister result = locs()->out(0).fpu_reg(); 3100 const VRegister result = locs()->out(0).fpu_reg();
3088 3101
3089 if (value_cid == kDoubleCid) { 3102 if (value_cid == kDoubleCid) {
3090 __ LoadDFieldFromOffset(result, value, Double::value_offset(), PP); 3103 __ LoadDFieldFromOffset(result, value, Double::value_offset(), PP);
3091 } else if (value_cid == kSmiCid) { 3104 } else if (value_cid == kSmiCid) {
3092 __ SmiUntag(TMP, value); // Untag input before conversion. 3105 __ SmiUntag(TMP, value); // Untag input before conversion.
3093 __ scvtfd(result, TMP); 3106 __ scvtfdx(result, TMP);
3094 } else { 3107 } else {
3095 Label* deopt = compiler->AddDeoptStub(deopt_id_, 3108 Label* deopt = compiler->AddDeoptStub(deopt_id_,
3096 ICData::kDeoptBinaryDoubleOp); 3109 ICData::kDeoptBinaryDoubleOp);
3097 if (value_type->is_nullable() && 3110 if (value_type->is_nullable() &&
3098 (value_type->ToNullableCid() == kDoubleCid)) { 3111 (value_type->ToNullableCid() == kDoubleCid)) {
3099 __ CompareObject(value, Object::null_object(), PP); 3112 __ CompareObject(value, Object::null_object(), PP);
3100 __ b(deopt, EQ); 3113 __ b(deopt, EQ);
3101 // It must be double now. 3114 // It must be double now.
3102 __ LoadDFieldFromOffset(result, value, Double::value_offset(), PP); 3115 __ LoadDFieldFromOffset(result, value, Double::value_offset(), PP);
3103 } else { 3116 } else {
3104 Label is_smi, done; 3117 Label is_smi, done;
3105 __ tsti(value, Immediate(kSmiTagMask)); 3118 __ tsti(value, Immediate(kSmiTagMask));
3106 __ b(&is_smi, EQ); 3119 __ b(&is_smi, EQ);
3107 __ CompareClassId(value, kDoubleCid, PP); 3120 __ CompareClassId(value, kDoubleCid, PP);
3108 __ b(deopt, NE); 3121 __ b(deopt, NE);
3109 __ LoadDFieldFromOffset(result, value, Double::value_offset(), PP); 3122 __ LoadDFieldFromOffset(result, value, Double::value_offset(), PP);
3110 __ b(&done); 3123 __ b(&done);
3111 __ Bind(&is_smi); 3124 __ Bind(&is_smi);
3112 __ SmiUntag(TMP, value); // Copy and untag. 3125 __ SmiUntag(TMP, value); // Copy and untag.
3113 __ scvtfd(result, TMP); 3126 __ scvtfdx(result, TMP);
3114 __ Bind(&done); 3127 __ Bind(&done);
3115 } 3128 }
3116 } 3129 }
3117 } 3130 }
3118 3131
3119 3132
3120 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(Isolate* isolate, 3133 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(Isolate* isolate,
3121 bool opt) const { 3134 bool opt) const {
3122 const intptr_t kNumInputs = 1; 3135 const intptr_t kNumInputs = 1;
3123 const intptr_t kNumTemps = 1; 3136 const intptr_t kNumTemps = 1;
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
4465 } 4478 }
4466 4479
4467 4480
4468 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4481 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4469 const VRegister result = locs()->out(0).fpu_reg(); 4482 const VRegister result = locs()->out(0).fpu_reg();
4470 const VRegister value = locs()->in(0).fpu_reg(); 4483 const VRegister value = locs()->in(0).fpu_reg();
4471 __ fnegd(result, value); 4484 __ fnegd(result, value);
4472 } 4485 }
4473 4486
4474 4487
4475 DEFINE_UNIMPLEMENTED_INSTRUCTION(Int32ToDoubleInstr) 4488 LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Isolate* isolate,
4489 bool opt) const {
4490 const intptr_t kNumInputs = 1;
4491 const intptr_t kNumTemps = 0;
4492 LocationSummary* result = new(isolate) LocationSummary(
4493 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4494 result->set_in(0, Location::RequiresRegister());
4495 result->set_out(0, Location::RequiresFpuRegister());
4496 return result;
4497 }
4498
4499
4500 void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4501 const Register value = locs()->in(0).reg();
4502 const VRegister result = locs()->out(0).fpu_reg();
4503 __ scvtfdw(result, value);
4504 }
4476 4505
4477 4506
4478 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Isolate* isolate, 4507 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Isolate* isolate,
4479 bool opt) const { 4508 bool opt) const {
4480 const intptr_t kNumInputs = 1; 4509 const intptr_t kNumInputs = 1;
4481 const intptr_t kNumTemps = 0; 4510 const intptr_t kNumTemps = 0;
4482 LocationSummary* result = new(isolate) LocationSummary( 4511 LocationSummary* result = new(isolate) LocationSummary(
4483 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4512 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4484 result->set_in(0, Location::RequiresRegister()); 4513 result->set_in(0, Location::RequiresRegister());
4485 result->set_out(0, Location::RequiresFpuRegister()); 4514 result->set_out(0, Location::RequiresFpuRegister());
4486 return result; 4515 return result;
4487 } 4516 }
4488 4517
4489 4518
4490 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4519 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4491 const Register value = locs()->in(0).reg(); 4520 const Register value = locs()->in(0).reg();
4492 const VRegister result = locs()->out(0).fpu_reg(); 4521 const VRegister result = locs()->out(0).fpu_reg();
4493 __ SmiUntag(TMP, value); 4522 __ SmiUntag(TMP, value);
4494 __ scvtfd(result, TMP); 4523 __ scvtfdx(result, TMP);
4495 } 4524 }
4496 4525
4497 4526
4498 LocationSummary* MintToDoubleInstr::MakeLocationSummary(Isolate* isolate, 4527 LocationSummary* MintToDoubleInstr::MakeLocationSummary(Isolate* isolate,
4499 bool opt) const { 4528 bool opt) const {
4500 UNIMPLEMENTED(); 4529 UNIMPLEMENTED();
4501 return NULL; 4530 return NULL;
4502 } 4531 }
4503 4532
4504 4533
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
5572 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5601 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
5573 #if defined(DEBUG) 5602 #if defined(DEBUG)
5574 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); 5603 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP);
5575 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); 5604 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP);
5576 #endif 5605 #endif
5577 } 5606 }
5578 5607
5579 } // namespace dart 5608 } // namespace dart
5580 5609
5581 #endif // defined TARGET_ARCH_ARM64 5610 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698