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

Unified 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: Port remaining V8 regexp tests and fix exposed bugs. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language_mips.cc
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index 4a69d11f31833d546a8fcb0ff3ab3cc74aa30aac..c8b1723977adc4404e0c80a539e0f2c63b5aacfa 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -1260,6 +1260,91 @@ void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+CompileType LoadCodeUnitsInstr::ComputeType() const {
+ switch (class_id()) {
+ case kOneByteStringCid:
+ case kTwoByteStringCid:
+ return CompileType::FromCid(kSmiCid);
+ default:
+ UNIMPLEMENTED();
+ return CompileType::Dynamic();
+ }
+}
+
+
+Representation LoadCodeUnitsInstr::representation() const {
+ switch (class_id()) {
+ case kOneByteStringCid:
+ case kTwoByteStringCid:
+ return kTagged;
+ default:
+ UNIMPLEMENTED();
+ return kTagged;
+ }
+}
+
+
+LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Isolate* isolate,
+ bool opt) const {
+ const intptr_t kNumInputs = 2;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* locs = new(isolate) LocationSummary(
+ isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ locs->set_in(0, Location::RequiresRegister());
+ if (CanBeImmediateIndex(index(), class_id(), IsExternal())) {
+ locs->set_in(1, Location::Constant(index()->definition()->AsConstant()));
+ } else {
+ locs->set_in(1, Location::RequiresRegister());
+ }
+
+ // TODO(jgruber): Handle mints properly once possible.
+ ASSERT(representation() == kTagged);
+ locs->set_out(0, Location::RequiresRegister());
+
+ return locs;
+}
+
+
+void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ const Register array = locs()->in(0).reg();
+ const Location index = locs()->in(1);
+
+ Address element_address = index.IsRegister()
+ ? __ ElementAddressForRegIndex(true, // Load.
+ IsExternal(), class_id(), index_scale(),
+ array, index.reg())
+ : __ ElementAddressForIntIndex(
+ IsExternal(), class_id(), index_scale(),
+ array, Smi::Cast(index.constant()).Value());
+ // Warning: element_address may use register TMP as base.
+
+ ASSERT(representation() == kTagged);
+ Register result = locs()->out(0).reg();
+ switch (class_id()) {
+ case kOneByteStringCid:
+ switch (element_count()) {
+ case 1: __ lbu(result, element_address); break;
+ case 2: __ lhu(result, element_address); break;
+ case 4: // Loading multiple code units is disabled on MIPS.
Florian Schneider 2014/10/01 17:04:13 Maybe add a TODO for supporting this?
jgruber1 2014/10/03 18:59:51 The associated TODO is for kEnableUnalignedAccesse
+ default: UNREACHABLE();
+ }
+ __ SmiTag(result);
+ break;
+ case kTwoByteStringCid:
+ switch (element_count()) {
+ case 1: __ lhu(result, element_address); break;
+ case 2: // Loading multiple code units is disabled on MIPS.
+ default: UNREACHABLE();
+ }
+ __ SmiTag(result);
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+}
+
+
Representation StoreIndexedInstr::RequiredInputRepresentation(
intptr_t idx) const {
// Array can be a Dart object or a pointer to external data.
@@ -3657,6 +3742,28 @@ void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary(
+ Isolate* isolate, bool opt) const {
+ const intptr_t kNumTemps = 0;
+ LocationSummary* summary = new(isolate) LocationSummary(
+ isolate, InputCount(), kNumTemps, LocationSummary::kCall);
+ summary->set_in(0, Location::RegisterLocation(A0));
+ summary->set_in(1, Location::RegisterLocation(A1));
+ summary->set_in(2, Location::RegisterLocation(A2));
+ summary->set_in(3, Location::RegisterLocation(A3));
+ summary->set_out(0, Location::RegisterLocation(V0));
+ return summary;
+}
+
+
+void CaseInsensitiveCompareUC16Instr::EmitNativeCode(
+ FlowGraphCompiler* compiler) {
+
+ // Call the function.
+ __ CallRuntime(TargetFunction(), TargetFunction().argument_count());
+}
+
+
LocationSummary* MathMinMaxInstr::MakeLocationSummary(Isolate* isolate,
bool opt) const {
if (result_cid() == kDoubleCid) {
@@ -4747,6 +4854,19 @@ void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+void IndirectEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ __ Bind(compiler->GetJumpLabel(this));
+ if (!compiler->is_optimizing()) {
+ compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt,
+ deopt_id_,
+ Scanner::kNoSourcePos);
+ }
+ if (HasParallelMove()) {
+ compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
+ }
+}
+
+
LocationSummary* GotoInstr::MakeLocationSummary(Isolate* isolate,
bool opt) const {
return new(isolate) LocationSummary(isolate, 0, 0, LocationSummary::kNoCall);
@@ -4780,6 +4900,40 @@ void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+LocationSummary* IndirectGotoInstr::MakeLocationSummary(Isolate* isolate,
+ bool opt) const {
+ const intptr_t kNumInputs = 1;
+ const intptr_t kNumTemps = 1;
+
+ LocationSummary* locs = new(isolate) LocationSummary(
+ isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall);
+
+ locs->set_in(0, Location::RequiresRegister());
+ locs->set_temp(0, Location::RequiresRegister());
+
+ return locs;
+}
+
+
+void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ Register sum_reg = locs()->temp_slot(0)->reg();
+
+ // Load from [current frame pointer] + kPcMarkerSlotFromFp.
+ __ lw(sum_reg, Address(FP, kPcMarkerSlotFromFp * kWordSize));
+
+ // Subtract the entrypoint offset.
+ __ AddImmediate(sum_reg, -Assembler::EntryPointToPcMarkerOffset());
+
+ // Add the offset.
+ Register offset_reg = locs()->in(0).reg();
+ __ SmiUntag(offset_reg);
+ __ addu(sum_reg, sum_reg, offset_reg);
+
+ // Jump to the absolute address.
+ __ jr(sum_reg);
+}
+
+
LocationSummary* CurrentContextInstr::MakeLocationSummary(Isolate* isolate,
bool opt) const {
return LocationSummary::Make(isolate,

Powered by Google App Engine
This is Rietveld 408576698