A64: Optimize a loop by using post-indexing.
authoralexandre.rames@arm.com <alexandre.rames@arm.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 18 Feb 2014 09:59:02 +0000 (09:59 +0000)
committeralexandre.rames@arm.com <alexandre.rames@arm.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 18 Feb 2014 09:59:02 +0000 (09:59 +0000)
R=ulan@chromium.org

Review URL: https://codereview.chromium.org/169543002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19429 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/a64/full-codegen-a64.cc

index eca3f06..ec5d339 100644 (file)
@@ -2805,16 +2805,13 @@ void FullCodeGenerator::EmitIsStringWrapperSafeForDefaultValueOf(
 
   // Loop through all the keys in the descriptor array. If one of these is the
   // string "valueOf" the result is false.
-  // TODO(all): optimise this loop to combine the add and ldr into an
-  // addressing mode.
   Register valueof_string = x1;
+  int descriptor_size = DescriptorArray::kDescriptorSize * kPointerSize;
   __ Mov(valueof_string, Operand(isolate()->factory()->value_of_string()));
   __ Bind(&loop);
-  __ Ldr(x15, MemOperand(descriptors));
+  __ Ldr(x15, MemOperand(descriptors, descriptor_size, PostIndex));
   __ Cmp(x15, valueof_string);
   __ B(eq, if_false);
-  __ Add(descriptors, descriptors,
-         DescriptorArray::kDescriptorSize * kPointerSize);
   __ Cmp(descriptors, descriptors_end);
   __ B(ne, &loop);