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

Unified Diff: src/a64/lithium-codegen-a64.cc

Issue 145973022: A64: Truncate booleans to 0 or 1 in LTaggedToI. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: whitespace Created 6 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e4e47c6a1f8d7771e00ddfe34d2466e9f864f123 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;
// If it's not a heap number, jump to undefined check.
__ JumpIfNotRoot(scratch1, Heap::kHeapNumberMapRootIndex, &check_bools);
@@ -5130,15 +5130,18 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr,
__ Bind(&check_bools);
- TODO_UNIMPLEMENTED("LTaggedToI: Truncate booleans to 0 or 1.");
+ Register true_root = output;
+ Register false_root = scratch2;
+ __ LoadTrueFalseRoots(true_root, false_root);
+ __ Cmp(scratch1, true_root);
+ __ Cset(output, eq);
+ __ Ccmp(scratch1, false_root, ZFlag, ne);
+ __ B(eq, &done);
- // Check for undefined. Undefined is converted to zero for truncating
+ // Output contains zero, undefined is converted to zero for truncating
// conversions.
- __ Bind(&undefined);
-
DeoptimizeIfNotRoot(input, Heap::kUndefinedValueRootIndex,
instr->environment());
- __ Mov(output, 0);
} else {
Register output = ToRegister32(instr->result());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698