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

Unified Diff: src/crankshaft/ia32/lithium-codegen-ia32.cc

Issue 2452193003: [crankshaft] Support all oddballs for truncating TaggedToI changes. (Closed)
Patch Set: Created 4 years, 2 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 | « src/crankshaft/arm64/lithium-codegen-arm64.cc ('k') | src/crankshaft/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/ia32/lithium-codegen-ia32.cc
diff --git a/src/crankshaft/ia32/lithium-codegen-ia32.cc b/src/crankshaft/ia32/lithium-codegen-ia32.cc
index 5424dd9204cf5159fd54669cc349f8f08d7c65e9..ec885682ff4dc1f23796060e7c16f95fdf270a75 100644
--- a/src/crankshaft/ia32/lithium-codegen-ia32.cc
+++ b/src/crankshaft/ia32/lithium-codegen-ia32.cc
@@ -4308,34 +4308,18 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) {
__ lea(input_reg, Operand(input_reg, times_2, kHeapObjectTag));
if (instr->truncating()) {
- Label no_heap_number, check_bools, check_false;
-
- // Heap number map check.
+ Label truncate;
+ Label::Distance truncate_distance =
+ DeoptEveryNTimes() ? Label::kFar : Label::kNear;
__ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
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);
- __ 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 {
XMMRegister scratch = ToDoubleRegister(instr->temp());
DCHECK(!scratch.is(xmm0));
« no previous file with comments | « src/crankshaft/arm64/lithium-codegen-arm64.cc ('k') | src/crankshaft/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698