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

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: 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..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());
« 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