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

Unified Diff: src/arm/fast-codegen-arm.cc

Issue 492002: Fast-codegen: Implementing try/finally on top of nesting context. (Closed)
Patch Set: Updated to be based on latest release. Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | src/fast-codegen.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/fast-codegen-arm.cc
diff --git a/src/arm/fast-codegen-arm.cc b/src/arm/fast-codegen-arm.cc
index 04fff5ca1528a2dfaa7071426b669d47625ca65d..c177ed80b24f28cd9f5bc74437951aaeb462d816 100644
--- a/src/arm/fast-codegen-arm.cc
+++ b/src/arm/fast-codegen-arm.cc
@@ -1647,6 +1647,7 @@ void FastCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
// Convert current context to test context: End post-test code.
}
+
void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) {
__ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
Move(expr->context(), r0);
@@ -1655,7 +1656,38 @@ void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) {
Register FastCodeGenerator::result_register() { return r0; }
-#undef __
+// ----------------------------------------------------------------------------
+// Non-local control flow support.
+
+void FastCodeGenerator::EnterFinallyBlock() {
+ // Cook return address in link register to stack (smi encoded Code* delta)
+ __ sub(r1, lr, Operand(masm_->CodeObject()));
+ ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize);
+ ASSERT_EQ(0, kSmiTag);
+ __ add(r1, r1, Operand(r1)); // Convert to smi.
+ __ push(r1);
+ // Store result register while executing finally block.
+ __ push(r0);
+}
+
+
+void FastCodeGenerator::ReturnFromFinallyBlock() {
+ // Restore result register from stack.
+ __ pop(r0);
+ // Uncook return address and return.
+ __ pop(r1);
+ ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize);
+ __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
+ __ add(pc, r1, Operand(masm_->CodeObject()));
+}
+
+void FastCodeGenerator::ThrowException() {
+ __ push(r0);
+ __ CallRuntime(Runtime::kThrow, 1);
+}
+
+
+#undef __
} } // namespace v8::internal
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | src/fast-codegen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698