Reviewers: Kasper Lund, Kevin Millikin,

Message:
I imagine this was originally done with some reason, we now have more
code in the main body, where before the stack failure call would have
been pushed to the bottom.  However, we will save 4 bytes when we can
use a short jcc, so this will mean it's only 1 byte more in the main
body, and nothing at the end, so I think it's a definite win.

Description:
Don't defer the stack check failure code.  It is a CallStub, which will
be a single 5 byte call instruction.  This should cause equivalent code
size now, but opens up the opportunity to make one of the most common
jcc's to use short encoding in the future.

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

Affected files:
   M src/codegen-ia32.cc


Index: src/codegen-ia32.cc
diff --git a/src/codegen-ia32.cc b/src/codegen-ia32.cc
index  
6a522c57988ef2a97ca16d61019c7c62256054b1..ce1bce6fe88c0a8c6855e64aac9517c8b3a99f45
  
100644
--- a/src/codegen-ia32.cc
+++ b/src/codegen-ia32.cc
@@ -2660,30 +2660,16 @@ void Ia32CodeGenerator::Branch(bool if_true, Label*  
L) {
  }


-class StackCheckDeferred: public DeferredCode {
- public:
-  explicit StackCheckDeferred(CodeGenerator* generator)
-      : DeferredCode(generator) {
-    set_comment("[ StackCheckDeferred");
-  }
-  virtual void Generate();
-};
-
-
-void StackCheckDeferred::Generate() {
-  StackCheckStub stub;
-  __ CallStub(&stub);
-}
-
-
  void Ia32CodeGenerator::CheckStack() {
    if (FLAG_check_stack) {
-    StackCheckDeferred* deferred = new StackCheckDeferred(this);
+    Label stack_is_ok;
+    StackCheckStub stub;
      ExternalReference stack_guard_limit =
          ExternalReference::address_of_stack_guard_limit();
      __ cmp(esp, Operand::StaticVariable(stack_guard_limit));
-    __ j(below, deferred->enter(), not_taken);
-    __ bind(deferred->exit());
+    __ j(above_equal, &stack_is_ok, taken);
+    __ CallStub(&stub);
+    __ bind(&stack_is_ok);
    }
  }




--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to