Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1469)

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 447793003: VM: Micro-optimization of inline array allocation code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 38967)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -1936,15 +1936,17 @@
// RCX: new object end address.
// RDI: iterator which initially points to the start of the variable
// data area to be initialized.
- __ LoadObject(R12, Object::null_object(), PP);
- __ leaq(RDI, FieldAddress(RAX, sizeof(RawArray)));
- Label init_loop;
- __ Bind(&init_loop);
- __ cmpq(RDI, RCX);
- __ j(ABOVE_EQUAL, done, Assembler::kNearJump);
- __ movq(Address(RDI, 0), R12);
- __ addq(RDI, Immediate(kWordSize));
- __ jmp(&init_loop, Assembler::kNearJump);
+ if (num_elements > 0) {
+ __ LoadObject(R12, Object::null_object(), PP);
+ __ leaq(RDI, FieldAddress(RAX, sizeof(RawArray)));
+ Label init_loop;
+ __ Bind(&init_loop);
+ __ movq(Address(RDI, 0), R12);
+ __ addq(RDI, Immediate(kWordSize));
+ __ cmpq(RDI, RCX);
+ __ j(BELOW, &init_loop, Assembler::kNearJump);
+ }
+ __ jmp(done, Assembler::kNearJump);
}
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698