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

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

Issue 683433003: Integrate the Irregexp Regular Expression Engine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase 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) 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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 __ SmiTag(result); 1246 __ SmiTag(result);
1247 break; 1247 break;
1248 default: 1248 default:
1249 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); 1249 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
1250 __ lw(result, element_address); 1250 __ lw(result, element_address);
1251 break; 1251 break;
1252 } 1252 }
1253 } 1253 }
1254 1254
1255 1255
1256 Representation LoadCodeUnitsInstr::representation() const {
1257 switch (class_id()) {
1258 case kOneByteStringCid:
1259 case kTwoByteStringCid:
1260 return kTagged;
1261 default:
1262 UNIMPLEMENTED();
1263 return kTagged;
1264 }
1265 }
1266
1267
1268 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate,
1269 bool opt) const {
1270 const intptr_t kNumInputs = 2;
1271 const intptr_t kNumTemps = 0;
1272 LocationSummary* summary = new(isolate) LocationSummary(
1273 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1274 summary->set_in(0, Location::RequiresRegister());
1275 summary->set_in(1, Location::RequiresRegister());
1276
1277 // TODO(jgruber): Handle mints properly once possible.
1278 ASSERT(representation() == kTagged);
1279 summary->set_out(0, Location::RequiresRegister());
1280
1281 return summary;
1282 }
1283
1284
1285 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1286 const Register array = locs()->in(0).reg();
1287 const Location index = locs()->in(1);
1288
1289 Address element_address = __ ElementAddressForRegIndex(
1290 true, IsExternal(), class_id(), index_scale(), array, index.reg());
1291 // Warning: element_address may use register TMP as base.
1292
1293 ASSERT(representation() == kTagged);
1294 Register result = locs()->out(0).reg();
1295 switch (class_id()) {
1296 case kOneByteStringCid:
1297 switch (element_count()) {
1298 case 1: __ lbu(result, element_address); break;
1299 case 2: __ lhu(result, element_address); break;
1300 case 4: // Loading multiple code units is disabled on MIPS.
1301 default: UNREACHABLE();
1302 }
1303 __ SmiTag(result);
1304 break;
1305 case kTwoByteStringCid:
1306 switch (element_count()) {
1307 case 1: __ lhu(result, element_address); break;
1308 case 2: // Loading multiple code units is disabled on MIPS.
1309 default: UNREACHABLE();
1310 }
1311 __ SmiTag(result);
1312 break;
1313 default:
1314 UNREACHABLE();
1315 break;
1316 }
1317 }
1318
1319
1256 Representation StoreIndexedInstr::RequiredInputRepresentation( 1320 Representation StoreIndexedInstr::RequiredInputRepresentation(
1257 intptr_t idx) const { 1321 intptr_t idx) const {
1258 // Array can be a Dart object or a pointer to external data. 1322 // Array can be a Dart object or a pointer to external data.
1259 if (idx == 0) return kNoRepresentation; // Flexible input representation. 1323 if (idx == 0) return kNoRepresentation; // Flexible input representation.
1260 if (idx == 1) return kTagged; // Index is a smi. 1324 if (idx == 1) return kTagged; // Index is a smi.
1261 ASSERT(idx == 2); 1325 ASSERT(idx == 2);
1262 switch (class_id_) { 1326 switch (class_id_) {
1263 case kArrayCid: 1327 case kArrayCid:
1264 case kOneByteStringCid: 1328 case kOneByteStringCid:
1265 case kTypedDataInt8ArrayCid: 1329 case kTypedDataInt8ArrayCid:
(...skipping 2390 matching lines...) Expand 10 before | Expand all | Expand 10 after
3656 } else if (kind() == MathUnaryInstr::kDoubleSquare) { 3720 } else if (kind() == MathUnaryInstr::kDoubleSquare) {
3657 DRegister val = locs()->in(0).fpu_reg(); 3721 DRegister val = locs()->in(0).fpu_reg();
3658 DRegister result = locs()->out(0).fpu_reg(); 3722 DRegister result = locs()->out(0).fpu_reg();
3659 __ muld(result, val, val); 3723 __ muld(result, val, val);
3660 } else { 3724 } else {
3661 __ CallRuntime(TargetFunction(), InputCount()); 3725 __ CallRuntime(TargetFunction(), InputCount());
3662 } 3726 }
3663 } 3727 }
3664 3728
3665 3729
3730 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
3731 Isolate* isolate, bool opt) const {
3732 const intptr_t kNumTemps = 0;
3733 LocationSummary* summary = new(isolate) LocationSummary(
3734 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
3735 summary->set_in(0, Location::RegisterLocation(A0));
3736 summary->set_in(1, Location::RegisterLocation(A1));
3737 summary->set_in(2, Location::RegisterLocation(A2));
3738 summary->set_in(3, Location::RegisterLocation(A3));
3739 summary->set_out(0, Location::RegisterLocation(V0));
3740 return summary;
3741 }
3742
3743
3744 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
3745 FlowGraphCompiler* compiler) {
3746
3747 // Call the function.
3748 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
3749 }
3750
3751
3666 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 3752 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
3667 bool opt) const { 3753 bool opt) const {
3668 if (result_cid() == kDoubleCid) { 3754 if (result_cid() == kDoubleCid) {
3669 const intptr_t kNumInputs = 2; 3755 const intptr_t kNumInputs = 2;
3670 const intptr_t kNumTemps = 1; 3756 const intptr_t kNumTemps = 1;
3671 LocationSummary* summary = new(isolate) LocationSummary( 3757 LocationSummary* summary = new(isolate) LocationSummary(
3672 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3758 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3673 summary->set_in(0, Location::RequiresFpuRegister()); 3759 summary->set_in(0, Location::RequiresFpuRegister());
3674 summary->set_in(1, Location::RequiresFpuRegister()); 3760 summary->set_in(1, Location::RequiresFpuRegister());
3675 // Reuse the left register so that code can be made shorter. 3761 // Reuse the left register so that code can be made shorter.
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
4804 } 4890 }
4805 4891
4806 // We can fall through if the successor is the next block in the list. 4892 // We can fall through if the successor is the next block in the list.
4807 // Otherwise, we need a jump. 4893 // Otherwise, we need a jump.
4808 if (!compiler->CanFallThroughTo(successor())) { 4894 if (!compiler->CanFallThroughTo(successor())) {
4809 __ b(compiler->GetJumpLabel(successor())); 4895 __ b(compiler->GetJumpLabel(successor()));
4810 } 4896 }
4811 } 4897 }
4812 4898
4813 4899
4900 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
4901 bool opt) const {
4902 const intptr_t kNumInputs = 1;
4903 const intptr_t kNumTemps = 1;
4904
4905 LocationSummary* summary = new(isolate) LocationSummary(
4906 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4907
4908 summary->set_in(0, Location::RequiresRegister());
4909 summary->set_temp(0, Location::RequiresRegister());
4910
4911 return summary;
4912 }
4913
4914
4915 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4916 Register target_address_reg = locs()->temp_slot(0)->reg();
4917
4918 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
4919 __ lw(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
4920
4921 // Add the offset.
4922 Register offset_reg = locs()->in(0).reg();
4923 __ SmiUntag(offset_reg);
4924 __ addu(target_address_reg, target_address_reg, offset_reg);
4925
4926 // Jump to the absolute address.
4927 __ jr(target_address_reg);
4928 }
4929
4930
4814 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 4931 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
4815 bool opt) const { 4932 bool opt) const {
4816 const intptr_t kNumInputs = 2; 4933 const intptr_t kNumInputs = 2;
4817 const intptr_t kNumTemps = 0; 4934 const intptr_t kNumTemps = 0;
4818 if (needs_number_check()) { 4935 if (needs_number_check()) {
4819 LocationSummary* locs = new(isolate) LocationSummary( 4936 LocationSummary* locs = new(isolate) LocationSummary(
4820 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 4937 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
4821 locs->set_in(0, Location::RegisterLocation(A0)); 4938 locs->set_in(0, Location::RegisterLocation(A0));
4822 locs->set_in(1, Location::RegisterLocation(A1)); 4939 locs->set_in(1, Location::RegisterLocation(A1));
4823 locs->set_out(0, Location::RegisterLocation(A0)); 4940 locs->set_out(0, Location::RegisterLocation(A0));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4944 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5061 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
4945 #if defined(DEBUG) 5062 #if defined(DEBUG)
4946 __ LoadImmediate(S4, kInvalidObjectPointer); 5063 __ LoadImmediate(S4, kInvalidObjectPointer);
4947 __ LoadImmediate(S5, kInvalidObjectPointer); 5064 __ LoadImmediate(S5, kInvalidObjectPointer);
4948 #endif 5065 #endif
4949 } 5066 }
4950 5067
4951 } // namespace dart 5068 } // namespace dart
4952 5069
4953 #endif // defined TARGET_ARCH_MIPS 5070 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698