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

Side by Side Diff: runtime/vm/intermediate_language_mips.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: Squashed all irregexp CLs, addressed 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
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 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 } 1253 }
1254 break; 1254 break;
1255 default: 1255 default:
1256 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); 1256 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid));
1257 __ lw(result, element_address); 1257 __ lw(result, element_address);
1258 break; 1258 break;
1259 } 1259 }
1260 } 1260 }
1261 1261
1262 1262
1263 Representation LoadCodeUnitsInstr::representation() const {
1264 switch (class_id()) {
1265 case kOneByteStringCid:
1266 case kTwoByteStringCid:
1267 return kTagged;
1268 default:
1269 UNIMPLEMENTED();
1270 return kTagged;
1271 }
1272 }
1273
1274
1275 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate,
1276 bool opt) const {
1277 const intptr_t kNumInputs = 2;
1278 const intptr_t kNumTemps = 0;
1279 LocationSummary* locs = new(isolate) LocationSummary(
1280 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1281 locs->set_in(0, Location::RequiresRegister());
1282 locs->set_in(1, Location::RequiresRegister());
1283
1284 // TODO(jgruber): Handle mints properly once possible.
1285 ASSERT(representation() == kTagged);
1286 locs->set_out(0, Location::RequiresRegister());
1287
1288 return locs;
1289 }
1290
1291
1292 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1293 const Register array = locs()->in(0).reg();
1294 const Location index = locs()->in(1);
1295
1296 Address element_address = __ ElementAddressForRegIndex(
1297 true, IsExternal(), class_id(), index_scale(), array, index.reg());
1298 // Warning: element_address may use register TMP as base.
1299
1300 ASSERT(representation() == kTagged);
1301 Register result = locs()->out(0).reg();
1302 switch (class_id()) {
1303 case kOneByteStringCid:
1304 switch (element_count()) {
1305 case 1: __ lbu(result, element_address); break;
1306 case 2: __ lhu(result, element_address); break;
1307 case 4: // Loading multiple code units is disabled on MIPS.
1308 default: UNREACHABLE();
1309 }
1310 __ SmiTag(result);
1311 break;
1312 case kTwoByteStringCid:
1313 switch (element_count()) {
1314 case 1: __ lhu(result, element_address); break;
1315 case 2: // Loading multiple code units is disabled on MIPS.
1316 default: UNREACHABLE();
1317 }
1318 __ SmiTag(result);
1319 break;
1320 default:
1321 UNREACHABLE();
1322 break;
1323 }
1324 }
1325
1326
1263 Representation StoreIndexedInstr::RequiredInputRepresentation( 1327 Representation StoreIndexedInstr::RequiredInputRepresentation(
1264 intptr_t idx) const { 1328 intptr_t idx) const {
1265 // Array can be a Dart object or a pointer to external data. 1329 // Array can be a Dart object or a pointer to external data.
1266 if (idx == 0) return kNoRepresentation; // Flexible input representation. 1330 if (idx == 0) return kNoRepresentation; // Flexible input representation.
1267 if (idx == 1) return kTagged; // Index is a smi. 1331 if (idx == 1) return kTagged; // Index is a smi.
1268 ASSERT(idx == 2); 1332 ASSERT(idx == 2);
1269 switch (class_id_) { 1333 switch (class_id_) {
1270 case kArrayCid: 1334 case kArrayCid:
1271 case kOneByteStringCid: 1335 case kOneByteStringCid:
1272 case kTypedDataInt8ArrayCid: 1336 case kTypedDataInt8ArrayCid:
(...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after
3654 } else if (kind() == MathUnaryInstr::kDoubleSquare) { 3718 } else if (kind() == MathUnaryInstr::kDoubleSquare) {
3655 DRegister val = locs()->in(0).fpu_reg(); 3719 DRegister val = locs()->in(0).fpu_reg();
3656 DRegister result = locs()->out(0).fpu_reg(); 3720 DRegister result = locs()->out(0).fpu_reg();
3657 __ muld(result, val, val); 3721 __ muld(result, val, val);
3658 } else { 3722 } else {
3659 __ CallRuntime(TargetFunction(), InputCount()); 3723 __ CallRuntime(TargetFunction(), InputCount());
3660 } 3724 }
3661 } 3725 }
3662 3726
3663 3727
3728 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
3729 Isolate* isolate, bool opt) const {
3730 const intptr_t kNumTemps = 0;
3731 LocationSummary* summary = new(isolate) LocationSummary(
3732 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
3733 summary->set_in(0, Location::RegisterLocation(A0));
3734 summary->set_in(1, Location::RegisterLocation(A1));
3735 summary->set_in(2, Location::RegisterLocation(A2));
3736 summary->set_in(3, Location::RegisterLocation(A3));
3737 summary->set_out(0, Location::RegisterLocation(V0));
3738 return summary;
3739 }
3740
3741
3742 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
3743 FlowGraphCompiler* compiler) {
3744
3745 // Call the function.
3746 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
3747 }
3748
3749
3664 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 3750 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
3665 bool opt) const { 3751 bool opt) const {
3666 if (result_cid() == kDoubleCid) { 3752 if (result_cid() == kDoubleCid) {
3667 const intptr_t kNumInputs = 2; 3753 const intptr_t kNumInputs = 2;
3668 const intptr_t kNumTemps = 1; 3754 const intptr_t kNumTemps = 1;
3669 LocationSummary* summary = new(isolate) LocationSummary( 3755 LocationSummary* summary = new(isolate) LocationSummary(
3670 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3756 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3671 summary->set_in(0, Location::RequiresFpuRegister()); 3757 summary->set_in(0, Location::RequiresFpuRegister());
3672 summary->set_in(1, Location::RequiresFpuRegister()); 3758 summary->set_in(1, Location::RequiresFpuRegister());
3673 // Reuse the left register so that code can be made shorter. 3759 // Reuse the left register so that code can be made shorter.
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
4777 } 4863 }
4778 4864
4779 // We can fall through if the successor is the next block in the list. 4865 // We can fall through if the successor is the next block in the list.
4780 // Otherwise, we need a jump. 4866 // Otherwise, we need a jump.
4781 if (!compiler->CanFallThroughTo(successor())) { 4867 if (!compiler->CanFallThroughTo(successor())) {
4782 __ b(compiler->GetJumpLabel(successor())); 4868 __ b(compiler->GetJumpLabel(successor()));
4783 } 4869 }
4784 } 4870 }
4785 4871
4786 4872
4873 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
4874 bool opt) const {
4875 const intptr_t kNumInputs = 1;
4876 const intptr_t kNumTemps = 1;
4877
4878 LocationSummary* locs = new(isolate) LocationSummary(
4879 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4880
4881 locs->set_in(0, Location::RequiresRegister());
4882 locs->set_temp(0, Location::RequiresRegister());
4883
4884 return locs;
4885 }
4886
4887
4888 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4889 Register target_address_reg = locs()->temp_slot(0)->reg();
4890
4891 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
4892 __ lw(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
4893
4894 // Add the offset.
4895 Register offset_reg = locs()->in(0).reg();
4896 __ SmiUntag(offset_reg);
4897 __ addu(target_address_reg, target_address_reg, offset_reg);
4898
4899 // Jump to the absolute address.
4900 __ jr(target_address_reg);
4901 }
4902
4903
4787 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 4904 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
4788 bool opt) const { 4905 bool opt) const {
4789 const intptr_t kNumInputs = 2; 4906 const intptr_t kNumInputs = 2;
4790 const intptr_t kNumTemps = 0; 4907 const intptr_t kNumTemps = 0;
4791 if (needs_number_check()) { 4908 if (needs_number_check()) {
4792 LocationSummary* locs = new(isolate) LocationSummary( 4909 LocationSummary* locs = new(isolate) LocationSummary(
4793 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 4910 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
4794 locs->set_in(0, Location::RegisterLocation(A0)); 4911 locs->set_in(0, Location::RegisterLocation(A0));
4795 locs->set_in(1, Location::RegisterLocation(A1)); 4912 locs->set_in(1, Location::RegisterLocation(A1));
4796 locs->set_out(0, Location::RegisterLocation(A0)); 4913 locs->set_out(0, Location::RegisterLocation(A0));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4917 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5034 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
4918 #if defined(DEBUG) 5035 #if defined(DEBUG)
4919 __ LoadImmediate(S4, kInvalidObjectPointer); 5036 __ LoadImmediate(S4, kInvalidObjectPointer);
4920 __ LoadImmediate(S5, kInvalidObjectPointer); 5037 __ LoadImmediate(S5, kInvalidObjectPointer);
4921 #endif 5038 #endif
4922 } 5039 }
4923 5040
4924 } // namespace dart 5041 } // namespace dart
4925 5042
4926 #endif // defined TARGET_ARCH_MIPS 5043 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698