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

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: more comments Created 6 years 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_ia32.cc ('k') | runtime/vm/intermediate_language_x64.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) 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 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after
3737 } else if (kind() == MathUnaryInstr::kDoubleSquare) { 3801 } else if (kind() == MathUnaryInstr::kDoubleSquare) {
3738 DRegister val = locs()->in(0).fpu_reg(); 3802 DRegister val = locs()->in(0).fpu_reg();
3739 DRegister result = locs()->out(0).fpu_reg(); 3803 DRegister result = locs()->out(0).fpu_reg();
3740 __ muld(result, val, val); 3804 __ muld(result, val, val);
3741 } else { 3805 } else {
3742 __ CallRuntime(TargetFunction(), InputCount()); 3806 __ CallRuntime(TargetFunction(), InputCount());
3743 } 3807 }
3744 } 3808 }
3745 3809
3746 3810
3811 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
3812 Isolate* isolate, bool opt) const {
3813 const intptr_t kNumTemps = 0;
3814 LocationSummary* summary = new(isolate) LocationSummary(
3815 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
3816 summary->set_in(0, Location::RegisterLocation(A0));
3817 summary->set_in(1, Location::RegisterLocation(A1));
3818 summary->set_in(2, Location::RegisterLocation(A2));
3819 summary->set_in(3, Location::RegisterLocation(A3));
3820 summary->set_out(0, Location::RegisterLocation(V0));
3821 return summary;
3822 }
3823
3824
3825 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
3826 FlowGraphCompiler* compiler) {
3827
3828 // Call the function.
3829 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
3830 }
3831
3832
3747 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 3833 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
3748 bool opt) const { 3834 bool opt) const {
3749 if (result_cid() == kDoubleCid) { 3835 if (result_cid() == kDoubleCid) {
3750 const intptr_t kNumInputs = 2; 3836 const intptr_t kNumInputs = 2;
3751 const intptr_t kNumTemps = 1; 3837 const intptr_t kNumTemps = 1;
3752 LocationSummary* summary = new(isolate) LocationSummary( 3838 LocationSummary* summary = new(isolate) LocationSummary(
3753 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3839 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3754 summary->set_in(0, Location::RequiresFpuRegister()); 3840 summary->set_in(0, Location::RequiresFpuRegister());
3755 summary->set_in(1, Location::RequiresFpuRegister()); 3841 summary->set_in(1, Location::RequiresFpuRegister());
3756 // Reuse the left register so that code can be made shorter. 3842 // Reuse the left register so that code can be made shorter.
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
4714 } 4800 }
4715 4801
4716 // We can fall through if the successor is the next block in the list. 4802 // We can fall through if the successor is the next block in the list.
4717 // Otherwise, we need a jump. 4803 // Otherwise, we need a jump.
4718 if (!compiler->CanFallThroughTo(successor())) { 4804 if (!compiler->CanFallThroughTo(successor())) {
4719 __ b(compiler->GetJumpLabel(successor())); 4805 __ b(compiler->GetJumpLabel(successor()));
4720 } 4806 }
4721 } 4807 }
4722 4808
4723 4809
4810 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
4811 bool opt) const {
4812 const intptr_t kNumInputs = 1;
4813 const intptr_t kNumTemps = 1;
4814
4815 LocationSummary* summary = new(isolate) LocationSummary(
4816 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4817
4818 summary->set_in(0, Location::RequiresRegister());
4819 summary->set_temp(0, Location::RequiresRegister());
4820
4821 return summary;
4822 }
4823
4824
4825 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4826 Register target_address_reg = locs()->temp_slot(0)->reg();
4827
4828 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
4829 __ lw(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
4830
4831 // Add the offset.
4832 Register offset_reg = locs()->in(0).reg();
4833 __ SmiUntag(offset_reg);
4834 __ addu(target_address_reg, target_address_reg, offset_reg);
4835
4836 // Jump to the absolute address.
4837 __ jr(target_address_reg);
4838 }
4839
4840
4724 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 4841 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
4725 bool opt) const { 4842 bool opt) const {
4726 const intptr_t kNumInputs = 2; 4843 const intptr_t kNumInputs = 2;
4727 const intptr_t kNumTemps = 0; 4844 const intptr_t kNumTemps = 0;
4728 if (needs_number_check()) { 4845 if (needs_number_check()) {
4729 LocationSummary* locs = new(isolate) LocationSummary( 4846 LocationSummary* locs = new(isolate) LocationSummary(
4730 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 4847 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
4731 locs->set_in(0, Location::RegisterLocation(A0)); 4848 locs->set_in(0, Location::RegisterLocation(A0));
4732 locs->set_in(1, Location::RegisterLocation(A1)); 4849 locs->set_in(1, Location::RegisterLocation(A1));
4733 locs->set_out(0, Location::RegisterLocation(A0)); 4850 locs->set_out(0, Location::RegisterLocation(A0));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4854 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 4971 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
4855 #if defined(DEBUG) 4972 #if defined(DEBUG)
4856 __ LoadImmediate(S4, kInvalidObjectPointer); 4973 __ LoadImmediate(S4, kInvalidObjectPointer);
4857 __ LoadImmediate(S5, kInvalidObjectPointer); 4974 __ LoadImmediate(S5, kInvalidObjectPointer);
4858 #endif 4975 #endif
4859 } 4976 }
4860 4977
4861 } // namespace dart 4978 } // namespace dart
4862 4979
4863 #endif // defined TARGET_ARCH_MIPS 4980 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698