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

Unified Diff: runtime/vm/intermediate_language_mips.cc

Issue 14289006: Implements catch on MIPS. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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
===================================================================
--- runtime/vm/intermediate_language_mips.cc (revision 21890)
+++ runtime/vm/intermediate_language_mips.cc (working copy)
@@ -1528,13 +1528,44 @@
LocationSummary* CatchEntryInstr::MakeLocationSummary() const {
- UNIMPLEMENTED();
- return NULL;
+ return LocationSummary::Make(0,
+ Location::NoLocation(),
+ LocationSummary::kNoCall);
}
+// Restore stack and initialize the two exception variables:
+// exception and stack trace variables.
void CatchEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- UNIMPLEMENTED();
+ // Restore SP from FP as we are coming from a throw and the code for
+ // popping arguments has not been run.
+ const intptr_t fp_sp_dist =
+ (kFirstLocalSlotIndex + 1 - compiler->StackSize()) * kWordSize;
+ ASSERT(fp_sp_dist <= 0);
+ __ AddImmediate(SP, FP, fp_sp_dist);
+
+ ASSERT(!exception_var().is_captured());
+ ASSERT(!stacktrace_var().is_captured());
+
+ __ sw(kExceptionObjectReg,
+ Address(FP, exception_var().index() * kWordSize));
+ __ sw(kStackTraceObjectReg,
+ Address(FP, stacktrace_var().index() * kWordSize));
+
+ Label next;
+ __ mov(TMP1, RA); // Save return adress.
+ // Restore the pool pointer.
+ __ bal(&next); // Branch and link to next instruction to get PC in RA.
+ __ delay_slot()->mov(TMP2, RA); // Save PC of the following mov.
+
+ // Calculate offset of pool pointer from the PC.
+ const intptr_t object_pool_pc_dist =
+ Instructions::HeaderSize() - Instructions::object_pool_offset() +
+ compiler->assembler()->CodeSize();
+
+ __ Bind(&next);
+ __ mov(RA, TMP1); // Restore return address.
+ __ lw(PP, Address(TMP2, -object_pool_pc_dist));
}
@@ -2108,13 +2139,16 @@
LocationSummary* ReThrowInstr::MakeLocationSummary() const {
- UNIMPLEMENTED();
- return NULL;
+ return new LocationSummary(0, 0, LocationSummary::kCall);
}
void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- UNIMPLEMENTED();
+ compiler->GenerateCallRuntime(token_pos(),
+ deopt_id(),
+ kReThrowRuntimeEntry,
+ locs());
+ __ break_(0);
}

Powered by Google App Engine
This is Rietveld 408576698