Chromium Code Reviews| 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); |
|
m.m.capewell
2014/02/05 18:43:23
It may be better to load both roots at once and us
ulan
2014/02/05 19:21:29
Nice! Done.
|
| + __ 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()); |