Reviewers: m.m.capewell, jbramley,

Message:
PTAL

Description:
A64: Truncate booleans to 0 or 1 in LTaggedToI.

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

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

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


Index: src/a64/lithium-codegen-a64.cc
diff --git a/src/a64/lithium-codegen-a64.cc b/src/a64/lithium-codegen-a64.cc
index 3a58f021e4b7c1115906e7957105b01a27e4f62d..bbbd05f9c2e6de542690448102b937916426b6ef 100644
--- a/src/a64/lithium-codegen-a64.cc
+++ b/src/a64/lithium-codegen-a64.cc
@@ -5118,7 +5118,7 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr,
   if (instr->truncating()) {
     Register output = ToRegister(instr->result());
     Register scratch2 = ToRegister(temp2);
-    Label check_bools, undefined;
+    Label check_bools, check_false, check_undefined;

     // If it's not a heap number, jump to undefined check.
__ JumpIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, &check_bools); @@ -5129,12 +5129,17 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr,
     __ B(&done);

     __ Bind(&check_bools);
-
-    TODO_UNIMPLEMENTED("LTaggedToI: Truncate booleans to 0 or 1.");
+    __ JumpIfNotRoot(scratch1, Heap::kTrueValueRootIndex, &check_false);
+    __ Mov(output, 1);
+    __ B(&done);
+    __ Bind(&check_false);
+ __ JumpIfNotRoot(scratch1, Heap::kFalseValueRootIndex, &check_undefined);
+    __ Mov(output, 0);
+    __ B(&done);

     // Check for undefined. Undefined is converted to zero for truncating
     // conversions.
-    __ Bind(&undefined);
+    __ Bind(&check_undefined);

     DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex,
                         instr->environment());


--
--
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