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

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

Issue 683433003: Integrate the Irregexp Regular Expression Engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase, enable tests, remove *CodeUnitsAt Created 6 years, 1 month 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) 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 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 __ SmiTag(result); 1128 __ SmiTag(result);
1129 break; 1129 break;
1130 default: 1130 default:
1131 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); 1131 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
1132 __ ldr(result, element_address); 1132 __ ldr(result, element_address);
1133 break; 1133 break;
1134 } 1134 }
1135 } 1135 }
1136 1136
1137 1137
1138 Representation LoadCodeUnitsInstr::representation() const {
1139 switch (class_id()) {
1140 case kOneByteStringCid:
1141 case kTwoByteStringCid:
1142 case kExternalOneByteStringCid:
1143 case kExternalTwoByteStringCid:
1144 return kTagged;
1145 default:
1146 UNIMPLEMENTED();
1147 return kTagged;
1148 }
1149 }
1150
1151
1152 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate,
1153 bool opt) const {
1154 const intptr_t kNumInputs = 2;
1155 const intptr_t kNumTemps = 0;
1156 LocationSummary* summary = new(isolate) LocationSummary(
1157 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1158 summary->set_in(0, Location::RequiresRegister());
1159 summary->set_in(1, Location::RequiresRegister());
1160 summary->set_out(0, Location::RequiresRegister());
1161 return summary;
1162 }
1163
1164
1165 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1166 const Register array = locs()->in(0).reg();
1167 const Location index = locs()->in(1);
1168
1169 Address element_address = __ ElementAddressForRegIndex(
1170 true, IsExternal(), class_id(), index_scale(), array, index.reg());
1171 // Warning: element_address may use register TMP as base.
1172
1173 Register result = locs()->out(0).reg();
1174 switch (class_id()) {
1175 case kOneByteStringCid:
1176 case kExternalOneByteStringCid:
1177 switch (element_count()) {
1178 case 1: __ ldr(result, element_address, kUnsignedByte); break;
1179 case 2: __ ldr(result, element_address, kUnsignedHalfword); break;
1180 case 4: __ ldr(result, element_address, kUnsignedWord); break;
1181 default: UNREACHABLE();
1182 }
1183 __ SmiTag(result);
1184 break;
1185 case kTwoByteStringCid:
1186 case kExternalTwoByteStringCid:
1187 switch (element_count()) {
1188 case 1: __ ldr(result, element_address, kUnsignedHalfword); break;
1189 case 2: __ ldr(result, element_address, kUnsignedWord); break;
1190 default: UNREACHABLE();
1191 }
1192 __ SmiTag(result);
1193 break;
1194 default:
1195 UNREACHABLE();
1196 break;
1197 }
1198 }
1199
1200
1138 Representation StoreIndexedInstr::RequiredInputRepresentation( 1201 Representation StoreIndexedInstr::RequiredInputRepresentation(
1139 intptr_t idx) const { 1202 intptr_t idx) const {
1140 // Array can be a Dart object or a pointer to external data. 1203 // Array can be a Dart object or a pointer to external data.
1141 if (idx == 0) return kNoRepresentation; // Flexible input representation. 1204 if (idx == 0) return kNoRepresentation; // Flexible input representation.
1142 if (idx == 1) return kTagged; // Index is a smi. 1205 if (idx == 1) return kTagged; // Index is a smi.
1143 ASSERT(idx == 2); 1206 ASSERT(idx == 2);
1144 switch (class_id_) { 1207 switch (class_id_) {
1145 case kArrayCid: 1208 case kArrayCid:
1146 case kOneByteStringCid: 1209 case kOneByteStringCid:
1147 case kTypedDataInt8ArrayCid: 1210 case kTypedDataInt8ArrayCid:
(...skipping 3175 matching lines...) Expand 10 before | Expand all | Expand 10 after
4323 const VRegister result = locs()->out(0).fpu_reg(); 4386 const VRegister result = locs()->out(0).fpu_reg();
4324 __ fmuld(result, val, val); 4387 __ fmuld(result, val, val);
4325 } else { 4388 } else {
4326 ASSERT((kind() == MathUnaryInstr::kSin) || 4389 ASSERT((kind() == MathUnaryInstr::kSin) ||
4327 (kind() == MathUnaryInstr::kCos)); 4390 (kind() == MathUnaryInstr::kCos));
4328 __ CallRuntime(TargetFunction(), InputCount()); 4391 __ CallRuntime(TargetFunction(), InputCount());
4329 } 4392 }
4330 } 4393 }
4331 4394
4332 4395
4396 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
4397 Isolate* isolate, bool opt) const {
4398 const intptr_t kNumTemps = 0;
4399 LocationSummary* summary = new(isolate) LocationSummary(
4400 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
4401 summary->set_in(0, Location::RegisterLocation(R0));
4402 summary->set_in(1, Location::RegisterLocation(R1));
4403 summary->set_in(2, Location::RegisterLocation(R2));
4404 summary->set_in(3, Location::RegisterLocation(R3));
4405 summary->set_out(0, Location::RegisterLocation(R0));
4406 return summary;
4407 }
4408
4409
4410 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
4411 FlowGraphCompiler* compiler) {
4412
4413 // Call the function.
4414 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
4415 }
4416
4417
4333 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 4418 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
4334 bool opt) const { 4419 bool opt) const {
4335 if (result_cid() == kDoubleCid) { 4420 if (result_cid() == kDoubleCid) {
4336 const intptr_t kNumInputs = 2; 4421 const intptr_t kNumInputs = 2;
4337 const intptr_t kNumTemps = 0; 4422 const intptr_t kNumTemps = 0;
4338 LocationSummary* summary = new(isolate) LocationSummary( 4423 LocationSummary* summary = new(isolate) LocationSummary(
4339 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4424 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4340 summary->set_in(0, Location::RequiresFpuRegister()); 4425 summary->set_in(0, Location::RequiresFpuRegister());
4341 summary->set_in(1, Location::RequiresFpuRegister()); 4426 summary->set_in(1, Location::RequiresFpuRegister());
4342 // Reuse the left register so that code can be made shorter. 4427 // Reuse the left register so that code can be made shorter.
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
5457 } 5542 }
5458 5543
5459 // We can fall through if the successor is the next block in the list. 5544 // We can fall through if the successor is the next block in the list.
5460 // Otherwise, we need a jump. 5545 // Otherwise, we need a jump.
5461 if (!compiler->CanFallThroughTo(successor())) { 5546 if (!compiler->CanFallThroughTo(successor())) {
5462 __ b(compiler->GetJumpLabel(successor())); 5547 __ b(compiler->GetJumpLabel(successor()));
5463 } 5548 }
5464 } 5549 }
5465 5550
5466 5551
5552 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
5553 bool opt) const {
5554 const intptr_t kNumInputs = 1;
5555 const intptr_t kNumTemps = 1;
5556
5557 LocationSummary* summary = new(isolate) LocationSummary(
5558 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5559
5560 summary->set_in(0, Location::RequiresRegister());
5561 summary->set_temp(0, Location::RequiresRegister());
5562
5563 return summary;
5564 }
5565
5566
5567 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5568 Register target_address_reg = locs()->temp_slot(0)->reg();
5569
5570 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
5571 __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
5572
5573 // Add the offset.
5574 Register offset_reg = locs()->in(0).reg();
5575 __ add(target_address_reg,
5576 target_address_reg,
5577 Operand(offset_reg, ASR, kSmiTagSize));
5578
5579 // Jump to the absolute address.
5580 __ br(target_address_reg);
5581 }
5582
5583
5467 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 5584 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
5468 bool opt) const { 5585 bool opt) const {
5469 const intptr_t kNumInputs = 2; 5586 const intptr_t kNumInputs = 2;
5470 const intptr_t kNumTemps = 0; 5587 const intptr_t kNumTemps = 0;
5471 if (needs_number_check()) { 5588 if (needs_number_check()) {
5472 LocationSummary* locs = new(isolate) LocationSummary( 5589 LocationSummary* locs = new(isolate) LocationSummary(
5473 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 5590 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
5474 locs->set_in(0, Location::RegisterLocation(R0)); 5591 locs->set_in(0, Location::RegisterLocation(R0));
5475 locs->set_in(1, Location::RegisterLocation(R1)); 5592 locs->set_in(1, Location::RegisterLocation(R1));
5476 locs->set_out(0, Location::RegisterLocation(R0)); 5593 locs->set_out(0, Location::RegisterLocation(R0));
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
5593 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5710 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
5594 #if defined(DEBUG) 5711 #if defined(DEBUG)
5595 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); 5712 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP);
5596 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); 5713 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP);
5597 #endif 5714 #endif
5598 } 5715 }
5599 5716
5600 } // namespace dart 5717 } // namespace dart
5601 5718
5602 #endif // defined TARGET_ARCH_ARM64 5719 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698