I lied, this does decrease code size, because it eliminates the backward jmp from the deferred code. So as is, it should save us 5 bytes per stack check.
On a run of delta-blue (I have no idea if this is a good benchmark for this), total bytes emitted before: 89881 after: 89282. Not a huge savings (~0.7%). When using a short jmp encoding (what this change makes possible), it results in 88667 bytes, which is maybe a bit better (~1.3%). On Wed, Sep 24, 2008 at 3:46 PM, Dean McNamee <[EMAIL PROTECTED]> wrote: > So this reversing the forward branch from being likely not taken to > likely taken, so that might throw off static branch prediction? Will > be interesting to see if there are any performance changes on > benchmarks. > > On Wed, Sep 24, 2008 at 3:04 PM, <[EMAIL PROTECTED]> wrote: >> 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 -~----------~----~----~----~------~----~------~--~---
