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

Unified Diff: src/crankshaft/x64/lithium-codegen-x64.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/mips64/lithium-codegen-mips64.cc ('k') | src/deoptimize-reason.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/x64/lithium-codegen-x64.cc
diff --git a/src/crankshaft/x64/lithium-codegen-x64.cc b/src/crankshaft/x64/lithium-codegen-x64.cc
index 923eda163982e0a1708da018bc11ed82535a18e0..52cf25175fe3ff44ceb77524371468999655bdea 100644
--- a/src/crankshaft/x64/lithium-codegen-x64.cc
+++ b/src/crankshaft/x64/lithium-codegen-x64.cc
@@ -4594,34 +4594,17 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) {
Register input_reg = ToRegister(instr->value());
if (instr->truncating()) {
- Label no_heap_number, check_bools, check_false;
-
- // Heap number map check.
- __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset),
- Heap::kHeapNumberMapRootIndex);
- __ j(not_equal, &no_heap_number, Label::kNear);
+ Register input_map_reg = kScratchRegister;
+ Label truncate;
+ Label::Distance truncate_distance =
+ DeoptEveryNTimes() ? Label::kFar : Label::kNear;
+ __ movp(input_map_reg, FieldOperand(input_reg, HeapObject::kMapOffset));
+ __ JumpIfRoot(input_map_reg, Heap::kHeapNumberMapRootIndex, &truncate,
+ truncate_distance);
+ __ CmpInstanceType(input_map_reg, ODDBALL_TYPE);
+ 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.
- __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex);
- __ j(not_equal, &check_bools, Label::kNear);
- __ Set(input_reg, 0);
- __ jmp(done);
-
- __ bind(&check_bools);
- __ CompareRoot(input_reg, Heap::kTrueValueRootIndex);
- __ j(not_equal, &check_false, Label::kNear);
- __ Set(input_reg, 1);
- __ jmp(done);
-
- __ bind(&check_false);
- __ CompareRoot(input_reg, Heap::kFalseValueRootIndex);
- DeoptimizeIf(not_equal, instr,
- DeoptimizeReason::kNotAHeapNumberUndefinedBoolean);
- __ Set(input_reg, 0);
} else {
XMMRegister scratch = ToDoubleRegister(instr->temp());
DCHECK(!scratch.is(double_scratch0()));
« no previous file with comments | « src/crankshaft/mips64/lithium-codegen-mips64.cc ('k') | src/deoptimize-reason.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698