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

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: Explicitly null IC-Data, whitespace fixes in tests. 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 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after
3657 } else if (kind() == MathUnaryInstr::kDoubleSquare) { 3721 } else if (kind() == MathUnaryInstr::kDoubleSquare) {
3658 DRegister val = locs()->in(0).fpu_reg(); 3722 DRegister val = locs()->in(0).fpu_reg();
3659 DRegister result = locs()->out(0).fpu_reg(); 3723 DRegister result = locs()->out(0).fpu_reg();
3660 __ muld(result, val, val); 3724 __ muld(result, val, val);
3661 } else { 3725 } else {
3662 __ CallRuntime(TargetFunction(), InputCount()); 3726 __ CallRuntime(TargetFunction(), InputCount());
3663 } 3727 }
3664 } 3728 }
3665 3729
3666 3730
3731 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
3732 Isolate* isolate, bool opt) const {
3733 const intptr_t kNumTemps = 0;
3734 LocationSummary* summary = new(isolate) LocationSummary(
3735 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
3736 summary->set_in(0, Location::RegisterLocation(A0));
3737 summary->set_in(1, Location::RegisterLocation(A1));
3738 summary->set_in(2, Location::RegisterLocation(A2));
3739 summary->set_in(3, Location::RegisterLocation(A3));
3740 summary->set_out(0, Location::RegisterLocation(V0));
3741 return summary;
3742 }
3743
3744
3745 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
3746 FlowGraphCompiler* compiler) {
3747
3748 // Call the function.
3749 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
3750 }
3751
3752
3667 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 3753 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
3668 bool opt) const { 3754 bool opt) const {
3669 if (result_cid() == kDoubleCid) { 3755 if (result_cid() == kDoubleCid) {
3670 const intptr_t kNumInputs = 2; 3756 const intptr_t kNumInputs = 2;
3671 const intptr_t kNumTemps = 1; 3757 const intptr_t kNumTemps = 1;
3672 LocationSummary* summary = new(isolate) LocationSummary( 3758 LocationSummary* summary = new(isolate) LocationSummary(
3673 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3759 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3674 summary->set_in(0, Location::RequiresFpuRegister()); 3760 summary->set_in(0, Location::RequiresFpuRegister());
3675 summary->set_in(1, Location::RequiresFpuRegister()); 3761 summary->set_in(1, Location::RequiresFpuRegister());
3676 // Reuse the left register so that code can be made shorter. 3762 // Reuse the left register so that code can be made shorter.
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
4779 } 4865 }
4780 4866
4781 // We can fall through if the successor is the next block in the list. 4867 // We can fall through if the successor is the next block in the list.
4782 // Otherwise, we need a jump. 4868 // Otherwise, we need a jump.
4783 if (!compiler->CanFallThroughTo(successor())) { 4869 if (!compiler->CanFallThroughTo(successor())) {
4784 __ b(compiler->GetJumpLabel(successor())); 4870 __ b(compiler->GetJumpLabel(successor()));
4785 } 4871 }
4786 } 4872 }
4787 4873
4788 4874
4875 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
4876 bool opt) const {
4877 const intptr_t kNumInputs = 1;
4878 const intptr_t kNumTemps = 1;
4879
4880 LocationSummary* locs = new(isolate) LocationSummary(
4881 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4882
4883 locs->set_in(0, Location::RequiresRegister());
4884 locs->set_temp(0, Location::RequiresRegister());
4885
4886 return locs;
4887 }
4888
4889
4890 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4891 Register target_address_reg = locs()->temp_slot(0)->reg();
4892
4893 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
4894 __ lw(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
4895
4896 // Add the offset.
4897 Register offset_reg = locs()->in(0).reg();
4898 __ SmiUntag(offset_reg);
4899 __ addu(target_address_reg, target_address_reg, offset_reg);
4900
4901 // Jump to the absolute address.
4902 __ jr(target_address_reg);
4903 }
4904
4905
4789 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 4906 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
4790 bool opt) const { 4907 bool opt) const {
4791 const intptr_t kNumInputs = 2; 4908 const intptr_t kNumInputs = 2;
4792 const intptr_t kNumTemps = 0; 4909 const intptr_t kNumTemps = 0;
4793 if (needs_number_check()) { 4910 if (needs_number_check()) {
4794 LocationSummary* locs = new(isolate) LocationSummary( 4911 LocationSummary* locs = new(isolate) LocationSummary(
4795 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 4912 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
4796 locs->set_in(0, Location::RegisterLocation(A0)); 4913 locs->set_in(0, Location::RegisterLocation(A0));
4797 locs->set_in(1, Location::RegisterLocation(A1)); 4914 locs->set_in(1, Location::RegisterLocation(A1));
4798 locs->set_out(0, Location::RegisterLocation(A0)); 4915 locs->set_out(0, Location::RegisterLocation(A0));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4919 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5036 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
4920 #if defined(DEBUG) 5037 #if defined(DEBUG)
4921 __ LoadImmediate(S4, kInvalidObjectPointer); 5038 __ LoadImmediate(S4, kInvalidObjectPointer);
4922 __ LoadImmediate(S5, kInvalidObjectPointer); 5039 __ LoadImmediate(S5, kInvalidObjectPointer);
4923 #endif 5040 #endif
4924 } 5041 }
4925 5042
4926 } // namespace dart 5043 } // namespace dart
4927 5044
4928 #endif // defined TARGET_ARCH_MIPS 5045 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698