Reviewers: Alexandre Rames,

Description:
A64: Tidy up VisitForOfStatement

Small tidy up to use JumpIfRoot and a named register.

BUG=none

Please review this at https://codereview.chromium.org/146703002/

SVN Base: https://v8.googlecode.com/svn/branches/experimental/a64

Affected files (+9, -8 lines):
  M src/a64/full-codegen-a64.cc


Index: src/a64/full-codegen-a64.cc
diff --git a/src/a64/full-codegen-a64.cc b/src/a64/full-codegen-a64.cc
index 8c55bfabada69d9408c6e5e057075b1790865cfc..14b2065684d39ac410651d242e6031cbcf77e649 100644
--- a/src/a64/full-codegen-a64.cc
+++ b/src/a64/full-codegen-a64.cc
@@ -1269,21 +1269,22 @@ void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) {
   VisitForAccumulatorValue(stmt->assign_iterator());

   // As with for-in, skip the loop if the iterator is null or undefined.
-  __ CompareRoot(x0, Heap::kUndefinedValueRootIndex);
-  __ B(eq, loop_statement.break_label());
-  __ CompareRoot(x0, Heap::kNullValueRootIndex);
-  __ B(eq, loop_statement.break_label());
+  Register iterator = x0;
+  __ JumpIfRoot(iterator, Heap::kUndefinedValueRootIndex,
+                loop_statement.break_label());
+  __ JumpIfRoot(iterator, Heap::kNullValueRootIndex,
+                loop_statement.break_label());

   // Convert the iterator to a JS object.
   Label convert, done_convert;
-  __ JumpIfSmi(x0, &convert);
-  __ CompareObjectType(x0, x10, x11, FIRST_SPEC_OBJECT_TYPE);
+  __ JumpIfSmi(iterator, &convert);
+  __ CompareObjectType(iterator, x1, x1, FIRST_SPEC_OBJECT_TYPE);
   __ B(ge, &done_convert);
   __ Bind(&convert);
-  __ Push(x0);
+  __ Push(iterator);
   __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
   __ Bind(&done_convert);
-  __ Push(x0);
+  __ Push(iterator);

   // Loop entry.
   __ Bind(loop_statement.continue_label());


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to