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

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

Issue 539153002: Port and integrate the irregexp engine from V8 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed Ivan's comments. 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 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 __ SmiTag(result); 1127 __ SmiTag(result);
1128 break; 1128 break;
1129 default: 1129 default:
1130 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); 1130 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
1131 __ ldr(result, element_address); 1131 __ ldr(result, element_address);
1132 break; 1132 break;
1133 } 1133 }
1134 } 1134 }
1135 1135
1136 1136
1137 Representation LoadCodeUnitsInstr::representation() const {
1138 switch (class_id()) {
1139 case kOneByteStringCid:
1140 case kTwoByteStringCid:
1141 case kExternalOneByteStringCid:
1142 case kExternalTwoByteStringCid:
1143 return kTagged;
1144 default:
1145 UNIMPLEMENTED();
1146 return kTagged;
1147 }
1148 }
1149
1150
1151 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate,
1152 bool opt) const {
1153 const intptr_t kNumInputs = 2;
1154 const intptr_t kNumTemps = 0;
1155 LocationSummary* summary = new(isolate) LocationSummary(
1156 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1157 summary->set_in(0, Location::RequiresRegister());
1158 summary->set_in(1, Location::RequiresRegister());
1159 summary->set_out(0, Location::RequiresRegister());
1160 return summary;
1161 }
1162
1163
1164 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1165 const Register array = locs()->in(0).reg();
1166 const Location index = locs()->in(1);
1167
1168 Address element_address = __ ElementAddressForRegIndex(
1169 true, IsExternal(), class_id(), index_scale(), array, index.reg());
1170 // Warning: element_address may use register TMP as base.
1171
1172 Register result = locs()->out(0).reg();
1173 switch (class_id()) {
1174 case kOneByteStringCid:
1175 case kExternalOneByteStringCid:
1176 switch (element_count()) {
1177 case 1: __ ldr(result, element_address, kUnsignedByte); break;
1178 case 2: __ ldr(result, element_address, kUnsignedHalfword); break;
1179 case 4: __ ldr(result, element_address, kUnsignedWord); break;
1180 default: UNREACHABLE();
1181 }
1182 __ SmiTag(result);
1183 break;
1184 case kTwoByteStringCid:
1185 case kExternalTwoByteStringCid:
1186 switch (element_count()) {
1187 case 1: __ ldr(result, element_address, kUnsignedHalfword); break;
1188 case 2: __ ldr(result, element_address, kUnsignedWord); break;
1189 default: UNREACHABLE();
1190 }
1191 __ SmiTag(result);
1192 break;
1193 default:
1194 UNREACHABLE();
1195 break;
1196 }
1197 }
1198
1199
1137 Representation StoreIndexedInstr::RequiredInputRepresentation( 1200 Representation StoreIndexedInstr::RequiredInputRepresentation(
1138 intptr_t idx) const { 1201 intptr_t idx) const {
1139 // Array can be a Dart object or a pointer to external data. 1202 // Array can be a Dart object or a pointer to external data.
1140 if (idx == 0) return kNoRepresentation; // Flexible input representation. 1203 if (idx == 0) return kNoRepresentation; // Flexible input representation.
1141 if (idx == 1) return kTagged; // Index is a smi. 1204 if (idx == 1) return kTagged; // Index is a smi.
1142 ASSERT(idx == 2); 1205 ASSERT(idx == 2);
1143 switch (class_id_) { 1206 switch (class_id_) {
1144 case kArrayCid: 1207 case kArrayCid:
1145 case kOneByteStringCid: 1208 case kOneByteStringCid:
1146 case kTypedDataInt8ArrayCid: 1209 case kTypedDataInt8ArrayCid:
(...skipping 3175 matching lines...) Expand 10 before | Expand all | Expand 10 after
4322 const VRegister result = locs()->out(0).fpu_reg(); 4385 const VRegister result = locs()->out(0).fpu_reg();
4323 __ fmuld(result, val, val); 4386 __ fmuld(result, val, val);
4324 } else { 4387 } else {
4325 ASSERT((kind() == MathUnaryInstr::kSin) || 4388 ASSERT((kind() == MathUnaryInstr::kSin) ||
4326 (kind() == MathUnaryInstr::kCos)); 4389 (kind() == MathUnaryInstr::kCos));
4327 __ CallRuntime(TargetFunction(), InputCount()); 4390 __ CallRuntime(TargetFunction(), InputCount());
4328 } 4391 }
4329 } 4392 }
4330 4393
4331 4394
4395 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
4396 Isolate* isolate, bool opt) const {
4397 const intptr_t kNumTemps = 0;
4398 LocationSummary* summary = new(isolate) LocationSummary(
4399 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
4400 summary->set_in(0, Location::RegisterLocation(R0));
4401 summary->set_in(1, Location::RegisterLocation(R1));
4402 summary->set_in(2, Location::RegisterLocation(R2));
4403 summary->set_in(3, Location::RegisterLocation(R3));
4404 summary->set_out(0, Location::RegisterLocation(R0));
4405 return summary;
4406 }
4407
4408
4409 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
4410 FlowGraphCompiler* compiler) {
4411
4412 // Call the function.
4413 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
4414 }
4415
4416
4332 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 4417 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
4333 bool opt) const { 4418 bool opt) const {
4334 if (result_cid() == kDoubleCid) { 4419 if (result_cid() == kDoubleCid) {
4335 const intptr_t kNumInputs = 2; 4420 const intptr_t kNumInputs = 2;
4336 const intptr_t kNumTemps = 0; 4421 const intptr_t kNumTemps = 0;
4337 LocationSummary* summary = new(isolate) LocationSummary( 4422 LocationSummary* summary = new(isolate) LocationSummary(
4338 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 4423 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4339 summary->set_in(0, Location::RequiresFpuRegister()); 4424 summary->set_in(0, Location::RequiresFpuRegister());
4340 summary->set_in(1, Location::RequiresFpuRegister()); 4425 summary->set_in(1, Location::RequiresFpuRegister());
4341 // Reuse the left register so that code can be made shorter. 4426 // Reuse the left register so that code can be made shorter.
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
5436 } 5521 }
5437 5522
5438 // We can fall through if the successor is the next block in the list. 5523 // We can fall through if the successor is the next block in the list.
5439 // Otherwise, we need a jump. 5524 // Otherwise, we need a jump.
5440 if (!compiler->CanFallThroughTo(successor())) { 5525 if (!compiler->CanFallThroughTo(successor())) {
5441 __ b(compiler->GetJumpLabel(successor())); 5526 __ b(compiler->GetJumpLabel(successor()));
5442 } 5527 }
5443 } 5528 }
5444 5529
5445 5530
5531 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
5532 bool opt) const {
5533 const intptr_t kNumInputs = 1;
5534 const intptr_t kNumTemps = 1;
5535
5536 LocationSummary* summary = new(isolate) LocationSummary(
5537 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
5538
5539 summary->set_in(0, Location::RequiresRegister());
5540 summary->set_temp(0, Location::RequiresRegister());
5541
5542 return summary;
5543 }
5544
5545
5546 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
5547 Register target_address_reg = locs()->temp_slot(0)->reg();
5548
5549 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
5550 __ ldr(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
5551
5552 // Add the offset.
5553 Register offset_reg = locs()->in(0).reg();
5554 __ add(target_address_reg,
5555 target_address_reg,
5556 Operand(offset_reg, ASR, kSmiTagSize));
5557
5558 // Jump to the absolute address.
5559 __ br(target_address_reg);
5560 }
5561
5562
5446 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 5563 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
5447 bool opt) const { 5564 bool opt) const {
5448 const intptr_t kNumInputs = 2; 5565 const intptr_t kNumInputs = 2;
5449 const intptr_t kNumTemps = 0; 5566 const intptr_t kNumTemps = 0;
5450 if (needs_number_check()) { 5567 if (needs_number_check()) {
5451 LocationSummary* locs = new(isolate) LocationSummary( 5568 LocationSummary* locs = new(isolate) LocationSummary(
5452 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 5569 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
5453 locs->set_in(0, Location::RegisterLocation(R0)); 5570 locs->set_in(0, Location::RegisterLocation(R0));
5454 locs->set_in(1, Location::RegisterLocation(R1)); 5571 locs->set_in(1, Location::RegisterLocation(R1));
5455 locs->set_out(0, Location::RegisterLocation(R0)); 5572 locs->set_out(0, Location::RegisterLocation(R0));
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
5572 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5689 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
5573 #if defined(DEBUG) 5690 #if defined(DEBUG)
5574 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); 5691 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP);
5575 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); 5692 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP);
5576 #endif 5693 #endif
5577 } 5694 }
5578 5695
5579 } // namespace dart 5696 } // namespace dart
5580 5697
5581 #endif // defined TARGET_ARCH_ARM64 5698 #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