Reviewers: Mads Ager,

Description:
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).


Please review this at http://codereview.chromium.org/20454

SVN Base: http://v8.googlecode.com/svn/branches/experimental/toiger/

Affected files:
   M     src/codegen-arm.cc


Index: src/codegen-arm.cc
===================================================================
--- src/codegen-arm.cc  (revision 1298)
+++ src/codegen-arm.cc  (working copy)
@@ -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
-~----------~----~----~----~------~----~------~--~---

Reply via email to