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

Side by Side Diff: src/x87/macro-assembler-x87.cc

Issue 895473002: x87: Use signaling NaN for holes in fixed double arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/x87/lithium-x87.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/division-by-constant.h" 10 #include "src/base/division-by-constant.h"
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 Label* fail, 590 Label* fail,
591 int elements_offset) { 591 int elements_offset) {
592 Label smi_value, done, maybe_nan, not_nan, is_nan, have_double_value; 592 Label smi_value, done, maybe_nan, not_nan, is_nan, have_double_value;
593 JumpIfSmi(maybe_number, &smi_value, Label::kNear); 593 JumpIfSmi(maybe_number, &smi_value, Label::kNear);
594 594
595 CheckMap(maybe_number, 595 CheckMap(maybe_number,
596 isolate()->factory()->heap_number_map(), 596 isolate()->factory()->heap_number_map(),
597 fail, 597 fail,
598 DONT_DO_SMI_CHECK); 598 DONT_DO_SMI_CHECK);
599 599
600 // Double value, canonicalize NaN.
601 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32);
602 cmp(FieldOperand(maybe_number, offset),
603 Immediate(kNaNOrInfinityLowerBoundUpper32));
604 j(greater_equal, &maybe_nan, Label::kNear);
605
606 bind(&not_nan);
607 ExternalReference canonical_nan_reference =
608 ExternalReference::address_of_canonical_non_hole_nan();
609 fld_d(FieldOperand(maybe_number, HeapNumber::kValueOffset)); 600 fld_d(FieldOperand(maybe_number, HeapNumber::kValueOffset));
610 bind(&have_double_value); 601 jmp(&done, Label::kNear);
611 fstp_d(FieldOperand(elements, key, times_4,
612 FixedDoubleArray::kHeaderSize - elements_offset));
613 jmp(&done);
614
615 bind(&maybe_nan);
616 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise
617 // it's an Infinity, and the non-NaN code path applies.
618 j(greater, &is_nan, Label::kNear);
619 cmp(FieldOperand(maybe_number, HeapNumber::kValueOffset), Immediate(0));
620 j(zero, &not_nan);
621 bind(&is_nan);
622 fld_d(Operand::StaticVariable(canonical_nan_reference));
623 jmp(&have_double_value, Label::kNear);
624 602
625 bind(&smi_value); 603 bind(&smi_value);
626 // Value is a smi. Convert to a double and store. 604 // Value is a smi. Convert to a double and store.
627 // Preserve original value. 605 // Preserve original value.
628 mov(scratch, maybe_number); 606 mov(scratch, maybe_number);
629 SmiUntag(scratch); 607 SmiUntag(scratch);
630 push(scratch); 608 push(scratch);
631 fild_s(Operand(esp, 0)); 609 fild_s(Operand(esp, 0));
632 pop(scratch); 610 pop(scratch);
611 bind(&done);
633 fstp_d(FieldOperand(elements, key, times_4, 612 fstp_d(FieldOperand(elements, key, times_4,
634 FixedDoubleArray::kHeaderSize - elements_offset)); 613 FixedDoubleArray::kHeaderSize - elements_offset));
635 bind(&done);
636 } 614 }
637 615
638 616
639 void MacroAssembler::CompareMap(Register obj, Handle<Map> map) { 617 void MacroAssembler::CompareMap(Register obj, Handle<Map> map) {
640 cmp(FieldOperand(obj, HeapObject::kMapOffset), map); 618 cmp(FieldOperand(obj, HeapObject::kMapOffset), map);
641 } 619 }
642 620
643 621
644 void MacroAssembler::CheckMap(Register obj, 622 void MacroAssembler::CheckMap(Register obj,
645 Handle<Map> map, 623 Handle<Map> map,
(...skipping 2556 matching lines...) Expand 10 before | Expand all | Expand 10 after
3202 if (mag.shift > 0) sar(edx, mag.shift); 3180 if (mag.shift > 0) sar(edx, mag.shift);
3203 mov(eax, dividend); 3181 mov(eax, dividend);
3204 shr(eax, 31); 3182 shr(eax, 31);
3205 add(edx, eax); 3183 add(edx, eax);
3206 } 3184 }
3207 3185
3208 3186
3209 } } // namespace v8::internal 3187 } } // namespace v8::internal
3210 3188
3211 #endif // V8_TARGET_ARCH_X87 3189 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/lithium-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698