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

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, 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) 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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 __ SmiTag(result); 1234 __ SmiTag(result);
1235 break; 1235 break;
1236 default: 1236 default:
1237 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); 1237 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
1238 __ lw(result, element_address); 1238 __ lw(result, element_address);
1239 break; 1239 break;
1240 } 1240 }
1241 } 1241 }
1242 1242
1243 1243
1244 Representation LoadCodeUnitsInstr::representation() const {
1245 switch (class_id()) {
1246 case kOneByteStringCid:
1247 case kTwoByteStringCid:
1248 return kTagged;
1249 default:
1250 UNIMPLEMENTED();
1251 return kTagged;
1252 }
1253 }
1254
1255
1256 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate,
1257 bool opt) const {
1258 const intptr_t kNumInputs = 2;
1259 const intptr_t kNumTemps = 0;
1260 LocationSummary* summary = new(isolate) LocationSummary(
1261 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1262 summary->set_in(0, Location::RequiresRegister());
1263 summary->set_in(1, Location::RequiresRegister());
1264
1265 // TODO(zerny): Handle mints properly once possible.
1266 ASSERT(representation() == kTagged);
1267 summary->set_out(0, Location::RequiresRegister());
1268
1269 return summary;
1270 }
1271
1272
1273 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1274 const Register array = locs()->in(0).reg();
1275 const Location index = locs()->in(1);
1276
1277 Address element_address = __ ElementAddressForRegIndex(
1278 true, IsExternal(), class_id(), index_scale(), array, index.reg());
1279 // Warning: element_address may use register TMP as base.
1280
1281 ASSERT(representation() == kTagged);
1282 Register result = locs()->out(0).reg();
1283 switch (class_id()) {
1284 case kOneByteStringCid:
1285 switch (element_count()) {
1286 case 1: __ lbu(result, element_address); break;
1287 case 2: __ lhu(result, element_address); break;
1288 case 4: // Loading multiple code units is disabled on MIPS.
1289 default: UNREACHABLE();
1290 }
1291 __ SmiTag(result);
1292 break;
1293 case kTwoByteStringCid:
1294 switch (element_count()) {
1295 case 1: __ lhu(result, element_address); break;
1296 case 2: // Loading multiple code units is disabled on MIPS.
1297 default: UNREACHABLE();
1298 }
1299 __ SmiTag(result);
1300 break;
1301 default:
1302 UNREACHABLE();
1303 break;
1304 }
1305 }
1306
1307
1244 Representation StoreIndexedInstr::RequiredInputRepresentation( 1308 Representation StoreIndexedInstr::RequiredInputRepresentation(
1245 intptr_t idx) const { 1309 intptr_t idx) const {
1246 // Array can be a Dart object or a pointer to external data. 1310 // Array can be a Dart object or a pointer to external data.
1247 if (idx == 0) return kNoRepresentation; // Flexible input representation. 1311 if (idx == 0) return kNoRepresentation; // Flexible input representation.
1248 if (idx == 1) return kTagged; // Index is a smi. 1312 if (idx == 1) return kTagged; // Index is a smi.
1249 ASSERT(idx == 2); 1313 ASSERT(idx == 2);
1250 switch (class_id_) { 1314 switch (class_id_) {
1251 case kArrayCid: 1315 case kArrayCid:
1252 case kOneByteStringCid: 1316 case kOneByteStringCid:
1253 case kTypedDataInt8ArrayCid: 1317 case kTypedDataInt8ArrayCid:
(...skipping 2390 matching lines...) Expand 10 before | Expand all | Expand 10 after
3644 } else if (kind() == MathUnaryInstr::kDoubleSquare) { 3708 } else if (kind() == MathUnaryInstr::kDoubleSquare) {
3645 DRegister val = locs()->in(0).fpu_reg(); 3709 DRegister val = locs()->in(0).fpu_reg();
3646 DRegister result = locs()->out(0).fpu_reg(); 3710 DRegister result = locs()->out(0).fpu_reg();
3647 __ muld(result, val, val); 3711 __ muld(result, val, val);
3648 } else { 3712 } else {
3649 __ CallRuntime(TargetFunction(), InputCount()); 3713 __ CallRuntime(TargetFunction(), InputCount());
3650 } 3714 }
3651 } 3715 }
3652 3716
3653 3717
3718 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
3719 Isolate* isolate, bool opt) const {
3720 const intptr_t kNumTemps = 0;
3721 LocationSummary* summary = new(isolate) LocationSummary(
3722 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
3723 summary->set_in(0, Location::RegisterLocation(A0));
3724 summary->set_in(1, Location::RegisterLocation(A1));
3725 summary->set_in(2, Location::RegisterLocation(A2));
3726 summary->set_in(3, Location::RegisterLocation(A3));
3727 summary->set_out(0, Location::RegisterLocation(V0));
3728 return summary;
3729 }
3730
3731
3732 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
3733 FlowGraphCompiler* compiler) {
3734
3735 // Call the function.
3736 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
3737 }
3738
3739
3654 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 3740 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
3655 bool opt) const { 3741 bool opt) const {
3656 if (result_cid() == kDoubleCid) { 3742 if (result_cid() == kDoubleCid) {
3657 const intptr_t kNumInputs = 2; 3743 const intptr_t kNumInputs = 2;
3658 const intptr_t kNumTemps = 1; 3744 const intptr_t kNumTemps = 1;
3659 LocationSummary* summary = new(isolate) LocationSummary( 3745 LocationSummary* summary = new(isolate) LocationSummary(
3660 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3746 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3661 summary->set_in(0, Location::RequiresFpuRegister()); 3747 summary->set_in(0, Location::RequiresFpuRegister());
3662 summary->set_in(1, Location::RequiresFpuRegister()); 3748 summary->set_in(1, Location::RequiresFpuRegister());
3663 // Reuse the left register so that code can be made shorter. 3749 // Reuse the left register so that code can be made shorter.
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
4792 } 4878 }
4793 4879
4794 // We can fall through if the successor is the next block in the list. 4880 // We can fall through if the successor is the next block in the list.
4795 // Otherwise, we need a jump. 4881 // Otherwise, we need a jump.
4796 if (!compiler->CanFallThroughTo(successor())) { 4882 if (!compiler->CanFallThroughTo(successor())) {
4797 __ b(compiler->GetJumpLabel(successor())); 4883 __ b(compiler->GetJumpLabel(successor()));
4798 } 4884 }
4799 } 4885 }
4800 4886
4801 4887
4888 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
4889 bool opt) const {
4890 const intptr_t kNumInputs = 1;
4891 const intptr_t kNumTemps = 1;
4892
4893 LocationSummary* summary = new(isolate) LocationSummary(
4894 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4895
4896 summary->set_in(0, Location::RequiresRegister());
4897 summary->set_temp(0, Location::RequiresRegister());
4898
4899 return summary;
4900 }
4901
4902
4903 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4904 Register target_address_reg = locs()->temp_slot(0)->reg();
4905
4906 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
4907 __ lw(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
4908
4909 // Add the offset.
4910 Register offset_reg = locs()->in(0).reg();
4911 __ SmiUntag(offset_reg);
4912 __ addu(target_address_reg, target_address_reg, offset_reg);
4913
4914 // Jump to the absolute address.
4915 __ jr(target_address_reg);
4916 }
4917
4918
4802 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 4919 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
4803 bool opt) const { 4920 bool opt) const {
4804 const intptr_t kNumInputs = 2; 4921 const intptr_t kNumInputs = 2;
4805 const intptr_t kNumTemps = 0; 4922 const intptr_t kNumTemps = 0;
4806 if (needs_number_check()) { 4923 if (needs_number_check()) {
4807 LocationSummary* locs = new(isolate) LocationSummary( 4924 LocationSummary* locs = new(isolate) LocationSummary(
4808 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 4925 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
4809 locs->set_in(0, Location::RegisterLocation(A0)); 4926 locs->set_in(0, Location::RegisterLocation(A0));
4810 locs->set_in(1, Location::RegisterLocation(A1)); 4927 locs->set_in(1, Location::RegisterLocation(A1));
4811 locs->set_out(0, Location::RegisterLocation(A0)); 4928 locs->set_out(0, Location::RegisterLocation(A0));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4932 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5049 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
4933 #if defined(DEBUG) 5050 #if defined(DEBUG)
4934 __ LoadImmediate(S4, kInvalidObjectPointer); 5051 __ LoadImmediate(S4, kInvalidObjectPointer);
4935 __ LoadImmediate(S5, kInvalidObjectPointer); 5052 __ LoadImmediate(S5, kInvalidObjectPointer);
4936 #endif 5053 #endif
4937 } 5054 }
4938 5055
4939 } // namespace dart 5056 } // namespace dart
4940 5057
4941 #endif // defined TARGET_ARCH_MIPS 5058 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698