Revision: 3304 Author: [email protected] Date: Fri Nov 13 05:59:07 2009 Log: Improve the allocation and initialization of locals on IA32 in the top-level compiler.
This optimization is already done on x64 and ARM. Until now we used a push immediate for each local variable on IA32: push $undefined push $undefined ... to initialize each local variable. This change does: mov eax, $undefined push eax push eax ... Review URL: http://codereview.chromium.org/393009 http://code.google.com/p/v8/source/detail?r=3304 Modified: /branches/bleeding_edge/src/ia32/fast-codegen-ia32.cc ======================================= --- /branches/bleeding_edge/src/ia32/fast-codegen-ia32.cc Fri Nov 13 01:42:18 2009 +++ /branches/bleeding_edge/src/ia32/fast-codegen-ia32.cc Fri Nov 13 05:59:07 2009 @@ -62,8 +62,13 @@ { Comment cmnt(masm_, "[ Allocate locals"); int locals_count = fun->scope()->num_stack_slots(); - for (int i = 0; i < locals_count; i++) { + if (locals_count == 1) { __ push(Immediate(Factory::undefined_value())); + } else if (locals_count > 1) { + __ mov(eax, Immediate(Factory::undefined_value())); + for (int i = 0; i < locals_count; i++) { + __ push(eax); + } } } --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
