Reviewers: Paul Lind, kisg, kilvadyb, danno, oliv,
Message:
PTAL.
Description:
MIPS: Truncate booleans to 0/1 in truncating t-to-i.
Port r17166 (0a4bf790)
Original commit message:
Truncate booleans to 0/1 in truncating t-to-i.
Thanks to [email protected] for discovering the issue.
BUG=
Please review this at https://codereview.chromium.org/26742006/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+21, -8 lines):
M src/mips/lithium-codegen-mips.cc
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc
b/src/mips/lithium-codegen-mips.cc
index
f598894a08fca099d784117d0f03f5098c9eea58..b3252d6c6e18533934462d22767b41cad113119a
100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -4895,19 +4895,32 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI*
instr) {
if (instr->truncating()) {
// Performs a truncating conversion of a floating point number as used
by
// the JS bitwise operations.
- Label heap_number;
- __ Branch(&heap_number, eq, scratch1, Operand(at)); // HeapNumber map?
- // Check for undefined. Undefined is converted to zero for truncating
- // conversions.
+ Label no_heap_number, check_bools, check_false;
+ __ Branch(&no_heap_number, ne, scratch1, Operand(at)); // HeapNumber
map?
+ __ mov(scratch2, input_reg);
+ __ TruncateHeapNumberToI(input_reg, scratch2);
+ __ Branch(&done);
+
+ // Check for Oddballs. Undefined/False is converted to zero and True
to one
+ // for truncating conversions.
+ __ bind(&no_heap_number);
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
- DeoptimizeIf(ne, instr->environment(), input_reg, Operand(at));
+ __ Branch(&check_bools, ne, input_reg, Operand(at));
ASSERT(ToRegister(instr->result()).is(input_reg));
__ mov(input_reg, zero_reg);
__ Branch(&done);
- __ bind(&heap_number);
- __ mov(scratch2, input_reg);
- __ TruncateHeapNumberToI(input_reg, scratch2);
+ __ bind(&check_bools);
+ __ LoadRoot(at, Heap::kTrueValueRootIndex);
+ __ Branch(&check_false, ne, scratch2, Operand(at));
+ __ li(input_reg, Operand(1));
+ __ Branch(&done);
+
+ __ bind(&check_false);
+ __ LoadRoot(at, Heap::kFalseValueRootIndex);
+ DeoptimizeIf(ne, instr->environment(), scratch2, Operand(at));
+ __ mov(input_reg, zero_reg);
+ __ Branch(&done);
} else {
// Deoptimize if we don't have a heap number.
DeoptimizeIf(ne, instr->environment(), scratch1, Operand(at));
--
--
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.