Commit 5b08a1a1 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Fix DeferredTaggedToINoSSE2 to not unconditionally untag undefined to 0.

R=danno@chromium.org

Review URL: https://chromiumcodereview.appspot.com/16228002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14896 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 794a10cb
...@@ -5352,15 +5352,20 @@ void LCodeGen::DoDeferredTaggedToINoSSE2(LTaggedToINoSSE2* instr) { ...@@ -5352,15 +5352,20 @@ void LCodeGen::DoDeferredTaggedToINoSSE2(LTaggedToINoSSE2* instr) {
// Heap number map check. // Heap number map check.
__ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
factory()->heap_number_map()); factory()->heap_number_map());
__ j(equal, &heap_number, Label::kNear); if (instr->truncating()) {
// Check for undefined. Undefined is converted to zero for truncating __ j(equal, &heap_number, Label::kNear);
// conversions. // Check for undefined. Undefined is converted to zero for truncating
__ cmp(input_reg, factory()->undefined_value()); // conversions.
__ RecordComment("Deferred TaggedToI: cannot truncate"); __ cmp(input_reg, factory()->undefined_value());
DeoptimizeIf(not_equal, instr->environment()); __ RecordComment("Deferred TaggedToI: cannot truncate");
__ xor_(result_reg, result_reg); DeoptimizeIf(not_equal, instr->environment());
__ jmp(&done, Label::kFar); __ xor_(result_reg, result_reg);
__ bind(&heap_number); __ 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 // Surprisingly, all of this crazy bit manipulation is considerably
// faster than using the built-in x86 CPU conversion functions (about 6x). // faster than using the built-in x86 CPU conversion functions (about 6x).
......
...@@ -95,6 +95,7 @@ function f_external(test, test2, test3, a, i) { ...@@ -95,6 +95,7 @@ function f_external(test, test2, test3, a, i) {
d = d|0; d = d|0;
} }
a[d] = 1; a[d] = 1;
assertEquals(1, a[d]);
return d; return d;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment