Reviewers: danno,
Message:
PTAL
Description:
Fix DeferredTaggedToINoSSE2 to not unconditionally untag undefined to 0.
Please review this at https://chromiumcodereview.appspot.com/16228002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/ia32/lithium-codegen-ia32.cc
M test/mjsunit/regress/regress-convert-hole.js
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc
b/src/ia32/lithium-codegen-ia32.cc
index
f8b28c48d9d43eb5442809bcd10354c74a2893f6..fb566d1dd1fb4231730cc2856b0a382c4415d5cd
100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -5352,15 +5352,20 @@ void
LCodeGen::DoDeferredTaggedToINoSSE2(LTaggedToINoSSE2* instr) {
// Heap number map check.
__ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
factory()->heap_number_map());
- __ j(equal, &heap_number, Label::kNear);
- // Check for undefined. Undefined is converted to zero for truncating
- // conversions.
- __ cmp(input_reg, factory()->undefined_value());
- __ RecordComment("Deferred TaggedToI: cannot truncate");
- DeoptimizeIf(not_equal, instr->environment());
- __ xor_(result_reg, result_reg);
- __ jmp(&done, Label::kFar);
- __ bind(&heap_number);
+ if (instr->truncating()) {
+ __ j(equal, &heap_number, Label::kNear);
+ // Check for undefined. Undefined is converted to zero for truncating
+ // conversions.
+ __ cmp(input_reg, factory()->undefined_value());
+ __ RecordComment("Deferred TaggedToI: cannot truncate");
+ DeoptimizeIf(not_equal, instr->environment());
+ __ xor_(result_reg, result_reg);
+ __ jmp(&done, Label::kFar);
+ __ bind(&heap_number);
+ } else {
+ // Deoptimize if we don't have a heap number.
+ DeoptimizeIf(not_equal, instr->environment());
+ }
// Surprisingly, all of this crazy bit manipulation is considerably
// faster than using the built-in x86 CPU conversion functions (about
6x).
Index: test/mjsunit/regress/regress-convert-hole.js
diff --git a/test/mjsunit/regress/regress-convert-hole.js
b/test/mjsunit/regress/regress-convert-hole.js
index
3316f307d9fb7493ed8686cc1b0c60088e6bb726..1e9c3f313805925a6b551214dfab692c5da04143
100644
--- a/test/mjsunit/regress/regress-convert-hole.js
+++ b/test/mjsunit/regress/regress-convert-hole.js
@@ -95,6 +95,7 @@ function f_external(test, test2, test3, a, i) {
d = d|0;
}
a[d] = 1;
+ assertEquals(1, a[d]);
return d;
}
--
--
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.