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

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: Addressed Ivan's 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
« 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 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* summary = new(isolate) LocationSummary(
1280 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
1281 summary->set_in(0, Location::RequiresRegister());
1282 summary->set_in(1, Location::RequiresRegister());
1283
1284 // TODO(jgruber): Handle mints properly once possible.
1285 ASSERT(representation() == kTagged);
1286 summary->set_out(0, Location::RequiresRegister());
1287
1288 return summary;
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 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after
3666 } else if (kind() == MathUnaryInstr::kDoubleSquare) { 3730 } else if (kind() == MathUnaryInstr::kDoubleSquare) {
3667 DRegister val = locs()->in(0).fpu_reg(); 3731 DRegister val = locs()->in(0).fpu_reg();
3668 DRegister result = locs()->out(0).fpu_reg(); 3732 DRegister result = locs()->out(0).fpu_reg();
3669 __ muld(result, val, val); 3733 __ muld(result, val, val);
3670 } else { 3734 } else {
3671 __ CallRuntime(TargetFunction(), InputCount()); 3735 __ CallRuntime(TargetFunction(), InputCount());
3672 } 3736 }
3673 } 3737 }
3674 3738
3675 3739
3740 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
3741 Isolate* isolate, bool opt) const {
3742 const intptr_t kNumTemps = 0;
3743 LocationSummary* summary = new(isolate) LocationSummary(
3744 isolate, InputCount(), kNumTemps, LocationSummary::kCall);
3745 summary->set_in(0, Location::RegisterLocation(A0));
3746 summary->set_in(1, Location::RegisterLocation(A1));
3747 summary->set_in(2, Location::RegisterLocation(A2));
3748 summary->set_in(3, Location::RegisterLocation(A3));
3749 summary->set_out(0, Location::RegisterLocation(V0));
3750 return summary;
3751 }
3752
3753
3754 void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
3755 FlowGraphCompiler* compiler) {
3756
3757 // Call the function.
3758 __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
3759 }
3760
3761
3676 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate, 3762 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
3677 bool opt) const { 3763 bool opt) const {
3678 if (result_cid() == kDoubleCid) { 3764 if (result_cid() == kDoubleCid) {
3679 const intptr_t kNumInputs = 2; 3765 const intptr_t kNumInputs = 2;
3680 const intptr_t kNumTemps = 1; 3766 const intptr_t kNumTemps = 1;
3681 LocationSummary* summary = new(isolate) LocationSummary( 3767 LocationSummary* summary = new(isolate) LocationSummary(
3682 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); 3768 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
3683 summary->set_in(0, Location::RequiresFpuRegister()); 3769 summary->set_in(0, Location::RequiresFpuRegister());
3684 summary->set_in(1, Location::RequiresFpuRegister()); 3770 summary->set_in(1, Location::RequiresFpuRegister());
3685 // Reuse the left register so that code can be made shorter. 3771 // Reuse the left register so that code can be made shorter.
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
4793 } 4879 }
4794 4880
4795 // We can fall through if the successor is the next block in the list. 4881 // We can fall through if the successor is the next block in the list.
4796 // Otherwise, we need a jump. 4882 // Otherwise, we need a jump.
4797 if (!compiler->CanFallThroughTo(successor())) { 4883 if (!compiler->CanFallThroughTo(successor())) {
4798 __ b(compiler->GetJumpLabel(successor())); 4884 __ b(compiler->GetJumpLabel(successor()));
4799 } 4885 }
4800 } 4886 }
4801 4887
4802 4888
4889 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
4890 bool opt) const {
4891 const intptr_t kNumInputs = 1;
4892 const intptr_t kNumTemps = 1;
4893
4894 LocationSummary* summary = new(isolate) LocationSummary(
4895 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
4896
4897 summary->set_in(0, Location::RequiresRegister());
4898 summary->set_temp(0, Location::RequiresRegister());
4899
4900 return summary;
4901 }
4902
4903
4904 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4905 Register target_address_reg = locs()->temp_slot(0)->reg();
4906
4907 // Load from [current frame pointer] + kPcMarkerSlotFromFp.
4908 __ lw(target_address_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
4909
4910 // Add the offset.
4911 Register offset_reg = locs()->in(0).reg();
4912 __ SmiUntag(offset_reg);
4913 __ addu(target_address_reg, target_address_reg, offset_reg);
4914
4915 // Jump to the absolute address.
4916 __ jr(target_address_reg);
4917 }
4918
4919
4803 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate, 4920 LocationSummary* StrictCompareInstr::MakeLocationSummary(Isolate* isolate,
4804 bool opt) const { 4921 bool opt) const {
4805 const intptr_t kNumInputs = 2; 4922 const intptr_t kNumInputs = 2;
4806 const intptr_t kNumTemps = 0; 4923 const intptr_t kNumTemps = 0;
4807 if (needs_number_check()) { 4924 if (needs_number_check()) {
4808 LocationSummary* locs = new(isolate) LocationSummary( 4925 LocationSummary* locs = new(isolate) LocationSummary(
4809 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); 4926 isolate, kNumInputs, kNumTemps, LocationSummary::kCall);
4810 locs->set_in(0, Location::RegisterLocation(A0)); 4927 locs->set_in(0, Location::RegisterLocation(A0));
4811 locs->set_in(1, Location::RegisterLocation(A1)); 4928 locs->set_in(1, Location::RegisterLocation(A1));
4812 locs->set_out(0, Location::RegisterLocation(A0)); 4929 locs->set_out(0, Location::RegisterLocation(A0));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
4933 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); 5050 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs());
4934 #if defined(DEBUG) 5051 #if defined(DEBUG)
4935 __ LoadImmediate(S4, kInvalidObjectPointer); 5052 __ LoadImmediate(S4, kInvalidObjectPointer);
4936 __ LoadImmediate(S5, kInvalidObjectPointer); 5053 __ LoadImmediate(S5, kInvalidObjectPointer);
4937 #endif 5054 #endif
4938 } 5055 }
4939 5056
4940 } // namespace dart 5057 } // namespace dart
4941 5058
4942 #endif // defined TARGET_ARCH_MIPS 5059 #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