Author: [email protected]
Date: Thu Feb 19 00:09:29 2009
New Revision: 1308
Modified:
branches/experimental/toiger/src/codegen-arm.cc
Log:
Experimental (ARM): remember to adjust the virtual frame height at
returns, to remove state kept on the expression stack by statements
that don't shadow the return (eg, with or for...in).
Review URL: http://codereview.chromium.org/20454
Modified: branches/experimental/toiger/src/codegen-arm.cc
==============================================================================
--- branches/experimental/toiger/src/codegen-arm.cc (original)
+++ branches/experimental/toiger/src/codegen-arm.cc Thu Feb 19 00:09:29 2009
@@ -1290,12 +1290,24 @@
void CodeGenerator::VisitReturnStatement(ReturnStatement* node) {
VirtualFrame::SpilledScope spilled_scope(this);
Comment cmnt(masm_, "[ ReturnStatement");
- CodeForStatementPosition(node);
- LoadAndSpill(node->expression());
- // Move the function result into r0.
- frame_->EmitPop(r0);
- function_return_.Jump();
+ if (function_return_is_shadowed_) {
+ CodeForStatementPosition(node);
+ LoadAndSpill(node->expression());
+ frame_->EmitPop(r0);
+ function_return_.Jump();
+ } else {
+ // Load the returned value.
+ CodeForStatementPosition(node);
+ LoadAndSpill(node->expression());
+
+ // Pop the result from the frame and prepare the frame for
+ // returning thus making it easier to merge.
+ frame_->EmitPop(r0);
+ frame_->PrepareForReturn();
+
+ function_return_.Jump();
+ }
}
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---