Commit 77ae6884 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [crankshaft] Support all oddballs for truncating TaggedToI changes.

  port 7d383be9 (r40608)

  original commit message:
  For inputs to truncating binary operations like <<, | or >>>, support
  all Oddballs not just undefined, true and false. This unifies treatment
  of these truncations in Crankshaft and TurboFan, and is very easy
  nowadays, since the memory layout of Oddball and HeapNumber is
  compatible.

BUG=

Review-Url: https://codereview.chromium.org/2450093007
Cr-Commit-Position: refs/heads/master@{#40632}
parent 4d6df11f
...@@ -4672,34 +4672,18 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { ...@@ -4672,34 +4672,18 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) {
__ lea(input_reg, Operand(input_reg, times_2, kHeapObjectTag)); __ lea(input_reg, Operand(input_reg, times_2, kHeapObjectTag));
if (instr->truncating()) { if (instr->truncating()) {
Label no_heap_number, check_bools, check_false; Label truncate;
Label::Distance truncate_distance =
// Heap number map check. DeoptEveryNTimes() ? Label::kFar : Label::kNear;
__ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
factory()->heap_number_map()); factory()->heap_number_map());
__ j(not_equal, &no_heap_number, Label::kNear); __ j(equal, &truncate, truncate_distance);
__ push(input_reg);
__ CmpObjectType(input_reg, ODDBALL_TYPE, input_reg);
__ pop(input_reg);
DeoptimizeIf(not_equal, instr, DeoptimizeReason::kNotANumberOrOddball);
__ bind(&truncate);
__ TruncateHeapNumberToI(input_reg, input_reg); __ TruncateHeapNumberToI(input_reg, input_reg);
__ jmp(done);
__ bind(&no_heap_number);
// Check for Oddballs. Undefined/False is converted to zero and True to one
// for truncating conversions.
__ cmp(input_reg, factory()->undefined_value());
__ j(not_equal, &check_bools, Label::kNear);
__ Move(input_reg, Immediate(0));
__ jmp(done);
__ bind(&check_bools);
__ cmp(input_reg, factory()->true_value());
__ j(not_equal, &check_false, Label::kNear);
__ Move(input_reg, Immediate(1));
__ jmp(done);
__ bind(&check_false);
__ cmp(input_reg, factory()->false_value());
DeoptimizeIf(not_equal, instr,
DeoptimizeReason::kNotAHeapNumberUndefinedBoolean);
__ Move(input_reg, Immediate(0));
} else { } else {
// TODO(olivf) Converting a number on the fpu is actually quite slow. We // TODO(olivf) Converting a number on the fpu is actually quite slow. We
// should first try a fast conversion and then bailout to this slow case. // should first try a fast conversion and then bailout to this slow case.
......
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